WIP: initial changes to use pacstrap or not.
This commit is contained in:
parent
26eaf5d858
commit
0cd7302167
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
# shellcheck disable=SC2086,SC2046
|
# shellcheck disable=SC2086,SC2046
|
||||||
|
|
||||||
VER=2.1.26
|
VER=2.1.27
|
||||||
|
|
||||||
# default values {
|
# default values {
|
||||||
|
|
||||||
@ -17,6 +17,7 @@ ANS=/tmp/ans # dialog answer output file
|
|||||||
FONT=ter-i16n # font used for the linux console
|
FONT=ter-i16n # font used for the linux console
|
||||||
HOOKS=shutdown # additional mkinitcpio HOOKS
|
HOOKS=shutdown # additional mkinitcpio HOOKS
|
||||||
SEL=0 # currently selected menu item
|
SEL=0 # currently selected menu item
|
||||||
|
PACSTRAP=1 # use a fresh pacstrap or copy the iso filesystem
|
||||||
SYS=Unknown # bios type, to be determined: UEFI/BIOS
|
SYS=Unknown # bios type, to be determined: UEFI/BIOS
|
||||||
BG=/tmp/bgout # output from background process
|
BG=/tmp/bgout # output from background process
|
||||||
ERR=/tmp/errlog # stderr log used internally by errshow()
|
ERR=/tmp/errlog # stderr log used internally by errshow()
|
||||||
@ -136,6 +137,7 @@ _format="is already formatted correctly.\n\nFor a clean install, previously exis
|
|||||||
_swapsize="\nEnter the size of the swapfile in megabytes (M) or gigabytes (G).\n\neg. 100M will create a 100 megabyte swapfile, while 10G will create a 10 gigabyte swapfile.\n\nFor ease of use and as an example it is filled in to match the size of your system memory (RAM).\n\nMust be greater than 1, contain only whole numbers, and end with either M or G."
|
_swapsize="\nEnter the size of the swapfile in megabytes (M) or gigabytes (G).\n\neg. 100M will create a 100 megabyte swapfile, while 10G will create a 10 gigabyte swapfile.\n\nFor ease of use and as an example it is filled in to match the size of your system memory (RAM).\n\nMust be greater than 1, contain only whole numbers, and end with either M or G."
|
||||||
_expart="\nYou can now choose any additional partitions you want mounted, you'll be asked for a mountpoint after.\n\nSelect 'done' to finish the mounting step and begin unpacking the base system in the background."
|
_expart="\nYou can now choose any additional partitions you want mounted, you'll be asked for a mountpoint after.\n\nSelect 'done' to finish the mounting step and begin unpacking the base system in the background."
|
||||||
_exmnt="\nWhere do you want the partition mounted?\n\nEnsure the name begins with a slash (/).\nExamples include: /usr, /home, /var, etc."
|
_exmnt="\nWhere do you want the partition mounted?\n\nEnsure the name begins with a slash (/).\nExamples include: /usr, /home, /var, etc."
|
||||||
|
_bginstall="\nA background install portion will now begin, select what kind of base install to use\n\npacstrap - guarantees the latest packages and avoids conflicts but is much slower and network dependant\n\ncopy iso - much faster and not network dependant but can have issues\n"
|
||||||
_user="\nEnter a name and password for the new user account.\n\nThe name must not use capital letters, contain any periods (.), end with a hyphen (-), or include any colons (:)\n\nNOTE: Use [Up], [Down], or [Tab] to switch between fields, and [Enter] to accept."
|
_user="\nEnter a name and password for the new user account.\n\nThe name must not use capital letters, contain any periods (.), end with a hyphen (-), or include any colons (:)\n\nNOTE: Use [Up], [Down], or [Tab] to switch between fields, and [Enter] to accept."
|
||||||
_hostname="\nEnter a hostname for the new system.\n\nA hostname is used to identify systems on the network.\n\nIt's restricted to alphanumeric characters (a-z, A-Z, 0-9).\nIt can contain hyphens (-) BUT NOT at the beginning or end."
|
_hostname="\nEnter a hostname for the new system.\n\nA hostname is used to identify systems on the network.\n\nIt's restricted to alphanumeric characters (a-z, A-Z, 0-9).\nIt can contain hyphens (-) BUT NOT at the beginning or end."
|
||||||
_locale="\nLocale determines the system language and currency formats.\n\nThe format for locale names is languagecode_COUNTRYCODE\n\neg. en_US is: English United States\n en_GB is: English Great Britain"
|
_locale="\nLocale determines the system language and currency formats.\n\nThe format for locale names is languagecode_COUNTRYCODE\n\neg. en_US is: English United States\n en_GB is: English Great Britain"
|
||||||
@ -1240,10 +1242,22 @@ install_base()
|
|||||||
unset BG_PID
|
unset BG_PID
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $PACSTRAP == 1 ]]; then
|
||||||
|
# we have some customizations in /etc on the iso we want to preserve
|
||||||
|
if [[ $DIST == "ArchLabs" ]]; then
|
||||||
|
cp -aTvf /etc/skel/ "$MNT/etc/"
|
||||||
|
rm -rf "$MNT/etc/mkinitcpio-archiso.conf"
|
||||||
|
fi
|
||||||
|
else
|
||||||
# archiso files
|
# archiso files
|
||||||
rm -rf "$MNT/etc/mkinitcpio-archiso.conf"
|
rm -rf "$MNT/etc/mkinitcpio-archiso.conf"
|
||||||
find "$MNT/usr/lib/initcpio" -name 'archiso*' -type f -delete
|
find "$MNT/usr/lib/initcpio" -name 'archiso*' -type f -delete
|
||||||
|
|
||||||
|
# vmlinuz, if this isn't copied the standard kernel may fail mkinitcpio
|
||||||
|
cp -vf "$RUN/x86_64/vmlinuz" "$MNT/boot/vmlinuz-linux" 2> "$ERR"
|
||||||
|
errshow 1 "cp -vf '$RUN/x86_64/vmlinuz' '$MNT/boot/vmlinuz-linux'"
|
||||||
|
fi
|
||||||
|
|
||||||
# remove/disable customizations done to airootfs during building
|
# remove/disable customizations done to airootfs during building
|
||||||
chrun "systemctl disable pacman-init.service choose-mirror.service" > /dev/null 2>&1
|
chrun "systemctl disable pacman-init.service choose-mirror.service" > /dev/null 2>&1
|
||||||
rm -f "$MNT/etc/systemd/scripts/choose-mirror"
|
rm -f "$MNT/etc/systemd/scripts/choose-mirror"
|
||||||
@ -1257,22 +1271,19 @@ install_base()
|
|||||||
# changing distro name?
|
# changing distro name?
|
||||||
[[ $DIST != "ArchLabs" ]] || sed -i "s/ArchLabs/$DIST/g" "$MNT/etc/"{lsb-release,os-release}
|
[[ $DIST != "ArchLabs" ]] || sed -i "s/ArchLabs/$DIST/g" "$MNT/etc/"{lsb-release,os-release}
|
||||||
|
|
||||||
# vmlinuz, if this isn't copied the standard kernel may fail mkinitcpio
|
|
||||||
cp -vf "$RUN/x86_64/vmlinuz" "$MNT/boot/vmlinuz-linux" 2> "$ERR"
|
|
||||||
errshow 1 "cp -vf '$RUN/x86_64/vmlinuz' '$MNT/boot/vmlinuz-linux'"
|
|
||||||
|
|
||||||
# copy network settings
|
# copy network settings
|
||||||
[[ -d /etc/netctl ]] && cp -rfv /etc/netctl "$MNT/etc/"
|
[[ -d /etc/netctl ]] && cp -rfv /etc/netctl "$MNT/etc/"
|
||||||
[[ -f /etc/resolv.conf ]] && cp -fv /etc/resolv.conf "$MNT/etc/"
|
[[ -f /etc/resolv.conf ]] && cp -fv /etc/resolv.conf "$MNT/etc/"
|
||||||
[[ -e /etc/NetworkManager/system-connections ]] && cp -rvf /etc/NetworkManager/system-connections "$MNT/etc/NetworkManager/"
|
[[ -e /etc/NetworkManager/system-connections ]] && cp -rvf /etc/NetworkManager/system-connections "$MNT/etc/NetworkManager/"
|
||||||
|
|
||||||
|
mkdir -pv "$MNT/etc/default"
|
||||||
echo "LANG=$LOCALE" > "$MNT/etc/locale.conf"
|
echo "LANG=$LOCALE" > "$MNT/etc/locale.conf"
|
||||||
cp -fv "$MNT/etc/locale.conf" "$MNT/etc/default/locale"
|
cp -fv "$MNT/etc/locale.conf" "$MNT/etc/default/locale"
|
||||||
sed -i "s/#en_US.UTF-8/en_US.UTF-8/g; s/#${LOCALE}/${LOCALE}/g" "$MNT/etc/locale.gen"
|
sed -i "s/#en_US.UTF-8/en_US.UTF-8/g; s/#${LOCALE}/${LOCALE}/g" "$MNT/etc/locale.gen"
|
||||||
chrun "locale-gen"
|
chrun "locale-gen"
|
||||||
chrun "ln -svf /usr/share/zoneinfo/$ZONE/$SUBZ /etc/localtime"
|
chrun "ln -svf /usr/share/zoneinfo/$ZONE/$SUBZ /etc/localtime"
|
||||||
|
|
||||||
mkdir -pv "$MNT/etc/X11/xorg.conf.d" "$MNT/etc/default"
|
mkdir -pv "$MNT/etc/X11/xorg.conf.d"
|
||||||
cat > "$MNT/etc/X11/xorg.conf.d/00-keyboard.conf" <<- EOF
|
cat > "$MNT/etc/X11/xorg.conf.d/00-keyboard.conf" <<- EOF
|
||||||
# Use localectl(1) to instruct systemd-localed to update it.
|
# Use localectl(1) to instruct systemd-localed to update it.
|
||||||
Section "InputClass"
|
Section "InputClass"
|
||||||
@ -1446,16 +1457,21 @@ install_packages()
|
|||||||
local rmpkg=""
|
local rmpkg=""
|
||||||
local inpkg="$PACKAGES $USER_PKGS $AL_BASE_PKGS "
|
local inpkg="$PACKAGES $USER_PKGS $AL_BASE_PKGS "
|
||||||
|
|
||||||
pacman -Qq archlabs-installer > /dev/null 2>&1 && rmpkg+="archlabs-installer "
|
|
||||||
|
|
||||||
[[ $NEWSHELL == 'zsh' ]] && inpkg+="zsh-completions "
|
if [[ $NEWSHELL == 'zsh' ]]; then
|
||||||
|
inpkg+="zsh-completions "
|
||||||
|
elif [[ $PACSTRAP != 1 ]]; then
|
||||||
|
rmpkg+="archlabs-installer zsh "
|
||||||
|
fi
|
||||||
|
|
||||||
[[ $INSTALL_WMS =~ ($WM_PKG_SES) ]] && inpkg+="$WM_BASE_PKGS "
|
[[ $INSTALL_WMS =~ ($WM_PKG_SES) ]] && inpkg+="$WM_BASE_PKGS "
|
||||||
|
|
||||||
# update and install crucial packages first to avoid issues
|
# update and install crucial packages first to avoid issues
|
||||||
chrun "pacman -Syyu --noconfirm" 2> "$ERR" 2>&1
|
chrun "pacman -Syyu --noconfirm" 2> "$ERR" 2>&1
|
||||||
chrun "pacman -S ${LOGIN_PKGS[$LOGIN_TYPE]} $NEWSHELL $UCODE $KERNEL --noconfirm --needed" 2> "$ERR" 2>&1
|
chrun "pacman -S ${LOGIN_PKGS[$LOGIN_TYPE]} $NEWSHELL --noconfirm --needed" 2> "$ERR" 2>&1
|
||||||
errshow 1 "chrun 'pacman -S ${LOGIN_PKGS[$LOGIN_TYPE]} $NEWSHELL $UCODE $KERNEL --noconfirm --needed'"
|
errshow 1 "chrun 'pacman -S ${LOGIN_PKGS[$LOGIN_TYPE]} $NEWSHELL --noconfirm --needed'"
|
||||||
|
# reinstalling iputils fixes the network issue for non-root users
|
||||||
|
chrun "pacman -S iputils $UCODE $KERNEL --noconfirm"
|
||||||
|
|
||||||
# remove the packages we don't want on the installed system
|
# remove the packages we don't want on the installed system
|
||||||
[[ $rmpkg ]] && chrun "pacman -Rnsc $rmpkg --noconfirm"
|
[[ $rmpkg ]] && chrun "pacman -Rnsc $rmpkg --noconfirm"
|
||||||
@ -1595,8 +1611,10 @@ install_tearfree()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $PACSTRAP != 1 ]]; then
|
||||||
# remove nvidia installer from installed system
|
# remove nvidia installer from installed system
|
||||||
[[ $xpath == *"$MNT"* ]] && rm -rf "$MNT/usr/bin/nvidia-installer" "$MNT/var/lib/nvidia-installer"
|
[[ $xpath == *"$MNT"* ]] && rm -rf "$MNT/usr/bin/nvidia-installer" "$MNT/var/lib/nvidia-installer"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_mkinitcpio()
|
install_mkinitcpio()
|
||||||
@ -1639,12 +1657,24 @@ install_mirrorlist()
|
|||||||
|
|
||||||
install_background()
|
install_background()
|
||||||
{
|
{
|
||||||
|
if yesno "Base Install" "$_bginstall" "Pacstrap" "Copy iso"; then
|
||||||
|
PACSTRAP=1
|
||||||
(
|
(
|
||||||
install_mirrorlist "/etc/pacman.d/mirrorlist" > /tmp/bgout 2>&1 &&
|
install_mirrorlist "/etc/pacman.d/mirrorlist" > /tmp/bgout 2>&1 &&
|
||||||
pacstrap /mnt $BASE_PKGS > /tmp/bgout 2>&1 &&
|
pacstrap /mnt $BASE_PKGS > /tmp/bgout 2>&1 &&
|
||||||
al_repo "$MNT/etc/pacman.conf"
|
al_repo "$MNT/etc/pacman.conf"
|
||||||
) &
|
) &
|
||||||
BG_PID=$!
|
BG_PID=$!
|
||||||
|
else
|
||||||
|
PACSTRAP=0
|
||||||
|
(
|
||||||
|
rsync -a /run/archiso/sfs/airootfs/ "$MNT/" &&
|
||||||
|
install_mirrorlist "$MNT/etc/pacman.d/mirrorlist" > /tmp/bgout 2>&1 &&
|
||||||
|
al_repo "$MNT/etc/pacman.conf" &&
|
||||||
|
chrun "pacman -Sy && pacman -Syyu $BASE_PKGS --noconfirm --needed" > /tmp/bgout 2>&1
|
||||||
|
) &
|
||||||
|
BG_PID=$!
|
||||||
|
fi
|
||||||
# shellcheck disable=SC2064
|
# shellcheck disable=SC2064
|
||||||
trap "kill $BG_PID 2> /dev/null" EXIT
|
trap "kill $BG_PID 2> /dev/null" EXIT
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user