8 Commits

Author SHA1 Message Date
d05e63df81 - Add VSL support,
- Support now rx3-base 1.2.0.
2026-09-13 17:50:18 +02:00
89ec509f92 - Fix greedy locales stripping bug in mk_base_image. 2026-05-30 11:09:40 +02:00
c5e6d07bc2 - Add docker_mk_env default global variables. 2026-05-28 14:45:26 +02:00
038f77f2fe - Fix double / bug in docker_tools_install,
- Add APPL_HOME_DIR declaration in docker_tools lib,
- Minor comment fixes.
2026-05-27 19:19:41 +02:00
b0c891ea53 - Fix rx3-base dependencies in SPEC file. 2026-05-04 00:38:14 +02:00
df54b3b814 - Update ReleaseNotes file. 2026-04-19 12:24:19 +02:00
9cce50b55f - Move lib to top dir and remove usr,
- Update mk_base_image to use urpmi-setup-dump.cgi,
- Now support rx3-base 1.1.2.
2026-04-16 19:18:46 +02:00
8839a9baf6 - Improve and simplify mk_base_image script,
- Add RX3_LIB_DIR env variable support,
- Now support rx3-base 1.1.1.
2026-04-10 17:21:06 +02:00
15 changed files with 374 additions and 230 deletions

View File

