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
: ${DIST="ArchLabs"}
VER="2.0.65" # installer version
VER="2.0.66" # installer version
MNT="/mnt" # install mountpoint
ANS="/tmp/ans" # dialog answer file
@ -48,10 +48,6 @@ BOOTDIR='boot'
# these values will be selected during the install, it is not recommended
# 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_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_WM='' # default login session to be placed in ~/.xinitrc
LOGINRC='' # login shell rc file, eg. .zprofile, .bash_profile, .profile
AUTOLOGIN='' # enable autologin for xinit
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
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_DEV='' # boot parameter string for LUKS
LUKS_PART='' # partition used for encryption
@ -88,7 +89,6 @@ VGROUP_MB=0 # available space in volume group
WARN='' # issued mounting/partitioning warning
SEP_BOOT='' # separate boot partition for BIOS
AUTOLOGIN='' # enable autologin for xinit
CONFIG_DONE='' # basic configuration is finished
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`
# baseline
BASE_PKGS="base-devel xorg xorg-drivers sudo git gvfs gtk3 gtk-engines gtk-engine-murrine pavucontrol tumbler xdg-user-dirs "
BASE_PKGS+="playerctl ffmpeg gstreamer libmad libmatroska gst-libav gst-plugins-base gst-plugins-good scrot"
BASE_PKGS="base-devel xorg xorg-drivers sudo git gvfs gtk3 pavucontrol tumbler xdg-user-dirs playerctl "
BASE_PKGS+="ffmpeg gstreamer libmad libmatroska gst-libav gst-plugins-base gst-plugins-good scrot"
# archlabs base
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'
[mupdf]='mupdf-tools'
[qt5ct]='qt5-styleplugins'
[rxvt-unicode]='urxvt-pearls'
[vlc]='qt5ct qt5-styleplugins'
[zathura]='zathura-pdf-poppler'
[noto-fonts]='noto-fonts-emoji'
@ -712,24 +713,13 @@ part_menu()
while :; do
choice=""
if [[ $DISPLAY && $TERM != 'linux' ]] && hash gparted >/dev/null 2>&1; then
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" \
"gparted" "GUI front end to parted" \
"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
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
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
if [[ $choice == 'done' ]]; then
return 0
@ -1017,7 +1007,6 @@ part_cryptlv()
if lsblk -lno TYPE "$part" | grep -q 'crypt'; then
LUKS='encrypted'
LUKS_NAME="${part#/dev/mapper/}"
for dev in $(awk '/lvm/ && /crypto_LUKS/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do
if lsblk -lno NAME "$dev" | grep -q "$LUKS_NAME"; then
LUKS_DEV="$LUKS_DEV cryptdevice=$dev:$LUKS_NAME"
@ -1025,7 +1014,6 @@ part_cryptlv()
break
fi
done
for dev in $(awk '/part/ && /crypto_LUKS/ {print "/dev/"$1}' <<< "$devs" | uniq); do
if lsblk -lno NAME "$dev" | grep -q "$LUKS_NAME"; then
LUKS_UUID="$(lsblk -lno UUID,TYPE,FSTYPE "$dev" | awk '/part/ && /crypto_LUKS/ {print $1}')"
@ -1033,18 +1021,15 @@ part_cryptlv()
break
fi
done
elif lsblk -lno TYPE "$part" | grep -q 'lvm'; then
LVM='logical volume'
VNAME="${part#/dev/mapper/}"
for dev in $(awk '/crypt/ && /lvm2_member/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do
if lsblk -lno NAME "$dev" | grep -q "$VNAME"; then
LUKS_NAME="${dev/\/dev\/mapper\//}"
break
fi
done
for dev in $(awk '/part/ && /crypto_LUKS/ {print "/dev/"$1}' <<< "$devs" | uniq); do
if lsblk -lno NAME "$dev" | grep -q "$LUKS_NAME"; then
LUKS_UUID="$(lsblk -lno UUID,TYPE,FSTYPE "$dev" | awk '/part/ && /crypto_LUKS/ {print $1}')"
@ -1362,7 +1347,7 @@ install_main()
login "${EDIT_FILES[login]}"
if [[ -z $choice || $choice == 'finished' ]]; then
[[ $DEBUG == true && -r $DBG ]] && vim $DBG
[[ $DEBUG == true && -r $DBG ]] && $EDITOR $DBG
clear && die 127
else
local exists=''
@ -1370,7 +1355,7 @@ install_main()
[[ -e ${MNT}$f ]] && exists+=" ${MNT}$f"
done
if [[ $exists ]]; then
vim -O $exists
$EDITOR -O $exists
else
msg "File Missing" "\nThe file(s) selected do not exist:\n\n${EDIT_FILES[$choice]}\n"
fi
@ -1484,15 +1469,12 @@ install_boot()
if [[ $SYS == 'UEFI' ]]; then
# some UEFI firmware requires a generic esp/BOOT/BOOTX64.EFI
mkdir -pv $MNT/$BOOTDIR/EFI/BOOT
if [[ $BOOTLDR == 'grub' ]]; then
cp -fv $MNT/$BOOTDIR/EFI/$DIST/grubx64.efi $MNT/$BOOTDIR/EFI/BOOT/BOOTX64.EFI
elif [[ $BOOTLDR == 'syslinux' ]]; then
cp -rf $MNT/$BOOTDIR/EFI/syslinux/* $MNT/$BOOTDIR/EFI/BOOT/
cp -f $MNT/$BOOTDIR/EFI/syslinux/syslinux.efi $MNT/$BOOTDIR/EFI/BOOT/BOOTX64.EFI
elif [[ $BOOTLDR == 'refind-efi' ]]; then
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
case "$BOOTLDR" in
grub) cp -fv $MNT/$BOOTDIR/EFI/$DIST/grubx64.efi $MNT/$BOOTDIR/EFI/BOOT/BOOTX64.EFI ;;
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 ;;
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 -fv $MNT/$BOOTDIR/EFI/refind/refind_x64.efi $MNT/$BOOTDIR/EFI/BOOT/BOOTX64.EFI ;;
esac
fi
return 0
@ -1519,13 +1501,6 @@ install_user()
chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2>$ERR
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
[[ $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=".."
[[ $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
UI vesamenu.c32
UI menu.c32
PROMPT 0
MENU TITLE $DIST Boot Menu
MENU BACKGROUND splash.png
TIMEOUT 50
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
MENU LABEL $DIST Linux
LINUX $d/vmlinuz-$KERNEL