2022-12-14 07:06:55 +01:00
|
|
|
#!/usr/bin/env bash
|
2023-08-11 17:19:18 +02:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2023-01-09 18:38:55 +01:00
|
|
|
# created by Tobias Powalowski <tpowa@archlinux.org>
|
2023-09-06 09:03:43 +02:00
|
|
|
. /usr/lib/archboot/common.sh
|
2022-04-05 21:44:16 +02:00
|
|
|
. /usr/lib/archboot/installer/common.sh
|
2023-02-07 22:22:19 +01:00
|
|
|
_DESTDIR="${1}"
|
2022-04-05 21:44:16 +02:00
|
|
|
|
2023-01-09 08:20:54 +01:00
|
|
|
_usage() {
|
2024-08-01 10:30:36 +02:00
|
|
|
echo -e "\e[1m\e[36mArchboot\e[m \e[1m- Quickinst Installer\e[m"
|
|
|
|
echo -e "\e[1m------------------------------\e[m"
|
2024-08-01 07:54:05 +02:00
|
|
|
echo -e "Usage: \e[1mquickinst <destdir>\e[m"
|
2022-04-05 09:50:59 +02:00
|
|
|
echo ""
|
2024-08-01 07:54:05 +02:00
|
|
|
echo "This script is for users, who would rather partition/mkfs/mount"
|
|
|
|
echo "their target media manually, than go through the routines in"
|
|
|
|
echo "the setup script."
|
2009-02-11 21:34:04 +01:00
|
|
|
echo
|
2023-01-08 08:48:05 +01:00
|
|
|
if ! [[ -e "${_LOCAL_DB}" ]]; then
|
2024-08-01 07:54:05 +02:00
|
|
|
echo -e "Configure repositories: \e[1m/etc/pacman.conf\e[m"
|
|
|
|
echo -e "Configure mirror: \e[1m/etc/pacman.d/mirrorlist\e[m"
|
2022-03-19 17:37:17 +01:00
|
|
|
fi
|
2024-08-01 07:54:05 +02:00
|
|
|
echo -e "Configure packages to install: \e[1m/etc/archboot/defaults\e[m"
|
|
|
|
echo -e "Mount all your filesystems: \e[1m<destdir>\e[m."
|
|
|
|
echo -e "Run: \e[1mquickinst <destdir>\e[m"
|
2009-02-11 21:34:04 +01:00
|
|
|
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-09-06 11:44:56 +02:00
|
|
|
if [[ ! -d "${_DESTDIR}${_CACHEDIR}" ]]; then
|
|
|
|
mkdir -p "${_DESTDIR}${_CACHEDIR}"
|
2022-04-05 21:33:44 +02:00
|
|
|
fi
|
2023-09-06 11:44:56 +02:00
|
|
|
if [[ ! -d "${_DESTDIR}${_PACMAN_LIB}" ]]; then
|
|
|
|
mkdir -p "${_DESTDIR}${_PACMAN_LIB}"
|
2022-04-05 21:33:44 +02:00
|
|
|
fi
|
2024-06-11 12:31:10 +02:00
|
|
|
_pacman_keyring
|
2023-01-09 08:31:45 +01:00
|
|
|
${_PACMAN} -Sy
|
2023-01-08 08:48:05 +01:00
|
|
|
_KEYRING="archlinux-keyring"
|
2023-10-10 08:23:44 +02:00
|
|
|
[[ "${_RUNNING_ARCH}" == "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
|
2024-06-26 21:52:49 +02:00
|
|
|
_PACKAGES="$(rg -o '^_PACKAGES="(.*)"' -r '$1' /etc/archboot/defaults)"
|
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
|
2023-02-07 20:19:31 +01:00
|
|
|
echo -e "Pacman preparation \e[91mFAILED\e[m."
|
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
|
2023-02-07 20:19:31 +01:00
|
|
|
echo -e "Package installation \e[91mFAILED\e[m."
|
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
|
2023-02-07 20:19:31 +01:00
|
|
|
echo -e "\e[1mPackage installation complete.\e[m"
|
2009-02-11 21:34:04 +01:00
|
|
|
echo
|
2023-02-07 20:19:31 +01:00
|
|
|
echo -e "Please install a \e[1mbootloader\e[m. Edit the appropriate config file for"
|
|
|
|
echo -e "your loader. Please use \e[1m${_VMLINUZ}\e[m as kernel image."
|
2022-04-05 21:01:07 +02:00
|
|
|
echo -e "Chroot into your system to install it:"
|
2023-02-07 20:19:31 +01:00
|
|
|
echo -e " \e[1m# mount -o bind /dev ${_DESTDIR}/dev\e[m"
|
|
|
|
echo -e " \e[1m# mount -t proc none ${_DESTDIR}/proc\e[m"
|
|
|
|
echo -e " \e[1m# mount -t sysfs none ${_DESTDIR}/sys\e[m"
|
|
|
|
echo -e " \e[1m# chroot ${_DESTDIR} /bin/bash\e[m"
|
2009-02-11 21:34:04 +01:00
|
|
|
echo
|
2008-10-20 22:39:25 +02:00
|
|
|
echo "Next step, initramfs setup:"
|
2023-02-07 20:19:31 +01:00
|
|
|
echo -e "Edit your \e[1m/etc/mkinitcpio.conf\e[m to fit your needs. After that run:"
|
|
|
|
echo -e " \e[1m# mkinitcpio -p ${_KERNELPKG}\e[m"
|
2009-02-11 21:34:04 +01:00
|
|
|
echo
|
2023-02-07 20:19:31 +01:00
|
|
|
echo -e "Then \e[1mexit\e[m your chroot shell, edit \e[1m${_DESTDIR}/etc/fstab\e[m and \e[1mreboot\e[m! "
|
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:
|