More cleanup in various functions, use var+="val" rather than var="$var val"

This commit is contained in:
natemaia 2018-10-20 04:07:48 -07:00
parent 0702dc69a4
commit 3401939dd6
6 changed files with 231 additions and 216 deletions

View File

@ -25,9 +25,9 @@ _NoNetwork="\nThe installer should be run with an active network connection.\n"
# Preparation Menu
_PrepTitle="Prepare System"
_PrepBody="\nFollow the steps in order.\n\nConfigure settings before install."
_PrepBody="\nFollow the below steps in order.\n\nTo begin install there must be a root partition mounted first, UEFI requires\na seperate boot partition, once mounted configure the system settings before beginning the install."
_PrepLayout="Keyboard Layout"
_PrepShowDev="List Device Tree"
_PrepShowDev="Device Tree"
_PrepParts="Edit Partitions"
_PrepLUKS="LUKS (optional)"
_PrepLVM="LVM (optional)"
@ -40,8 +40,8 @@ _ConfHost="System Hostname"
_ConfLocale="Language and Timezone"
# Select Config Files
_EditBody="\nThe install is now finished.\n\nSelect configuration file(s) listed below to review or change or select $_Done to close the installer and reboot."
_EditTitle="Edit Files"
_EditBody="\nBefore exiting the installer you may select configuration files to review/change."
# Close Installer
_CloseInst="Close Installer"
@ -66,7 +66,6 @@ _InstSysBody="\nInstall syslinux to the master boot record (MBR) or to root (/)?
# mirrors
_MirrorTitle="Setup Mirrorlist"
_MirrorSetup="\nWant the mirrorlist automatically sorted?\n\nThis will take longer but guarantees the fastest mirrors.\n"
_MirrorCountry="\nSelect a country to use when sorting mirrors, the full command can be changed manually after\n\nNote: Your country may not have the fastest mirrors for your location.\n"
_MirrorCmd="\nThe command below will be used to sort the mirrorlist, a short description of each option is provided, edit the command if needed.\n"
# window managers and packages
@ -88,7 +87,7 @@ _XMapBody="\nSelect the system wide keymap, this is the keyboard layout used onc
_LocaleBody="\nLocale determines the date, time, currency, and language.\n\nThe format is language_COUNTRY\n\neg. en_US: english United States\n en_GB: english Great Britain"
# Set hostname
_HostNameBody="\nA hostname is used to identify systems on the network.\n\nIt is restricted to alphanumeric characters (a-z, A-Z, 0-9).\nIt can contain a hyphen (-) BUT NOT at the beggining or end."
_HostNameBody="\nA hostname is used to identify systems on the network.\n\nIt is restricted to alphanumeric characters (a-z, A-Z, 0-9).\nIt can contain hyphens (-) BUT NOT at the beggining or end."
# Create new user and set password
_UserTitle="Create New User"
@ -101,18 +100,18 @@ _RootBody="--- Enter root password (empty uses the password entered above) ---"
# Mounting (Partitions)
_MntTitle="Mount Status"
_MntSucc="\nMount Successful!\n"
_MntSucc="\nMount Succeeded!\n"
_MntFail="\nMount Failed!\n"
_WarnMount="\nIMPORTANT: Please choose carefully during mounting and formatting.\n\nPartitions with existing filesystems can be mounted without formatting them by selecting the '$_Skip' option from the menu, otherwise the partition will be formatted as the chosen filesystem.\n"
_WarnMount="\nIMPORTANT: Please choose carefully during mounting and formatting.\n\nDuring mounting, partitions can be mounted without formatting by selecting '$_Skip'.\nThis can be useful for data partitions or previously formatted partitions.\n"
_MntBody="\nUse [Space] to de/select the desired mount options.\n\nFor SSD's the 'discard' option provides active TRIM support.\n\nChoosing none will result in an automatic mount with system applied options."
_MntConfBody="\nConfirm the following mount options:"
# Select Device
_DevSelTitle="Select Device"
_DevSelBody="\nSelect which device to use.\n\nDevices (/dev/) are the available drives on the system. /sda, /sdb, and so on."
_DevSelBody="\nSelect a device from the list below.\n\nDevices (/dev) are the available drives on the system. /sda, /sdb ..."
# Extra Partitions
_ExtPartBody="\nSelect additional partitions to mount, otherwise select '$_Done' to exit mounting.\n\nAfter choosing a partition you will be asked to enter the mountpoint."
_ExtPartBody="\nSelect any additional partitions you want to mount, otherwise select '$_Done' to finish the mounting step.\n\nAfter choosing a partition you will be asked to enter the mountpoint."
_ExtPartBody1="\nWhere do you want the partition mounted?\n\nEnsure the name begins with a forward slash (/).\nSome examples include:"
# Auto partition
@ -120,11 +119,13 @@ _PartBody1="\nWARNING: ALL data on"
_PartBody2="will be destroyed and the following partitions will be created\n\n- 512M partition with boot/esp flag enabled (ext4 for BIOS, vfat/fat32 for UEFI)\n- ext4 partition using all remaining space.\n\nDo you want to continue?\n"
_PartWipeBody2="will be destroyed using 'wipe -Ifre'.\n\nThis process can take a long time depending on the size of the drive.\n\nDo you want to continue?\n"
# Partitioning Menu
_PartTitle="Partitioning Tool"
_PartBody="\nAuto partitioning is available for beginners, otherwise gparted is provided as a GUI option and cfdisk/parted for CLI.\n\nUEFI systems require a vfat/fat32 partition between 100-512M in size to be mounted at /boot or /boot/efi, additionally BIOS systems using LUKS require a seperate /boot partition, between 100-512M and formatted as ext3/4."
_PartBody="\nWhole device auto partitioning is available for beginners.\n\nUEFI systems require a vfat/fat32 partition between 100-512M in size to be mounted at /boot or /boot/efi, additionally BIOS systems using LUKS require a seperate /boot partition, between 100-512M and formatted as ext3/4."
_PartAuto="Automatic Partitioning"
_PartWipe="Secure Wipe Device (optional)"
_PartWipe="Secure Wipe Device"
_PartShowTree="Show Partition Tree"
# bootloader
_InstSysTitle="Install Syslinux"

