fix code merge

This commit is contained in:
Tobias Powalowski 2022-10-02 16:33:37 +02:00
parent d9fd9b247f
commit cc3baf7b9b
6 changed files with 12 additions and 11 deletions

View file

@ -9,6 +9,7 @@ _root_check
echo "Starting container creation ..."
[[ -d "${1}" ]] || (echo "Create directory ${1} ..."; mkdir "${1}")
if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
_cachedir_check
_create_pacman_conf "${1}"
_prepare_pacman "${1}" || exit 1
_pacman_parameters "${1}"

View file

@ -9,6 +9,7 @@ _root_check
echo "Starting container creation ..."
[[ -d "${1}" ]] || (echo "Create directory ${1} ..."; mkdir "${1}")
if [[ "${_RUNNING_ARCH}" == "riscv64" ]]; then
_cachedir_check
_create_pacman_conf "${1}"
_prepare_pacman "${1}" || exit 1
_pacman_parameters "${1}"

View file

@ -7,6 +7,7 @@ _ARCHBOOT="archboot"
_parameters "$@"
_root_check
_x86_64_check
_cachedir_check
echo "Starting container creation ..."
[[ -d "${1}" ]] || (echo "Create directory ${1} ..."; mkdir "${1}")
_create_pacman_conf "${1}"

View file

@ -141,6 +141,7 @@ _pacman_parameters() {
_PACMAN_CACHEDIR="--cachedir ${_CACHEDIR}"
_PACMAN_DB="--dbpath ${1}/blankdb"
fi
[[ -d "${1}"/blankdb ]] || mkdir "${1}"/blankdb
# defaults used on every pacman call
_PACMAN_DEFAULTS="--config ${_PACMAN_CONF} ${_PACMAN_CACHEDIR} --ignore systemd-resolvconf --noconfirm"
}
@ -162,3 +163,10 @@ _riscv64_disable_graphics() {
#shellcheck disable=SC2001
[[ "$(echo "${_CONTAINER_ARCH}" | sed -e 's#\r##g')" == "riscv64" ]] && _GRAPHICAL_PACKAGES=""
}
_cachedir_check() {
if grep -q ^CacheDir /etc/pacman.conf; then
echo "Error: CacheDir is set in /etc/pacman.conf. Aborting ..."
exit 1
fi
}

View file

@ -144,13 +144,12 @@ _umount_special() {
_install_base_packages() {
_PACMAN_OPTIONS="${_PACKAGES} ${_PACMAN_DEFAULTS}"
[[ -d "${1}"/blankdb ]] || mkdir "${1}"/blankdb
if [[ "${2}" == "use_binfmt" ]]; then
echo "Downloading ${_PACKAGES} to ${1} ..."
${_PACMAN} -Syw ${_PACMAN_OPTIONS} --dbpath /blankdb >/dev/null 2>&1 || exit 1
fi
echo "Installing packages ${_PACKAGES} to ${1} ..."
${_PACMAN} -Sy ${_PACMAN_OPTIONS} >/dev/null 2>&1 || exit 1
${_PACMAN} -Sy ${_PACMAN_OPTIONS} >/dev/null 2>&1 || exit 1
}
_install_archboot() {
@ -163,7 +162,6 @@ _install_archboot() {
[[ "${_RUNNING_ARCH}" == "riscv64" ]] && _GRAPHICAL_PACKAGES=""
fi
[[ "${_CLEANUP_CACHE}" == "1" ]] && _GRAPHICAL_PACKAGES=""
[[ -d "${1}"/blankdb ]] || mkdir "${1}"/blankdb
_pacman_key
#shellcheck disable=SC2086
if grep -qw archboot /etc/hostname; then

View file

@ -11,16 +11,8 @@ _usage () {
exit 0
}
_cachedir_check() {
if grep -q ^CacheDir /etc/pacman.conf; then
echo "Error: CacheDir set in /etc/pacman.conf. Aborting ..."
exit 1
fi
}
_download_packages() {
_PACMAN_OPTIONS="${_PACKAGES} ${_ARCHBOOT} ${_GRAPHICAL_PACKAGES} ${_PACMAN_DEFAULTS}"
[[ -d "${1}"/blankdb ]] || mkdir "${1}"/blankdb
if [[ "${2}" == "use_binfmt" ]]; then
_copy_gpg_key
_riscv64_disable_graphics