From 4fbbef3ee4adf2ec387d07153e1f8719c060a41b Mon Sep 17 00:00:00 2001 From: natemaia Date: Tue, 14 Aug 2018 19:58:07 -0700 Subject: [PATCH] Add package selection option, add back swap partition possibility --- src/installer | 140 ++++++++++++++++++++++++++++++++++------- trans/chinese.trans | 1 + trans/dutch.trans | 1 + trans/english.trans | 11 +++- trans/french.trans | 1 + trans/hungarian.trans | 1 + trans/italian.trans | 1 + trans/p_brasil.trans | 1 + trans/portuguese.trans | 1 + trans/russian.trans | 1 + trans/spanish.trans | 1 + 11 files changed, 135 insertions(+), 25 deletions(-) diff --git a/src/installer b/src/installer index d4850a3..d6ba2ad 100755 --- a/src/installer +++ b/src/installer @@ -15,7 +15,7 @@ # immutable variables { 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 TRN="/usr/share/archlabs-installer" # Translation path readonly MNT="/mnt/install" # Install mountpoint @@ -906,21 +906,36 @@ get_swap_size() { } 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 check_for_errors "fallocate -l $size $MNT/swapfile" || return 1 - chmod 600 $MNT/swapfile 2>$ERR check_for_errors "chmod 600 $MNT/swapfile" || return 1 mkswap $MNT/swapfile >/dev/null 2>$ERR check_for_errors "mkswap $MNT/swapfile" || return 1 - swapon $MNT/swapfile >/dev/null 2>$ERR check_for_errors "swapon $MNT/swapfile" || return 1 - 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 return 0 @@ -1186,7 +1201,7 @@ select_install_partitions() { if [[ $SYS == "UEFI" ]]; then select_efi_partition || { BOOT_PART=""; return 1; } elif (( COUNT > 0 )); then - select_bios_boot_partition || return 1 + select_bios_boot_partition || { BOOT_PART=""; return 1; } fi else infobox "$_PrepMount" "\nUsing boot partition: $BOOT_PART\n" @@ -1709,8 +1724,8 @@ install_main() { if [[ $UNPACKED_BASE != true ]]; then # whether to use a custom mirror sorting command later update_mirrorlist_cmd || MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate" - choose_window_manager || return 1 + select_extra_packages # user can choose to bail at this point unpack_base_system || { initialize_variables; return 1; } @@ -1734,6 +1749,10 @@ install_main() { DONE_UPDATE=true else 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 # 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 local pkgs="$WM_PACKAGES" [[ $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" \ --title " Install Packages " --progressbox "\nInstalling packages chosen during install setup.\n\n$pkgs" 30 90 @@ -1814,29 +1834,101 @@ install_packages() { return 0 } -setup_lightdm() { - chroot_cmd 'systemctl enable lightdm.service && systemctl set-default graphical.target' >/dev/null 2>&1 - - 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 - - if [[ $AUTOLOGIN == true ]]; then - chroot_cmd 'groupadd -r nopasswdlogin' >/dev/null 2>&1 - 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 +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 + + 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 + + if [[ $AUTOLOGIN == true ]]; then + chroot_cmd 'groupadd -r nopasswdlogin' >/dev/null 2>&1 + 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 + fi + } + update_system() { local pkgcmd pkgcmd="pacman -Syyu --noconfirm; pacman -S iputils --noconfirm; pacman -S base-devel git --needed --noconfirm" - pkgcmd="pacman -Rs archlabs-installer --noconfirm; $pkgcmd" + 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" + fi tput civis chroot_cmd "$pkgcmd" 2>/dev/null | dialog --cr-wrap --backtitle "$BT" \ diff --git a/trans/chinese.trans b/trans/chinese.trans index 51e6807..d149e5e 100644 --- a/trans/chinese.trans +++ b/trans/chinese.trans @@ -127,6 +127,7 @@ _FSBody="如果不确定的话建议使用ext4.\n\n并不是所有格式类型 _SelRootBody="选择根分区 (/).\n\n这是 $DIST 安装的位置." _SelSwpBody="是否启用交换分区? (可选)\n\n选择使用交换文件还是交换分区n\n\n交换文件的大小默认为内存容量,也可以在接下来的步骤中修改." _SelSwpFile="交换文件" +_SelSwpNone="沒有" _SelUefiBody="选择EFI分区.\n\n这是一个用于启动较新系统的特殊分区. 通常位于硬盘第一个分区,大小100-500M,分区格式为vfat/fat32." _FormUefiBody="[重要]\nEFI分区" _FormBiosBody="[重要]\nboot分区" diff --git a/trans/dutch.trans b/trans/dutch.trans index 249eac5..b42b7ce 100644 --- a/trans/dutch.trans +++ b/trans/dutch.trans @@ -153,6 +153,7 @@ _SelRootBody="Selecteer de ROOT Partitie.\n\nDit is waar $DIST zal worden geïns # Selecteer SWAP _SelSwpBody="Selecteer de SWAP Partitie.\n\nBij gebruik van SWAP, zal deze even groot ingesteld worden als de hoeveelheid RAM." _SelSwpFile="Swapbestand" +_SelSwpNone="Geen" # Selecteer UEFI _SelUefiBody="Selecteer een UEFI Partitie.\n\nDit is een speciale partitie voor het starten van UEFI systemen." diff --git a/trans/english.trans b/trans/english.trans index 00c47b4..c76c2cb 100644 --- a/trans/english.trans +++ b/trans/english.trans @@ -117,6 +117,10 @@ _AutoLoginBody="\nDo you want to automatically log in when the computer starts?" _PackageChoice="Additional Packages" _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 @@ -189,11 +193,16 @@ _FSTitle="Choose Filesystem" _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." _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" _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:" _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." _FormUefiBody="IMPORTANT:\n\nThe EFI partition" _FormBiosBody="IMPORTANT:\n\nThe boot partition" diff --git a/trans/french.trans b/trans/french.trans index 1177a8d..c682b9f 100644 --- a/trans/french.trans +++ b/trans/french.trans @@ -148,6 +148,7 @@ _SelRootBody="\nSélectionner la partition racine (ROOT) où $DIST sera install # 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)." _SelSwpFile="Fichier d'échange" +_SelSwpNone="Aucun" # Formater UEFI _FormUefiBody="[IMPORTANT]\nLa partition EFI" diff --git a/trans/hungarian.trans b/trans/hungarian.trans index 35a510b..a81e2a8 100644 --- a/trans/hungarian.trans +++ b/trans/hungarian.trans @@ -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 _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" +_SelSwpNone="Egyik sem" # 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." diff --git a/trans/italian.trans b/trans/italian.trans index a5f9ba4..678f2d0 100644 --- a/trans/italian.trans +++ b/trans/italian.trans @@ -148,6 +148,7 @@ _SelRootBody="\nSelezionare partizione ROOT. $DIST sarà installata qui." # Select SWAP _SelSwpBody="\nSelezionare partizione SWAP. Se si opta per uno Swapfile, sarà creato della stessa dimensione della RAM." _SelSwpFile="File di Swap" +_SelSwpNone="Nessuna" # Select UEFI _SelUefiBody="\nSelezionare partizione UEFI. È una partizione speciale per l'avvio nei sistemi UEFI." diff --git a/trans/p_brasil.trans b/trans/p_brasil.trans index 5f4a40e..c923893 100644 --- a/trans/p_brasil.trans +++ b/trans/p_brasil.trans @@ -148,6 +148,7 @@ _SelRootBody="\nSelecione a partição ROOT. Este é o lugar onde $DIST será in # 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." _SelSwpFile="Arquivo SWAP" +_SelSwpNone="Nenhum" # Selecionar UEFI _SelUefiBody="\nSelecione a partição UEFI. Esta é a partição especial para iniciar sistemas UEFI." diff --git a/trans/portuguese.trans b/trans/portuguese.trans index 0381770..7b278e4 100644 --- a/trans/portuguese.trans +++ b/trans/portuguese.trans @@ -148,6 +148,7 @@ _SelRootBody="\nSeleccione a partição ROOT. Este é o lugar onde $DIST será i # 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." _SelSwpFile="Arquivo SWAP" +_SelSwpNone="Nenhum" # Seleccionar UEFI _SelUefiBody="\nSeleccione a partição UEFI. Esta é a partição especial para iniciar sistemas UEFI." diff --git a/trans/russian.trans b/trans/russian.trans index d6b6af9..c2b5b5f 100644 --- a/trans/russian.trans +++ b/trans/russian.trans @@ -148,6 +148,7 @@ _SelRootBody="\nВыберите ROOT раздел. Это тот раздел # Select SWAP _SelSwpBody="\nВыберите SWAP раздел. Если выбрать Swapfile, то он будет создан соразмерно вашей RAM-памяти." _SelSwpFile="Swapfile" +_SelSwpNone="Нету" # Select UEFI _SelUefiBody="\nВыберите UEFI раздел. Это специальный раздел для загрузки UEFI систем." diff --git a/trans/spanish.trans b/trans/spanish.trans index 709cdc2..5a297f8 100644 --- a/trans/spanish.trans +++ b/trans/spanish.trans @@ -148,6 +148,7 @@ _SelRootBody="\nSeleccione la partición RAÍZ. Aquí es donde se instalará $DI # 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." _SelSwpFile="Archivo SWAP" +_SelSwpNone="Ninguno" # Seleccionar UEFI _SelUefiBody="\nSeleccione la partición UEFI. Ésta es una partición especial para arrancar los sistemas UEFI."