View File

@ -12,7 +12,7 @@
# immutable variables {
readonly DIST="ArchLabs" # Linux distributor
readonly VER="1.6.78" # Installer version
readonly VER="1.6.88" # Installer version
readonly LIVE="liveuser" # Live session user
readonly MNT="/mnt/install" # Install mountpoint
readonly ERR="/tmp/errlog" # Built-in error log
@ -83,7 +83,7 @@ declare -Agr FS_CMDS=(
)
declare -Agr FS_OPTS=([vfat]="" [ntfs]="" [ext2]="" [ext3]=""
[ext4]="dealloc - off discard - off nofail - off noacl - off relatime - off noatime - off nobarrier - off nodelalloc - off"
[ext4]="discard - off dealloc - off nofail - off noacl - off relatime - off noatime - off nobarrier - off nodelalloc - off"
[jfs]="discard - off errors=continue - off errors=panic - off nointegrity - off"
[reiserfs]="acl - off nolog - off notail - off replayonly - off user_xattr - off"
[xfs]="discard - off filestreams - off ikeep - off largeio - off noalign - off nobarrier - off norecovery - off noquota - off wsync - off"
@ -114,6 +114,7 @@ init_variables() {
declare -g EXTRA_PACKAGES=""
declare -g MKINIT_HOOKS="shutdown"
declare -g WARN=false
declare -g IS_64BIT=false
declare -g AUTOLOGIN=false
declare -g CONFIG_DONE=false
@ -139,7 +140,7 @@ init_variables() {
}
source_file() {
. $1 2>/dev/null || { printf "\nFailed to source library file %s" "$1"; die 1; }
. "$1" || { printf "\nFailed to source library file %s" "$1"; die 1; }
}
user_creation() {
@ -241,7 +242,7 @@ select_language() {
sed -i "s/#${LOC}/${LOC}/" /etc/locale.gen
locale-gen >/dev/null 2>&1
fi
setfont $FONT >/dev/null 2>&1
[[ $TERM == 'linux' ]] && setfont $FONT >/dev/null 2>&1
export LANG="$LOC"
return 0
}
@ -287,12 +288,12 @@ window_manager() {
INSTALL_WMS="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_WMChoice " --checklist "$_WMChoiceBody\n" 0 0 0 \
"openbox" "A lightweight, powerful, and highly configurable stacking window manager" off \
"bspwm" "A tiling window manager that represents windows as the leaves of a binary tree" off \
"bspwm" "A tiling window manager that represents windows as the leaves of a binary tree" off \
"i3-gaps" "A fork of i3 window manager with more features including gaps" off \
"dwm" "A customized fork of dwm, with patches and modifications" off \
"gnome" "A desktop environment that aims to be simple and easy to use" off \
"dwm" "A customized fork of dwm, with patches and modifications" off \
"gnome" "A desktop environment that aims to be simple and easy to use" off \
"cinnamon" "A desktop environment combining a traditional desktop layout with modern graphical effects" off \
"xfce4" "A lightweight and modular desktop environment based on GTK+ 2 and 3" off)"
"xfce4" "A lightweight and modular desktop environment based on GTK+ 2 and 3" off)"
[[ $? != 0 || $INSTALL_WMS == "" ]] && return 1
WM_NUM=$(awk '{print NF}' <<< "$INSTALL_WMS")
@ -300,19 +301,20 @@ window_manager() {
for wm in $INSTALL_WMS; do
LOGIN_CHOICES="${LOGIN_CHOICES}$wm - "
case $wm in
openbox) WM_PACKAGES="$WM_PACKAGES $wm obconf archlabs-obkey archlabs-kickshaw archlabs-skippy-xd tint2 conky jgmenu" ;;
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" ;;
cinnamon) WM_PACKAGES+=" $wm" ;;
bspwm) WM_PACKAGES+=" $wm sxhkd" ;;
gnome) WM_PACKAGES+=" $wm gnome-extra" ;;
i3-gaps) WM_PACKAGES+=" $wm i3status perl-anyevent-i3" ;;
xfce4) WM_PACKAGES+=" $wm xfce4-goodies xfce4-pulseaudio-plugin" ;;
openbox) WM_PACKAGES+=" $wm obconf archlabs-obkey archlabs-kickshaw archlabs-skippy-xd tint2 conky jgmenu" ;;
esac
done
if [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps) ]]; then
WM_PACKAGES="$WM_PACKAGES archlabs-polybar jsoncpp libmpdclient archlabs-screenlock archlabs-oblogout archlabs-paranoid lxappearance rofi termite thunar"
WM_PACKAGES+=" archlabs-polybar jsoncpp libmpdclient archlabs-screenlock archlabs-oblogout"
WM_PACKAGES+=" archlabs-paranoid lxappearance rofi termite thunar"
elif [[ $INSTALL_WMS =~ (xfce4) ]]; then
WM_PACKAGES="$WM_PACKAGES archlabs-oblogout archlabs-screenlock archlabs-paranoid"
WM_PACKAGES+=" archlabs-oblogout archlabs-screenlock archlabs-paranoid"
fi
# choose which to login
@ -330,7 +332,7 @@ window_manager() {
FILES[11]="/home/$NEWUSER/.xinitrc"
else
LOGIN_TYPE='lightdm'
WM_PACKAGES="$WM_PACKAGES lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
WM_PACKAGES+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
FILES[11]="/etc/lightdm/lightdm.conf $MNT/etc/lightdm/lightdm-gtk-greeter.conf"
fi
@ -338,13 +340,12 @@ window_manager() {
# autologin
yesno "$_WMLogin" "$_AutoLoginBody\n" && AUTOLOGIN=true || AUTOLOGIN=false
case $LOGIN_WM in
i3-gaps) LOGIN_WM='i3' ;;
gnome) LOGIN_WM='gnome-session' ;;
i3-gaps) LOGIN_WM='i3' ;;
xfce4) LOGIN_WM='startxfce4' ;;
gnome) LOGIN_WM='gnome-session' ;;
openbox) LOGIN_WM='openbox-session' ;;
cinnamon) LOGIN_WM='cinnamon-session' ;;
openbox) LOGIN_WM='openbox-session' ;;
xfce4) LOGIN_WM='startxfce4' ;;
esac
return 0
@ -354,91 +355,92 @@ extra_packages() {
local pkgs
pkgs="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_ExtraPackages " --checklist "$_ExtraPackagesBody\n" 0 0 30 \
"firefox" "A popular open-source graphical web browser from Mozilla" off \
"chromium" "an open-source graphical web browser based on the Blink rendering engine" off \
"opera" "Fast and secure, free of charge web browser from Opera Software" off \
"epiphany" "A GNOME web browser based on the WebKit rendering engine" off \
"qutebrowser" "A keyboard-focused vim-like web browser based on Python and PyQt5" off \
"atom" "An open-source text editor developed by GitHub that is licensed under the MIT License" off \
"geany" "A fast and lightweight IDE" off \
"emacs" "An extensible, customizable, self-documenting real-time display editor" off \
"neovim" "A fork of Vim aiming to improve user experience, plugins, and GUIs." off \
"mousepad" "A simple text editor" off \
"rxvt-unicode" "A unicode enabled rxvt-clone terminal emulator" off \
"termite" "A minimal VTE-based terminal emulator" off \
"tilix" "A tiling terminal emulator for Linux using GTK+ 3" off \
"terminator" "Terminal emulator that supports tabs and grids" off \
"tilda" "A Gtk based drop down terminal for Linux and Unix" off \
"xfce4-terminal" "A terminal emulator based in the Xfce Desktop Environment" off \
"thunar" "A modern file manager for the Xfce Desktop Environment" off \
"pcmanfm" "A fast and lightweight file manager based in Lxde" off \
"gnome-disk-utility" "Disk Management Utility" off \
"firefox" "A popular open-source graphical web browser from Mozilla" off \
"chromium" "an open-source graphical web browser based on the Blink rendering engine" off \
"opera" "Fast and secure, free of charge web browser from Opera Software" off \
"epiphany" "A GNOME web browser based on the WebKit rendering engine" off \
"qutebrowser" "A keyboard-focused vim-like web browser based on Python and PyQt5" off \
"atom" "An open-source text editor developed by GitHub that is licensed under the MIT License" off \
"geany" "A fast and lightweight IDE" off \
"emacs" "An extensible, customizable, self-documenting real-time display editor" off \
"neovim" "A fork of Vim aiming to improve user experience, plugins, and GUIs." off \
"mousepad" "A simple text editor" off \
"rxvt-unicode" "A unicode enabled rxvt-clone terminal emulator" off \
"termite" "A minimal VTE-based terminal emulator" off \
"tilix" "A tiling terminal emulator for Linux using GTK+ 3" off \
"terminator" "Terminal emulator that supports tabs and grids" off \
"tilda" "A Gtk based drop down terminal for Linux and Unix" off \
"xfce4-terminal" "A terminal emulator based in the Xfce Desktop Environment" off \
"thunar" "A modern file manager for the Xfce Desktop Environment" off \
"pcmanfm" "A fast and lightweight file manager based in Lxde" off \
"gnome-disk-utility" "Disk Management Utility" off \
"gnome-system-monitor" "View current processes and monitor system state" off \
"steam" "A popular game distribution platform by Valve" off \
"vlc" "A free and open source cross-platform multimedia player" off \
"mpd" "A flexible, powerful, server-side application for playing music" off \
"ncmpcpp" "An mpd client and almost exact clone of ncmpc with some new features" off \
"cmus" "A small, fast and powerful console music player for Unix-like operating systems" off \
"audacious" "A free and advanced audio player based on GTK+" off \
"nicotine+" "A graphical client for Soulseek" off \
"lollypop" "A new music playing application" off \
"rhythmbox" "Music playback and management application" off \
"deadbeef" "A GTK+ audio player for GNU/Linux" off \
"clementine" "A modern music player and library organizer" off \
"thunderbird" "Standalone mail and news reader from mozilla" off \
"geary" "A lightweight email client for the GNOME desktop" off \
"evolution" "Manage your email, contacts and schedule" off \
"mutt" "Small but very powerful text-based mail client" off \
"deluge" "A BitTorrent client written in python" off \
"transmission-gtk" "Free BitTorrent client GTK+ GUI" off \
"qbittorrent" "An advanced BitTorrent client" off \
"hexchat" "A popular and easy to use graphical IRC client" off \
"pidgin" "Multi-protocol instant messaging client" off \
"weechat" "Fast, light and extensible IRC client" off \
"irssi" "Modular text mode IRC client" off \
"libreoffice-fresh" "Full featured office suite" off \
"abiword" "Fully-featured word processor" off \
"calligra" "A set of applications for productivity" off \
"evince" "A document viewer" off \
"zathura" "Minimalistic document viewer" off \
"qpdfview" "A tabbed PDF viewer" off \
"mupdf" "Lightweight PDF and XPS viewer" off \
"gpicview" "Lightweight image viewer" off \
"gimp" "GNU Image Manipulation Program" off \
"inkscape" "Professional vector graphics editor" off \
"krita" "Edit and paint images" off \
"steam" "A popular game distribution platform by Valve" off \
"vlc" "A free and open source cross-platform multimedia player" off \
"mpd" "A flexible, powerful, server-side application for playing music" off \
"ncmpcpp" "An mpd client and almost exact clone of ncmpc with some new features" off \
"cmus" "A small, fast and powerful console music player for Unix-like operating systems" off \
"audacious" "A free and advanced audio player based on GTK+" off \
"nicotine+" "A graphical client for Soulseek" off \
"lollypop" "A new music playing application" off \
"rhythmbox" "Music playback and management application" off \
"deadbeef" "A GTK+ audio player for GNU/Linux" off \
"clementine" "A modern music player and library organizer" off \
"thunderbird" "Standalone mail and news reader from mozilla" off \
"geary" "A lightweight email client for the GNOME desktop" off \
"evolution" "Manage your email, contacts and schedule" off \
"mutt" "Small but very powerful text-based mail client" off \
"deluge" "A BitTorrent client written in python" off \
"transmission-gtk" "Free BitTorrent client GTK+ GUI" off \
"qbittorrent" "An advanced BitTorrent client" off \
"hexchat" "A popular and easy to use graphical IRC client" off \
"pidgin" "Multi-protocol instant messaging client" off \
"weechat" "Fast, light and extensible IRC client" off \
"irssi" "Modular text mode IRC client" off \
"libreoffice-fresh" "Full featured office suite" off \
"abiword" "Fully-featured word processor" off \
"calligra" "A set of applications for productivity" off \
"evince" "A document viewer" off \
"zathura" "Minimalistic document viewer" off \
"qpdfview" "A tabbed PDF viewer" off \
"mupdf" "Lightweight PDF and XPS viewer" off \
"gpicview" "Lightweight image viewer" off \
"gimp" "GNU Image Manipulation Program" off \
"inkscape" "Professional vector graphics editor" off \
"krita" "Edit and paint images" off \
"simplescreenrecorder" "A feature-rich screen recorder" off \
"obs-studio" "Free opensource streaming/recording software" off \
"openshot" "An open-source, non-linear video editor for Linux based on MLT framework" off \
"kdenlive" "A non-linear video editor for Linux using the MLT video framework" off \
"audacity" "A program that lets you manipulate digital audio waveforms" off \
"guvcview" "Capture video from camera devices" off \
"gpick" "Advanced color picker using GTK+ toolkit" off \
"gcolor2" "A simple GTK+2 color selector" off \
"plank" "An elegant, simple, and clean dock" off \
"docky" "Full fledged dock that makes opening common applications and managing windows faster and easier" off \
"cairo-dock" "Light eye-candy fully themable animated dock" off \
"qt5ct" "GUI for managing Qt based application themes, icons, and fonts" off \
"ttf-hack" "A hand groomed and optically balanced typeface based on Bitstream Vera Mono" off \
"ttf-anonymous-pro" "A family of four fixed-width fonts designed especially with coding in mind" off \
"ttf-font-awesome" "Iconic font designed for Bootstrap" off \
"ttf-fira-code" "Monospaced font with programming ligatures" off \
"noto-fonts" "Google Noto fonts" off \
"noto-fonts-cjk" "Google Noto CJK fonts (Chinese, Japanese, Korean)" off)"
[[ $pkgs =~ vlc ]] && pkgs="$pkgs qt4"
[[ $pkgs =~ mpd ]] && pkgs="$pkgs mpc"
[[ $pkgs =~ mupdf ]] && pkgs="$pkgs mupdf-tools"
[[ $pkgs =~ qt5ct ]] && pkgs="$pkgs qt5-styleplugins"
[[ $pkgs =~ steam ]] && pkgs="$pkgs steam-native-runtime"
[[ $pkgs =~ zathura ]] && pkgs="$pkgs zathura-pdf-poppler"
[[ $pkgs =~ noto-fonts ]] && pkgs="$pkgs noto-fonts-emoji"
[[ $pkgs =~ cairo-dock ]] && pkgs="$pkgs cairo-dock-plug-ins"
[[ $pkgs =~ kdenlive ]] && pkgs="$pkgs kdebase-runtime dvdauthor frei0r-plugins breeze breeze-gtk"
"obs-studio" "Free opensource streaming/recording software" off \
"openshot" "An open-source, non-linear video editor for Linux based on MLT framework" off \
"kdenlive" "A non-linear video editor for Linux using the MLT video framework" off \
"audacity" "A program that lets you manipulate digital audio waveforms" off \
"guvcview" "Capture video from camera devices" off \
"gpick" "Advanced color picker using GTK+ toolkit" off \
"gcolor2" "A simple GTK+2 color selector" off \
"plank" "An elegant, simple, and clean dock" off \
"docky" "Full fledged dock that makes opening applications and managing windows faster and easier" off \
"cairo-dock" "Light eye-candy fully themable animated dock" off \
"qt5ct" "GUI for managing Qt based application themes, icons, and fonts" off \
"ttf-hack" "A hand groomed and optically balanced typeface based on Bitstream Vera Mono" off \
"ttf-anonymous-pro" "A family of four fixed-width fonts designed especially with coding in mind" off \
"ttf-font-awesome" "Iconic font designed for Bootstrap" off \
"ttf-fira-code" "Monospaced font with programming ligatures" off \
"noto-fonts" "Google Noto fonts" off \
"noto-fonts-cjk" "Google Noto CJK fonts (Chinese, Japanese, Korean)" off)"
[[ $pkgs =~ vlc ]] && pkgs+=" qt4"
[[ $pkgs =~ mpd ]] && pkgs+=" mpc"
[[ $pkgs =~ mupdf ]] && pkgs+=" mupdf-tools"
[[ $pkgs =~ qt5ct ]] && pkgs+=" qt5-styleplugins"
[[ $pkgs =~ steam ]] && pkgs+=" steam-native-runtime"
[[ $pkgs =~ zathura ]] && pkgs+=" zathura-pdf-poppler"
[[ $pkgs =~ noto-fonts ]] && pkgs+=" noto-fonts-emoji"
[[ $pkgs =~ cairo-dock ]] && pkgs+=" cairo-dock-plug-ins"
[[ $pkgs =~ kdenlive ]] && pkgs+=" kdebase-runtime dvdauthor frei0r-plugins breeze breeze-gtk"
if [[ $INSTALL_WMS =~ dwm ]] && ! [[ $pkgs =~ ttf-hack ]]; then
pkgs="$pkgs ttf-hack"
pkgs+=" ttf-hack"
fi
if [[ $pkgs =~ (qutebrowser|qbittorrent|kdenlive|vlc) ]] && ! [[ $pkgs =~ qt5ct ]]; then
pkgs="$pkgs qt5ct qt5-styleplugins"
pkgs+=" qt5ct qt5-styleplugins"
fi
EXTRA_PACKAGES="$EXTRA_PACKAGES$([[ $pkgs ]] && printf " %s" "$pkgs")"
@ -492,38 +494,33 @@ mirrorlist_cmd() {
}
display_selection() {
local msg="Configuration values used for install
msgbox "$_PrepTitle" "\nConfiguration values used for install\n\n
Root: $ROOT_PART
Boot: $BOOT_PART
Swap: $SWAP
Extra: ${EXTRA_MNTS:-None}
LVM: $LVM
LUKS: $LUKS
Root Partition: $ROOT_PART
Boot Partition: $BOOT_PART
Bootloader: $BOOTLDR
Boot Mount: ${BMNTS[$SYS-$BOOTLDR]}
Bootloader: $BOOTLDR
Boot Mount: ${BMNTS[$SYS-$BOOTLDR]}
Boot Command: ${BCMDS[$BOOTLDR]}
Swap: $SWAP
Extra: $EXTRA_MNTS
LUKS: $LUKS
LVM: $LVM
New User: $NEWUSER
Autologin: $AUTOLOGIN
New User: $NEWUSER
Login: $LOGIN_WM
Autologin: $AUTOLOGIN
Login Type: $LOGIN_TYPE
Login Session: $LOGIN_WM
Hostname: $HOSTNAME
Locale: $LOCALE
Keymap: $KEYMAP
Locale: $LOCALE
Keymap: $KEYMAP
Timezone: $ZONE/$SUBZONE
Kernel: $KERNEL
Kernel: $KERNEL
Sessions: $INSTALL_WMS
Mirrors: $MIRROR_CMD
Packages: $EXTRA_PACKAGES"
msgbox "$_PrepTitle" "\n$msg\n"
Mirrors: $MIRROR_CMD
Packages: $EXTRA_PACKAGES\n"
}
configure_install() {
@ -540,10 +537,8 @@ configure_install() {
mirrorlist_cmd || return 1
user_creation || return 1
window_manager || return 1
yesno 'Choose Kernel' "\nUse the current kernel or the LTS kernel?\n" 'Current' 'LTS' &&
KERNEL='linux' || KERNEL='linux-lts'
extra_packages || return 1
CONFIG_DONE=true
return 0
@ -551,64 +546,63 @@ configure_install() {
edit_configs() {
if [[ $CURRENT_MENU != "edit" ]]; then
MENU_HIGHLIGHT=1
SELECTED=1
CURRENT_MENU="edit"
elif (( MENU_HIGHLIGHT < 10 )); then
(( MENU_HIGHLIGHT++ ))
elif (( SELECTED < 10 )); then
(( SELECTED++ ))
fi
tput civis
MENU_HIGHLIGHT=$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_EditTitle " --default-item $MENU_HIGHLIGHT --menu "$_EditBody" 0 0 0 \
"1" "$_Done" "2" "keyboard" "3" "language + locale" "4" "hostname" "5" "sudoers" \
"6" "mkinitcpio.conf" "7" "fstab" "8" "crypttab" "9" "$BOOTLDR" "10" "pacman.conf" \
SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_EditTitle " --default-item $SELECTED --menu "$_EditBody" 0 0 0 \
"1" "Exit & Reboot" "2" "Keyboard" "3" "Locale" "4" "Hostname" "5" "Sudoers" \
"6" "Mkinitcpio.conf" "7" "Fstab" "8" "Crypttab" "9" "${BOOTLDR^}" "10" "Pacman.conf" \
"11" "$LOGIN_TYPE")
if [[ $MENU_HIGHLIGHT == "" || $MENU_HIGHLIGHT == 1 ]]; then
if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then
wrap_up "$_InstFinBody" 'Reboot' 'Back' 'reboot'
else
local existing_files=""
for f in $(echo "${FILES[$MENU_HIGHLIGHT]}"); do
[[ -e ${MNT}$f ]] && existing_files="$existing_files ${MNT}$f"
for f in $(echo "${FILES[$SELECTED]}"); do
[[ -e ${MNT}$f ]] && existing_files+=" ${MNT}$f"
done
if [[ $existing_files ]]; then
vim -O $existing_files
else
msgbox "$_ErrTitle" "$_NoFileErr"
fi
[[ ! $existing_files ]] && msgbox "$_ErrTitle" "$_NoFileErr" || vim -O $existing_files
fi
edit_configs
}
main() {
if [[ $CURRENT_MENU != "main" ]]; then
MENU_HIGHLIGHT=1
SELECTED=1
CURRENT_MENU="main"
elif (( MENU_HIGHLIGHT < 8 )); then
((MENU_HIGHLIGHT++)) # increment the highlighted menu item
elif (( SELECTED < 8 )); then
((SELECTED++)) # increment the highlighted menu item
fi
tput civis
MENU_HIGHLIGHT=$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_PrepTitle " --default-item $MENU_HIGHLIGHT --menu "$_PrepBody" 0 0 0 \
SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_PrepTitle " --default-item $SELECTED --menu "$_PrepBody" 0 0 0 \
"1" "$_PrepShowDev" "2" "$_PrepParts" "3" "$_PrepLUKS" "4" "$_PrepLVM" \
"5" "$_PrepMount" "6" "$_PrepConfig" "7" "Check Choices" "8" "$_PrepInstall" \
"9" "$_Done")
# if trying to install the system, make sure the partitions are mounted
# and that the needed config variables and user variables have been set up
if [[ $MENU_HIGHLIGHT && $MENU_HIGHLIGHT -eq 8 ]]; then
check_install_ready || return 1
if [[ $SELECTED ]]; then
if [[ $SELECTED -eq 8 ]]; then
check_install_ready || return 1
elif [[ ($SELECTED -eq 2 || $SELECTED -eq 5) && $WARN != true ]]; then
msgbox "$_PrepTitle" "$_WarnMount"
WARN=true
fi
fi
case $MENU_HIGHLIGHT in
case $SELECTED in
1) show_devices ;;
2) edit_partitions ;;
3) luks_menu || MENU_HIGHLIGHT=1 ;;
4) lvm_menu || MENU_HIGHLIGHT=1 ;;
5) mount_main || MENU_HIGHLIGHT=1 ;;
3) luks_menu || SELECTED=1 ;;
4) lvm_menu || SELECTED=1 ;;
5) mount_main || SELECTED=1 ;;
6) configure_install ;;
7) display_selection ;;
8) install_main && edit_configs ;;
@ -620,7 +614,7 @@ main() {
init_variables
for file in /usr/share/archlabs/installer/lib/?*.sh; do
source_file $file
source_file "$file"
done
# trap Ctrl-C to properly exit

View File

@ -109,15 +109,13 @@ LABEL $DIST
MENU LABEL $DIST Linux
LINUX ../vmlinuz-$KERNEL
APPEND root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
INITRD ../initramfs-$KERNEL.img
$([[ $UCODE ]] && printf "\nINITRD %s" "../$UCODE")
INITRD ../initramfs-$KERNEL.img$([[ $UCODE ]] && printf "\nINITRD %s" "../$UCODE")
LABEL ${DIST}fallback
MENU LABEL $DIST Linux Fallback
LINUX ../vmlinuz-$KERNEL
APPEND root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
INITRD ../initramfs-$KERNEL-fallback.img
$([[ $UCODE ]] && printf "\nINITRD %s" "../$UCODE")
INITRD ../initramfs-$KERNEL-fallback.img$([[ $UCODE ]] && printf "\nINITRD %s" "../$UCODE")
EOF
return 0
}