@@ -1,3 +1,35 @@
------------------------------------------------------------------------------------------------------------------------------------
Rx3-Docker/Docker Tools V 1.5.3 - A. GIBERT - 2026/09/13
------------------------------------------------------------------------------------------------------------------------------------
- Add VSL support,
- Support now rx3-base 1.2.0.
------------------------------------------------------------------------------------------------------------------------------------
Rx3-Docker/Docker Tools V 1.5.2 - A. GIBERT - 2026/05/30
------------------------------------------------------------------------------------------------------------------------------------
- Move lib to top dir and remove usr,
- Update mk_base_image to use urpmi-setup-dump.cgi,
- Fix greedy locales stripping bug in mk_base_image,
- Fix double / bug in docker_tools_install,
- Add docker_mk_env default global variables,
- Now support rx3-base 1.1.2.
------------------------------------------------------------------------------------------------------------------------------------
Rx3-Docker/Docker Tools V 1.5.1 - A. GIBERT - 2026/04/10
------------------------------------------------------------------------------------------------------------------------------------
- Improve and simplify mk_base_image script,
- Add RX3_LIB_DIR env variable support,
- Now support rx3-base 1.1.1.
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
Rx3-Docker/Docker Tools V 1.5.0 - A. GIBERT - 2026/04/07 Rx3-Docker/Docker Tools V 1.5.0 - A. GIBERT - 2026/04/07
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -24,17 +24,25 @@
%define name docker_tools %define name docker_tools
%define version 1.5.0 %define version 1.5.3
%define release %mkrel 1rx3 %define release %mkrel 1rx3
%global debug_package %{nil} %global debug_package %{nil}
#-----------------------------------------------------------------------------------------------------------------------------------
# Package
#-----------------------------------------------------------------------------------------------------------------------------------
Name: %{name} Name: %{name}
Version: %{version} Version: %{version}
Release: %{release} Release: %{release}
Summary: Rx3 Docker Management Tools Summary: Rx3 Docker Management Tools
License: GPL License: GPL
URL: https://git.rx3.org/gitea/rx3/%{name} URL: https://git.rx3.org/gitea/rx3/%{name}
@@ -46,7 +54,7 @@ Packager: Arnaud G. GIBERT <arnaud@rx3.net>
BuildArch: noarch BuildArch: noarch
Requires: rx3-base Requires: rx3-base-libs
%description %description
This project aims to give some basic tools to be used by other Rx3 docker packaging projects This project aims to give some basic tools to be used by other Rx3 docker packaging projects
@@ -70,8 +78,10 @@ Support different mounted volume modes:
%package devel %package devel
Summary: Meta Package Manager - Server repository Summary: Rx3 Docker Developement Tools
Requires: %{name} Requires: %{name}
Requires: rx3-base-tools
Requires: buildah Requires: buildah
%description devel %description devel
@@ -116,7 +126,7 @@ cp etc/bash_completion.d/* %{buildroot}%{_sysconfdir}/bash_completi
# Lib # Lib
%{__mkdir_p} %{buildroot}%{_prefix}/lib/rx3 %{__mkdir_p} %{buildroot}%{_prefix}/lib/rx3
cp usr/lib/rx3/*.bash %{buildroot}%{_prefix}/lib/rx3 cp lib/rx3/*.bash %{buildroot}%{_prefix}/lib/rx3
# Bin # Bin
%{__mkdir_p} %{buildroot}%{_sbindir} %{__mkdir_p} %{buildroot}%{_sbindir}
@@ -174,5 +184,15 @@ cp sbin/* %{buildroot}%{_sbindir}
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
%changelog %changelog
* Sun Sep 13 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.5.3-1rx3.mga9
- Update to 1.5.3
* Sat May 30 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.5.2-1rx3.mga9
- Update to 1.5.2
- move lib to top dir
* Fri Apr 10 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.5.1-1rx3.mga9
- Update to 1.5.1
* Tue Apr 7 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.5.0-1rx3.mga9 * Tue Apr 7 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.5.0-1rx3.mga9
- Create initial SPEC file for 1.5.0 on Mageia 9 - Create initial SPEC file for 1.5.0 on Mageia 9

View File

@@ -22,13 +22,34 @@
# #
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
if [[ "${DOCKER_TOOLS}" != "" ]]
then
return
else
declare -g DOCKER_TOOLS=1
fi
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
# Includes # Includes
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/base.bash : "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/base.bash"
#-----------------------------------------------------------------------------------------------------------------------------------
# Global Variables
#-----------------------------------------------------------------------------------------------------------------------------------
declare LIB_NAME="Docker_Tools"
declare LIB_VERSION="1.5.3"
declare -g APPL_HOME_DIR=""
@@ -68,3 +89,13 @@ dt_appl_home_get()
return 1 return 1
fi fi
} }
#--------------------------------------------------------------------------------------------------------------------------
# Main
#--------------------------------------------------------------------------------------------------------------------------
vsl_add

View File

@@ -24,15 +24,18 @@
# Include #-----------------------------------------------------------------------------------------------------------------------------------
# Includes
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/docker_tools.bash : "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/docker_tools.bash"
#-----------------------------------------------------------------------------------------------------------------------------------
# Init # Init
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@@ -47,6 +50,7 @@ dt_appl_home_get "${1:-}"
#-----------------------------------------------------------------------------------------------------------------------------------
# Main # Main
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------

View File

@@ -24,15 +24,18 @@
# Include #-----------------------------------------------------------------------------------------------------------------------------------
# Includes
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/docker_tools.bash : "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/docker_tools.bash"
#-----------------------------------------------------------------------------------------------------------------------------------
# Init # Init
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@@ -47,6 +50,7 @@ dt_appl_home_get "${1:-}"
#-----------------------------------------------------------------------------------------------------------------------------------
# Main # Main
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------

View File

@@ -24,15 +24,18 @@
# Include #-----------------------------------------------------------------------------------------------------------------------------------
# Includes
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/docker_tools.bash : "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/docker_tools.bash"
#-----------------------------------------------------------------------------------------------------------------------------------
# Init # Init
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@@ -47,6 +50,7 @@ dt_appl_home_get "${1:-}"
#-----------------------------------------------------------------------------------------------------------------------------------
# Main # Main
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------

View File

@@ -42,15 +42,34 @@
# Include #-----------------------------------------------------------------------------------------------------------------------------------
# Includes
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/docker_tools.bash : "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/docker_tools.bash"
#-----------------------------------------------------------------------------------------------------------------------------------
# Global Variables
#-----------------------------------------------------------------------------------------------------------------------------------
declare -g VERSION="1.5.3"
declare -g NAME="Docker_Mk_Env"
declare -g DOCKER_TOOLS_VOLUME="SINGLE"
declare -g DOCKER_TOOLS_EXEPTION_LIBS=""
declare -g DOCKER_TOOLS_EXEPTION_LOGS=""
declare -g DOCKER_TOOLS_USER_GROUP_FORCE="FALSE"
#-----------------------------------------------------------------------------------------------------------------------------------
# Init # Init
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@@ -71,7 +90,10 @@ CONFIG_FILE_LIST=""
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
function dynvar_export # Dynvar Export
#-----------------------------------------------------------------------------------------------------------------------------------
dynvar_export()
{ {
var=$1 var=$1
value=$2 value=$2
@@ -85,7 +107,10 @@ function dynvar_export
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
function psfix_cat # Psfix Cat
#-----------------------------------------------------------------------------------------------------------------------------------
psfix_cat()
{ {
prefix=$1 prefix=$1
separator=$2 separator=$2
@@ -103,7 +128,10 @@ function psfix_cat
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
function module_lib_name_get # Module Lib Name Get
#-----------------------------------------------------------------------------------------------------------------------------------
module_lib_name_get()
{ {
module=$1 module=$1
@@ -122,7 +150,10 @@ function module_lib_name_get
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
function module_log_name_get # Module Log Name Get
#-----------------------------------------------------------------------------------------------------------------------------------
module_log_name_get()
{ {
module=$1 module=$1
@@ -141,7 +172,10 @@ function module_log_name_get
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
function docker_service_add # Docker Service Add
#-----------------------------------------------------------------------------------------------------------------------------------
docker_service_add()
{ {
varible_prefix="$1" varible_prefix="$1"
shift shift
@@ -354,7 +388,10 @@ function docker_service_add
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
function docker_config_add # Docker Config Add
#-----------------------------------------------------------------------------------------------------------------------------------
docker_config_add()
{ {
config_file_target="$1" config_file_target="$1"
config_file_source="$2" config_file_source="$2"
@@ -366,6 +403,7 @@ function docker_config_add
#-----------------------------------------------------------------------------------------------------------------------------------
# Main # Main
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@@ -379,6 +417,8 @@ function docker_config_add
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
vsl_add
. ${APPL_HOME_DIR}/env . ${APPL_HOME_DIR}/env

View File

@@ -24,15 +24,18 @@
# Include #-----------------------------------------------------------------------------------------------------------------------------------
# Includes
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/docker_tools.bash : "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/docker_tools.bash"
#-----------------------------------------------------------------------------------------------------------------------------------
# Init # Init
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@@ -46,6 +49,7 @@ dt_appl_home_get "${1:-}"
#-----------------------------------------------------------------------------------------------------------------------------------
# Main # Main
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------

View File

@@ -24,15 +24,18 @@
# Include #-----------------------------------------------------------------------------------------------------------------------------------
# Includes
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/docker_tools.bash : "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/docker_tools.bash"
#-----------------------------------------------------------------------------------------------------------------------------------
# Init # Init
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@@ -47,6 +50,7 @@ dt_appl_home_get "${1:-}"
#-----------------------------------------------------------------------------------------------------------------------------------
# Main # Main
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------

View File

@@ -24,15 +24,18 @@
# Include #-----------------------------------------------------------------------------------------------------------------------------------
# Includes
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/docker_tools.bash : "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/docker_tools.bash"
#-----------------------------------------------------------------------------------------------------------------------------------
# Init # Init
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@@ -47,6 +50,7 @@ dt_appl_home_get "${1:-}"
#-----------------------------------------------------------------------------------------------------------------------------------
# Main # Main
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------

View File

@@ -24,15 +24,18 @@
# Include #-----------------------------------------------------------------------------------------------------------------------------------
# Includes
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/docker_tools.bash : "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/docker_tools.bash"
#-----------------------------------------------------------------------------------------------------------------------------------
# Init # Init
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@@ -47,6 +50,7 @@ dt_appl_home_get "${1:-}"
#-----------------------------------------------------------------------------------------------------------------------------------
# Main # Main
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------

View File

@@ -24,15 +24,18 @@
# Include #-----------------------------------------------------------------------------------------------------------------------------------
# Includes
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/docker_tools.bash : "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/docker_tools.bash"
#-----------------------------------------------------------------------------------------------------------------------------------
# Init # Init
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@@ -47,6 +50,7 @@ dt_appl_home_get "${1:-}"
#-----------------------------------------------------------------------------------------------------------------------------------
# Main # Main
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------

View File

@@ -24,15 +24,18 @@
# Include #-----------------------------------------------------------------------------------------------------------------------------------
# Includes
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/docker_tools.bash : "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/docker_tools.bash"
#-----------------------------------------------------------------------------------------------------------------------------------
# Init # Init
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@@ -47,6 +50,7 @@ dt_appl_home_get "${1:-}"
#-----------------------------------------------------------------------------------------------------------------------------------
# Main # Main
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------

View File

@@ -24,15 +24,28 @@
# Include #-----------------------------------------------------------------------------------------------------------------------------------
# Includes
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/docker_tools.bash : "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/docker_tools.bash"
#-----------------------------------------------------------------------------------------------------------------------------------
# Global Variables
#-----------------------------------------------------------------------------------------------------------------------------------
declare -g DOCKER_TOOLS_HOME_DIR="$(dirname "$(dirname "$0")")"
#-----------------------------------------------------------------------------------------------------------------------------------
# Init # Init
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@@ -43,21 +56,11 @@ fi
dt_appl_home_get "${1:-}" dt_appl_home_get "${1:-}"
DOCKER_TOOLS_HOME_DIR="$(dirname "$(dirname "$0")")"
if [[ "${1:-}" == "" ]]
then
APPL_HOME_DIR="$PWD"
else
APPL_HOME_DIR="${1}"
fi
#-----------------------------------------------------------------------------------------------------------------------------------
# Link Create # Link Create
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@@ -85,6 +88,7 @@ function link_create
#-----------------------------------------------------------------------------------------------------------------------------------
# Main # Main
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@@ -94,6 +98,11 @@ cd ${APPL_HOME_DIR}
docker_tools_home_dir=$( realpath ${DOCKER_TOOLS_HOME_DIR}) docker_tools_home_dir=$( realpath ${DOCKER_TOOLS_HOME_DIR})
if [[ "${docker_tools_home_dir}" == "/" ]]
then
docker_tools_home_dir=""
fi
#link_create ${docker_tools_home_dir}/sbin . #link_create ${docker_tools_home_dir}/sbin .

View File

@@ -28,7 +28,8 @@
# Includes # Includes
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/docker_tools.bash : "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/docker_tools.bash"
@@ -38,8 +39,8 @@
# Global Variables # Global Variables
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
declare -g VERSION=1.0.0 declare -g VERSION=1.5.3
declare -g NAME="MBI" declare -g NAME="Mk_Base_Image"
declare -g HELP="usage: mk_base_image [[-h | --help] | [-V | --version] | [-p | --pre] | [-P | --post] | [-s | --strip] | [-u | --unstrip]] [-D | --direct] [-d | --distrib <Distrib>] [-l | --lang <Lang>] [-L | --language <Langage>] [-m | --localtime <Local_Time>] [-r | --root <Root_Dir>] [-t | --tmp <Tmp_Dir>] [-T | --test] [-v | --verbose]" declare -g HELP="usage: mk_base_image [[-h | --help] | [-V | --version] | [-p | --pre] | [-P | --post] | [-s | --strip] | [-u | --unstrip]] [-D | --direct] [-d | --distrib <Distrib>] [-l | --lang <Lang>] [-L | --language <Langage>] [-m | --localtime <Local_Time>] [-r | --root <Root_Dir>] [-t | --tmp <Tmp_Dir>] [-T | --test] [-v | --verbose]"
declare -g TMP_DIR_DEF="/tmp/mk_base_image" declare -g TMP_DIR_DEF="/tmp/mk_base_image"
@@ -51,10 +52,6 @@ declare -g LANGUAGE_DEF="en_US.UTF-8:en_US:en"
declare -g LOCALTIME_DEF="Europe/Paris" declare -g LOCALTIME_DEF="Europe/Paris"
declare -Ag CONTAINER_TAB declare -Ag CONTAINER_TAB
CONTAINER_TAB["Builder,Name"]='rx3-builder'
CONTAINER_TAB["Builder,Source"]='docker.io/library/mageia:9'
CONTAINER_TAB["Root,Name"]='rx3-mageia${DISTRIB}'
CONTAINER_TAB["Root,Source"]='scratch'
declare -g BUILDER_DIR="/" declare -g BUILDER_DIR="/"
declare -g ROOT_DIR="${ROOT_DIR_DEF}" declare -g ROOT_DIR="${ROOT_DIR_DEF}"
@@ -65,6 +62,7 @@ declare -g LANG="${LANG_DEF}"
declare -g LANGUAGE="${LANGUAGE_DEF}" declare -g LANGUAGE="${LANGUAGE_DEF}"
declare -g LOCALTIME="${LOCALTIME_DEF}" declare -g LOCALTIME="${LOCALTIME_DEF}"
declare -g EXIT_CODE=0
declare -g MODE="DEFAULT" declare -g MODE="DEFAULT"
declare -g VERBOSE="FALSE" declare -g VERBOSE="FALSE"
declare -g DRY_RUN="FALSE" declare -g DRY_RUN="FALSE"
@@ -77,61 +75,7 @@ declare -g NAME_SERVER_1='8.8.8.8'
#-----------------------------------------------------------------------------------------------------------------------------------
# Func Exec
#-----------------------------------------------------------------------------------------------------------------------------------
function mbi_func_exec()
{
func="$1"
arg="$2"
name="$3"
builder_mode="$4"
echo_error "Executing Name: [${name}] Func: [${func}] Arg: [${arg}] Builder_Mode: [${builder_mode}]"
if [[ "${builder_mode}" == "TRUE" ]]
then
if [[ "${BUILDER_DIR}" != "/" ]]
then
echo_error "Only direct ${name} and '/' Builder Root dir supported: Recall in ..."
mkdir -p "${BUILDER_DIR}/${ROOT_DIR_DEF}"
mount --bind "${ROOT_DIR}" "${BUILDER_DIR}/${ROOT_DIR_DEF}"
cmd_exec chroot "${BUILDER_DIR}" mk_base_image ${arg} --direct --root "${ROOT_DIR_DEF}" ${RECALL_OPTS}
umount "${BUILDER_DIR}/${ROOT_DIR_DEF}"
return
fi
else
if [[ "${ROOT_DIR}" != "/" ]]
then
echo_error "Only direct ${name} and '/' Target Root dir supported: Recall..."
cmd_exec chroot "${ROOT_DIR}" mk_base_image ${arg} --direct --root "/" "${RECALL_OPTS}"
return
fi
fi
set +e
# find / 2>/dev/null | grep -v -e "^/dev" -e "^/proc" -e "^/run" -e "^/sys/" >/root/before
declare -f ${func} | sed -n '/^{/,/^}/p' | sed -e '1d;$d' -e 's/;$//' | grep -v -E '^$|^#' | while read -r line
do
sh_exec "${line}"
done
# find / 2>/dev/null | grep -v -e "^/dev" -e "^/proc" -e "^/run" -e "^/sys/" >/root/after # find / 2>/dev/null | grep -v -e "^/dev" -e "^/proc" -e "^/run" -e "^/sys/" >/root/after
}
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
# Version # Version
@@ -152,7 +96,6 @@ function mbi_version_print()
function mbi_help_print() function mbi_help_print()
{ {
mbi_version_print
help_print help_print
} }
@@ -173,7 +116,8 @@ function mbi_args_parse()
# Note the quotes around `$tmp_args': they are essential! # Note the quotes around `$tmp_args': they are essential!
eval set -- "${tmp_args}" eval set -- "${tmp_args}"
while true ; do while true
do
case "$1" in case "$1" in
# Options # Options
@@ -190,12 +134,12 @@ function mbi_args_parse()
-r|--root) shift; ROOT_DIR="$1"; shift;; -r|--root) shift; ROOT_DIR="$1"; shift;;
# Mode switches # Mode switches
-h|--help) MODE="EXIT"; mbi_help_print; shift;; -h|--help) MODE="HELP"; shift;;
-p|--pre) MODE="PRE"; shift;; -p|--pre) MODE="PRE"; shift;;
-P|--post) MODE="POST"; shift;; -P|--post) MODE="POST"; shift;;
-s|--strip) MODE="STRIP"; shift;; -s|--strip) MODE="STRIP"; shift;;
-u|--unstrip) MODE="UNSTRIP"; shift;; -u|--unstrip) MODE="UNSTRIP"; shift;;
-V|--version) MODE="EXIT"; mbi_version_print; shift;; -V|--version) MODE="VERSION"; shift;;
# Global options # Global options
-T|--test) DRY_RUN="TRUE"; shift; RECALL_OPTS+=" --test";; -T|--test) DRY_RUN="TRUE"; shift; RECALL_OPTS+=" --test";;
@@ -212,6 +156,22 @@ function mbi_args_parse()
#-----------------------------------------------------------------------------------------------------------------------------------
# Container Tab Init
#-----------------------------------------------------------------------------------------------------------------------------------
mbi_container_tab_init()
{
CONTAINER_TAB["Builder,Name"]="rx3-builder"
CONTAINER_TAB["Builder,Source"]="docker.io/library/mageia:${DISTRIB_DEF}"
CONTAINER_TAB["Root,Name"]="rx3-mageia${DISTRIB}"
CONTAINER_TAB["Root,Source"]="scratch"
}
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
# Env Init # Env Init
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@@ -286,8 +246,9 @@ function mbi_env_init()
echo_error "Making Builder..." echo_error "Making Builder..."
cmd_exec chroot "${BUILDER_DIR}" bash -c 'curl -L http://mirror.rx3.net/rx3/sbin/urpmi-setup-'${DISTRIB}' | bash' cmd_exec cp /etc/resolv.conf "${BUILDER_DIR}/etc/resolv.conf"
cmd_exec chroot "${BUILDER_DIR}" urpmi --force docker_tools-devel cmd_exec chroot "${BUILDER_DIR}" bash -c 'curl -L http://mirror.rx3.net/rx3/cgi-bin/urpmi-setup-dump.cgi?'${DISTRIB}' | bash'
cmd_exec chroot "${BUILDER_DIR}" urpmi --force rx3-base
fi fi
fi fi
} }
@@ -335,31 +296,47 @@ function mbi_env_deinit()
# Base Install Pre # Base Install Pre
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
function _mbi_base_install_pre()
{
rm /var/cache/urpmi/rpms/*
urpmi --root ${ROOT_DIR} --force --no-install --no-recommends --nolock --reinstall --download-all ${TMP_DIR} --downloader curl makedev filesystem curl urpmi rx3-base docker_tools-devel
rpm --root ${ROOT_DIR} --initdb
rpm --root ${ROOT_DIR} -Uvh --nodeps --noscripts ${TMP_DIR}/rpms/filesystem*
rm ${TMP_DIR}/rpms/filesystem*
rpm --root ${ROOT_DIR} -Uvh --nodeps --noscripts ${TMP_DIR}/rpms/makedev*
rm ${TMP_DIR}/rpms/makedev*
rpm --root ${ROOT_DIR} -Uvh --nodeps ${TMP_DIR}/rpms/*
rm -R ${TMP_DIR}
# Enable Neworking
echo -e "nameserver ${NAME_SERVER_0}\nnameserver ${NAME_SERVER_1}" >"${ROOT_DIR}/etc/resolv.conf"
echo -e "NETWORKING=yes" >"${ROOT_DIR}/etc/sysconfig/network"
}
function mbi_base_install_pre() function mbi_base_install_pre()
{ {
mbi_func_exec "_mbi_base_install_pre" "--pre" "pre-installing" "TRUE" if [[ "${DIRECT}" == "FALSE" ]]
then
echo_error "Chrooting in Builder_Dir: [${BUILDER_DIR}] for Pre-Install.."
cmd_exec mkdir -p "${BUILDER_DIR}/${ROOT_DIR_DEF}"
cmd_exec mount --bind "${ROOT_DIR}" "${BUILDER_DIR}/${ROOT_DIR_DEF}"
chroot_cmd="chroot ${BUILDER_DIR}"
root_dir="${ROOT_DIR_DEF}"
else
echo_error "Direct Pre-Install..."
chroot_cmd=""
root_dir="${ROOT_DIR}"
fi
cmd_exec ${chroot_cmd} bash -c 'rm /var/cache/urpmi/rpms/* || true'
cmd_exec ${chroot_cmd} urpmi --root ${root_dir} --force --no-install --no-recommends --nolock --reinstall --download-all ${TMP_DIR} --downloader curl makedev filesystem curl urpmi rx3-base
cmd_exec ${chroot_cmd} bash -c 'rpm --root '${root_dir}' --initdb'
cmd_exec ${chroot_cmd} bash -c 'rpm --root '${root_dir}' -Uvh --nodeps --noscripts '${TMP_DIR}'/rpms/filesystem*'
cmd_exec ${chroot_cmd} bash -c 'rm '${TMP_DIR}'/rpms/filesystem*'
cmd_exec ${chroot_cmd} bash -c 'rpm --root '${root_dir}' -Uvh --nodeps --noscripts '${TMP_DIR}'/rpms/makedev*'
cmd_exec ${chroot_cmd} bash -c 'rm '${TMP_DIR}'/rpms/makedev*'
cmd_exec ${chroot_cmd} bash -c 'rpm --root '${root_dir}' -Uvh --nodeps '${TMP_DIR}'/rpms/*'
cmd_exec ${chroot_cmd} bash -c 'rm -R '${TMP_DIR}
# Enable Neworking
sh_exec 'echo -e "nameserver '${NAME_SERVER_0}'\nnameserver '${NAME_SERVER_1}'" >"'${ROOT_DIR}'/etc/resolv.conf"'
sh_exec 'echo -e "NETWORKING=yes" >"'${ROOT_DIR}'/etc/sysconfig/network"'
if [[ "${DIRECT}" == "FALSE" ]]
then
cmd_exec umount "${BUILDER_DIR}/${ROOT_DIR_DEF}"
fi
} }
@@ -370,22 +347,17 @@ function mbi_base_install_pre()
# Base Install Post # Base Install Post
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
function _mbi_base_install_post()
{
urpmi-setup --verbose --distrib "${DISTRIB}"
urpmi --force --auto-update
urpmi --force basesystem-minimal locales locales-en shared-mime-info vim-minimal mpm
echo -e "LANG=${LANG}\nLANGUAGE=${LANGUAGE}" >"${ROOT_DIR}/etc/locale.conf"
ln -s /usr/share/zoneinfo/${LOCALTIME} "${ROOT_DIR}/etc/localtime"
}
function mbi_base_install_post() function mbi_base_install_post()
{ {
mbi_func_exec "_mbi_base_install_post" "--post" "post-installing" "FALSE"
cmd_exec chroot ${ROOT_DIR} urpmi-setup --verbose --distrib "${DISTRIB}"
cmd_exec chroot ${ROOT_DIR} urpmi --force --auto-update
cmd_exec chroot ${ROOT_DIR} urpmi --force basesystem-minimal locales locales-en shared-mime-info vim-minimal mpm
sh_exec 'echo -e "LANG='${LANG}'\nLANGUAGE='${LANGUAGE}'" >"'"${ROOT_DIR}"'/etc/locale.conf"'
cmd_exec chroot ${ROOT_DIR} ln -s /usr/share/zoneinfo/${LOCALTIME} "/etc/localtime"
} }
@@ -396,47 +368,40 @@ function mbi_base_install_post()
# Base Strip # Base Strip
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
function _mbi_base_strip()
{
# RPM force uninstall
rpm -e --nodeps cracklib-dicts buildah
rpm -e dhcp-common dhcp-client cronie-anacron opencontainers-runc lib64gpgme11 gnupg2 lib64ksba8 lib64usb1.0_0 lib64npth0 lib64assuan0
# Docker mounts tmpfs at /dev and procfs at /proc so we can remove them
rm -rf /dev /proc 2>/dev/null
mkdir -p /dev /proc 2>/dev/null
# Keep only en_US.UTF8 locale
rm -rf /usr/share/locale/!("en_US.UTF-8"|"locale.alias"|"locale-archive")
rm -rf /usr/{{lib,lib64}/gconv,bin/localedef,sbin/build-locale-archive}
# Docs
rm -rf /usr/share/{man,doc,info,gnome/help}
# sln
rm -rf /sbin/sln
# ldconfig
rm -rf /etc/ld.so.cache /var/cache/ldconfig
mkdir -p --mode=0755 /var/cache/ldconfig
# UDev
rm -rf /usr/lib/udev
rm -rf /etc/udev/hwdb.bin
rm -rf /usr/lib/.build-id
# Cache & Tmp
rm -rf /var/cache/urpmi/rpms 2>/dev/null
rm -rf /tmp/*
}
function mbi_base_strip() function mbi_base_strip()
{ {
mbi_func_exec "_mbi_base_strip" "--strip" "stripping" "FALSE" # RPM force uninstall
cmd_exec chroot ${ROOT_DIR} rpm -e --nodeps cracklib-dicts || true
cmd_exec chroot ${ROOT_DIR} rpm -e dhcp-common dhcp-client cronie-anacron || true
# Docker mounts tmpfs at /dev and procfs at /proc so we can remove them
cmd_exec rm -rf "${ROOT_DIR}"/dev "${ROOT_DIR}"/proc 2>/dev/null || true
cmd_exec mkdir -p "${ROOT_DIR}"/dev "${ROOT_DIR}"/proc 2>/dev/null || true
# Keep only en_US.UTF8 locale
cmd_exec rm -rf "${ROOT_DIR}"/usr/share/locale/!("UTF-8"|"C.UTF-8"|"en_US.UTF-8"|"en"|"locale.alias"|"locale-archive")
cmd_exec rm -rf "${ROOT_DIR}"/usr/{{lib,lib64}/gconv,bin/localedef,sbin/build-locale-archive}
# Docs
cmd_exec rm -rf "${ROOT_DIR}"/usr/share/{man,doc,info,gnome/help}
# sln
cmd_exec rm -rf "${ROOT_DIR}"/sbin/sln
# ldconfig
cmd_exec rm -rf "${ROOT_DIR}"/etc/ld.so.cache "${ROOT_DIR}"/var/cache/ldconfig
cmd_exec mkdir -p --mode=0755 "${ROOT_DIR}"/var/cache/ldconfig
# UDev
cmd_exec rm -rf "${ROOT_DIR}"/usr/lib/udev
cmd_exec rm -rf "${ROOT_DIR}"/etc/udev/hwdb.bin
cmd_exec rm -rf "${ROOT_DIR}"/usr/lib/.build-id
# Cache & Tmp
cmd_exec rm -rf "${ROOT_DIR}"/var/cache/urpmi/rpms 2>/dev/null
cmd_exec rm -rf "${ROOT_DIR}"/tmp/*
} }
@@ -447,22 +412,15 @@ function mbi_base_strip()
# Base UnStrip # Base UnStrip
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
function _mbi_base_unstrip()
{
urpmi.update -a
# Install uninstalled packages
urpmi --force cracklib-dicts buildah dhcp-common dhcp-client cronie-anacron buildah opencontainers-runc lib64gpgme11 gnupg2 lib64ksba8 lib64usb1.0_0 lib64npth0 lib64assuan0
# Force reinstall all packages
urpmi --force --replacepkgs $(rpm -qa | grep -v gpg-pubkey)
}
function mbi_base_unstrip() function mbi_base_unstrip()
{ {
mbi_func_exec "_mbi_base_unstrip" "--unstrip" "unstripping" "FALSE" cmd_exec chroot ${ROOT_DIR} urpmi.update -a
# Install uninstalled packages
cmd_exec chroot ${ROOT_DIR} urpmi --force cracklib-dicts dhcp-common dhcp-client cronie-anacron
# Force reinstall all packages
cmd_exec chroot ${ROOT_DIR} urpmi --force --replacepkgs $(rpm -qa | grep -v gpg-pubkey)
} }
@@ -473,6 +431,8 @@ function mbi_base_unstrip()
# Main # Main
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
vsl_add
ORIG_ARGS=("$@") ORIG_ARGS=("$@")
@@ -484,18 +444,32 @@ export LC_ALL="C"
mbi_args_parse "$@" mbi_args_parse "$@"
case "${MODE}" in
"EXIT")
exit ${EXIT_CODE}
;;
if [[ ${MODE} == "EXIT" ]] "HELP")
then mbi_help_print
exit 0 exit ${EXIT_CODE}
fi ;;
"TEST")
DRY_RUN="TRUE"
;;
"VERSION")
mbi_version_print
exit ${EXIT_CODE}
;;
esac
mbi_container_tab_init
echo_error "MBI: Mode: [${MODE}] Verbose: [${VERBOSE}] Distrib: [${DISTRIB}] Direct: [${DIRECT}] Dry_Run: [${DRY_RUN}] Lang: [${LANG}] Language: [${LANGUAGE}] Local_Time: [${LOCALTIME}] Builder_Dir: [${BUILDER_DIR}] Root_Dir: [${ROOT_DIR}] Tmp_Dir: [${TMP_DIR}]" echo_error "MBI: Mode: [${MODE}] Verbose: [${VERBOSE}] Distrib: [${DISTRIB}] Direct: [${DIRECT}] Dry_Run: [${DRY_RUN}] Lang: [${LANG}] Language: [${LANGUAGE}] Local_Time: [${LOCALTIME}] Builder_Dir: [${BUILDER_DIR}] Root_Dir: [${ROOT_DIR}] Tmp_Dir: [${TMP_DIR}]"
eval CONTAINER_TAB["Root,Name"]=${CONTAINER_TAB["Root,Name"]}
if [[ "${MODE}" == "DEFAULT" ]] if [[ "${MODE}" == "DEFAULT" ]]
then then
mbi_env_init "TRUE" mbi_env_init "TRUE"
@@ -528,5 +502,7 @@ case "${MODE}" in
"UNSTRIP") "UNSTRIP")
mbi_base_unstrip mbi_base_unstrip
;; ;;
esac esac
exit ${EXIT_CODE}