Cleanup some mess

This commit is contained in:
natemaia 2019-09-01 23:23:58 -07:00
parent cb6908bbaa
commit a01b110eca

View File

@ -14,7 +14,7 @@
# will result in "My Distro Linux" used where needed # will result in "My Distro Linux" used where needed
: ${DIST="ArchLabs"} : ${DIST="ArchLabs"}
VER="2.0.65" # installer version VER="2.0.66" # installer version
MNT="/mnt" # install mountpoint MNT="/mnt" # install mountpoint
ANS="/tmp/ans" # dialog answer file ANS="/tmp/ans" # dialog answer file
@ -48,10 +48,6 @@ BOOTDIR='boot'
# these values will be selected during the install, it is not recommended # these values will be selected during the install, it is not recommended
# to edit them here unless you know what you're doing. # to edit them here unless you know what you're doing.
UCODE='' # cpu microcode (if any), can be: amd-ucode, intel-ucode
KERNEL='' # linux kernel, can be: linux, linux-lts, linux-zen, or linux-hardened
MYSHELL='' # full path for the shell, eg. /usr/bin/zsh
SWAP_PART='' # swap partition or file path SWAP_PART='' # swap partition or file path
SWAP_SIZE='' # swap size, only used when creating a swapfile SWAP_SIZE='' # swap size, only used when creating a swapfile
@ -64,6 +60,7 @@ HOOKS="shutdown" # list of additional HOOKS to add in /etc/mkinitcpio.conf
LOGIN_TYPE='' # login manager can be: lightdm, xinit, ly LOGIN_TYPE='' # login manager can be: lightdm, xinit, ly
LOGIN_WM='' # default login session to be placed in ~/.xinitrc LOGIN_WM='' # default login session to be placed in ~/.xinitrc
LOGINRC='' # login shell rc file, eg. .zprofile, .bash_profile, .profile LOGINRC='' # login shell rc file, eg. .zprofile, .bash_profile, .profile
AUTOLOGIN='' # enable autologin for xinit
INSTALL_WMS='' # space separated list of chosen wm/de INSTALL_WMS='' # space separated list of chosen wm/de
@ -75,6 +72,10 @@ NEWUSER='' # username for the new user
USER_PASS='' # new user's password USER_PASS='' # new user's password
ROOT_PASS='' # root password ROOT_PASS='' # root password
KERNEL='' # linux kernel, can be: linux, linux-lts, linux-zen, or linux-hardened
MYSHELL='' # full path for the shell, eg. /usr/bin/zsh
UCODE='' # cpu microcode (if any), can be: amd-ucode, intel-ucode
LUKS='' # empty when not using encryption LUKS='' # empty when not using encryption
LUKS_DEV='' # boot parameter string for LUKS LUKS_DEV='' # boot parameter string for LUKS
LUKS_PART='' # partition used for encryption LUKS_PART='' # partition used for encryption
@ -88,7 +89,6 @@ VGROUP_MB=0 # available space in volume group
WARN='' # issued mounting/partitioning warning WARN='' # issued mounting/partitioning warning
SEP_BOOT='' # separate boot partition for BIOS SEP_BOOT='' # separate boot partition for BIOS
AUTOLOGIN='' # enable autologin for xinit
CONFIG_DONE='' # basic configuration is finished CONFIG_DONE='' # basic configuration is finished
FORMATTED='' # partitions we formatted and should allow skipping FORMATTED='' # partitions we formatted and should allow skipping
@ -104,8 +104,8 @@ SYS='Unknown' # bios type to be determined: UEFI/BIOS
export DIALOGOPTS="--cr-wrap" # see `man dialog` export DIALOGOPTS="--cr-wrap" # see `man dialog`
# baseline # baseline
BASE_PKGS="base-devel xorg xorg-drivers sudo git gvfs gtk3 gtk-engines gtk-engine-murrine pavucontrol tumbler xdg-user-dirs " BASE_PKGS="base-devel xorg xorg-drivers sudo git gvfs gtk3 pavucontrol tumbler xdg-user-dirs playerctl "
BASE_PKGS+="playerctl ffmpeg gstreamer libmad libmatroska gst-libav gst-plugins-base gst-plugins-good scrot" BASE_PKGS+="ffmpeg gstreamer libmad libmatroska gst-libav gst-plugins-base gst-plugins-good scrot"
# archlabs base # archlabs base
AL_BASE_PKGS="archlabs-skel-base archlabs-fonts archlabs-themes archlabs-icons archlabs-wallpapers archlabs-scripts" AL_BASE_PKGS="archlabs-skel-base archlabs-fonts archlabs-themes archlabs-icons archlabs-wallpapers archlabs-scripts"
@ -231,6 +231,7 @@ declare -A PKG_EXT=(
[mpd]='mpc' [mpd]='mpc'
[mupdf]='mupdf-tools' [mupdf]='mupdf-tools'
[qt5ct]='qt5-styleplugins' [qt5ct]='qt5-styleplugins'
[rxvt-unicode]='urxvt-pearls'
[vlc]='qt5ct qt5-styleplugins' [vlc]='qt5ct qt5-styleplugins'
[zathura]='zathura-pdf-poppler' [zathura]='zathura-pdf-poppler'
[noto-fonts]='noto-fonts-emoji' [noto-fonts]='noto-fonts-emoji'
@ -712,24 +713,13 @@ part_menu()
while :; do while :; do
choice="" choice=""
if [[ $DISPLAY && $TERM != 'linux' ]] && hash gparted >/dev/null 2>&1; then dlg choice menu "Edit Partitions" "$_part" \
dlg choice menu "Edit Partitions" "$_part" \ "auto" "Whole device automatic partitioning" \
"auto" "Whole device automatic partitioning" \ "shrink" "Shrink an existing ext2/3/4 or ntfs partition to make room for a new partition" \
"shrink" "Shrink an existing ext2/3/4 or ntfs partition to make room for a new partition" \ "cfdisk" "Curses based variant of fdisk" \
"gparted" "GUI front end to parted" \ "parted" "GNU partition editor" \
"cfdisk" "Curses based variant of fdisk" \ "fdisk" "Dialog-driven creation and manipulation of partitions" \
"parted" "GNU partition editor" \ "done" "Return to the main menu" || return 0
"fdisk" "Dialog-driven creation and manipulation of partitions" \
"done" "Return to the main menu" || return 0
else
dlg choice menu "Edit Partitions" "$_part" \
"auto" "Whole device automatic partitioning" \
"shrink" "Shrink an existing ext2/3/4 or ntfs partition to make room for a new partition" \
"cfdisk" "Curses based variant of fdisk" \
"parted" "GNU partition editor" \
"fdisk" "Dialog-driven creation and manipulation of partitions" \
"done" "Return to the main menu" || return 0
fi
if [[ $choice == 'done' ]]; then if [[ $choice == 'done' ]]; then
return 0 return 0
@ -1017,7 +1007,6 @@ part_cryptlv()
if lsblk -lno TYPE "$part" | grep -q 'crypt'; then if lsblk -lno TYPE "$part" | grep -q 'crypt'; then
LUKS='encrypted' LUKS='encrypted'
LUKS_NAME="${part#/dev/mapper/}" LUKS_NAME="${part#/dev/mapper/}"
for dev in $(awk '/lvm/ && /crypto_LUKS/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do for dev in $(awk '/lvm/ && /crypto_LUKS/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do
if lsblk -lno NAME "$dev" | grep -q "$LUKS_NAME"; then if lsblk -lno NAME "$dev" | grep -q "$LUKS_NAME"; then
LUKS_DEV="$LUKS_DEV cryptdevice=$dev:$LUKS_NAME" LUKS_DEV="$LUKS_DEV cryptdevice=$dev:$LUKS_NAME"
@ -1025,7 +1014,6 @@ part_cryptlv()
break break
fi fi
done done
for dev in $(awk '/part/ && /crypto_LUKS/ {print "/dev/"$1}' <<< "$devs" | uniq); do for dev in $(awk '/part/ && /crypto_LUKS/ {print "/dev/"$1}' <<< "$devs" | uniq); do
if lsblk -lno NAME "$dev" | grep -q "$LUKS_NAME"; then if lsblk -lno NAME "$dev" | grep -q "$LUKS_NAME"; then
LUKS_UUID="$(lsblk -lno UUID,TYPE,FSTYPE "$dev" | awk '/part/ && /crypto_LUKS/ {print $1}')" LUKS_UUID="$(lsblk -lno UUID,TYPE,FSTYPE "$dev" | awk '/part/ && /crypto_LUKS/ {print $1}')"
@ -1033,18 +1021,15 @@ part_cryptlv()
break break
fi fi
done done
elif lsblk -lno TYPE "$part" | grep -q 'lvm'; then elif lsblk -lno TYPE "$part" | grep -q 'lvm'; then
LVM='logical volume' LVM='logical volume'
VNAME="${part#/dev/mapper/}" VNAME="${part#/dev/mapper/}"
for dev in $(awk '/crypt/ && /lvm2_member/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do for dev in $(awk '/crypt/ && /lvm2_member/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do
if lsblk -lno NAME "$dev" | grep -q "$VNAME"; then if lsblk -lno NAME "$dev" | grep -q "$VNAME"; then
LUKS_NAME="${dev/\/dev\/mapper\//}" LUKS_NAME="${dev/\/dev\/mapper\//}"
break break
fi fi
done done
for dev in $(awk '/part/ && /crypto_LUKS/ {print "/dev/"$1}' <<< "$devs" | uniq); do for dev in $(awk '/part/ && /crypto_LUKS/ {print "/dev/"$1}' <<< "$devs" | uniq); do
if lsblk -lno NAME "$dev" | grep -q "$LUKS_NAME"; then if lsblk -lno NAME "$dev" | grep -q "$LUKS_NAME"; then
LUKS_UUID="$(lsblk -lno UUID,TYPE,FSTYPE "$dev" | awk '/part/ && /crypto_LUKS/ {print $1}')" LUKS_UUID="$(lsblk -lno UUID,TYPE,FSTYPE "$dev" | awk '/part/ && /crypto_LUKS/ {print $1}')"
@ -1362,7 +1347,7 @@ install_main()
login "${EDIT_FILES[login]}" login "${EDIT_FILES[login]}"
if [[ -z $choice || $choice == 'finished' ]]; then if [[ -z $choice || $choice == 'finished' ]]; then
[[ $DEBUG == true && -r $DBG ]] && vim $DBG [[ $DEBUG == true && -r $DBG ]] && $EDITOR $DBG
clear && die 127 clear && die 127
else else
local exists='' local exists=''
@ -1370,7 +1355,7 @@ install_main()
[[ -e ${MNT}$f ]] && exists+=" ${MNT}$f" [[ -e ${MNT}$f ]] && exists+=" ${MNT}$f"
done done
if [[ $exists ]]; then if [[ $exists ]]; then
vim -O $exists $EDITOR -O $exists
else else
msg "File Missing" "\nThe file(s) selected do not exist:\n\n${EDIT_FILES[$choice]}\n" msg "File Missing" "\nThe file(s) selected do not exist:\n\n${EDIT_FILES[$choice]}\n"
fi fi
@ -1484,15 +1469,12 @@ install_boot()
if [[ $SYS == 'UEFI' ]]; then if [[ $SYS == 'UEFI' ]]; then
# some UEFI firmware requires a generic esp/BOOT/BOOTX64.EFI # some UEFI firmware requires a generic esp/BOOT/BOOTX64.EFI
mkdir -pv $MNT/$BOOTDIR/EFI/BOOT mkdir -pv $MNT/$BOOTDIR/EFI/BOOT
if [[ $BOOTLDR == 'grub' ]]; then case "$BOOTLDR" in
cp -fv $MNT/$BOOTDIR/EFI/$DIST/grubx64.efi $MNT/$BOOTDIR/EFI/BOOT/BOOTX64.EFI grub) cp -fv $MNT/$BOOTDIR/EFI/$DIST/grubx64.efi $MNT/$BOOTDIR/EFI/BOOT/BOOTX64.EFI ;;
elif [[ $BOOTLDR == 'syslinux' ]]; then syslinux) cp -rf $MNT/$BOOTDIR/EFI/syslinux/* $MNT/$BOOTDIR/EFI/BOOT/ && cp -f $MNT/$BOOTDIR/EFI/syslinux/syslinux.efi $MNT/$BOOTDIR/EFI/BOOT/BOOTX64.EFI ;;
cp -rf $MNT/$BOOTDIR/EFI/syslinux/* $MNT/$BOOTDIR/EFI/BOOT/ refind-efi) sed -i '/#extra_kernel_version_strings/ c extra_kernel_version_strings linux-hardened,linux-zen,linux-lts,linux' $MNT/$BOOTDIR/EFI/refind/refind.conf
cp -f $MNT/$BOOTDIR/EFI/syslinux/syslinux.efi $MNT/$BOOTDIR/EFI/BOOT/BOOTX64.EFI cp -fv $MNT/$BOOTDIR/EFI/refind/refind_x64.efi $MNT/$BOOTDIR/EFI/BOOT/BOOTX64.EFI ;;
elif [[ $BOOTLDR == 'refind-efi' ]]; then esac
sed -i '/#extra_kernel_version_strings/ c extra_kernel_version_strings linux-hardened,linux-zen,linux-lts,linux' $MNT/$BOOTDIR/EFI/refind/refind.conf
cp -fv $MNT/$BOOTDIR/EFI/refind/refind_x64.efi $MNT/$BOOTDIR/EFI/BOOT/BOOTX64.EFI
fi
fi fi
return 0 return 0
@ -1519,13 +1501,6 @@ install_user()
chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2>$ERR chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2>$ERR
errshow 1 "set $NEWUSER password" errshow 1 "set $NEWUSER password"
# if neovim was picked copy vim configs to ~/.config/nvim
if [[ $USER_PKGS == *neovim* ]]; then
mkdir -p $MNT/home/$NEWUSER/.config/nvim
cp -fv $MNT/home/$NEWUSER/.vimrc $MNT/home/$NEWUSER/.config/nvim/init.vim
cp -rfv $MNT/home/$NEWUSER/.vim/colors $MNT/home/$NEWUSER/.config/nvim/colors
fi
[[ $INSTALL_WMS == *dwm* ]] && install_suckless [[ $INSTALL_WMS == *dwm* ]] && install_suckless
[[ $WM_PKGS == *xfce* ]] && echo 'volumeicon &' >> $MNT/home/$NEWUSER/.xprofile [[ $WM_PKGS == *xfce* ]] && echo 'volumeicon &' >> $MNT/home/$NEWUSER/.xprofile
@ -1782,34 +1757,14 @@ prerun_syslinux()
local c="$MNT/boot/syslinux" s="/usr/lib/syslinux/bios" d=".." local c="$MNT/boot/syslinux" s="/usr/lib/syslinux/bios" d=".."
[[ $SYS == 'UEFI' ]] && { c="$MNT/boot/EFI/syslinux"; s="/usr/lib/syslinux/efi64/"; d=''; } [[ $SYS == 'UEFI' ]] && { c="$MNT/boot/EFI/syslinux"; s="/usr/lib/syslinux/efi64/"; d=''; }
mkdir -pv "$c" && cp -rfv $s/* "$c/" && cp -f "$RUN/syslinux/splash.png" "$c/" mkdir -pv "$c" && cp -rfv $s/* "$c/"
cat > "$c/syslinux.cfg" <<- EOF cat > "$c/syslinux.cfg" <<- EOF
UI vesamenu.c32 UI menu.c32
PROMPT 0
MENU TITLE $DIST Boot Menu MENU TITLE $DIST Boot Menu
MENU BACKGROUND splash.png
TIMEOUT 50 TIMEOUT 50
DEFAULT $DIST DEFAULT $DIST
# see: https://www.syslinux.org/wiki/index.php/Comboot/menu.c32
MENU WIDTH 78
MENU MARGIN 4
MENU ROWS 4
MENU VSHIFT 10
MENU TIMEOUTROW 13
MENU TABMSGROW 14
MENU CMDLINEROW 14
MENU HELPMSGROW 16
MENU HELPMSGENDROW 29
MENU COLOR border 30;44 #40ffffff #a0000000 std
MENU COLOR title 1;36;44 #9033ccff #a0000000 std
MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all
MENU COLOR unsel 37;44 #50ffffff #a0000000 std
MENU COLOR help 37;40 #c0ffffff #a0000000 std
MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std
MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std
MENU COLOR msg07 37;40 #90ffffff #a0000000 std
MENU COLOR tabmsg 31;40 #30ffffff #00000000 std
LABEL $DIST LABEL $DIST
MENU LABEL $DIST Linux MENU LABEL $DIST Linux
LINUX $d/vmlinuz-$KERNEL LINUX $d/vmlinuz-$KERNEL