View File

@ -52,7 +52,7 @@ install_main() {
}
install_base() {
printf "\nUnpacking base file system --- Total: ~ 2.8G\n\n"
printf "\nUnpacking base file system --- Total: ~ 2.9G\n\n"
rsync -ah --info=progress2 /run/archiso/sfs/airootfs/ $MNT/
# remove archiso init files and clean up install files
@ -88,9 +88,13 @@ EOF
cp -f /etc/resolv.conf $MNT/etc/
# set the locale and timezone
cat > $MNT/etc/locale.conf << EOF
LANG=$LOCALE
EOF
cat > $MNT/etc/default/locale << EOF
LANG=$LOCALE
EOF
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/${LOCALE}/g" $MNT/etc/locale.conf
cp -f $MNT/etc/locale.conf $MNT/etc/default/locale
chroot_cmd "locale-gen" 2>/dev/null
chroot_cmd "ln -sf /usr/share/zoneinfo/$ZONE/$SUBZONE /etc/localtime" 2>/dev/null
@ -118,7 +122,9 @@ KEYMAP=$CONSOLE_MAP
FONT=$FONT
EOF
# set the hostname
printf "%s\n" "$HOSTNAME" > $MNT/etc/hostname
cat > $MNT/etc/hostname << EOF
$HOSTNAME
EOF
cat > $MNT/etc/hosts << EOF
127.0.0.1 localhost
127.0.1.1 $HOSTNAME
@ -142,6 +148,8 @@ create_user() {
# fix up some user files that reference the liveuser
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/home/$LIVE/.config/gtk-3.0/bookmarks \
$MNT/home/$LIVE/.mozilla/firefox/archlabs.default/{prefs,sessionstore}.js
# remove welcome message
sed -i '/printf/d' $MNT/home/$LIVE/.zshrc
[[ $INSTALL_WMS =~ bspwm ]] || rm -rf $MNT/home/$LIVE/.config/{bspwm,sxhkd}
[[ $INSTALL_WMS =~ i3-gaps ]] || rm -rf $MNT/home/$LIVE/.config/i3
[[ $INSTALL_WMS =~ openbox ]] || rm -rf $MNT/home/$LIVE/.config/{openbox,skippy-xd,jgmenu,conky,tint2}
@ -154,7 +162,6 @@ create_user() {
run_mkinitcpio() {
local add=""
# setup a keyfile for LUKS.. Only when choosing grub and system is UEFI
[[ $LUKS -eq 1 && $LVM -eq 0 && $SYS == 'UEFI' && $BOOTLDR == 'grub' ]] && luks_keyfile
@ -168,27 +175,32 @@ run_mkinitcpio() {
}
package_operations() {
local inpkg="$EXTRA_PACKAGES" # add the packages chosen during setup
local inpkg="$EXTRA_PACKAGES" # add the packages chosen during setup
local rmpkg="archlabs-installer" # always remove the installer
local vbx="virtualbox-guest-modules-arch" # save retyping this multiple times
# the LTS kernel uses different packages
if [[ $KERNEL == 'linux-lts' ]]; then
rmpkg="$rmpkg $vbx linux"
inpkg="$inpkg linux-lts"
rmpkg+=" virtualbox-guest-modules-arch linux"
inpkg+=" linux-lts"
# if the system is a VM then install the needed packages otherwise remove the guest utils
[[ $VM ]] && inpkg="$inpkg virtualbox-guest-dkms linux-lts-headers" || rmpkg="$rmpkg virtualbox-guest-utils"
elif ! [[ $VM ]]; then
if [[ $VM ]]; then
inpkg+=" virtualbox-guest-dkms linux-lts-headers"
else
rmpkg+=" virtualbox-guest-utils"
fi
else
# if the system is not a VM then remove the guest utils
rmpkg="$rmpkg $vbx virtualbox-guest-utils"
if ! [[ $VM ]]; then
rmpkg+=" virtualbox-guest-modules-arch virtualbox-guest-utils"
fi
fi
# for only gnome or cinnamon we don't need the xfce provided stuff
[[ $INSTALL_WMS == 'gnome' || $INSTALL_WMS == 'cinnamon' ]] && rmpkg="$(pacman -Qssq 'xfce4*' 2>/dev/null)"
[[ $INSTALL_WMS =~ (gnome|cinnamon) ]] && rmpkg+=" $(pacman -Qssq 'xfce4*' 2>/dev/null)"
# when not using grub bootloader remove it's package and configurations
if [[ $BOOTLDR != 'grub' ]]; then
rmpkg="$rmpkg grub"
rmpkg+=" grub"
rm -f $MNT/etc/default/grub
find $MNT/boot/ -name 'grub*' -exec rm -rf '{}' \; >/dev/null 2>&1
elif [[ $BOOTLDR != 'syslinux' ]]; then
@ -197,11 +209,10 @@ package_operations() {
fi
# iputils, base-devel, and git are all needed and should always be installed separately
local base="pacman -S iputils git --noconfirm; pacman -S base-devel --needed --noconfirm"
local install="pacman -S $inpkg --needed --noconfirm"
local remove="pacman -Rs $rmpkg --noconfirm"
chroot_cmd "pacman -Syyu --noconfirm; $base; $install; $remove" 2>/dev/null
chroot_cmd "pacman -Syyu --noconfirm"
chroot_cmd "pacman -S iputils git --noconfirm; pacman -S base-devel --needed --noconfirm"
chroot_cmd "pacman -S $inpkg --needed --noconfirm"
chroot_cmd "pacman -Rs $rmpkg --noconfirm"
# for neovim copy the default vimrc and colorscheme to ~/.config/nvim
if [[ $EXTRA_PACKAGES =~ neovim ]]; then
@ -213,19 +224,19 @@ package_operations() {
# install and setup dwm
if [[ $INSTALL_WMS =~ dwm ]]; then
mkdir -pv $MNT/home/$LIVE/suckless
for prog in dwm dmenu st; do
chroot_cmd "git clone https://bitbucket.org/natemaia/$prog /home/$LIVE/suckless/$prog && cd /home/$LIVE/suckless/$prog"
[[ -e $MNT/home/$LIVE/suckless/$prog/config.h ]] && rm -f $MNT/home/$LIVE/suckless/$prog/config.h
chroot_cmd "make clean install && make clean"
for i in dwm dmenu st; do
p="/home/$LIVE/suckless/$i"
chroot_cmd "git clone https://bitbucket.org/natemaia/$i $p && { cd $p; rm -f $p/config.h 2>/dev/null; make clean install && make clean; }"
done
fi
}
login_manager() {
local service="$MNT/etc/systemd/system/getty@tty1.service.d"
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
rm -rf $MNT/etc/systemd/system/getty@tty1.service.d
for file in $MNT/home/$LIVE/.{xinitrc,zprofile}; do
awk '{if($0 && $0 !~ "^#") print "# "$0; else print $0}' $file > $file
rm -rf $service
for f in $MNT/home/$LIVE/.{xinitrc,zprofile}; do
awk '{if($0 && $0 !~ "^#") print "# "$0; else print $0}' $f > $f
done
chroot_cmd 'systemctl enable lightdm.service && systemctl set-default graphical.target'
cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf << EOF
@ -248,11 +259,22 @@ EOF
fi
else # xinit login
sed -i "s/openbox-session/${LOGIN_WM}/g" $MNT/home/$LIVE/.xinitrc
sed -i 's|exec sudo archlabs-installer|exec startx -- vt1 &>/dev/null|' $MNT/home/$LIVE/.zprofile
if [[ $AUTOLOGIN == true ]]; then
sed -i "s/${LIVE}/${NEWUSER}/g" $MNT/etc/systemd/system/getty@tty1.service.d/autologin.conf
if grep -q '#exec' $MNT/home/$LIVE/.zprofile; then
sed -i 's/#exec/exec/' $MNT/home/$LIVE/.zprofile
elif grep -q 'exec sudo archlabs-installer' $MNT/home/$LIVE/.zprofile; then
sed -i 's|exec sudo archlabs-installer|exec startx -- vt1 >/dev/null 2>&1|' $MNT/home/$LIVE/.zprofile
else
rm -rf $MNT/etc/systemd/system/getty@tty1.service.d
cat > ~/test << EOF
if [[ ! \$DISPLAY && \$XDG_VTNR -eq 1 ]]; then
exec startx -- vt1 >/dev/null 2>&1
fi
EOF
fi
if [[ $AUTOLOGIN == true ]]; then
sed -i "s/${LIVE}/${NEWUSER}/g" $service/autologin.conf
else
rm -rf $service
fi
fi
}

View File

@ -69,14 +69,13 @@ confirm_mount() {
local msg="Partition: $part\n"
[[ $mount == "$MNT" ]] && msg+="Mountpoint: / (root)" || msg+="Mountpoint: ${mount#$MNT}"
if ! [[ $(mount) =~ "$mount" ]]; then
if [[ $(mount) =~ "$mount" ]]; then
infobox "$_MntTitle" "$_MntSucc\n$msg\n" 1
decr_count "$part"
else
infobox "$_MntTitle" "$_MntFail\n$msg\n" 1
return 1
fi
return 0
}
@ -255,24 +254,29 @@ select_device() {
}
edit_partitions() {
local device="$1"
if [[ $device == "" ]]; then
local device
if [[ $# -eq 0 ]]; then
select_device 'root' || return 1
device="$DEVICE"
else
device="$1"
fi
tput civis
local choice
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_PartTitle " --menu "$_PartBody" 0 0 0 "$_PartAuto" "-" \
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PartTitle " \
--menu "$_PartBody" 0 0 0 "$_PartShowTree" "-" "$_PartAuto" "-" \
$( ([[ $DISPLAY ]] && hash gparted >/dev/null 2>&1) && printf "gparted -") \
"cfdisk" "-" "parted" "-" "$_PartWipe" "-")"
[[ $? != 0 || $choice == "" ]] && return 1
clear
tput cnorm
if [[ $choice != "$_PartWipe" && $choice != "$_PartAuto" ]]; then
tput civis
if [[ $choice != "$_PartWipe" && $choice != "$_PartAuto" && $choice != "$_PartShowTree" ]]; then
clear; tput cnorm
$choice $device
elif [[ $choice == "$_PartShowTree" ]]; then
msgbox "$_PrepShowDev" "\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT "$device")\n"
edit_partitions $device
elif [[ $choice == "$_PartWipe" ]]; then
yesno "$_PartWipe" "$_PartBody1 $device $_PartWipeBody2" && wipe -Ifrev $device
edit_partitions $device
@ -287,10 +291,8 @@ edit_partitions() {
########################################################
mount_main() {
msgbox "$_PrepMount" "$_WarnMount"
lvm_detect
# prepare partition list PARTS for dialog
lvm_detect
unmount_partitions
find_partitions 'part|lvm|crypt' || return 1
@ -319,7 +321,6 @@ mount_main() {
select_swap || return 1
select_extra_partitions || return 1
return 0
}
@ -347,7 +348,6 @@ select_swap() {
enable_swap "$SWAP"
decr_count "$SWAP"
fi
return 0
}

View File

@ -75,10 +75,10 @@ check_install_ready() {
if ! [[ $(lsblk -o MOUNTPOINT) =~ $MNT ]]; then
msgbox "$_ErrTitle" "$_ErrNoMount"
MENU_HIGHLIGHT=4
SELECTED=4
else
msgbox "$_ErrTitle" "$_ErrNoConfig"
MENU_HIGHLIGHT=5
SELECTED=5
fi
return 1
}