move most automagic to package installation end

This commit is contained in:
Tobias Powalowski 2022-11-26 11:24:02 +01:00
parent b14b626118
commit 7fcfd6f230
3 changed files with 21 additions and 14 deletions

View file

@ -98,10 +98,6 @@ prepare_storagedrive() {
configure_system() { configure_system() {
destdir_mounts || return 1 destdir_mounts || return 1
## PREPROCESSING ## ## PREPROCESSING ##
auto_pacman_mirror
auto_network
auto_parameters
auto_system_files
auto_mkinitcpio auto_mkinitcpio
## END PREPROCESS ## ## END PREPROCESS ##
geteditor || return 1 geteditor || return 1
@ -147,8 +143,6 @@ configure_system() {
if [[ ${S_CONFIG} -eq 1 ]]; then if [[ ${S_CONFIG} -eq 1 ]]; then
# only done on normal exit of configure menu # only done on normal exit of configure menu
## POSTPROCESSING ## ## POSTPROCESSING ##
# adjust time
auto_timesetting
# /etc/initcpio.conf # /etc/initcpio.conf
run_mkinitcpio run_mkinitcpio
DIALOG --infobox "Rebuilding glibc locales ..." 3 40 DIALOG --infobox "Rebuilding glibc locales ..." 3 40

View file

@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
# created by Tobias Powalowski <tpowa@archlinux.org> # created by Tobias Powalowski <tpowa@archlinux.org>
# auto_fstab() # auto_fstab()
# preprocess fstab file # preprocess fstab file
# comments out old fields and inserts new ones # comments out old fields and inserts new ones
# according to partitioning/formatting stage # according to partitioning/formatting stage
#
auto_fstab(){ auto_fstab(){
# Modify fstab # Modify fstab
if [[ "${S_MKFS}" = "1" || "${S_MKFSAUTO}" = "1" ]]; then if [[ "${S_MKFS}" = "1" || "${S_MKFSAUTO}" = "1" ]]; then
@ -21,15 +21,17 @@ auto_fstab(){
fi fi
} }
# auto_ssd()
# add udev rule for schedulers by default # add udev rule for schedulers by default
# add sysctl file for swaps auto_scheduler () {
auto_ssd () {
if [[ ! -f ${DESTDIR}/etc/udev/rules.d/70-ioschedulers.rules ]]; then if [[ ! -f ${DESTDIR}/etc/udev/rules.d/70-ioschedulers.rules ]]; then
DIALOG --infobox "Enable performance ioscheduler settings on installed system ..." 3 70 DIALOG --infobox "Enable performance ioscheduler settings on installed system ..." 3 70
cp /etc/udev/rules.d/60-ioschedulers.rules "${DESTDIR}"/etc/udev/rules.d/60-ioschedulers.rules cp /etc/udev/rules.d/60-ioschedulers.rules "${DESTDIR}"/etc/udev/rules.d/60-ioschedulers.rules
sleep 1 sleep 1
fi fi
}
# add sysctl file for swaps
auto_swap () {
if [[ ! -f ${DESTDIR}/etc/sysctl.d/99-sysctl.conf ]]; then if [[ ! -f ${DESTDIR}/etc/sysctl.d/99-sysctl.conf ]]; then
DIALOG --infobox "Enable sysctl swap settings on installed system ..." 3 70 DIALOG --infobox "Enable sysctl swap settings on installed system ..." 3 70
cp /etc/sysctl.d/99-sysctl.conf "${DESTDIR}"/etc/sysctl.d/99-sysctl.conf cp /etc/sysctl.d/99-sysctl.conf "${DESTDIR}"/etc/sysctl.d/99-sysctl.conf
@ -60,7 +62,7 @@ auto_network()
if [[ ${S_NET} -eq 0 ]]; then if [[ ${S_NET} -eq 0 ]]; then
return 1 return 1
fi fi
DIALOG --infobox "Enable netctl network and proxy settings to installed system ..." 3 70 DIALOG --infobox "Enable netctl network and proxy settings on installed system ..." 3 70
# copy netctl profiles # copy netctl profiles
[[ -d ${DESTDIR}/etc/netctl ]] && cp /etc/netctl/* "${DESTDIR}"/etc/netctl/ 2>/dev/null [[ -d ${DESTDIR}/etc/netctl ]] && cp /etc/netctl/* "${DESTDIR}"/etc/netctl/ 2>/dev/null
# enable netctl profiles # enable netctl profiles
@ -152,7 +154,7 @@ auto_mkinitcpio() {
sleep 1 sleep 1
} }
auto_parameters() { auto_vconsole() {
if [[ ! -f ${DESTDIR}/etc/vconsole.conf ]]; then if [[ ! -f ${DESTDIR}/etc/vconsole.conf ]]; then
DIALOG --infobox "Setting keymap and font on installed system ..." 3 70 DIALOG --infobox "Setting keymap and font on installed system ..." 3 70
: >"${DESTDIR}"/etc/vconsole.conf : >"${DESTDIR}"/etc/vconsole.conf
@ -206,12 +208,15 @@ auto_pacman_mirror() {
fi fi
} }
auto_system_files() { auto_hostname() {
if [[ ! -f ${DESTDIR}/etc/hostname ]]; then if [[ ! -f ${DESTDIR}/etc/hostname ]]; then
DIALOG --infobox "Set default hostname on installed system ..." 3 70 DIALOG --infobox "Set default hostname on installed system ..." 3 70
echo "myhostname" > "${DESTDIR}"/etc/hostname echo "myhostname" > "${DESTDIR}"/etc/hostname
sleep 1 sleep 1
fi fi
}
auto_locale() {
if [[ ! -f ${DESTDIR}/etc/locale.conf ]]; then if [[ ! -f ${DESTDIR}/etc/locale.conf ]]; then
DIALOG --infobox "Set default locale on installed system ..." 3 70 DIALOG --infobox "Set default locale on installed system ..." 3 70
echo "LANG=C.UTF-8" > "${DESTDIR}"/etc/locale.conf echo "LANG=C.UTF-8" > "${DESTDIR}"/etc/locale.conf

View file

@ -175,12 +175,20 @@ install_packages() {
# automagic time! # automagic time!
# any automatic configuration should go here # any automatic configuration should go here
DIALOG --infobox "Writing base configuration..." 6 40 DIALOG --infobox "Writing base configuration..." 6 40
auto_timesetting
auto_network
auto_fstab auto_fstab
auto_ssd auto_scheduler
auto_swap
auto_mdadm auto_mdadm
auto_luks auto_luks
auto_pacman auto_pacman
auto_testing auto_testing
auto_pacman_mirror
auto_vconsole
auto_hostname
auto_locale
auto_mkinitcpio
# tear down the chroot environment # tear down the chroot environment
chroot_umount chroot_umount
} }