Add package selection option, add back swap partition possibility

This commit is contained in:
natemaia 2018-08-14 19:58:07 -07:00
parent dd36a8bb67
commit 4fbbef3ee4
11 changed files with 135 additions and 25 deletions

View File

@ -15,7 +15,7 @@
# immutable variables { # immutable variables {
readonly DIST="Archlabs" # Linux distributor readonly DIST="Archlabs" # Linux distributor
readonly VER="1.6.26" # Installer version readonly VER="1.6.27" # Installer version
readonly LIVE="liveuser" # Live session user readonly LIVE="liveuser" # Live session user
readonly TRN="/usr/share/archlabs-installer" # Translation path readonly TRN="/usr/share/archlabs-installer" # Translation path
readonly MNT="/mnt/install" # Install mountpoint readonly MNT="/mnt/install" # Install mountpoint
@ -906,21 +906,36 @@ get_swap_size() {
} }
select_swap() { select_swap() {
if yesno "$_SelSwpSetup" "$_SwapSetup\n" && get_swap_size; then # Ask user to select partition or create swapfile
SWAP="$(dialog --backtitle "$BT" --cr-wrap --stdout --title " $_SelSwpSetup " \
--menu "$_SelSwpBody" 0 0 0 "$_SelSwpNone" "-" "$_SelSwpFile" "-" $PARTS)"
[[ $? != 0 || $SWAP == "$_SelSwpNone" ]] && return 0
if [[ $SWAP == "$_SelSwpFile" ]]; then
get_swap_size || return 1
fallocate -l $SWAP_SIZE $MNT/swapfile 2>$ERR fallocate -l $SWAP_SIZE $MNT/swapfile 2>$ERR
check_for_errors "fallocate -l $size $MNT/swapfile" || return 1 check_for_errors "fallocate -l $size $MNT/swapfile" || return 1
chmod 600 $MNT/swapfile 2>$ERR chmod 600 $MNT/swapfile 2>$ERR
check_for_errors "chmod 600 $MNT/swapfile" || return 1 check_for_errors "chmod 600 $MNT/swapfile" || return 1
mkswap $MNT/swapfile >/dev/null 2>$ERR mkswap $MNT/swapfile >/dev/null 2>$ERR
check_for_errors "mkswap $MNT/swapfile" || return 1 check_for_errors "mkswap $MNT/swapfile" || return 1
swapon $MNT/swapfile >/dev/null 2>$ERR swapon $MNT/swapfile >/dev/null 2>$ERR
check_for_errors "swapon $MNT/swapfile" || return 1 check_for_errors "swapon $MNT/swapfile" || return 1
SWAP_FILE="/swapfile" SWAP_FILE="/swapfile"
else
# Warn user if creating a new swap
if ! grep -qi "swap" <<< "$(lsblk -o FSTYPE $SWAP)"; then
yesno "$_PrepMount" "\nmkswap $SWAP\n" || return 0
mkswap $SWAP >/dev/null 2>$ERR
check_for_errors "mkswap $SWAP" || return 1
fi
swapon $SWAP >/dev/null 2>$ERR
check_for_error "swapon $SWAP" || return 1
decrease_part_count "$SWAP"
SWAP_FILE="$SWAP"
fi fi
return 0 return 0
@ -1186,7 +1201,7 @@ select_install_partitions() {
if [[ $SYS == "UEFI" ]]; then if [[ $SYS == "UEFI" ]]; then
select_efi_partition || { BOOT_PART=""; return 1; } select_efi_partition || { BOOT_PART=""; return 1; }
elif (( COUNT > 0 )); then elif (( COUNT > 0 )); then
select_bios_boot_partition || return 1 select_bios_boot_partition || { BOOT_PART=""; return 1; }
fi fi
else else
infobox "$_PrepMount" "\nUsing boot partition: $BOOT_PART\n" infobox "$_PrepMount" "\nUsing boot partition: $BOOT_PART\n"
@ -1709,8 +1724,8 @@ install_main() {
if [[ $UNPACKED_BASE != true ]]; then if [[ $UNPACKED_BASE != true ]]; then
# whether to use a custom mirror sorting command later # whether to use a custom mirror sorting command later
update_mirrorlist_cmd || MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate" update_mirrorlist_cmd || MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate"
choose_window_manager || return 1 choose_window_manager || return 1
select_extra_packages
# user can choose to bail at this point # user can choose to bail at this point
unpack_base_system || { initialize_variables; return 1; } unpack_base_system || { initialize_variables; return 1; }
@ -1734,6 +1749,10 @@ install_main() {
DONE_UPDATE=true DONE_UPDATE=true
else else
chroot_cmd "pacman -Rs archlabs-installer --noconfirm" >/dev/null 2>&1 chroot_cmd "pacman -Rs archlabs-installer --noconfirm" >/dev/null 2>&1
if ! grep -qi "hypervisor" <<< "$(dmesg)" && pacman -Qsq virtualbox-guest &>/dev/null; then
chroot_cmd "pacman -Rns $(pacman -Qsq virtualbox-guest) --noconfirm" >/dev/null 2>&1
[[ -e $MNT/etc/xdg/autostart/vboxclient.desktop ]] && rm -f $MNT/etc/xdg/autostart/vboxclient.desktop
fi
fi fi
# these also only should need to be run once, when done jump to the config edit menu # these also only should need to be run once, when done jump to the config edit menu
@ -1806,6 +1825,7 @@ install_packages() {
tput civis tput civis
local pkgs="$WM_PACKAGES" local pkgs="$WM_PACKAGES"
[[ $LOGIN_TYPE == 'lightdm' ]] && pkgs="$pkgs lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice" [[ $LOGIN_TYPE == 'lightdm' ]] && pkgs="$pkgs lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
[[ $EXTRA_PACKAGES != "" ]] && pkgs="$pkgs $EXTRA_PACKAGES"
chroot_cmd "pacman -S $pkgs --needed --noconfirm" 2>/dev/null | dialog --cr-wrap --backtitle "$BT" \ chroot_cmd "pacman -S $pkgs --needed --noconfirm" 2>/dev/null | dialog --cr-wrap --backtitle "$BT" \
--title " Install Packages " --progressbox "\nInstalling packages chosen during install setup.\n\n$pkgs" 30 90 --title " Install Packages " --progressbox "\nInstalling packages chosen during install setup.\n\n$pkgs" 30 90
@ -1814,7 +1834,75 @@ install_packages() {
return 0 return 0
} }
setup_lightdm() { select_extra_packages() {
if yesno "$_ExtraPackages" "$_ChooseExtraPackages"; then
EXTRA_PACKAGES="$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_WMChoice " --checklist "$_WMChoiceBody\n" 0 0 20 \
"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 \
"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 \
"urxvt" "A unicode enabled rxvt-clone 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 primarily for the XFCE desktop" off \
"termite" "A minimal VTE-based terminal emulator" off \
"pcmanfm" "A fast and lightweight file manager" off \
"gnome-disk-utility" "Disk Management Utility" off \
"gnome-system-monitor" "View current processes and monitor system state" off \
"steam steam-native-runtime" "A popular game distribution platform by Valve" off \
"vlc qt4" "a free and open source cross-platform multimedia player" 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" "Document viewer" off \
"zathura" "Minimalistic document viewer" off \
"qpdfview" "A tabbed PDF viewer" off \
"mupdf" "Lightweight PDF and XPS 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 \
"guvcview" "Capture video from camera devices" off \
"gpick" "Advanced color picker using GTK+ toolkit" off \
"gcolor2" "A simple GTK+2 color selector" off \
"plank" "Stupidly simple dock" off \
"docky" "The finest dock no money can buy" off \
"cairo-dock" "Light, eye-candy filled dock and desklets" 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-cjk" "Google Noto CJK fonts (Chinese, Japanese, Korean)" off)"
fi
return 0
}
setup_lightdm() {
chroot_cmd 'systemctl enable lightdm.service && systemctl set-default graphical.target' >/dev/null 2>&1 chroot_cmd 'systemctl enable lightdm.service && systemctl set-default graphical.target' >/dev/null 2>&1
local cfg="$MNT/etc/lightdm/lightdm-gtk-greeter.conf" local cfg="$MNT/etc/lightdm/lightdm-gtk-greeter.conf"
@ -1831,12 +1919,16 @@ setup_lightdm() {
sed -i '/#%PAM-1.0/ a auth sufficient pam_succeed_if.so user ingroup nopasswdlogin' $MNT/etc/pam.d/lightdm 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-session=/ c autologin-session=${LOGIN_WM}" $MNT/etc/lightdm/lightdm.conf
fi fi
} }
update_system() { update_system() {
local pkgcmd local pkgcmd
pkgcmd="pacman -Syyu --noconfirm; pacman -S iputils --noconfirm; pacman -S base-devel git --needed --noconfirm" pkgcmd="pacman -Syyu --noconfirm; pacman -S iputils --noconfirm; pacman -S base-devel git --needed --noconfirm"
if ! grep -qi "hypervisor" <<< "$(dmesg)" && pacman -Qsq virtualbox-guest &>/dev/null; then
pkgcmd="pacman -Rs archlabs-installer $(pacman -Qsq virtualbox-guest) --noconfirm; $pkgcmd"
else
pkgcmd="pacman -Rs archlabs-installer --noconfirm; $pkgcmd" pkgcmd="pacman -Rs archlabs-installer --noconfirm; $pkgcmd"
fi
tput civis tput civis
chroot_cmd "$pkgcmd" 2>/dev/null | dialog --cr-wrap --backtitle "$BT" \ chroot_cmd "$pkgcmd" 2>/dev/null | dialog --cr-wrap --backtitle "$BT" \

View File

@ -127,6 +127,7 @@ _FSBody="如果不确定的话建议使用ext4.\n\n并不是所有格式类型
_SelRootBody="选择根分区 (/).\n\n这是 $DIST 安装的位置." _SelRootBody="选择根分区 (/).\n\n这是 $DIST 安装的位置."
_SelSwpBody="是否启用交换分区? (可选)\n\n选择使用交换文件还是交换分区n\n\n交换文件的大小默认为内存容量也可以在接下来的步骤中修改." _SelSwpBody="是否启用交换分区? (可选)\n\n选择使用交换文件还是交换分区n\n\n交换文件的大小默认为内存容量也可以在接下来的步骤中修改."
_SelSwpFile="交换文件" _SelSwpFile="交换文件"
_SelSwpNone="沒有"
_SelUefiBody="选择EFI分区.\n\n这是一个用于启动较新系统的特殊分区. 通常位于硬盘第一个分区大小100-500M,分区格式为vfat/fat32." _SelUefiBody="选择EFI分区.\n\n这是一个用于启动较新系统的特殊分区. 通常位于硬盘第一个分区大小100-500M,分区格式为vfat/fat32."
_FormUefiBody="[重要]\nEFI分区" _FormUefiBody="[重要]\nEFI分区"
_FormBiosBody="[重要]\nboot分区" _FormBiosBody="[重要]\nboot分区"

View File

@ -153,6 +153,7 @@ _SelRootBody="Selecteer de ROOT Partitie.\n\nDit is waar $DIST zal worden geïns
# Selecteer SWAP # Selecteer SWAP
_SelSwpBody="Selecteer de SWAP Partitie.\n\nBij gebruik van SWAP, zal deze even groot ingesteld worden als de hoeveelheid RAM." _SelSwpBody="Selecteer de SWAP Partitie.\n\nBij gebruik van SWAP, zal deze even groot ingesteld worden als de hoeveelheid RAM."
_SelSwpFile="Swapbestand" _SelSwpFile="Swapbestand"
_SelSwpNone="Geen"
# Selecteer UEFI # Selecteer UEFI
_SelUefiBody="Selecteer een UEFI Partitie.\n\nDit is een speciale partitie voor het starten van UEFI systemen." _SelUefiBody="Selecteer een UEFI Partitie.\n\nDit is een speciale partitie voor het starten van UEFI systemen."

View File

@ -117,6 +117,10 @@ _AutoLoginBody="\nDo you want to automatically log in when the computer starts?"
_PackageChoice="Additional Packages" _PackageChoice="Additional Packages"
_PackageChoiceBody="\nUse [Space] to select/deselect additional packages to install." _PackageChoiceBody="\nUse [Space] to select/deselect additional packages to install."
_ChooseExtraPackages="\nChoose additional packages to install?\n"
_ExtraPackages="Extra Packages"
_ExtraPackagesBody="\nUse [Space] to select/deselect packages(s) to install from the list below."
## END NEW ## END NEW
@ -189,11 +193,16 @@ _FSTitle="Choose Filesystem"
_FSBody="\nRecommended: ext4\n\nNOTE: Some aren't usable for root (/) or boot (/boot) partitions." _FSBody="\nRecommended: ext4\n\nNOTE: Some aren't usable for root (/) or boot (/boot) partitions."
_SelRootBody="\nSelect root (/) partition.\n\nThis is the partition where $DIST will be installed." _SelRootBody="\nSelect root (/) partition.\n\nThis is the partition where $DIST will be installed."
_SelBiosBody="\nDo you want to use a seperate boot partition? (required for LUKS)\n\nThis partition is where the bootloader will be installed.\n" _SelBiosBody="\nDo you want to use a seperate boot partition? (required for LUKS)\n\nThis partition is where the bootloader will be installed.\n"
_SelSwpFile="Swapfile" _SelSwpFile="Swapfile"
_SelSwpSetup="Swap Setup" _SelSwpSetup="Swap Setup"
_SwapSetup="\nDo you want to use a swapfile?"
_SelSwpBody="\nSelect SWAP partition/file, or none. If using a swapfile, it will be initially set the same size as your RAM."
_SelSwpNone="None"
_SelSwpErr="Swap Setup Error: Must be 1(M|G) or greater, and can only contain whole numbers\n\nSize Entered:" _SelSwpErr="Swap Setup Error: Must be 1(M|G) or greater, and can only contain whole numbers\n\nSize Entered:"
_SelSwpSize="\nEnter the size to use for swap.\n\nMust be greater than 1, end in either M or G, and contain only whole numbers." _SelSwpSize="\nEnter the size to use for swap.\n\nMust be greater than 1, end in either M or G, and contain only whole numbers."
_SelUefiBody="\nSelect the system EFI boot partition.\n\nThis is a special partition used for booting newer UEFI systems. Usually the first partition on the drive, less than 512M, and formatted as vfat/fat32." _SelUefiBody="\nSelect the system EFI boot partition.\n\nThis is a special partition used for booting newer UEFI systems. Usually the first partition on the drive, less than 512M, and formatted as vfat/fat32."
_FormUefiBody="IMPORTANT:\n\nThe EFI partition" _FormUefiBody="IMPORTANT:\n\nThe EFI partition"
_FormBiosBody="IMPORTANT:\n\nThe boot partition" _FormBiosBody="IMPORTANT:\n\nThe boot partition"

View File

@ -148,6 +148,7 @@ _SelRootBody="\nSélectionner la partition racine (ROOT) où $DIST sera install
# Sélectionner le fichier d'échange (SWAP) # Sélectionner le fichier d'échange (SWAP)
_SelSwpBody="\nSélectionner une partition SWAP. Le fichier d'échange créé doit être de la même taille que votre mémoire vive (RAM)." _SelSwpBody="\nSélectionner une partition SWAP. Le fichier d'échange créé doit être de la même taille que votre mémoire vive (RAM)."
_SelSwpFile="Fichier d'échange" _SelSwpFile="Fichier d'échange"
_SelSwpNone="Aucun"
# Formater UEFI # Formater UEFI
_FormUefiBody="[IMPORTANT]\nLa partition EFI" _FormUefiBody="[IMPORTANT]\nLa partition EFI"

View File

@ -148,6 +148,7 @@ _SelRootBody="\nVálassz gyökérpartíciót (ROOT). Ez lesz ahová az $DIST tel
# Cserepartíció (SWAP) kiválasztása # Cserepartíció (SWAP) kiválasztása
_SelSwpBody="\nVálassz cserepartíciót (SWAP). Ha lapozófájlt használsz ezzel létrejön a RAM azonos méretű cserefájl." _SelSwpBody="\nVálassz cserepartíciót (SWAP). Ha lapozófájlt használsz ezzel létrejön a RAM azonos méretű cserefájl."
_SelSwpFile="Cserefájl" _SelSwpFile="Cserefájl"
_SelSwpNone="Egyik sem"
# UEFI kiválasztása # UEFI kiválasztása
_SelUefiBody="\nVálassz UEFI partíciót. Ez egy speciális partíció az UEFI rendszerek indítása számára." _SelUefiBody="\nVálassz UEFI partíciót. Ez egy speciális partíció az UEFI rendszerek indítása számára."

View File

@ -148,6 +148,7 @@ _SelRootBody="\nSelezionare partizione ROOT. $DIST sarà installata qui."
# Select SWAP # Select SWAP
_SelSwpBody="\nSelezionare partizione SWAP. Se si opta per uno Swapfile, sarà creato della stessa dimensione della RAM." _SelSwpBody="\nSelezionare partizione SWAP. Se si opta per uno Swapfile, sarà creato della stessa dimensione della RAM."
_SelSwpFile="File di Swap" _SelSwpFile="File di Swap"
_SelSwpNone="Nessuna"
# Select UEFI # Select UEFI
_SelUefiBody="\nSelezionare partizione UEFI. È una partizione speciale per l'avvio nei sistemi UEFI." _SelUefiBody="\nSelezionare partizione UEFI. È una partizione speciale per l'avvio nei sistemi UEFI."

View File

@ -148,6 +148,7 @@ _SelRootBody="\nSelecione a partição ROOT. Este é o lugar onde $DIST será in
# Selecionar SWAP # Selecionar SWAP
_SelSwpBody="\nSelecione a partição SWAP. Se você utiliza um arquivo Swap, ele será criado do mesmo tamanho da sua memória RAM." _SelSwpBody="\nSelecione a partição SWAP. Se você utiliza um arquivo Swap, ele será criado do mesmo tamanho da sua memória RAM."
_SelSwpFile="Arquivo SWAP" _SelSwpFile="Arquivo SWAP"
_SelSwpNone="Nenhum"
# Selecionar UEFI # Selecionar UEFI
_SelUefiBody="\nSelecione a partição UEFI. Esta é a partição especial para iniciar sistemas UEFI." _SelUefiBody="\nSelecione a partição UEFI. Esta é a partição especial para iniciar sistemas UEFI."

View File

@ -148,6 +148,7 @@ _SelRootBody="\nSeleccione a partição ROOT. Este é o lugar onde $DIST será i
# Seleccionar SWAP # Seleccionar SWAP
_SelSwpBody="\nSeleccione a partição SWAP. Se você utiliza um arquivo Swap, ele será criado do mesmo tamanho da sua memória RAM." _SelSwpBody="\nSeleccione a partição SWAP. Se você utiliza um arquivo Swap, ele será criado do mesmo tamanho da sua memória RAM."
_SelSwpFile="Arquivo SWAP" _SelSwpFile="Arquivo SWAP"
_SelSwpNone="Nenhum"
# Seleccionar UEFI # Seleccionar UEFI
_SelUefiBody="\nSeleccione a partição UEFI. Esta é a partição especial para iniciar sistemas UEFI." _SelUefiBody="\nSeleccione a partição UEFI. Esta é a partição especial para iniciar sistemas UEFI."

View File

@ -148,6 +148,7 @@ _SelRootBody="\nВыберите ROOT раздел. Это тот раздел
# Select SWAP # Select SWAP
_SelSwpBody="\nВыберите SWAP раздел. Если выбрать Swapfile, то он будет создан соразмерно вашей RAM-памяти." _SelSwpBody="\nВыберите SWAP раздел. Если выбрать Swapfile, то он будет создан соразмерно вашей RAM-памяти."
_SelSwpFile="Swapfile" _SelSwpFile="Swapfile"
_SelSwpNone="Нету"
# Select UEFI # Select UEFI
_SelUefiBody="\nВыберите UEFI раздел. Это специальный раздел для загрузки UEFI систем." _SelUefiBody="\nВыберите UEFI раздел. Это специальный раздел для загрузки UEFI систем."

View File

@ -148,6 +148,7 @@ _SelRootBody="\nSeleccione la partición RAÍZ. Aquí es donde se instalará $DI
# Seleccionar SWAP # Seleccionar SWAP
_SelSwpBody="\nSeleccione la partición SWAP. Si va a usar un archivo SWAP, se creará con un tamaño igual al de la memoria RAM del equipo." _SelSwpBody="\nSeleccione la partición SWAP. Si va a usar un archivo SWAP, se creará con un tamaño igual al de la memoria RAM del equipo."
_SelSwpFile="Archivo SWAP" _SelSwpFile="Archivo SWAP"
_SelSwpNone="Ninguno"
# Seleccionar UEFI # Seleccionar UEFI
_SelUefiBody="\nSeleccione la partición UEFI. Ésta es una partición especial para arrancar los sistemas UEFI." _SelUefiBody="\nSeleccione la partición UEFI. Ésta es una partición especial para arrancar los sistemas UEFI."