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

37 lines
1.1 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 ..."
echo "Create directories in ${_DIR} ..."
_prepare_pacman
_install_base_packages
2022-02-09 09:59:28 +01:00
_clean_mkinitcpio
_clean_cache
_install_archboot
_umount_special
2022-02-09 09:59:28 +01:00
_clean_container
_clean_archboot_cache
_generate_locales
_clean_locale
_generate_keyring
_copy_mirrorlist_and_pacman_conf
_change_pacman_conf
# 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
_set_hostname
2021-10-15 09:16:30 +02:00
echo "Finished container setup in ${_DIR} ."
2022-02-09 09:04:53 +01:00