archboot/usr/bin/archboot-x86_64-create-container.sh

37 lines
1.2 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# created by Tobias Powalowski <tpowa@archlinux.org>
source /usr/lib/archboot/functions
source /usr/lib/archboot/container_functions
2022-02-09 09:59:28 +01:00
_ARCHBOOT="archboot"
_KEYRING="archlinux"
[[ -z "${1}" ]] && _usage
2021-09-25 14:02:02 +02:00
_DIR="$1"
2022-02-09 09:59:28 +01:00
_parameters "$@"
_root_check
_x86_64_check
2021-10-15 09:16:30 +02:00
echo "Starting container creation ..."
[[ -d "${_DIR}" ]] || (echo "Create directory ${_DIR} ..."; mkdir "${_DIR}")
2022-02-09 16:36:28 +01:00
_prepare_pacman || exit 1
_install_base_packages || exit 1
_clean_mkinitcpio || exit 1
_clean_cache || exit 1
_install_archboot || exit 1
_umount_special || exit 1
_generate_locales || exit 1
2022-02-09 16:58:09 +01:00
_clean_locale
_clean_container || exit 1
_clean_archboot_cache
2022-02-09 16:36:28 +01:00
_generate_keyring || exit 1
2022-02-09 16:58:09 +01:00
_copy_mirrorlist_and_pacman_conf
2022-02-09 16:36:28 +01:00
_change_pacman_conf || exit 1
# enable [testing] if enabled in host
2022-01-21 11:59:06 +01:00
if grep -q "^\[testing" /etc/pacman.conf; then
2021-10-15 09:16:30 +02:00
echo "Enable [testing] repository in container ..."
2022-01-21 11:59:06 +01:00
sed -i -e '/^#\[testing\]/ { n ; s/^#// }' "${_DIR}/etc/pacman.conf"
sed -i -e '/^#\[community-testing\]/ { n ; s/^#// }' "${_DIR}/etc/pacman.conf"
sed -i -e 's:^#\[testing\]:\[testing\]:g' -e 's:^#\[community-testing\]:\[community-testing\]:g' "${_DIR}/etc/pacman.conf"
fi
2022-02-09 16:36:28 +01:00
_set_hostname || exit 1
2021-10-15 09:16:30 +02:00
echo "Finished container setup in ${_DIR} ."
2022-02-09 09:04:53 +01:00