You've already forked al-installer
Fix format asking permission and other small issues
This commit is contained in:
@ -9,25 +9,25 @@
|
||||
select_boot_setup() {
|
||||
# choose bootloader and by extension mountpoint (if needed)
|
||||
tput civis
|
||||
BOOTLOADER="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||
--title " $_PrepMount " --menu "$_MntBootBody" 0 0 0 ${BOOTLOADERS[$SYS]})"
|
||||
[[ $? != 0 || $BOOTLOADER == "" ]] && return 1
|
||||
BOOTLDR="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||
--title " $_PrepMount " --menu "$_MntBootBody" 0 0 0 ${BOOTLDRS[$SYS]})"
|
||||
[[ $? != 0 || $BOOTLDR == "" ]] && return 1
|
||||
|
||||
if [[ $SYS == 'BIOS' && $BOOTLOADER == 'grub' && $BOOT_DEVICE == "" ]]; then
|
||||
if [[ $SYS == 'BIOS' && $BOOTLDR == 'grub' && $BOOT_DEVICE == "" ]]; then
|
||||
# grub on BIOS needs an install device, NOT partition eg. /dev/sda
|
||||
select_device 'boot' || return 1
|
||||
fi
|
||||
|
||||
if [[ $BOOTLOADER == 'systemd-boot' ]]; then
|
||||
EDIT_FILES[9]="/boot/loader/entries/$DIST.conf"
|
||||
elif [[ $BOOTLOADER == 'syslinux' && $SYS == 'BIOS' ]]; then
|
||||
BOOT_CMDS[$BOOTLOADER]="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||
if [[ $BOOTLDR == 'systemd-boot' ]]; then
|
||||
FILES[9]="/boot/loader/entries/$DIST.conf"
|
||||
elif [[ $BOOTLDR == 'syslinux' && $SYS == 'BIOS' ]]; then
|
||||
BCMDS[$BOOTLDR]="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||
--title " $_InstSysTitle " --menu "$_InstSysBody" 0 0 0 \
|
||||
"syslinux-install_update -iam" "Install to MBR (Master Boot Record)" \
|
||||
"syslinux-install_update -i" "Install to root partition (/)")"
|
||||
[[ $? != 0 || ${BOOT_CMDS[$BOOTLOADER]} == "" ]] && return 1
|
||||
[[ $? != 0 || ${BCMDS[$BOOTLDR]} == "" ]] && return 1
|
||||
else
|
||||
EDIT_FILES[9]="/etc/default/grub"
|
||||
FILES[9]="/etc/default/grub"
|
||||
fi
|
||||
|
||||
return 0
|
||||
@ -38,7 +38,7 @@ shim_secure_boot() {
|
||||
|
||||
local shim_file="shim64.efi"
|
||||
[[ $IS_64BIT != true ]] && shim_file="shim.efi"
|
||||
efibootmgr -c -w -L $DIST -d $BOOT_DEVICE -p $BOOT_PART_NUM -l ${MNT}${BOOT_MNTS[$SYS-$BOOTLOADER]}/$shim_file
|
||||
efibootmgr -c -w -L $DIST -d $BOOT_DEVICE -p $BOOT_PART_NUM -l ${MNT}${BMNTS[$SYS-$BOOTLDR]}/$shim_file
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ uefi_boot_fallback() {
|
||||
# copy the bootloaders efi stub to that directory as bootx64.efi
|
||||
|
||||
local default="boot"
|
||||
local esp="${MNT}${BOOT_MNTS[$SYS-$BOOTLOADER]}"
|
||||
local esp="${MNT}${BMNTS[$SYS-$BOOTLDR]}"
|
||||
for i in $(find "$esp/EFI/" -maxdepth 1 -mindepth 1 -type d 2>/dev/null); do
|
||||
grep -qi "boot" <<< "$(basename $i)" && { default="$(basename $i)"; break; }
|
||||
done
|
||||
@ -75,27 +75,27 @@ uefi_boot_fallback() {
|
||||
}
|
||||
|
||||
prep_for_grub() {
|
||||
local ttype
|
||||
local cfg="$MNT/etc/default/grub"
|
||||
|
||||
if [[ $SYS == 'UEFI' ]]; then
|
||||
local gtype='x86_64-efi'
|
||||
[[ $IS_64BIT != true ]] && gtype='i386-efi'
|
||||
BOOT_CMDS[grub]="${BOOT_CMDS[grub]} --target=$gtype --bootloader-id=$DIST"
|
||||
[[ $IS_64BIT != true ]] && ttype='i386-efi' || ttype='x86_64-efi'
|
||||
BCMDS[grub]="${BCMDS[grub]} --target=$ttype --bootloader-id=$DIST"
|
||||
else
|
||||
BOOT_CMDS[grub]="${BOOT_CMDS[grub]} --target=i386-pc $BOOT_DEVICE"
|
||||
BCMDS[grub]="${BCMDS[grub]} --target=i386-pc $BOOT_DEVICE"
|
||||
fi
|
||||
|
||||
BOOT_CMDS[grub]="${BOOT_CMDS[grub]} && grub-mkconfig -o /boot/grub/grub.cfg"
|
||||
BCMDS[grub]="${BCMDS[grub]} && grub-mkconfig -o /boot/grub/grub.cfg"
|
||||
|
||||
sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g;
|
||||
s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" $cfg
|
||||
|
||||
if (( LUKS == 1 )); then
|
||||
if [[ $LUKS -eq 1 ]]; then
|
||||
sed -i "s~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g;
|
||||
s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g" $cfg
|
||||
fi
|
||||
|
||||
if [[ $SYS != 'UEFI' && $LVM -eq 1 && $SEPERATE_BOOT -eq 0 ]]; then
|
||||
if [[ $SYS == 'BIOS' && $LVM -eq 1 && $SEPERATE_BOOT == false ]]; then
|
||||
sed -i "s/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g" $cfg
|
||||
fi
|
||||
|
||||
@ -138,11 +138,11 @@ EOF
|
||||
prep_for_syslinux() {
|
||||
local cfgdir="$MNT/boot/syslinux"
|
||||
local cfgsrcdir="/usr/lib/syslinux/bios/"
|
||||
EDIT_FILES[9]="/boot/syslinux/syslinux.cfg"
|
||||
FILES[9]="/boot/syslinux/syslinux.cfg"
|
||||
|
||||
if [[ $SYS == 'UEFI' ]]; then
|
||||
EDIT_FILES[9]="/boot/EFI/syslinux/syslinux.cfg"
|
||||
BOOT_CMDS[syslinux]="efibootmgr -c -d $BOOT_DEVICE -p $BOOT_PART_NUM -l /EFI/syslinux/syslinux.efi -L $DIST"
|
||||
FILES[9]="/boot/EFI/syslinux/syslinux.cfg"
|
||||
BCMDS[syslinux]="efibootmgr -c -d $BOOT_DEVICE -p $BOOT_PART_NUM -l /EFI/syslinux/syslinux.efi -L $DIST"
|
||||
cfgdir="$MNT/boot/EFI/syslinux"
|
||||
cfgsrcdir="/usr/lib/syslinux/efi64/"
|
||||
fi
|
||||
@ -177,27 +177,29 @@ EOF
|
||||
install_bootloader() {
|
||||
chroot_cmd "export PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/bin/core_perl"
|
||||
|
||||
local msg="$_InstBootloader $BOOTLOADER\n"
|
||||
local msg="$_InstBootloader $BOOTLDR\n"
|
||||
[[ $BOOT_PART != "" ]] && msg="$msg\n$_InstBootDev $BOOT_PART\n"
|
||||
echo -e "$msg\nMountpoint: ${BOOT_MNTS[$SYS-$BOOTLOADER]}\n"
|
||||
echo -e "$msg\nMountpoint: ${BMNTS[$SYS-$BOOTLDR]}\n"
|
||||
|
||||
# if not on an LVM we can use the UUID for booting
|
||||
if ! [[ $ROOT_PART =~ /dev/mapper ]]; then
|
||||
ROOT_PART_ID="UUID=$(blkid -s PARTUUID $ROOT_PART | sed 's/.*=//g; s/"//g')"
|
||||
[[ $BOOTLOADER == 'systemd-boot' ]] && ROOT_PART_ID="PART$ROOT_PART_ID"
|
||||
[[ $BOOTLDR == 'systemd-boot' ]] && ROOT_PART_ID="PART$ROOT_PART_ID"
|
||||
else
|
||||
# for LVM use the partition name eg. /dev/mapper/cryptroot
|
||||
ROOT_PART_ID="$ROOT_PART"
|
||||
fi
|
||||
|
||||
# needed for os-prober module to work properly in the chroot
|
||||
mkdir -p /run/udev && mount --bind /run/udev /run/udev >/dev/null 2>&1
|
||||
BOOT_CMDS[$BOOTLOADER]="mkdir -p /run/udev && mount --bind /run/udev /run/udev ; ${BOOT_CMDS[$BOOTLOADER]}"
|
||||
echo -e "\n\nBinding mount: /run/udev -> $MNT/run/udev\n\n"
|
||||
mkdir -p $MNT/run/udev && mount --bind /run/udev $MNT/run/udev
|
||||
read NONE
|
||||
# BCMDS[$BOOTLDR]="mkdir -p /run/udev && mount --bind /run/udev /run/udev ; ${BCMDS[$BOOTLDR]}"
|
||||
|
||||
if [[ $SYS == 'UEFI' ]]; then
|
||||
# make sure efivarfs has been mounted
|
||||
mount -o remount,rw -t efivarfs efivarfs /sys/firmware/efi/efivars >/dev/null 2>&1
|
||||
BOOT_CMDS[$BOOTLOADER]="mount -o remount,rw -t efivarfs efivarfs /sys/firmware/efi/efivars ; ${BOOT_CMDS[$BOOTLOADER]}"
|
||||
BCMDS[$BOOTLDR]="mount -o remount,rw -t efivarfs efivarfs /sys/firmware/efi/efivars; ${BCMDS[$BOOTLDR]}"
|
||||
|
||||
# remove old boot entries
|
||||
local esp="$MNT/boot/efi/EFI/"
|
||||
@ -205,16 +207,16 @@ install_bootloader() {
|
||||
find $esp -maxdepth 1 -mindepth 1 \( -name '[aA][rR][cC][hH][lL]abs' -o -name '[Bb][oO][oO][tT]' \) -type d -exec rm -rf '{}' \; >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# sets up the bootloader config(s) and ${BOOT_CMDS[$BOOTLOADER]}
|
||||
prep_for_$BOOTLOADER
|
||||
# sets up the bootloader config(s) and ${BCMDS[$BOOTLDR]}
|
||||
prep_for_$BOOTLDR
|
||||
|
||||
# run the bootloader command
|
||||
chroot_cmd "${BOOT_CMDS[$BOOTLOADER]}"
|
||||
check_for_errors "${BOOT_CMDS[$BOOTLOADER]}"
|
||||
chroot_cmd "${BCMDS[$BOOTLDR]}"
|
||||
check_for_errors "${BCMDS[$BOOTLDR]}"
|
||||
|
||||
if [[ $SYS == 'UEFI' && $BOOTLOADER =~ (grub|syslinux) ]]; then
|
||||
if [[ $SYS == 'UEFI' && $BOOTLDR =~ (grub|syslinux) ]]; then
|
||||
local boot_dir="$DIST"
|
||||
[[ $BOOTLOADER == 'syslinux' ]] && boot_dir="syslinux"
|
||||
[[ $BOOTLDR == 'syslinux' ]] && boot_dir="syslinux"
|
||||
|
||||
# copy efi stub to generic catch all
|
||||
uefi_boot_fallback "$boot_dir"
|
||||
|
@ -7,9 +7,6 @@
|
||||
# sourcing this file in a non bash shell is not advised
|
||||
|
||||
install_main() {
|
||||
# this assumes all needed variables/settings are setup as needed
|
||||
# no additional user confirmation are performed aside from what is needed
|
||||
|
||||
# unpack the whole filesystem to install directory $MNT
|
||||
oneshot install_base
|
||||
|
||||
@ -22,30 +19,36 @@ install_main() {
|
||||
check_for_errors "sed -i s~${MNT}~~ $MNT/etc/fstab"
|
||||
fi
|
||||
|
||||
# run package operations before bootloader and mkinitcpio
|
||||
# due to the possibility of choosing lts kernel earlier
|
||||
oneshot update_mirrorlist
|
||||
oneshot update_system
|
||||
oneshot install_packages
|
||||
[[ $LOGIN_TYPE == 'lightdm' ]] && oneshot setup_lightdm
|
||||
# update the mirrorlist, if this isn't done before updating or it may be slow
|
||||
local cmdtail="--verbose --save $MNT/etc/pacman.d/mirrorlist"
|
||||
$MIRROR_CMD $cmdtail || reflector --score 100 -l 50 -f 10 --sort rate $cmdtail
|
||||
|
||||
oneshot update_system # MUST be before bootloader and mkinitcpio
|
||||
|
||||
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
|
||||
oneshot setup_lightdm
|
||||
fi
|
||||
|
||||
run_mkinitcpio || return 1
|
||||
install_bootloader || return 1
|
||||
|
||||
oneshot set_hwclock
|
||||
chroot_cmd "hwclock --systohc --utc" || chroot_cmd "hwclock --systohc --utc --directisa"
|
||||
|
||||
oneshot create_user || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
install_base() {
|
||||
# unpack the main system
|
||||
clear
|
||||
tput cnorm
|
||||
clear && echo -e "\nUnpacking base filesystem..\n\n"
|
||||
echo -e "\nUnpacking base filesystem..\n\n"
|
||||
rsync -ah --info=progress2 /run/archiso/sfs/airootfs/ $MNT/
|
||||
|
||||
# remove archiso init files
|
||||
# remove archiso init files and clean up install files
|
||||
find $MNT/usr/lib/initcpio -name 'archiso*' -type f -exec rm '{}' \;
|
||||
rm -rf $MNT/etc/{mkinitcpio-archiso.conf,sudoers.d/g_wheel,polkit-1/rules.d/49-nopasswd_global.rules}
|
||||
rm -f $MNT/etc/mkinitcpio-archiso.conf
|
||||
rm -rf $MNT/etc/sudoers.d/g_wheel
|
||||
rm -f $MNT/etc/polkit-1/rules.d/49-nopasswd_global.rules
|
||||
|
||||
# cleanup system permissions
|
||||
sed -i 's/volatile/auto/g' $MNT/etc/systemd/journald.conf
|
||||
@ -55,7 +58,9 @@ install_base() {
|
||||
[[ $VM ]] && rm -rf $MNT/etc/X11/xorg.conf.d
|
||||
|
||||
# if not installing the lts kernel, copy the kernel image
|
||||
[[ $KERNEL != 'linux-lts' ]] && cp -f /run/archiso/bootmnt/arch/boot/x86_64/vmlinuz $MNT/boot/vmlinuz-linux
|
||||
if [[ $KERNEL != 'linux-lts' ]]; then
|
||||
cp -f /run/archiso/bootmnt/arch/boot/x86_64/vmlinuz $MNT/boot/vmlinuz-linux
|
||||
fi
|
||||
|
||||
setup_configs
|
||||
return 0
|
||||
@ -71,9 +76,7 @@ setup_configs() {
|
||||
sed -i "s/en_US.UTF-8/${LOCALE}/g" $MNT/etc/locale.conf
|
||||
cp -f $MNT/etc/locale.conf $MNT/etc/default/locale
|
||||
chroot_cmd "locale-gen" 2>$ERR
|
||||
check_for_errors 'locale-gen'
|
||||
chroot_cmd "ln -sf /usr/share/zoneinfo/$ZONE/$SUBZONE /etc/localtime" 2>$ERR
|
||||
check_for_errors "ln -sf /usr/share/zoneinfo/$ZONE/$SUBZONE /etc/localtime"
|
||||
|
||||
# setup xorg vsync config for intel graphics
|
||||
if [[ $(lspci | grep ' VGA ' | grep 'Intel') != "" ]]; then
|
||||
@ -109,7 +112,6 @@ EOF
|
||||
KEYMAP=$CONSOLE_MAP
|
||||
FONT=$FONT
|
||||
EOF
|
||||
|
||||
# set the hostname
|
||||
echo "$HOSTNAME" > $MNT/etc/hostname
|
||||
cat > $MNT/etc/hosts << EOF
|
||||
@ -123,20 +125,43 @@ EOF
|
||||
}
|
||||
|
||||
create_user() {
|
||||
echo -e "\nSetting root password\n"
|
||||
local _home="$MNT/home/$LIVE"
|
||||
local serve="$MNT/etc/systemd/system/getty@tty1.service.d"
|
||||
|
||||
# set root password
|
||||
chroot_cmd "echo 'root:$ROOT_PASS' | chpasswd"
|
||||
|
||||
echo -e "$_UserSetBody"
|
||||
# edit the required files in /etc/ to swap the liveuser account name
|
||||
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/etc/{group,gshadow,passwd,shadow}
|
||||
|
||||
# set standard groups for the new user
|
||||
local groups="rfkill,wheel,network,lp,storage,power,video,audio,lp,autologin"
|
||||
|
||||
if [[ $AUTOLOGIN == true && $LOGIN_TYPE == 'lightdm' ]]; then
|
||||
groups="$groups,nopasswdlogin"
|
||||
elif [[ $AUTOLOGIN == true ]]; then
|
||||
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/etc/systemd/system/getty@tty1.service.d/autologin.conf
|
||||
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
|
||||
[[ $AUTOLOGIN == true ]] && groups="$groups,nopasswdlogin"
|
||||
rm -rf $_home/.{zprofile,xinitrc}
|
||||
rm -rf $serve
|
||||
else
|
||||
if [[ $AUTOLOGIN == true ]]; then
|
||||
sed -i "s/${LIVE}/${NEWUSER}/g" $serve/autologin.conf
|
||||
fi
|
||||
sed -i "s/:-openbox/:-${LOGIN_WM}/g" $_home/.xinitrc
|
||||
sed -i '/archlabs-installer/d' $_home/.zprofile
|
||||
cat >> $_home/.zprofile << EOF
|
||||
[[ -z \$DISPLAY && \$XDG_VTNR -eq 1 ]] && exec startx -- vt1 &>/dev/null
|
||||
EOF
|
||||
fi
|
||||
|
||||
sed -i "s/${LIVE}/${NEWUSER}/g" $_home/.config/gtk-3.0/bookmarks
|
||||
sed -i "s/${LIVE}/${NEWUSER}/g" $_home/.mozilla/firefox/archlabs.default/prefs.js
|
||||
sed -i "s/${LIVE}/${NEWUSER}/g" $_home/.mozilla/firefox/archlabs.default/sessionstore.js
|
||||
|
||||
if ! [[ $INSTALL_WMS =~ openbox ]]; then
|
||||
rm -rf $_home/.config/openbox
|
||||
elif ! [[ $INSTALL_WMS =~ bspwm ]]; then
|
||||
rm -rf $_home/.config/{bspwm,sxhkd}
|
||||
elif ! [[ $INSTALL_WMS =~ i3-gaps ]]; then
|
||||
rm -rf $_home/.config/i3
|
||||
fi
|
||||
|
||||
chroot_cmd "mv -f /home/$LIVE /home/$NEWUSER"
|
||||
@ -144,67 +169,21 @@ create_user() {
|
||||
chroot_cmd "echo '$NEWUSER:$USER_PASS' | chpasswd"
|
||||
chroot_cmd "chown -Rf $NEWUSER:users /home/$NEWUSER"
|
||||
|
||||
setup_user_home
|
||||
return 0
|
||||
}
|
||||
|
||||
setup_user_home() {
|
||||
local user_home="$MNT/home/$NEWUSER"
|
||||
|
||||
sed -i "s/${LIVE}/${NEWUSER}/g" $user_home/.config/gtk-3.0/bookmarks \
|
||||
$user_home/.mozilla/firefox/{archlabs.default/prefs.js,archlabs.default/sessionstore.js}
|
||||
|
||||
if [[ $AUTOLOGIN == true ]]; then
|
||||
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
|
||||
rm -rf $user_home/.{zprofile,xinitrc}
|
||||
else
|
||||
sed -i "s/:-openbox/:-${LOGIN_WM}/g" $user_home/.xinitrc
|
||||
sed -i '/archlabs-installer/d' $user_home/.zprofile
|
||||
echo '[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx -- vt1 &>/dev/null' >> $user_home/.zprofile
|
||||
fi
|
||||
else
|
||||
sed -i '/archlabs-installer/d' $user_home/.zprofile
|
||||
echo '[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx -- vt1 &>/dev/null' >> $user_home/.zprofile
|
||||
sed -i "s/:-openbox/:-${LOGIN_WM}/g" $user_home/.xinitrc
|
||||
fi
|
||||
|
||||
if ! [[ $INSTALL_WMS =~ openbox ]]; then
|
||||
rm -rf $user_home/.config/{openbox,ob-autostart,obmenu-generator}
|
||||
elif ! [[ $INSTALL_WMS =~ bspwm ]]; then
|
||||
rm -rf $user_home/.config/{bspwm,sxhkd}
|
||||
elif ! [[ $INSTALL_WMS =~ i3-gaps ]]; then
|
||||
rm -rf $user_home/.config/i3
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
set_hwclock() {
|
||||
chroot_cmd "hwclock --systohc --utc"
|
||||
[[ $? != 0 ]] && chroot_cmd "hwclock --systohc --utc --directisa"
|
||||
return 0
|
||||
}
|
||||
|
||||
update_mirrorlist() {
|
||||
echo -e "\nSorting the mirrorlist..\n"
|
||||
$MIRROR_CMD --verbose --save $MNT/etc/pacman.d/mirrorlist && return 0
|
||||
echo -e "\nAn error occurred while updating the mirrorlist.\n\nFalling back to automatic sorting...\n"
|
||||
reflector --score 100 -l 50 -f 10 --sort rate --verbose --save $MNT/etc/pacman.d/mirrorlist
|
||||
return 0
|
||||
}
|
||||
|
||||
run_mkinitcpio() {
|
||||
local conf="$MNT/etc/mkinitcpio.conf"
|
||||
local add
|
||||
|
||||
# setup a keyfile for LUKS.. Only when choosing grub and system is UEFI
|
||||
if [[ $LUKS -eq 1 && $SYS == 'UEFI' && $BOOTLOADER == 'grub' && $LUKS_PASS && $LUKS_UUID ]]; then
|
||||
luks_keyfile || return 1
|
||||
if [[ $LUKS -eq 1 && $LVM != 1 && $SYS == 'UEFI' && $BOOTLDR == 'grub' ]]; then
|
||||
luks_keyfile
|
||||
fi
|
||||
|
||||
# new HOOKS needed in /etc/mkinitcpio.conf if we used LUKS and/or LVM
|
||||
local add
|
||||
(( LVM == 1 )) && add="lvm2"
|
||||
(( LUKS == 1 )) && add="encrypt$([[ $add != "" ]] && echo -n " $add")"
|
||||
|
||||
local conf="$MNT/etc/mkinitcpio.conf"
|
||||
sed -i "s/block filesystems/block ${add} filesystems ${MKINIT_HOOKS}/g" $conf
|
||||
|
||||
tput civis
|
||||
@ -213,3 +192,75 @@ run_mkinitcpio() {
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
update_system() {
|
||||
tput cnorm
|
||||
local inpkg="base-devel git"
|
||||
local rmpkg="archlabs-installer"
|
||||
local vbx="virtualbox-guest-modules-arch"
|
||||
|
||||
if [[ $KERNEL == 'linux-lts' ]]; then
|
||||
rmpkg="$rmpkg $vbx linux"
|
||||
inpkg="linux-lts"
|
||||
if [[ $VM ]]; then
|
||||
inpkg="$inpkg virtualbox-guest-dkms linux-lts-headers"
|
||||
else
|
||||
rmpkg="$rmpkg virtualbox-guest-utils"
|
||||
fi
|
||||
elif ! [[ $VM ]]; then
|
||||
rmpkg="$rmpkg $vbx virtualbox-guest-utils"
|
||||
fi
|
||||
|
||||
if [[ $INSTALL_WMS == 'dwm' ]]; then
|
||||
inpkg="$inpkg xorg-server"
|
||||
fi
|
||||
|
||||
# for gnome and cinnamon we don't need the xfce provided stuff
|
||||
if [[ $INSTALL_WMS == 'gnome' || $INSTALL_WMS == 'cinnamon' ]]; then
|
||||
rmpkg="$(pacman -Qssq 'xfce4*' 2>/dev/null)"
|
||||
fi
|
||||
|
||||
if [[ $BOOTLDR != 'grub' ]]; then
|
||||
rmpkg="$rmpkg grub"
|
||||
rm -f $MNT/etc/default/grub
|
||||
find $MNT/boot/ -name 'grub*' -exec rm -rf '{}' \; >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
local update="pacman -Syyu --noconfirm"
|
||||
local network="pacman -S iputils --noconfirm"
|
||||
local install="pacman -S $inpkg $EXTRA_PACKAGES --needed --noconfirm"
|
||||
local remove="pacman -Rs $rmpkg --noconfirm"
|
||||
|
||||
chroot_cmd "$update; $network; $install; $remove" 2>/dev/null
|
||||
|
||||
if [[ $INSTALL_WMS =~ dwm ]]; then
|
||||
mkdir -pv $MNT/home/$LIVE/suckless
|
||||
for prog in dwm st dmenu; do
|
||||
local cmd="git clone https://bitbucket.org/natemaia/$prog /home/$LIVE/suckless/$prog"
|
||||
chroot_cmd "$cmd; cd /home/$LIVE/suckless/$prog && make clean install && make clean"
|
||||
done
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
setup_lightdm() {
|
||||
local cfg="$MNT/etc/lightdm/lightdm-gtk-greeter.conf"
|
||||
|
||||
chroot_cmd 'systemctl enable lightdm.service && systemctl set-default graphical.target'
|
||||
|
||||
sed -i '/#background=/ c background=/usr/share/backgrounds/archlabs/archlabs.jpg' $cfg
|
||||
sed -i '/#theme-name=/ c theme-name=ArchLabs-dARK' $cfg
|
||||
sed -i '/#icon-theme-name=/ c icon-theme-name=ArchLabs-Light' $cfg
|
||||
sed -i '/#position=/ c position=34%,end 66%,end' $cfg
|
||||
sed -i '/#font-name=/ c font-name=DejaVu Sans Mono 11' $cfg
|
||||
sed -i '/\[greeter]/ a default-user-image=/usr/share/icons/ArchLabs-Dark/64x64/places/distributor-logo-archlabs.png' $cfg
|
||||
sed -i '/\[greeter]/ a active-monitor=0' $cfg
|
||||
|
||||
if [[ $AUTOLOGIN == true ]]; then
|
||||
chroot_cmd 'groupadd -r nopasswdlogin'
|
||||
sed -i '/#%PAM-1.0/ a auth sufficient pam_succeed_if.so user ingroup nopasswdlogin' $MNT/etc/pam.d/lightdm
|
||||
sed -i "/#autologin-session=/ c autologin-session=${LOGIN_WM}" $MNT/etc/lightdm/lightdm.conf
|
||||
sed -i "/#autologin-user=/ c autologin-user=${NEWUSER}" $MNT/etc/lightdm/lightdm.conf
|
||||
fi
|
||||
}
|
||||
|
@ -6,6 +6,13 @@
|
||||
# this file is not meant to be run directly
|
||||
# sourcing this file in a non bash shell is not advised
|
||||
|
||||
declare -g LUKS=0
|
||||
declare -g LUKS_DEV=""
|
||||
declare -g LUKS_PART=""
|
||||
declare -g LUKS_PASS=""
|
||||
declare -g LUKS_UUID=""
|
||||
declare -g LUKS_NAME="cryptroot"
|
||||
|
||||
luks_open() {
|
||||
LUKS_PART=""
|
||||
modprobe -a dm-mod dm_crypt
|
||||
@ -42,7 +49,6 @@ luks_pass() {
|
||||
LUKS_NAME=""
|
||||
|
||||
tput cnorm
|
||||
|
||||
local values
|
||||
values="$(dialog --stdout --separator '~' --ok-label "Submit" --backtitle "$BT" \
|
||||
--title " $title " --insecure --mixedform "$_LuksOpenBody" 16 75 4 \
|
||||
@ -166,19 +172,17 @@ luks_keyfile() {
|
||||
|
||||
if [[ ! -e $MNT/crypto_keyfile.bin ]]; then
|
||||
infobox "$_LuksKeyFileTitle" "$_LuksKeyFileCreate" 0
|
||||
echo -e "$_LuksKeyFileCreate"
|
||||
|
||||
local dev
|
||||
dev="/dev/$(lsblk -lno NAME,UUID,TYPE | awk "/$LUKS_UUID/"' && /part|crypt|lvm/ {print $1}')"
|
||||
local n
|
||||
n="$(lsblk -lno NAME,UUID,TYPE | awk "/$LUKS_UUID/"' && /part|crypt|lvm/ {print $1}')"
|
||||
|
||||
local keycmd
|
||||
keycmd="dd bs=512 count=8 if=/dev/urandom of=/crypto_keyfile.bin && chmod 000 /crypto_keyfile.bin"
|
||||
keycmd="$keycmd && echo '$LUKS_PASS' | cryptsetup luksAddKey $dev /crypto_keyfile.bin"
|
||||
|
||||
chroot_cmd "$keycmd" 2>$ERR
|
||||
check_for_errors "$keycmd"
|
||||
local mkkey="dd bs=512 count=8 if=/dev/urandom of=/crypto_keyfile.bin"
|
||||
mkkey="$mkkey && chmod 000 /crypto_keyfile.bin"
|
||||
mkkey="$mkkey && echo '$LUKS_PASS' | cryptsetup luksAddKey /dev/$n /crypto_keyfile.bin"
|
||||
|
||||
chroot_cmd "$mkkey"
|
||||
sed -i 's/FILES=()/FILES=(\/crypto_keyfile.bin)/g' $MNT/etc/mkinitcpio.conf 2>$ERR
|
||||
check_for_errors 'sed -i "s/FILES=()/FILES=(/crypto_keyfile.bin)/g" /etc/mkinitcpio.conf'
|
||||
fi
|
||||
|
||||
return 0
|
||||
|
@ -6,6 +6,10 @@
|
||||
# this file is not meant to be run directly
|
||||
# sourcing this file in a non bash shell is not advised
|
||||
|
||||
declare -g LVM=0
|
||||
declare -g VOL_GROUP_MB=0
|
||||
declare -g GROUP_PARTS=0
|
||||
|
||||
lvm_detect() {
|
||||
PHYSICAL_VOLUMES="$(pvs -o pv_name --noheading 2>/dev/null)"
|
||||
VOLUME_GROUP="$(vgs -o vg_name --noheading 2>/dev/null)"
|
||||
|
@ -29,12 +29,12 @@ mount_main() {
|
||||
infobox "$_PrepMount" "\nUsing boot partition: $BOOT_PART\n" 1
|
||||
fi
|
||||
|
||||
select_boot_setup || { BOOTLOADER=""; return 1; }
|
||||
select_boot_setup || { BOOTLDR=""; return 1; }
|
||||
|
||||
if [[ $BOOT_PART != "" ]]; then
|
||||
setup_boot_device
|
||||
mount_partition "$BOOT_PART" "${BOOT_MNTS[$SYS-$BOOTLOADER]}" || return 1
|
||||
SEPERATE_BOOT=1
|
||||
mount_partition "$BOOT_PART" "${BMNTS[$SYS-$BOOTLDR]}" || return 1
|
||||
SEPERATE_BOOT=true
|
||||
fi
|
||||
|
||||
select_swap || return 1
|
||||
@ -209,6 +209,8 @@ select_extra_partitions() {
|
||||
# mount it
|
||||
mount_partition "$part" "$EXTRA_MNT" || { break; return 1; }
|
||||
|
||||
EXTRA_MNTS="$EXTRA_MNTS $part: $EXTRA_MNT"
|
||||
|
||||
# if the mountpoint was /usr add 'usr' to MKINIT_HOOKS
|
||||
[[ $EXTRA_MNT == "/usr" && $MKINIT_HOOKS != *usr* ]] && MKINIT_HOOKS="usr $MKINIT_HOOKS"
|
||||
done
|
||||
|
@ -1,123 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# vim:ft=sh:fdm=marker:fmr={,}
|
||||
|
||||
# archlabs installer library script file
|
||||
# this file is not meant to be run directly
|
||||
# sourcing this file in a non bash shell is not advised
|
||||
|
||||
update_system() {
|
||||
tput cnorm
|
||||
local pkgcmd
|
||||
if [[ $KERNEL == 'linux-lts' ]]; then
|
||||
pkgcmd="pacman -Rs linux --noconfirm ; pacman -S iputils --noconfirm ; pacman -S base-devel git linux-lts --needed --noconfirm"
|
||||
else
|
||||
pkgcmd="pacman -S iputils --noconfirm ; pacman -S base-devel git --needed --noconfirm"
|
||||
fi
|
||||
|
||||
pkgcmd="pacman -Rs archlabs-installer --noconfirm ; $pkgcmd"
|
||||
|
||||
if [[ $KERNEL == 'linux-lts' && $VM ]]; then
|
||||
pkgcmd="pacman -Rs virtualbox-guest-modules-arch --noconfirm ; pacman -S virtualbox-guest-dkms linux-lts-headers --noconfirm ; $pkgcmd"
|
||||
elif ! [[ $VM ]]; then
|
||||
pkgcmd="pacman -Rs virtualbox-guest-utils virtualbox-guest-modules-arch --noconfirm ; $pkgcmd"
|
||||
fi
|
||||
|
||||
if [[ $BOOTLOADER != 'grub' ]]; then
|
||||
pkgcmd="$pkgcmd ; pacman -Rs grub --noconfirm"
|
||||
rm -f $MNT/etc/default/grub
|
||||
find $MNT/boot/ -name 'grub*' -exec rm -rf '{}' \; >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
chroot_cmd "pacman -Syyu --noconfirm ; $pkgcmd" 2>/dev/null
|
||||
return 0
|
||||
}
|
||||
|
||||
install_packages() {
|
||||
tput civis
|
||||
# packages needed for the selected window manager
|
||||
for wm in $INSTALL_WMS; do
|
||||
WM_LOGIN_CHOICES="${WM_LOGIN_CHOICES}$wm - "
|
||||
case $wm in
|
||||
openbox) WM_PACKAGES="$WM_PACKAGES $wm obconf archlabs-obkey archlabs-kickshaw tint2 conky" ;;
|
||||
bspwm) WM_PACKAGES="$WM_PACKAGES $wm sxhkd" ;;
|
||||
i3-gaps) WM_PACKAGES="$WM_PACKAGES $wm i3status perl-anyevent-i3" ;;
|
||||
gnome) WM_PACKAGES="$WM_PACKAGES $wm gnome-extra" ;;
|
||||
cinnamon) WM_PACKAGES="$WM_PACKAGES $wm" ;;
|
||||
xfce4) WM_PACKAGES="$WM_PACKAGES $wm xfce4-goodies xfce4-pulseaudio-plugin" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps) ]]; then
|
||||
WM_PACKAGES="$WM_PACKAGES termite thunar archlabs-polybar archlabs-screenlock archlabs-skippy-xd archlabs-oblogout lxappearance"
|
||||
elif [[ $INSTALL_WMS =~ (xfce4) ]]; then
|
||||
WM_PACKAGES="$WM_PACKAGES archlabs-oblogout archlabs-screenlock"
|
||||
fi
|
||||
|
||||
local pkgs="$WM_PACKAGES"
|
||||
|
||||
# add lightdm packages if chosen
|
||||
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
|
||||
pkgs="$pkgs lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
|
||||
fi
|
||||
|
||||
# add extra packages
|
||||
[[ $EXTRA_PACKAGES != "" ]] && pkgs="$pkgs $EXTRA_PACKAGES"
|
||||
|
||||
# for gnome and cinnamon we dont need the xfce provided stuff
|
||||
if [[ $INSTALL_WMS == 'gnome' || $INSTALL_WMS == 'cinnamon' ]]; then
|
||||
REMOVE_PKGS="$(pacman -Qssq 'xfce4*' 2>/dev/null)"
|
||||
fi
|
||||
|
||||
[[ $INSTALL_WMS =~ dwm ]] && setup_dwm
|
||||
|
||||
local pkgcmd="pacman -S $pkgs --needed --noconfirm"
|
||||
|
||||
# are we removing some packages
|
||||
[[ $REMOVE_PKGS != "" ]] && pkgcmd="pacman -Rs $REMOVE_PKGS --noconfirm ; $pkgcmd"
|
||||
|
||||
chroot_cmd "$pkgcmd" 2>/dev/null
|
||||
return 0
|
||||
}
|
||||
|
||||
setup_dwm() {
|
||||
echo -e "\nSetting up dwm..\n\n"
|
||||
mkdir -pv $MNT/home/$LIVE/suckless
|
||||
for prog in dwm st dmenu; do
|
||||
echo -e "\nInstalling $prog..\n"
|
||||
git clone https://bitbucket.org/natemaia/$prog $MNT/home/$LIVE/suckless/$prog
|
||||
chroot_cmd "cd /home/$LIVE/suckless/$prog && sudo make clean install && make clean"
|
||||
echo -e "\n$prog has been installed..
|
||||
\nSee /home/$NEWUSER/suckless/$prog to customize and rebuild\n"
|
||||
done
|
||||
}
|
||||
|
||||
setup_lightdm() {
|
||||
# due to the user's information not being entered yet at this point, if they chose
|
||||
# autologin then there is one value in the lightdm config that must be changed later
|
||||
#
|
||||
# autologin-user=$USER
|
||||
|
||||
echo -e "\nSetting up lightdm..\n"
|
||||
chroot_cmd 'systemctl enable lightdm.service && systemctl set-default graphical.target'
|
||||
|
||||
local cfg="$MNT/etc/lightdm/lightdm-gtk-greeter.conf"
|
||||
|
||||
sed -i '/#background=/ c background=/usr/share/backgrounds/archlabs/archlabs.jpg' $cfg
|
||||
sed -i '/#theme-name=/ c theme-name=ArchLabs-dARK' $cfg
|
||||
sed -i '/#icon-theme-name=/ c icon-theme-name=ArchLabs-Light' $cfg
|
||||
sed -i '/#position=/ c position=34%,end 66%,end' $cfg
|
||||
sed -i '/#font-name=/ c font-name=DejaVu Sans Mono 11' $cfg
|
||||
sed -i '/\[greeter]/ a default-user-image=/usr/share/icons/ArchLabs-Dark/64x64/places/distributor-logo-archlabs.png' $cfg
|
||||
sed -i '/\[greeter]/ a active-monitor=0' $cfg
|
||||
|
||||
rm -rf $MNT/etc/systemd/system/getty@tty1.service.d
|
||||
|
||||
if [[ $AUTOLOGIN == true ]]; then
|
||||
echo -e "\nSetting up autologin..\n"
|
||||
chroot_cmd 'groupadd -r nopasswdlogin'
|
||||
sed -i '/#%PAM-1.0/ a auth sufficient pam_succeed_if.so user ingroup nopasswdlogin' $MNT/etc/pam.d/lightdm
|
||||
sed -i "/#autologin-session=/ c autologin-session=${LOGIN_WM}" $MNT/etc/lightdm/lightdm.conf
|
||||
sed -i "/#autologin-user=/ c autologin-user=${NEWUSER}" $MNT/etc/lightdm/lightdm.conf
|
||||
fi
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
|
||||
format() {
|
||||
infobox "$_FSTitle" "\nFormatting: $1\n\nCommand: ${FS_CMDS[$2]}\n" 0
|
||||
${FS_CMDS[$2]} $1 2>$ERR
|
||||
${FS_CMDS[$2]} $1 >/dev/null 2>$ERR
|
||||
check_for_errors "${FS_CMDS[$2]} $1"
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user