2022-12-14 07:06:55 +01:00
|
|
|
#!/usr/bin/env bash
|
2023-01-09 18:38:55 +01:00
|
|
|
# created by Tobias Powalowski <tpowa@archlinux.org>
|
2023-01-08 08:48:05 +01:00
|
|
|
_DESTDIR="${1}"
|
2022-04-05 21:44:16 +02:00
|
|
|
. /usr/lib/archboot/installer/common.sh
|
|
|
|
|
2023-01-09 08:20:54 +01:00
|
|
|
_usage() {
|
2022-04-05 20:09:24 +02:00
|
|
|
echo -e "\033[1mWelcome to \033[34marchboot's\033[0m \033[1m QUICKINST INSTALLER:\033[0m"
|
2022-04-05 20:08:56 +02:00
|
|
|
echo -e "\033[1m-------------------------------------------\033[0m"
|
2022-04-05 09:50:59 +02:00
|
|
|
echo -e "Usage:"
|
|
|
|
echo -e "\033[1mquickinst <destdir>\033[0m"
|
|
|
|
echo ""
|
2009-02-11 21:34:04 +01:00
|
|
|
echo "This script is for users who would rather partition/mkfs/mount their target"
|
|
|
|
echo "media manually than go through the routines in the setup script."
|
|
|
|
echo
|
2023-01-08 08:48:05 +01:00
|
|
|
if ! [[ -e "${_LOCAL_DB}" ]]; then
|
2022-04-05 09:50:59 +02:00
|
|
|
echo -e "First configure \033[1m/etc/pacman.conf\033[0m which repositories to use"
|
|
|
|
echo -e "and set a mirror in \033[1m/etc/pacman.d/mirrorlist\033[0m"
|
2022-03-19 17:37:17 +01:00
|
|
|
fi
|
|
|
|
echo
|
2022-04-05 09:50:59 +02:00
|
|
|
echo -e "Make sure you have all your filesystems mounted under \033[1m<destdir>\033[0m."
|
|
|
|
echo -e "Then run this script to install all packages listed in \033[1m/etc/archboot/defaults\033[0m"
|
|
|
|
echo -e "to \033[1m<destdir>\033[0m."
|
2009-02-11 21:34:04 +01:00
|
|
|
echo
|
2021-09-27 09:59:36 +02:00
|
|
|
echo "Example:"
|
2022-04-05 09:50:59 +02:00
|
|
|
echo -e " \033[1mquickinst /mnt\033[0m"
|
2009-02-11 21:34:04 +01:00
|
|
|
echo ""
|
|
|
|
exit 0
|
2008-10-20 22:39:25 +02:00
|
|
|
}
|
|
|
|
|
2010-02-22 07:40:53 +01:00
|
|
|
# configures pacman and syncs db on destination system
|
2010-01-17 22:38:24 +01:00
|
|
|
# params: none
|
|
|
|
# returns: 1 on error
|
2023-01-09 08:20:54 +01:00
|
|
|
_prepare_pacman() {
|
2010-01-17 22:38:24 +01:00
|
|
|
# Set up the necessary directories for pacman use
|
2023-01-08 08:48:05 +01:00
|
|
|
if [[ ! -d "${_DESTDIR}/var/cache/pacman/pkg" ]]; then
|
|
|
|
mkdir -p "${_DESTDIR}/var/cache/pacman/pkg"
|
2022-04-05 21:33:44 +02:00
|
|
|
fi
|
2023-01-08 08:48:05 +01:00
|
|
|
if [[ ! -d "${_DESTDIR}/var/lib/pacman" ]]; then
|
|
|
|
mkdir -p "${_DESTDIR}/var/lib/pacman"
|
2022-04-05 21:33:44 +02:00
|
|
|
fi
|
2022-09-02 11:59:39 +02:00
|
|
|
# pacman-key process itself
|
2023-01-19 08:12:54 +01:00
|
|
|
while pgrep -x pacman-key &>/dev/null; do
|
2022-09-02 11:59:39 +02:00
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
# gpg finished in background
|
2023-01-19 08:12:54 +01:00
|
|
|
while pgrep -x gpg &>/dev/null; do
|
2022-09-02 11:59:39 +02:00
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
[[ -e /etc/systemd/system/pacman-init.service ]] && systemctl stop pacman-init.service
|
2023-01-09 08:31:45 +01:00
|
|
|
${_PACMAN} -Sy
|
2023-01-08 08:48:05 +01:00
|
|
|
_KEYRING="archlinux-keyring"
|
|
|
|
[[ "$(uname -m)" == "aarch64" ]] && _KEYRING="${_KEYRING} archlinuxarm-keyring"
|
2022-09-23 08:50:09 +02:00
|
|
|
#shellcheck disable=SC2086
|
2023-01-09 21:34:59 +01:00
|
|
|
pacman -Sy ${_PACMAN_CONF} --noconfirm --noprogressbar ${_KEYRING} || exit 1
|
2010-01-17 22:38:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# package_installation
|
2023-01-09 08:20:54 +01:00
|
|
|
_install_packages() {
|
2022-03-19 08:44:48 +01:00
|
|
|
# add packages from archboot defaults
|
2023-01-08 08:48:05 +01:00
|
|
|
_PACKAGES=$(grep '^_PACKAGES' /etc/archboot/defaults | sed -e 's#_PACKAGES=##g' -e 's#"##g')
|
2022-03-19 08:44:48 +01:00
|
|
|
# fallback if _PACKAGES is empty
|
2023-01-08 08:48:05 +01:00
|
|
|
[[ -z "${_PACKAGES}" ]] && _PACKAGES="base linux linux-firmware"
|
2023-01-09 08:20:54 +01:00
|
|
|
_auto_packages
|
2022-01-26 11:40:22 +01:00
|
|
|
#shellcheck disable=SC2086
|
2023-01-09 08:31:45 +01:00
|
|
|
${_PACMAN} -S ${_PACKAGES}
|
2010-01-17 22:38:24 +01:00
|
|
|
}
|
2010-01-15 20:36:43 +01:00
|
|
|
|
2022-03-21 15:55:33 +01:00
|
|
|
# start script
|
2021-09-27 10:04:52 +02:00
|
|
|
if [[ -z "${1}" ]]; then
|
2023-01-09 08:20:54 +01:00
|
|
|
_usage
|
2008-10-20 22:39:25 +02:00
|
|
|
fi
|
|
|
|
|
2011-02-04 18:11:11 +01:00
|
|
|
! [[ -d /tmp ]] && mkdir /tmp
|
2008-10-20 22:39:25 +02:00
|
|
|
|
2023-01-08 08:48:05 +01:00
|
|
|
if [[ -e "${_LOCAL_DB}" ]]; then
|
2023-01-09 08:20:54 +01:00
|
|
|
_local_pacman_conf
|
2022-03-19 17:37:17 +01:00
|
|
|
else
|
2023-01-09 08:20:54 +01:00
|
|
|
_PACMAN_CONF=""
|
2022-03-19 17:37:17 +01:00
|
|
|
fi
|
|
|
|
|
2023-01-09 08:20:54 +01:00
|
|
|
if ! _prepare_pacman; then
|
2022-04-05 21:33:44 +02:00
|
|
|
echo -e "Pacman preparation \033[91mFAILED\033[0m."
|
2022-04-05 21:26:44 +02:00
|
|
|
exit 1
|
2022-04-05 21:01:07 +02:00
|
|
|
fi
|
2023-01-09 08:20:54 +01:00
|
|
|
_chroot_mount
|
|
|
|
if ! _install_packages; then
|
2022-04-05 21:33:44 +02:00
|
|
|
echo -e "Package installation \033[91mFAILED\033[0m."
|
2023-01-09 08:20:54 +01:00
|
|
|
_chroot_umount
|
2022-04-05 21:01:07 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
2023-01-09 08:20:54 +01:00
|
|
|
_locale_gen
|
|
|
|
_chroot_umount
|
2008-12-06 19:12:19 +01:00
|
|
|
|
2009-02-11 21:34:04 +01:00
|
|
|
echo
|
2022-04-05 21:01:07 +02:00
|
|
|
echo -e "\033[1mPackage installation complete.\033[0m"
|
2009-02-11 21:34:04 +01:00
|
|
|
echo
|
2022-04-05 21:01:07 +02:00
|
|
|
echo -e "Please install a \033[1mbootloader\033[0m. Edit the appropriate config file for"
|
2023-01-08 08:48:05 +01:00
|
|
|
echo -e "your loader. Please use \033[1m${_VMLINUZ}\033[0m as kernel image."
|
2022-04-05 21:01:07 +02:00
|
|
|
echo -e "Chroot into your system to install it:"
|
2023-01-08 08:48:05 +01:00
|
|
|
echo -e " \033[1m# mount -o bind /dev ${_DESTDIR}/dev\033[0m"
|
|
|
|
echo -e " \033[1m# mount -t proc none ${_DESTDIR}/proc\033[0m"
|
|
|
|
echo -e " \033[1m# mount -t sysfs none ${_DESTDIR}/sys\033[0m"
|
|
|
|
echo -e " \033[1m# chroot ${_DESTDIR} /bin/bash\033[0m"
|
2009-02-11 21:34:04 +01:00
|
|
|
echo
|
2008-10-20 22:39:25 +02:00
|
|
|
echo "Next step, initramfs setup:"
|
2022-04-05 21:01:07 +02:00
|
|
|
echo -e "Edit your \033[1m/etc/mkinitcpio.conf\033[0m to fit your needs. After that run:"
|
2023-01-08 08:48:05 +01:00
|
|
|
echo -e " \033[1m# mkinitcpio -p ${_KERNELPKG}\033[0m"
|
2009-02-11 21:34:04 +01:00
|
|
|
echo
|
2023-01-08 08:48:05 +01:00
|
|
|
echo -e "Then \033[1mexit\033[0m your chroot shell, edit \033[1m${_DESTDIR}/etc/fstab\033[0m and \033[1mreboot\033[0m! "
|
2008-10-20 22:39:25 +02:00
|
|
|
exit 0
|
2009-02-11 21:34:04 +01:00
|
|
|
|
2012-02-06 14:44:34 +01:00
|
|
|
# vim: set ts=4 sw=4 et:
|