archboot/usr/bin/archboot-quickinst.sh

86 lines
2.5 KiB
Bash
Raw Normal View History

#!/bin/bash
source /usr/lib/archboot/installer_common_functions
2021-09-27 10:02:51 +02:00
DESTDIR="${1}"
2008-10-20 22:39:25 +02:00
usage() {
echo "quickinst <destdir>"
2009-02-11 21:34:04 +01:00
echo
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
if ! [[ -e "${LOCAL_DB}" ]]; then
echo "First configure /etc/pacman.conf which repositories to use"
echo "and set a mirror in /etc/pacman.d/mirrorlist"
fi
echo
echo "Make sure you have all your filesystems mounted under <destdir>."
echo "Then run this script to install all packages listed in /etc/archboot/defaults"
echo "to <destdir>."
2009-02-11 21:34:04 +01:00
echo
echo "Example:"
echo " quickinst /mnt"
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
# params: none
# returns: 1 on error
prepare_pacman() {
# Set up the necessary directories for pacman use
2022-01-21 14:16:33 +01:00
[[ ! -d "${DESTDIR}/var/cache/pacman/pkg" ]] && mkdir -p "${DESTDIR}/var/cache/pacman/pkg"
[[ ! -d "${DESTDIR}/var/lib/pacman" ]] && mkdir -p "${DESTDIR}/var/lib/pacman"
2011-02-04 18:08:56 +01:00
${PACMAN} -Sy
}
# package_installation
2010-02-22 07:40:53 +01:00
install_packages() {
# add packages from archboot defaults
PACKAGES=$(grep '^_PACKAGES' /etc/archboot/defaults | sed -e 's#_PACKAGES=##g' -e 's#"##g')
# fallback if _PACKAGES is empty
[[ -z "${PACKAGES}" ]] && PACKAGES="base linux linux-firmware"
auto_packages
2022-01-26 11:40:22 +01:00
#shellcheck disable=SC2086
2022-01-22 21:13:58 +01:00
${PACMAN} -S ${PACKAGES}
}
2010-01-15 20:36:43 +01:00
# start script
2021-09-27 10:04:52 +02:00
if [[ -z "${1}" ]]; then
2009-02-11 21:34:04 +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
if [[ -e "${LOCAL_DB}" ]]; then
local_pacman_conf
else
PACMAN_CONF=""
fi
2022-01-21 14:16:33 +01:00
prepare_pacman || (echo "Pacman preparation FAILED!"; return 1)
chroot_mount
2022-01-21 14:16:33 +01:00
install_packages || (echo "Package installation FAILED."; chroot_umount; exit 1)
locale_gen
chroot_umount
2008-12-06 19:12:19 +01:00
2009-02-11 21:34:04 +01:00
echo
2008-10-20 22:39:25 +02:00
echo "Package installation complete."
2009-02-11 21:34:04 +01:00
echo
2008-10-20 22:39:25 +02:00
echo "Please install a bootloader. Edit the appropriate config file for"
2011-02-04 18:08:56 +01:00
echo "your loader. Please use ${VMLINUZ} as kernel image."
echo "Chroot into your system to install it into the boot sector:"
2011-02-04 18:08:56 +01:00
echo " # mount -o bind /dev ${DESTDIR}/dev"
echo " # mount -t proc none ${DESTDIR}/proc"
echo " # mount -t sysfs none ${DESTDIR}/sys"
echo " # chroot ${DESTDIR} /bin/bash"
2009-02-11 21:34:04 +01:00
echo
2008-10-20 22:39:25 +02:00
echo "Next step, initramfs setup:"
2022-03-21 14:51:24 +01:00
echo "Edit your /etc/mkinitcpio.conf to fit your needs. After that run:"
2011-02-04 18:08:56 +01:00
echo "# mkinitcpio -p ${KERNELPKG}"
2009-02-11 21:34:04 +01:00
echo
2013-01-21 16:33:16 +01:00
echo "Then exit your chroot shell, edit ${DESTDIR}/etc/fstab and reboot!"
2009-02-11 21:34:04 +01:00
echo
2008-10-20 22:39:25 +02:00
exit 0
2009-02-11 21:34:04 +01:00
# vim: set ts=4 sw=4 et: