From dd25a38120a23b6b2a8591162e9b83414c32d015 Mon Sep 17 00:00:00 2001 From: Bernhard Landauer Date: Thu, 2 Mar 2017 06:02:09 +0100 Subject: [PATCH] separate advanced stuff from regular, reorganize --- Makefile | 1 + bin/manjaro-architect.in | 1 + lib/util-base.sh | 654 ++++++++++++++------------------------- lib/util-desktop-full.sh | 330 ++++++++++++++++++++ lib/util-desktop.sh | 341 +------------------- lib/util-menu-full.sh | 295 ++++++++++++++++++ lib/util-menu.sh | 455 +-------------------------- 7 files changed, 860 insertions(+), 1217 deletions(-) create mode 100644 lib/util-desktop-full.sh diff --git a/Makefile b/Makefile index 1f07014..d8c1d75 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ LIBS = \ lib/util.sh \ lib/util-base.sh \ lib/util-desktop.sh \ + lib/util-desktop-full.sh \ lib/util-disk.sh \ lib/util-menu.sh \ lib/util-menu-full.sh diff --git a/bin/manjaro-architect.in b/bin/manjaro-architect.in index cb0ed58..f908985 100644 --- a/bin/manjaro-architect.in +++ b/bin/manjaro-architect.in @@ -32,6 +32,7 @@ menu_choice if [[ menu_opt == "advanced" ]]; then import ${LIBDIR}/util-menu-full.sh + import ${LIBDIR}/util-desktop-full.sh main_menu_full else main_menu diff --git a/lib/util-base.sh b/lib/util-base.sh index 8b98aa5..a0b35d1 100644 --- a/lib/util-base.sh +++ b/lib/util-base.sh @@ -10,233 +10,6 @@ # as published by the Free Software Foundation. So feel free to copy, distribute, # or modify it as you wish. -# virtual console keymap -set_keymap() { - KEYMAPS="" - for i in $(ls -R /usr/share/kbd/keymaps | grep "map.gz" | sed 's/\.map\.gz//g' | sort); do - KEYMAPS="${KEYMAPS} ${i} -" - done - - DIALOG " $_VCKeymapTitle " --menu "$_VCKeymapBody" 20 40 16 ${KEYMAPS} 2>${ANSWER} || return 0 - KEYMAP=$(cat ${ANSWER}) - - loadkeys $KEYMAP 2>$ERR - check_for_error "loadkeys $KEYMAP" "$?" - biggest_resolution=$(head -n 1 /sys/class/drm/card*/*/modes | awk -F'[^0-9]*' '{print $1}' | awk 'BEGIN{a= 0}{if ($1>a) a=$1 fi} END{print a}') - # Choose terminus font size depending on resolution - if [[ $biggest_resolution -gt 1920 ]]; then - FONT=ter-124n - elif [[ $biggest_resolution -eq 1920 ]]; then - FONT=ter-118n - else - FONT=ter-114n - fi - echo -e "KEYMAP=${KEYMAP}\nFONT=${FONT}" > /tmp/vconsole.conf -} - -# Set keymap for X11 -set_xkbmap() { - XKBMAP_LIST="" - keymaps_xkb=("af al am at az ba bd be bg br bt bw by ca cd ch cm cn cz de dk ee es et eu fi fo fr\ - gb ge gh gn gr hr hu ie il in iq ir is it jp ke kg kh kr kz la lk lt lv ma md me mk ml mm mn mt mv\ - ng nl no np pc ph pk pl pt ro rs ru se si sk sn sy tg th tj tm tr tw tz ua us uz vn za") - - for i in ${keymaps_xkb}; do - XKBMAP_LIST="${XKBMAP_LIST} ${i} -" - done - - DIALOG " $_PrepKBLayout " --menu "$_XkbmapBody" 0 0 16 ${XKBMAP_LIST} 2>${ANSWER} || return 0 - XKBMAP=$(cat ${ANSWER} |sed 's/_.*//') - echo -e "Section "\"InputClass"\"\nIdentifier "\"system-keyboard"\"\nMatchIsKeyboard "\"on"\"\nOption "\"XkbLayout"\" "\"${XKBMAP}"\"\nEndSection" \ - > ${MOUNTPOINT}/etc/X11/xorg.conf.d/00-keyboard.conf -} - -# locale array generation code adapted from the Manjaro 0.8 installer -set_locale() { - LOCALES="" - for i in $(cat /etc/locale.gen | grep -v "# " | sed 's/#//g' | sed 's/ UTF-8//g' | grep .UTF-8); do - LOCALES="${LOCALES} ${i} -" - done - - DIALOG " $_ConfBseSysLoc " --menu "$_localeBody" 0 0 12 ${LOCALES} 2>${ANSWER} || return 0 - - LOCALE=$(cat ${ANSWER}) - - echo "LANG=\"${LOCALE}\"" > ${MOUNTPOINT}/etc/locale.conf - sed -i "s/#${LOCALE}/${LOCALE}/" ${MOUNTPOINT}/etc/locale.gen 2>$ERR - arch_chroot "locale-gen" >/dev/null 2>$ERR - check_for_error "$FUNCNAME" "$?" -} - -# Set Zone and Sub-Zone -set_timezone() { - ZONE="" - for i in $(cat /usr/share/zoneinfo/zone.tab | awk '{print $3}' | grep "/" | sed "s/\/.*//g" | sort -ud); do - ZONE="$ZONE ${i} -" - done - - DIALOG " $_ConfBseTimeHC " --menu "$_TimeZBody" 0 0 10 ${ZONE} 2>${ANSWER} || return 0 - ZONE=$(cat ${ANSWER}) - - SUBZONE="" - for i in $(cat /usr/share/zoneinfo/zone.tab | awk '{print $3}' | grep "${ZONE}/" | sed "s/${ZONE}\///g" | sort -ud); do - SUBZONE="$SUBZONE ${i} -" - done - - DIALOG " $_ConfBseTimeHC " --menu "$_TimeSubZBody" 0 0 11 ${SUBZONE} 2>${ANSWER} || return 0 - SUBZONE=$(cat ${ANSWER}) - - DIALOG " $_ConfBseTimeHC " --yesno "\n$_TimeZQ ${ZONE}/${SUBZONE}?\n\n" 0 0 - if (( $? == 0 )); then - arch_chroot "ln -sf /usr/share/zoneinfo/${ZONE}/${SUBZONE} /etc/localtime" 2>$ERR - check_for_error "$FUNCNAME ${ZONE}/${SUBZONE}" $? - fi -} - -set_hw_clock() { - DIALOG " $_ConfBseTimeHC " --menu "$_HwCBody" 0 0 2 \ - "utc" "-" \ - "localtime" "-" 2>${ANSWER} - - if [[ $(cat ${ANSWER}) != "" ]]; then - arch_chroot "hwclock --systohc --$(cat ${ANSWER})" 2>$ERR - check_for_error "$FUNCNAME" "$?" - fi -} - -# Function will not allow incorrect UUID type for installed system. -generate_fstab() { - DIALOG " $_ConfBseFstab " --menu "$_FstabBody" 0 0 4 \ - "fstabgen -p" "$_FstabDevName" \ - "fstabgen -L -p" "$_FstabDevLabel" \ - "fstabgen -U -p" "$_FstabDevUUID" \ - "fstabgen -t PARTUUID -p" "$_FstabDevPtUUID" 2>${ANSWER} - - if [[ $(cat ${ANSWER}) != "" ]]; then - if [[ $SYSTEM == "BIOS" ]] && [[ $(cat ${ANSWER}) == "fstabgen -t PARTUUID -p" ]]; then - DIALOG " $_ErrTitle " --msgbox "$_FstabErr" 0 0 - generate_fstab - else - $(cat ${ANSWER}) ${MOUNTPOINT} > ${MOUNTPOINT}/etc/fstab 2>$ERR - check_for_error "$FUNCNAME" $? - [[ -f ${MOUNTPOINT}/swapfile ]] && sed -i "s/\\${MOUNTPOINT}//" ${MOUNTPOINT}/etc/fstab - fi - fi -} - -boot_encrypted_setting() { - # Check if there is separate encrypted /boot partition - if $(lsblk | grep '/mnt/boot' | grep -q 'crypt' ); then - echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub - # Check if root is encrypted and there is no separate /boot - elif $(lsblk | grep "/mnt$" | grep -q 'crypt' ) && [[ $(lsblk | grep "/mnt/boot$") == "" ]]; then - echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub - else - true - fi -} - -set_hostname() { - DIALOG " $_ConfBseHost " --inputbox "$_HostNameBody" 0 0 "manjaro" 2>${ANSWER} || return 0 - - echo "$(cat ${ANSWER})" > ${MOUNTPOINT}/etc/hostname 2>$ERR - echo -e "#\t\t\n127.0.0.1\tlocalhost.localdomain\tlocalhost\t$(cat \ - ${ANSWER})\n::1\tlocalhost.localdomain\tlocalhost\t$(cat ${ANSWER})" > ${MOUNTPOINT}/etc/hosts 2>$ERR - check_for_error "$FUNCNAME" -} - -# Adapted and simplified from the Manjaro 0.8 and Antergos 2.0 installers -set_root_password() { - DIALOG " $_ConfUsrRoot " --clear --insecure --passwordbox "$_PassRtBody" 0 0 \ - 2> ${ANSWER} || return 0 - PASSWD=$(cat ${ANSWER}) - - DIALOG " $_ConfUsrRoot " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 \ - 2> ${ANSWER} || return 0 - PASSWD2=$(cat ${ANSWER}) - - if [[ $PASSWD == $PASSWD2 ]]; then - echo -e "${PASSWD}\n${PASSWD}" > /tmp/.passwd - arch_chroot "passwd root" < /tmp/.passwd >/dev/null 2>$ERR - check_for_error "$FUNCNAME" $? - rm /tmp/.passwd - else - DIALOG " $_ErrTitle " --msgbox "$_PassErrBody" 0 0 - set_root_password - fi -} - -# Originally adapted from the Antergos 2.0 installer -create_new_user() { - DIALOG " $_NUsrTitle " --inputbox "$_NUsrBody" 0 0 "" 2>${ANSWER} || return 0 - USER=$(cat ${ANSWER}) - - # Loop while user name is blank, has spaces, or has capital letters in it. - while [[ ${#USER} -eq 0 ]] || [[ $USER =~ \ |\' ]] || [[ $USER =~ [^a-z0-9\ ] ]]; do - DIALOG " $_NUsrTitle " --inputbox "$_NUsrErrBody" 0 0 "" 2>${ANSWER} || return 0 - USER=$(cat ${ANSWER}) - done - - DIALOG "_DefShell" --radiolist "\n\n$_UseSpaceBar" 0 0 3 \ - "zsh" "" on \ - "bash" "" off \ - "fish" "" off 2>/tmp/.shell - shell=$(cat /tmp/.shell) - - # Enter password. This step will only be reached where the loop has been skipped or broken. - DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassNUsrBody $USER\n\n" 0 0 \ - 2> ${ANSWER} || return 0 - PASSWD=$(cat ${ANSWER}) - - DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 \ - 2> ${ANSWER} || return 0 - PASSWD2=$(cat ${ANSWER}) - - # loop while passwords entered do not match. - while [[ $PASSWD != $PASSWD2 ]]; do - DIALOG " $_ErrTitle " --msgbox "$_PassErrBody" 0 0 - - DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassNUsrBody $USER\n\n" 0 0 \ - 2> ${ANSWER} || return 0 - PASSWD=$(cat ${ANSWER}) - - DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 \ - 2> ${ANSWER} || return 0 - PASSWD2=$(cat ${ANSWER}) - done - - # create new user. This step will only be reached where the password loop has been skipped or broken. - DIALOG " $_ConfUsrNew " --infobox "$_NUsrSetBody" 0 0 - sleep 2 - - # Create the user, set password, then remove temporary password file - arch_chroot "groupadd ${USER}" - arch_chroot "useradd ${USER} -m -g ${USER} -G wheel,storage,power,network,video,audio,lp -s /bin/$shell" 2>$ERR - check_for_error "add user to groups" $? - echo -e "${PASSWD}\n${PASSWD}" > /tmp/.passwd - arch_chroot "passwd ${USER}" < /tmp/.passwd >/dev/null 2>$ERR - check_for_error "create user pwd" $? - rm /tmp/.passwd - - # Set up basic configuration files and permissions for user - #arch_chroot "cp /etc/skel/.bashrc /home/${USER}" - arch_chroot "chown -R ${USER}:${USER} /home/${USER}" - [[ -e ${MOUNTPOINT}/etc/sudoers ]] && sed -i '/%wheel ALL=(ALL) ALL/s/^#//' ${MOUNTPOINT}/etc/sudoers -} - -run_mkinitcpio() { - clear - KERNEL="" - - # If LVM and/or LUKS used, add the relevant hook(s) - ([[ $LVM -eq 1 ]] && [[ $LUKS -eq 0 ]]) && { sed -i 's/block filesystems/block lvm2 filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>$ERR || check_for_error "lVM2 hooks" $?; } - ([[ $LVM -eq 1 ]] && [[ $LUKS -eq 1 ]]) && { sed -i 's/block filesystems/block encrypt lvm2 filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>$ERR || check_for_error "lVM/LUKS hooks" $?; } - ([[ $LVM -eq 0 ]] && [[ $LUKS -eq 1 ]]) && { sed -i 's/block filesystems/block encrypt filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>$ERR || check_for_error "LUKS hooks" $?; } - - arch_chroot "mkinitcpio -P" 2>$ERR - check_for_error "$FUNCNAME" "$?" -} - install_base() { # Prep variables echo "" > ${PACKAGES} @@ -360,6 +133,16 @@ install_base() { fi } +install_bootloader() { + check_base && { + if [[ $SYSTEM == "BIOS" ]]; then + bios_bootloader + else + uefi_bootloader + fi + } +} + uefi_bootloader() { #Ensure again that efivarfs is mounted [[ -z $(mount | grep /sys/firmware/efi/efivars) ]] && mount -t efivarfs efivarfs /sys/firmware/efi/efivars @@ -520,170 +303,231 @@ bios_bootloader() { fi } -install_bootloader() { - check_base && { - if [[ $SYSTEM == "BIOS" ]]; then - bios_bootloader +boot_encrypted_setting() { + # Check if there is separate encrypted /boot partition + if $(lsblk | grep '/mnt/boot' | grep -q 'crypt' ); then + echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub + # Check if root is encrypted and there is no separate /boot + elif $(lsblk | grep "/mnt$" | grep -q 'crypt' ) && [[ $(lsblk | grep "/mnt/boot$") == "" ]]; then + echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub + else + true + fi +} + +# Function will not allow incorrect UUID type for installed system. +generate_fstab() { + DIALOG " $_ConfBseFstab " --menu "$_FstabBody" 0 0 4 \ + "fstabgen -p" "$_FstabDevName" \ + "fstabgen -L -p" "$_FstabDevLabel" \ + "fstabgen -U -p" "$_FstabDevUUID" \ + "fstabgen -t PARTUUID -p" "$_FstabDevPtUUID" 2>${ANSWER} + + if [[ $(cat ${ANSWER}) != "" ]]; then + if [[ $SYSTEM == "BIOS" ]] && [[ $(cat ${ANSWER}) == "fstabgen -t PARTUUID -p" ]]; then + DIALOG " $_ErrTitle " --msgbox "$_FstabErr" 0 0 + generate_fstab else - uefi_bootloader + $(cat ${ANSWER}) ${MOUNTPOINT} > ${MOUNTPOINT}/etc/fstab 2>$ERR + check_for_error "$FUNCNAME" $? + [[ -f ${MOUNTPOINT}/swapfile ]] && sed -i "s/\\${MOUNTPOINT}//" ${MOUNTPOINT}/etc/fstab fi - } + fi } -# ntp not exactly wireless, but this menu is the best fit. -install_wireless_packages() { +run_mkinitcpio() { + clear + KERNEL="" - WIRELESS_PACKAGES="" - wireless_pkgs="dialog iw rp-pppoe wireless_tools wpa_actiond" + # If LVM and/or LUKS used, add the relevant hook(s) + ([[ $LVM -eq 1 ]] && [[ $LUKS -eq 0 ]]) && { sed -i 's/block filesystems/block lvm2 filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>$ERR || check_for_error "lVM2 hooks" $?; } + ([[ $LVM -eq 1 ]] && [[ $LUKS -eq 1 ]]) && { sed -i 's/block filesystems/block encrypt lvm2 filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>$ERR || check_for_error "lVM/LUKS hooks" $?; } + ([[ $LVM -eq 0 ]] && [[ $LUKS -eq 1 ]]) && { sed -i 's/block filesystems/block encrypt filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>$ERR || check_for_error "LUKS hooks" $?; } + + arch_chroot "mkinitcpio -P" 2>$ERR + check_for_error "$FUNCNAME" "$?" +} - for i in ${wireless_pkgs}; do - WIRELESS_PACKAGES="${WIRELESS_PACKAGES} ${i} - on" +# virtual console keymap +set_keymap() { + KEYMAPS="" + for i in $(ls -R /usr/share/kbd/keymaps | grep "map.gz" | sed 's/\.map\.gz//g' | sort); do + KEYMAPS="${KEYMAPS} ${i} -" done - # If no wireless, uncheck wireless pkgs - [[ $(lspci | grep -i "Network Controller") == "" ]] && WIRELESS_PACKAGES=$(echo $WIRELESS_PACKAGES | sed "s/ on/ off/g") - - DIALOG " $_InstNMMenuPkg " --checklist "$_InstNMMenuPkgBody\n\n$_UseSpaceBar" 0 0 13 \ - $WIRELESS_PACKAGES \ - "ufw" "-" off \ - "gufw" "-" off \ - "ntp" "-" off \ - "b43-fwcutter" "Broadcom 802.11b/g/n" off \ - "bluez-firmware" "Broadcom BCM203x / STLC2300 Bluetooth" off \ - "ipw2100-fw" "Intel PRO/Wireless 2100" off \ - "ipw2200-fw" "Intel PRO/Wireless 2200" off \ - "zd1211-firmware" "ZyDAS ZD1211(b) 802.11a/b/g USB WLAN" off 2>${PACKAGES} + DIALOG " $_VCKeymapTitle " --menu "$_VCKeymapBody" 20 40 16 ${KEYMAPS} 2>${ANSWER} || return 0 + KEYMAP=$(cat ${ANSWER}) - if [[ $(cat ${PACKAGES}) != "" ]]; then - clear - basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR - check_for_error "$FUNCNAME" $? + loadkeys $KEYMAP 2>$ERR + check_for_error "loadkeys $KEYMAP" "$?" + biggest_resolution=$(head -n 1 /sys/class/drm/card*/*/modes | awk -F'[^0-9]*' '{print $1}' | awk 'BEGIN{a= 0}{if ($1>a) a=$1 fi} END{print a}') + # Choose terminus font size depending on resolution + if [[ $biggest_resolution -gt 1920 ]]; then + FONT=ter-124n + elif [[ $biggest_resolution -eq 1920 ]]; then + FONT=ter-118n + else + FONT=ter-114n fi + echo -e "KEYMAP=${KEYMAP}\nFONT=${FONT}" > /tmp/vconsole.conf } -install_cups() { - DIALOG " $_InstNMMenuCups " --checklist "$_InstCupsBody\n\n$_UseSpaceBar" 0 0 5 \ - "cups" "-" on \ - "cups-pdf" "-" off \ - "ghostscript" "-" on \ - "gsfonts" "-" on \ - "samba" "-" off 2>${PACKAGES} +# Set keymap for X11 +set_xkbmap() { + XKBMAP_LIST="" + keymaps_xkb=("af al am at az ba bd be bg br bt bw by ca cd ch cm cn cz de dk ee es et eu fi fo fr\ + gb ge gh gn gr hr hu ie il in iq ir is it jp ke kg kh kr kz la lk lt lv ma md me mk ml mm mn mt mv\ + ng nl no np pc ph pk pl pt ro rs ru se si sk sn sy tg th tj tm tr tw tz ua us uz vn za") - if [[ $(cat ${PACKAGES}) != "" ]]; then - clear - basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR - check_for_error "$FUNCNAME" $? + for i in ${keymaps_xkb}; do + XKBMAP_LIST="${XKBMAP_LIST} ${i} -" + done - if [[ $(cat ${PACKAGES} | grep "cups") != "" ]]; then - DIALOG " $_InstNMMenuCups " --yesno "$_InstCupsQ" 0 0 - if [[ $? -eq 0 ]]; then - # Add openrc support. If openrcbase was installed, the file /mnt/.openrc should exist. - if [[ -e /mnt/.openrc ]]; then - arch_chroot "rc-update add cupsd default" 2>$ERR - else - arch_chroot "systemctl enable org.cups.cupsd.service" 2>$ERR - fi - check_for_error "enable cups" $? - DIALOG " $_InstNMMenuCups " --infobox "\n$_Done!\n\n" 0 0 - sleep 2 - fi - fi - fi + DIALOG " $_PrepKBLayout " --menu "$_XkbmapBody" 0 0 16 ${XKBMAP_LIST} 2>${ANSWER} || return 0 + XKBMAP=$(cat ${ANSWER} |sed 's/_.*//') + echo -e "Section "\"InputClass"\"\nIdentifier "\"system-keyboard"\"\nMatchIsKeyboard "\"on"\"\nOption "\"XkbLayout"\" "\"${XKBMAP}"\"\nEndSection" \ + > ${MOUNTPOINT}/etc/X11/xorg.conf.d/00-keyboard.conf } -install_network_menu() { - declare -i loopmenu=1 - while ((loopmenu)); do - local PARENT="$FUNCNAME" - - submenu 5 - DIALOG " $_InstNMMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "$_InstNMMenuBody" 0 0 5 \ - "1" "$_SeeWirelessDev" \ - "2" "$_InstNMMenuPkg" \ - "3" "$_InstNMMenuNM" \ - "4" "$_InstNMMenuCups" \ - "5" "$_Back" 2>${ANSWER} - - case $(cat ${ANSWER}) in - "1") # Identify the Wireless Device - lspci -k | grep -i -A 2 "network controller" > /tmp/.wireless - if [[ $(cat /tmp/.wireless) != "" ]]; then - DIALOG " $_WirelessShowTitle " --textbox /tmp/.wireless 0 0 - else - DIALOG " $_WirelessShowTitle " --msgbox "$_WirelessErrBody" 7 30 - fi - ;; - "2") install_wireless_packages - ;; - "3") install_nm - ;; - "4") install_cups - ;; - *) loopmenu=0 - return 0 - ;; - esac +# locale array generation code adapted from the Manjaro 0.8 installer +set_locale() { + LOCALES="" + for i in $(cat /etc/locale.gen | grep -v "# " | sed 's/#//g' | sed 's/ UTF-8//g' | grep .UTF-8); do + LOCALES="${LOCALES} ${i} -" done + + DIALOG " $_ConfBseSysLoc " --menu "$_localeBody" 0 0 12 ${LOCALES} 2>${ANSWER} || return 0 + + LOCALE=$(cat ${ANSWER}) + + echo "LANG=\"${LOCALE}\"" > ${MOUNTPOINT}/etc/locale.conf + sed -i "s/#${LOCALE}/${LOCALE}/" ${MOUNTPOINT}/etc/locale.gen 2>$ERR + arch_chroot "locale-gen" >/dev/null 2>$ERR + check_for_error "$FUNCNAME" "$?" } -install_intel() { - sed -i 's/MODULES=""/MODULES="i915"/' ${MOUNTPOINT}/etc/mkinitcpio.conf +# Set Zone and Sub-Zone +set_timezone() { + ZONE="" + for i in $(cat /usr/share/zoneinfo/zone.tab | awk '{print $3}' | grep "/" | sed "s/\/.*//g" | sort -ud); do + ZONE="$ZONE ${i} -" + done - # Intel microcode (Grub, Syslinux and systemd-boot). - # Done as seperate if statements in case of multiple bootloaders. - if [[ -e ${MOUNTPOINT}/boot/grub/grub.cfg ]]; then - DIALOG " grub-mkconfig " --infobox "$_PlsWaitBody" 0 0 - sleep 1 - arch_chroot "grub-mkconfig -o /boot/grub/grub.cfg" 2>$ERR + DIALOG " $_ConfBseTimeHC " --menu "$_TimeZBody" 0 0 10 ${ZONE} 2>${ANSWER} || return 0 + ZONE=$(cat ${ANSWER}) + + SUBZONE="" + for i in $(cat /usr/share/zoneinfo/zone.tab | awk '{print $3}' | grep "${ZONE}/" | sed "s/${ZONE}\///g" | sort -ud); do + SUBZONE="$SUBZONE ${i} -" + done + + DIALOG " $_ConfBseTimeHC " --menu "$_TimeSubZBody" 0 0 11 ${SUBZONE} 2>${ANSWER} || return 0 + SUBZONE=$(cat ${ANSWER}) + + DIALOG " $_ConfBseTimeHC " --yesno "\n$_TimeZQ ${ZONE}/${SUBZONE}?\n\n" 0 0 + if (( $? == 0 )); then + arch_chroot "ln -sf /usr/share/zoneinfo/${ZONE}/${SUBZONE} /etc/localtime" 2>$ERR + check_for_error "$FUNCNAME ${ZONE}/${SUBZONE}" $? fi - # Syslinux - [[ -e ${MOUNTPOINT}/boot/syslinux/syslinux.cfg ]] && sed -i "s/INITRD /&..\/intel-ucode.img,/g" ${MOUNTPOINT}/boot/syslinux/syslinux.cfg +} - # Systemd-boot - if [[ -e ${MOUNTPOINT}${UEFI_MOUNT}/loader/loader.conf ]]; then - update=$(ls ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/*.conf) - for i in ${upgate}; do - sed -i '/linux \//a initrd \/intel-ucode.img' ${i} - done +set_hw_clock() { + DIALOG " $_ConfBseTimeHC " --menu "$_HwCBody" 0 0 2 \ + "utc" "-" \ + "localtime" "-" 2>${ANSWER} + + if [[ $(cat ${ANSWER}) != "" ]]; then + arch_chroot "hwclock --systohc --$(cat ${ANSWER})" 2>$ERR + check_for_error "$FUNCNAME" "$?" fi } -install_ati() { - sed -i 's/MODULES=""/MODULES="radeon"/' ${MOUNTPOINT}/etc/mkinitcpio.conf +set_hostname() { + DIALOG " $_ConfBseHost " --inputbox "$_HostNameBody" 0 0 "manjaro" 2>${ANSWER} || return 0 + + echo "$(cat ${ANSWER})" > ${MOUNTPOINT}/etc/hostname 2>$ERR + echo -e "#\t\t\n127.0.0.1\tlocalhost.localdomain\tlocalhost\t$(cat \ + ${ANSWER})\n::1\tlocalhost.localdomain\tlocalhost\t$(cat ${ANSWER})" > ${MOUNTPOINT}/etc/hosts 2>$ERR + check_for_error "$FUNCNAME" } -# Install xorg and input drivers. Also copy the xkbmap configuration file created earlier to the installed system -install_xorg_input() { - echo "" > ${PACKAGES} +# Adapted and simplified from the Manjaro 0.8 and Antergos 2.0 installers +set_root_password() { + DIALOG " $_ConfUsrRoot " --clear --insecure --passwordbox "$_PassRtBody" 0 0 \ + 2> ${ANSWER} || return 0 + PASSWD=$(cat ${ANSWER}) - DIALOG " $_InstGrMenuDS " --checklist "$_InstGrMenuDSBody\n\n$_UseSpaceBar" 0 0 11 \ - "wayland" "-" off \ - "xorg-server" "-" on \ - "xorg-server-common" "-" off \ - "xorg-server-utils" "-" on \ - "xorg-xinit" "-" on \ - "xorg-server-xwayland" "-" off \ - "xf86-input-evdev" "-" off \ - "xf86-input-keyboard" "-" on \ - "xf86-input-libinput" "-" on \ - "xf86-input-mouse" "-" on \ - "xf86-input-synaptics" "-" off 2>${PACKAGES} + DIALOG " $_ConfUsrRoot " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 \ + 2> ${ANSWER} || return 0 + PASSWD2=$(cat ${ANSWER}) - clear - # If at least one package, install. - if [[ $(cat ${PACKAGES}) != "" ]]; then - basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR + if [[ $PASSWD == $PASSWD2 ]]; then + echo -e "${PASSWD}\n${PASSWD}" > /tmp/.passwd + arch_chroot "passwd root" < /tmp/.passwd >/dev/null 2>$ERR check_for_error "$FUNCNAME" $? + rm /tmp/.passwd + else + DIALOG " $_ErrTitle " --msgbox "$_PassErrBody" 0 0 + set_root_password fi +} + +# Originally adapted from the Antergos 2.0 installer +create_new_user() { + DIALOG " $_NUsrTitle " --inputbox "$_NUsrBody" 0 0 "" 2>${ANSWER} || return 0 + USER=$(cat ${ANSWER}) + + # Loop while user name is blank, has spaces, or has capital letters in it. + while [[ ${#USER} -eq 0 ]] || [[ $USER =~ \ |\' ]] || [[ $USER =~ [^a-z0-9\ ] ]]; do + DIALOG " $_NUsrTitle " --inputbox "$_NUsrErrBody" 0 0 "" 2>${ANSWER} || return 0 + USER=$(cat ${ANSWER}) + done + + DIALOG "_DefShell" --radiolist "\n\n$_UseSpaceBar" 0 0 3 \ + "zsh" "" on \ + "bash" "" off \ + "fish" "" off 2>/tmp/.shell + shell=$(cat /tmp/.shell) - # now copy across .xinitrc for all user accounts - user_list=$(ls ${MOUNTPOINT}/home/ | sed "s/lost+found//") - for i in ${user_list}; do - [[ -e ${MOUNTPOINT}/home/$i/.xinitrc ]] || cp -f ${MOUNTPOINT}/etc/X11/xinit/xinitrc ${MOUNTPOINT}/home/$i/.xinitrc - arch_chroot "chown -R ${i}:${i} /home/${i}" + # Enter password. This step will only be reached where the loop has been skipped or broken. + DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassNUsrBody $USER\n\n" 0 0 \ + 2> ${ANSWER} || return 0 + PASSWD=$(cat ${ANSWER}) + + DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 \ + 2> ${ANSWER} || return 0 + PASSWD2=$(cat ${ANSWER}) + + # loop while passwords entered do not match. + while [[ $PASSWD != $PASSWD2 ]]; do + DIALOG " $_ErrTitle " --msgbox "$_PassErrBody" 0 0 + + DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassNUsrBody $USER\n\n" 0 0 \ + 2> ${ANSWER} || return 0 + PASSWD=$(cat ${ANSWER}) + + DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 \ + 2> ${ANSWER} || return 0 + PASSWD2=$(cat ${ANSWER}) done - HIGHLIGHT_SUB=1 + # create new user. This step will only be reached where the password loop has been skipped or broken. + DIALOG " $_ConfUsrNew " --infobox "$_NUsrSetBody" 0 0 + sleep 2 + + # Create the user, set password, then remove temporary password file + arch_chroot "groupadd ${USER}" + arch_chroot "useradd ${USER} -m -g ${USER} -G wheel,storage,power,network,video,audio,lp -s /bin/$shell" 2>$ERR + check_for_error "add user to groups" $? + echo -e "${PASSWD}\n${PASSWD}" > /tmp/.passwd + arch_chroot "passwd ${USER}" < /tmp/.passwd >/dev/null 2>$ERR + check_for_error "create user pwd" $? + rm /tmp/.passwd + + # Set up basic configuration files and permissions for user + #arch_chroot "cp /etc/skel/.bashrc /home/${USER}" + arch_chroot "chown -R ${USER}:${USER} /home/${USER}" + [[ -e ${MOUNTPOINT}/etc/sudoers ]] && sed -i '/%wheel ALL=(ALL) ALL/s/^#//' ${MOUNTPOINT}/etc/sudoers } setup_graphics_card() { @@ -708,76 +552,28 @@ setup_graphics_card() { check_for_error "$FUNCNAME $(cat /tmp/.driver)" "$?" } -security_menu() { - declare -i loopmenu=1 - while ((loopmenu)); do - local PARENT="$FUNCNAME" - - submenu 4 - DIALOG " $_SecMenuTitle " --default-item ${HIGHLIGHT_SUB} \ - --menu "$_SecMenuBody" 0 0 4 \ - "1" "$_SecJournTitle" \ - "2" "$_SecCoreTitle" \ - "3" "$_SecKernTitle " \ - "4" "$_Back" 2>${ANSWER} - - HIGHLIGHT_SUB=$(cat ${ANSWER}) - case $(cat ${ANSWER}) in - # systemd-journald - "1") DIALOG " $_SecJournTitle " --menu "$_SecJournBody" 0 0 7 \ - "$_Edit" "/etc/systemd/journald.conf" \ - "10M" "SystemMaxUse=10M" \ - "20M" "SystemMaxUse=20M" \ - "50M" "SystemMaxUse=50M" \ - "100M" "SystemMaxUse=100M" \ - "200M" "SystemMaxUse=200M" \ - "$_Disable" "Storage=none" 2>${ANSWER} - - if [[ $(cat ${ANSWER}) != "" ]]; then - if [[ $(cat ${ANSWER}) == "$_Disable" ]]; then - sed -i "s/#Storage.*\|Storage.*/Storage=none/g" ${MOUNTPOINT}/etc/systemd/journald.conf - sed -i "s/SystemMaxUse.*/#&/g" ${MOUNTPOINT}/etc/systemd/journald.conf - DIALOG " $_SecJournTitle " --infobox "\n$_Done!\n\n" 0 0 - sleep 2 - elif [[ $(cat ${ANSWER}) == "$_Edit" ]]; then - nano ${MOUNTPOINT}/etc/systemd/journald.conf - else - sed -i "s/#SystemMaxUse.*\|SystemMaxUse.*/SystemMaxUse=$(cat ${ANSWER})/g" ${MOUNTPOINT}/etc/systemd/journald.conf - sed -i "s/Storage.*/#&/g" ${MOUNTPOINT}/etc/systemd/journald.conf - DIALOG " $_SecJournTitle " --infobox "\n$_Done!\n\n" 0 0 - sleep 2 - fi - fi - ;; - # core dump - "2") DIALOG " $_SecCoreTitle " --menu "$_SecCoreBody" 0 0 2 \ - "$_Disable" "Storage=none" \ - "$_Edit" "/etc/systemd/coredump.conf" 2>${ANSWER} - - if [[ $(cat ${ANSWER}) == "$_Disable" ]]; then - sed -i "s/#Storage.*\|Storage.*/Storage=none/g" ${MOUNTPOINT}/etc/systemd/coredump.conf - DIALOG " $_SecCoreTitle " --infobox "\n$_Done!\n\n" 0 0 - sleep 2 - elif [[ $(cat ${ANSWER}) == "$_Edit" ]]; then - nano ${MOUNTPOINT}/etc/systemd/coredump.conf - fi - ;; - # Kernel log access - "3") DIALOG " $_SecKernTitle " --menu "$_SecKernBody" 0 0 2 \ - "$_Disable" "kernel.dmesg_restrict = 1" \ - "$_Edit" "/etc/systemd/coredump.conf.d/custom.conf" 2>${ANSWER} - - case $(cat ${ANSWER}) in - "$_Disable") echo "kernel.dmesg_restrict = 1" > ${MOUNTPOINT}/etc/sysctl.d/50-dmesg-restrict.conf - DIALOG " $_SecKernTitle " --infobox "\n$_Done!\n\n" 0 0 - sleep 2 ;; - "$_Edit") [[ -e ${MOUNTPOINT}/etc/sysctl.d/50-dmesg-restrict.conf ]] && nano ${MOUNTPOINT}/etc/sysctl.d/50-dmesg-restrict.conf || \ - DIALOG " $_SeeConfErrTitle " --msgbox "$_SeeConfErrBody1" 0 0 ;; - esac - ;; - *) loopmenu=0 - return 0 - ;; - esac - done +install_intel() { + sed -i 's/MODULES=""/MODULES="i915"/' ${MOUNTPOINT}/etc/mkinitcpio.conf + + # Intel microcode (Grub, Syslinux and systemd-boot). + # Done as seperate if statements in case of multiple bootloaders. + if [[ -e ${MOUNTPOINT}/boot/grub/grub.cfg ]]; then + DIALOG " grub-mkconfig " --infobox "$_PlsWaitBody" 0 0 + sleep 1 + arch_chroot "grub-mkconfig -o /boot/grub/grub.cfg" 2>$ERR + fi + # Syslinux + [[ -e ${MOUNTPOINT}/boot/syslinux/syslinux.cfg ]] && sed -i "s/INITRD /&..\/intel-ucode.img,/g" ${MOUNTPOINT}/boot/syslinux/syslinux.cfg + + # Systemd-boot + if [[ -e ${MOUNTPOINT}${UEFI_MOUNT}/loader/loader.conf ]]; then + update=$(ls ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/*.conf) + for i in ${upgate}; do + sed -i '/linux \//a initrd \/intel-ucode.img' ${i} + done + fi +} + +install_ati() { + sed -i 's/MODULES=""/MODULES="radeon"/' ${MOUNTPOINT}/etc/mkinitcpio.conf } diff --git a/lib/util-desktop-full.sh b/lib/util-desktop-full.sh new file mode 100644 index 0000000..d9a328a --- /dev/null +++ b/lib/util-desktop-full.sh @@ -0,0 +1,330 @@ +# !/bin/bash +# +# Architect Installation Framework (2016-2017) +# +# Written by Carl Duff and @mandog for Archlinux +# Heavily modified and re-written by @Chrysostomus to install Manjaro instead +# Contributors: @papajoker, @oberon and the Manjaro-Community. +# +# This program is free software, provided under the GNU General Public License +# as published by the Free Software Foundation. So feel free to copy, distribute, +# or modify it as you wish. + +install_manjaro_de_wm_git() { + PROFILES="$DATADIR/profiles" + # Only show this information box once + if [[ $SHOW_ONCE -eq 0 ]]; then + DIALOG " $_InstDETitle " --msgbox "\n$_InstPBody\n\n" 0 0 + SHOW_ONCE=1 + fi + clear + # install git if not already installed + inst_needed git + # download manjaro-tools.-isoprofiles git repo + if [[ -e $PROFILES ]]; then + git -C $PROFILES pull 2>$ERR + check_for_error "pull profiles repo" $? + else + git clone --depth 1 https://github.com/manjaro/iso-profiles.git $PROFILES 2>$ERR + check_for_error "clone profiles repo" $? + fi + + install_manjaro_de_wm +} + +# Install xorg and input drivers. Also copy the xkbmap configuration file created earlier to the installed system +install_xorg_input() { + echo "" > ${PACKAGES} + + DIALOG " $_InstGrMenuDS " --checklist "$_InstGrMenuDSBody\n\n$_UseSpaceBar" 0 0 11 \ + "wayland" "-" off \ + "xorg-server" "-" on \ + "xorg-server-common" "-" off \ + "xorg-server-utils" "-" on \ + "xorg-xinit" "-" on \ + "xorg-server-xwayland" "-" off \ + "xf86-input-evdev" "-" off \ + "xf86-input-keyboard" "-" on \ + "xf86-input-libinput" "-" on \ + "xf86-input-mouse" "-" on \ + "xf86-input-synaptics" "-" off 2>${PACKAGES} + + clear + # If at least one package, install. + if [[ $(cat ${PACKAGES}) != "" ]]; then + basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR + check_for_error "$FUNCNAME" $? + fi + + # now copy across .xinitrc for all user accounts + user_list=$(ls ${MOUNTPOINT}/home/ | sed "s/lost+found//") + for i in ${user_list}; do + [[ -e ${MOUNTPOINT}/home/$i/.xinitrc ]] || cp -f ${MOUNTPOINT}/etc/X11/xinit/xinitrc ${MOUNTPOINT}/home/$i/.xinitrc + arch_chroot "chown -R ${i}:${i} /home/${i}" + done + + HIGHLIGHT_SUB=1 +} + +# Display Manager +install_dm() { + if [[ $DM_ENABLED -eq 0 ]]; then + # Prep variables + echo "" > ${PACKAGES} + dm_list="gdm lxdm lightdm sddm" + DM_LIST="" + DM_INST="" + + # Generate list of DMs installed with DEs, and a list for selection menu + for i in ${dm_list}; do + [[ -e ${MOUNTPOINT}/usr/bin/${i} ]] && DM_INST="${DM_INST} ${i}" && check_for_error "${i} already installed." + DM_LIST="${DM_LIST} ${i} -" + done + + DIALOG " $_DmChTitle " --menu "$_AlreadyInst$DM_INST\n\n$_DmChBody" 0 0 4 \ + ${DM_LIST} 2>${PACKAGES} + clear + # If a selection has been made, act + if [[ $(cat ${PACKAGES}) != "" ]]; then + # check if selected dm already installed. If so, enable and break loop. + for i in ${DM_INST}; do + if [[ $(cat ${PACKAGES}) == ${i} ]]; then + enable_dm + break; + fi + done + + # If no match found, install and enable DM + if [[ $DM_ENABLED -eq 0 ]]; then + # Where lightdm selected, add gtk greeter package + sed -i 's/lightdm/lightdm lightdm-gtk-greeter/' ${PACKAGES} + basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR + check_for_error "install ${PACKAGES}" $? + + # Where lightdm selected, now remove the greeter package + sed -i 's/lightdm-gtk-greeter//' ${PACKAGES} + enable_dm + fi + fi + fi + + # Show after successfully installing or where attempting to repeat when already completed. + [[ $DM_ENABLED -eq 1 ]] && DIALOG " $_DmChTitle " --msgbox "$_DmDoneBody" 0 0 +} + +enable_dm() { + if [[ -e /mnt/.openrc ]]; then + sed -i "s/$(grep "DISPLAYMANAGER=" /mnt/etc/conf.d/xdm)/DISPLAYMANAGER=\"$(cat ${PACKAGES})\"/g" /mnt/etc/conf.d/xdm + arch_chroot "rc-update add xdm default" 2>$ERR + check_for_error "add default xdm" "$?" + DM=$(cat ${PACKAGES}) + DM_ENABLED=1 + else + # enable display manager for systemd + arch_chroot "systemctl enable $(cat ${PACKAGES})" 2>$ERR + check_for_error "enable $(cat ${PACKAGES})" "$?" + DM=$(cat ${PACKAGES}) + DM_ENABLED=1 + fi +} + +# ntp not exactly wireless, but this menu is the best fit. +install_wireless_packages() { + + WIRELESS_PACKAGES="" + wireless_pkgs="dialog iw rp-pppoe wireless_tools wpa_actiond" + + for i in ${wireless_pkgs}; do + WIRELESS_PACKAGES="${WIRELESS_PACKAGES} ${i} - on" + done + + # If no wireless, uncheck wireless pkgs + [[ $(lspci | grep -i "Network Controller") == "" ]] && WIRELESS_PACKAGES=$(echo $WIRELESS_PACKAGES | sed "s/ on/ off/g") + + DIALOG " $_InstNMMenuPkg " --checklist "$_InstNMMenuPkgBody\n\n$_UseSpaceBar" 0 0 13 \ + $WIRELESS_PACKAGES \ + "ufw" "-" off \ + "gufw" "-" off \ + "ntp" "-" off \ + "b43-fwcutter" "Broadcom 802.11b/g/n" off \ + "bluez-firmware" "Broadcom BCM203x / STLC2300 Bluetooth" off \ + "ipw2100-fw" "Intel PRO/Wireless 2100" off \ + "ipw2200-fw" "Intel PRO/Wireless 2200" off \ + "zd1211-firmware" "ZyDAS ZD1211(b) 802.11a/b/g USB WLAN" off 2>${PACKAGES} + + if [[ $(cat ${PACKAGES}) != "" ]]; then + clear + basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR + check_for_error "$FUNCNAME" $? + fi +} + +# Network Manager +install_nm() { + if [[ $NM_ENABLED -eq 0 ]]; then + # Prep variables + echo "" > ${PACKAGES} + nm_list="connman CLI dhcpcd CLI netctl CLI NetworkManager GUI wicd GUI" + NM_LIST="" + NM_INST="" + + # Generate list of DMs installed with DEs, and a list for selection menu + for i in ${nm_list}; do + [[ -e ${MOUNTPOINT}/usr/bin/${i} ]] && NM_INST="${NM_INST} ${i}" && check_for_error "${i} already installed." + NM_LIST="${NM_LIST} ${i}" + done + + # Remove netctl from selectable list as it is a PITA to configure via arch_chroot + NM_LIST=$(echo $NM_LIST | sed "s/netctl CLI//") + + DIALOG " $_InstNMTitle " --menu "$_AlreadyInst $NM_INST\n$_InstNMBody" 0 0 4 \ + ${NM_LIST} 2> ${PACKAGES} + clear + + # If a selection has been made, act + if [[ $(cat ${PACKAGES}) != "" ]]; then + # check if selected nm already installed. If so, enable and break loop. + for i in ${NM_INST}; do + [[ $(cat ${PACKAGES}) == ${i} ]] && enable_nm && break + done + + # If no match found, install and enable NM + if [[ $NM_ENABLED -eq 0 ]]; then + # Where networkmanager selected, add network-manager-applet + sed -i 's/NetworkManager/networkmanager network-manager-applet/g' ${PACKAGES} + basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR + check_for_error "$FUNCNAME" "$?" + + # Where networkmanager selected, now remove network-manager-applet + sed -i 's/networkmanager network-manager-applet/NetworkManager/g' ${PACKAGES} + enable_nm + fi + fi + fi + + # Show after successfully installing or where attempting to repeat when already completed. + [[ $NM_ENABLED -eq 1 ]] && DIALOG " $_InstNMTitle " --msgbox "$_InstNMErrBody" 0 0 +} + +enable_nm() { + # Add openrc support. If openrcbase was installed, the file /mnt/.openrc should exist. + if [[ $(cat ${PACKAGES}) == "NetworkManager" ]]; then + if [[ -e /mnt/.openrc ]]; then + arch_chroot "rc-update add NetworkManager default" 2>$ERR + check_for_error "add default NetworkManager." $? + else + arch_chroot "systemctl enable NetworkManager NetworkManager-dispatcher" >/tmp/.symlink 2>$ERR + check_for_error "enable NetworkManager." $? + fi + else + if [[ -e /mnt/.openrc ]]; then + arch_chroot "rc-update add $(cat ${PACKAGES}) default" 2>$ERR + check_for_error "add default $(cat ${PACKAGES})." $? + else + arch_chroot "systemctl enable $(cat ${PACKAGES})" 2>$ERR + check_for_error "enable $(cat ${PACKAGES})." $? + fi + fi + NM_ENABLED=1 +} + +install_cups() { + DIALOG " $_InstNMMenuCups " --checklist "$_InstCupsBody\n\n$_UseSpaceBar" 0 0 5 \ + "cups" "-" on \ + "cups-pdf" "-" off \ + "ghostscript" "-" on \ + "gsfonts" "-" on \ + "samba" "-" off 2>${PACKAGES} + + if [[ $(cat ${PACKAGES}) != "" ]]; then + clear + basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR + check_for_error "$FUNCNAME" $? + + if [[ $(cat ${PACKAGES} | grep "cups") != "" ]]; then + DIALOG " $_InstNMMenuCups " --yesno "$_InstCupsQ" 0 0 + if [[ $? -eq 0 ]]; then + # Add openrc support. If openrcbase was installed, the file /mnt/.openrc should exist. + if [[ -e /mnt/.openrc ]]; then + arch_chroot "rc-update add cupsd default" 2>$ERR + else + arch_chroot "systemctl enable org.cups.cupsd.service" 2>$ERR + fi + check_for_error "enable cups" $? + DIALOG " $_InstNMMenuCups " --infobox "\n$_Done!\n\n" 0 0 + sleep 2 + fi + fi + fi +} + +install_alsa_pulse() { + # Prep Variables + echo "" > ${PACKAGES} + ALSA="" + PULSE_EXTRA="" + alsa=$(pacman -Ss alsa | awk '{print $1}' | grep "/alsa-" | sed "s/extra\///g" | sort -u) + pulse_extra=$(pacman -Ss pulseaudio- | awk '{print $1}' | sed "s/extra\///g" | grep "pulseaudio-" | sort -u) + + for i in ${alsa}; do + ALSA="${ALSA} ${i} - off" + done + + ALSA=$(echo $ALSA | sed "s/alsa-utils - off/alsa-utils - on/g" | sed "s/alsa-plugins - off/alsa-plugins - on/g") + + for i in ${pulse_extra}; do + PULSE_EXTRA="${PULSE_EXTRA} ${i} - off" + done + + DIALOG " $_InstMulSnd " --checklist "$_InstMulSndBody\n\n$_UseSpaceBar" 0 0 6 \ + $ALSA "pulseaudio" "-" off $PULSE_EXTRA \ + "paprefs" "pulseaudio GUI" off \ + "pavucontrol" "pulseaudio GUI" off \ + "ponymix" "pulseaudio CLI" off \ + "volumeicon" "ALSA GUI" off \ + "volwheel" "ASLA GUI" off 2>${PACKAGES} + + clear + # If at least one package, install. + if [[ $(cat ${PACKAGES}) != "" ]]; then + basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR + check_for_error "$FUNCNAME" "$?" + fi +} + +install_codecs() { + # Prep Variables + echo "" > ${PACKAGES} + GSTREAMER="" + gstreamer=$(pacman -Ss gstreamer | awk '{print $1}' | grep "/gstreamer" | sed "s/extra\///g" | sed "s/community\///g" | sort -u) + echo $gstreamer + for i in ${gstreamer}; do + GSTREAMER="${GSTREAMER} ${i} - off" + done + + DIALOG " $_InstMulCodec " --checklist "$_InstMulCodBody\n\n$_UseSpaceBar" 0 0 14 \ + $GSTREAMER "xine-lib" "-" off 2>${PACKAGES} + + clear + # If at least one package, install. + if [[ $(cat ${PACKAGES}) != "" ]]; then + basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR + check_for_error "$FUNCNAME" "$?" + fi +} + +install_cust_pkgs() { + echo "" > ${PACKAGES} + DIALOG " $_InstMulCust " --inputbox "$_InstMulCustBody" 0 0 "" 2>${PACKAGES} || return 0 + + clear + # If at least one package, install. + if [[ $(cat ${PACKAGES}) != "" ]]; then + if [[ $(cat ${PACKAGES}) == "hen poem" ]]; then + DIALOG " \"My Sweet Buckies\" by Atiya & Carl " --msgbox "\nMy Sweet Buckies,\nYou are the sweetest Buckies that ever did \"buck\",\nLily, Rosie, Trumpet, and Flute,\nMy love for you all is absolute!\n\nThey buck: \"We love our treats, we are the Booyakka sisters,\"\n\"Sometimes we squabble and give each other comb-twisters,\"\n\"And in our garden we love to sunbathe, forage, hop and jump,\"\n\"We love our freedom far, far away from that factory farm dump,\"\n\n\"For so long we were trapped in cramped prisons full of disease,\"\n\"No sunlight, no fresh air, no one who cared for even our basic needs,\"\n\"We suffered in fear, pain, and misery for such a long time,\"\n\"But now we are so happy, we wanted to tell you in this rhyme!\"\n\n" 0 0 + else + basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR + check_for_error "$FUNCNAME $(cat ${PACKAGES})" "$?" + fi + fi +} diff --git a/lib/util-desktop.sh b/lib/util-desktop.sh index d1ddd76..e9f78cd 100644 --- a/lib/util-desktop.sh +++ b/lib/util-desktop.sh @@ -10,78 +10,18 @@ # as published by the Free Software Foundation. So feel free to copy, distribute, # or modify it as you wish. -install_de_wm() { +install_manjaro_de_wm_pkg() { + PROFILES="/usr/share/manjaro-tools/iso-profiles" # Only show this information box once if [[ $SHOW_ONCE -eq 0 ]]; then - DIALOG " $_InstDETitle " --msgbox "$_DEInfoBody" 0 0 + DIALOG " $_InstDETitle " --msgbox "\n$_InstPBody\n\n" 0 0 SHOW_ONCE=1 fi + clear + pacman -Sy --noconfirm $p manjaro-iso-profiles-{base,official,community} 2>$ERR + check_for_error "update profiles pkgs" $? - # DE/WM Menu - DIALOG " $_InstDETitle " --checklist "\n$_InstDEBody\n\n$_UseSpaceBar" 0 0 12 \ - "budgie-desktop" "-" off \ - "cinnamon" "-" off \ - "deepin" "-" off \ - "deepin-extra" "-" off \ - "enlightenment + terminology" "-" off \ - "gnome-shell" "-" off \ - "gnome" "-" off \ - "gnome-extra" "-" off \ - "plasma-desktop" "-" off \ - "plasma" "-" off \ - "kde-applications" "-" off \ - "lxde" "-" off \ - "lxqt + oxygen-icons" "-" off \ - "mate" "-" off \ - "mate-extra" "-" off \ - "mate-gtk3" "-" off \ - "mate-extra-gtk3" "-" off \ - "xfce4" "-" off \ - "xfce4-goodies" "-" off \ - "awesome + vicious" "-" off \ - "fluxbox + fbnews" "-" off \ - "i3-wm + i3lock + i3status" "-" off \ - "icewm + icewm-themes" "-" off \ - "openbox + openbox-themes" "-" off \ - "pekwm + pekwm-themes" "-" off \ - "windowmaker" "-" off 2>${PACKAGES} - - # If something has been selected, install - if [[ $(cat ${PACKAGES}) != "" ]]; then - clear - sed -i 's/+\|\"//g' ${PACKAGES} - basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR - check_for_error "${FUNCNAME}: ${PACKAGES}" "$?" - - # Clear the packages file for installation of "common" packages - echo "" > ${PACKAGES} - - # Offer to install various "common" packages. - DIALOG " $_InstComTitle " --checklist "\n$_InstComBody\n\n$_UseSpaceBar" 0 50 14 \ - "bash-completion" "-" on \ - "gamin" "-" on \ - "gksu" "-" on \ - "gnome-icon-theme" "-" on \ - "gnome-keyring" "-" on \ - "gvfs" "-" on \ - "gvfs-afc" "-" on \ - "gvfs-smb" "-" on \ - "polkit" "-" on \ - "poppler" "-" on \ - "python2-xdg" "-" on \ - "ntfs-3g" "-" on \ - "ttf-dejavu" "-" on \ - "xdg-user-dirs" "-" on \ - "xdg-utils" "-" on \ - "xterm" "-" on 2>${PACKAGES} - - # If at least one package, install. - if [[ $(cat ${PACKAGES}) != "" ]]; then - clear - basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR - check_for_error "basestrap ${MOUNTPOINT} $(cat ${PACKAGES})" "$?" - fi - fi + install_manjaro_de_wm } install_manjaro_de_wm() { @@ -310,104 +250,6 @@ install_manjaro_de_wm() { fi } -install_manjaro_de_wm_pkg() { - PROFILES="/usr/share/manjaro-tools/iso-profiles" - # Only show this information box once - if [[ $SHOW_ONCE -eq 0 ]]; then - DIALOG " $_InstDETitle " --msgbox "\n$_InstPBody\n\n" 0 0 - SHOW_ONCE=1 - fi - clear - pacman -Sy --noconfirm $p manjaro-iso-profiles-{base,official,community} 2>$ERR - check_for_error "update profiles pkgs" $? - - install_manjaro_de_wm -} - -install_manjaro_de_wm_git() { - PROFILES="$DATADIR/profiles" - # Only show this information box once - if [[ $SHOW_ONCE -eq 0 ]]; then - DIALOG " $_InstDETitle " --msgbox "\n$_InstPBody\n\n" 0 0 - SHOW_ONCE=1 - fi - clear - # install git if not already installed - inst_needed git - # download manjaro-tools.-isoprofiles git repo - if [[ -e $PROFILES ]]; then - git -C $PROFILES pull 2>$ERR - check_for_error "pull profiles repo" $? - else - git clone --depth 1 https://github.com/manjaro/iso-profiles.git $PROFILES 2>$ERR - check_for_error "clone profiles repo" $? - fi - - install_manjaro_de_wm -} - -# Display Manager -install_dm() { - if [[ $DM_ENABLED -eq 0 ]]; then - # Prep variables - echo "" > ${PACKAGES} - dm_list="gdm lxdm lightdm sddm" - DM_LIST="" - DM_INST="" - - # Generate list of DMs installed with DEs, and a list for selection menu - for i in ${dm_list}; do - [[ -e ${MOUNTPOINT}/usr/bin/${i} ]] && DM_INST="${DM_INST} ${i}" && check_for_error "${i} already installed." - DM_LIST="${DM_LIST} ${i} -" - done - - DIALOG " $_DmChTitle " --menu "$_AlreadyInst$DM_INST\n\n$_DmChBody" 0 0 4 \ - ${DM_LIST} 2>${PACKAGES} - clear - # If a selection has been made, act - if [[ $(cat ${PACKAGES}) != "" ]]; then - # check if selected dm already installed. If so, enable and break loop. - for i in ${DM_INST}; do - if [[ $(cat ${PACKAGES}) == ${i} ]]; then - enable_dm - break; - fi - done - - # If no match found, install and enable DM - if [[ $DM_ENABLED -eq 0 ]]; then - # Where lightdm selected, add gtk greeter package - sed -i 's/lightdm/lightdm lightdm-gtk-greeter/' ${PACKAGES} - basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR - check_for_error "install ${PACKAGES}" $? - - # Where lightdm selected, now remove the greeter package - sed -i 's/lightdm-gtk-greeter//' ${PACKAGES} - enable_dm - fi - fi - fi - - # Show after successfully installing or where attempting to repeat when already completed. - [[ $DM_ENABLED -eq 1 ]] && DIALOG " $_DmChTitle " --msgbox "$_DmDoneBody" 0 0 -} - -enable_dm() { - if [[ -e /mnt/.openrc ]]; then - sed -i "s/$(grep "DISPLAYMANAGER=" /mnt/etc/conf.d/xdm)/DISPLAYMANAGER=\"$(cat ${PACKAGES})\"/g" /mnt/etc/conf.d/xdm - arch_chroot "rc-update add xdm default" 2>$ERR - check_for_error "add default xdm" "$?" - DM=$(cat ${PACKAGES}) - DM_ENABLED=1 - else - # enable display manager for systemd - arch_chroot "systemctl enable $(cat ${PACKAGES})" 2>$ERR - check_for_error "enable $(cat ${PACKAGES})" "$?" - DM=$(cat ${PACKAGES}) - DM_ENABLED=1 - fi -} - set_lightdm_greeter() { local greeters=$(ls /mnt/usr/share/xgreeters/*greeter.desktop) name for g in ${greeters[@]}; do @@ -434,172 +276,3 @@ set_sddm_ck() { arch_chroot "gpasswd -a sddm video &> /dev/null" 2>$ERR check_for_error "$FUNCNAME" $? } - -# Network Manager -install_nm() { - if [[ $NM_ENABLED -eq 0 ]]; then - # Prep variables - echo "" > ${PACKAGES} - nm_list="connman CLI dhcpcd CLI netctl CLI NetworkManager GUI wicd GUI" - NM_LIST="" - NM_INST="" - - # Generate list of DMs installed with DEs, and a list for selection menu - for i in ${nm_list}; do - [[ -e ${MOUNTPOINT}/usr/bin/${i} ]] && NM_INST="${NM_INST} ${i}" && check_for_error "${i} already installed." - NM_LIST="${NM_LIST} ${i}" - done - - # Remove netctl from selectable list as it is a PITA to configure via arch_chroot - NM_LIST=$(echo $NM_LIST | sed "s/netctl CLI//") - - DIALOG " $_InstNMTitle " --menu "$_AlreadyInst $NM_INST\n$_InstNMBody" 0 0 4 \ - ${NM_LIST} 2> ${PACKAGES} - clear - - # If a selection has been made, act - if [[ $(cat ${PACKAGES}) != "" ]]; then - # check if selected nm already installed. If so, enable and break loop. - for i in ${NM_INST}; do - [[ $(cat ${PACKAGES}) == ${i} ]] && enable_nm && break - done - - # If no match found, install and enable NM - if [[ $NM_ENABLED -eq 0 ]]; then - # Where networkmanager selected, add network-manager-applet - sed -i 's/NetworkManager/networkmanager network-manager-applet/g' ${PACKAGES} - basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR - check_for_error "$FUNCNAME" "$?" - - # Where networkmanager selected, now remove network-manager-applet - sed -i 's/networkmanager network-manager-applet/NetworkManager/g' ${PACKAGES} - enable_nm - fi - fi - fi - - # Show after successfully installing or where attempting to repeat when already completed. - [[ $NM_ENABLED -eq 1 ]] && DIALOG " $_InstNMTitle " --msgbox "$_InstNMErrBody" 0 0 -} - -enable_nm() { - # Add openrc support. If openrcbase was installed, the file /mnt/.openrc should exist. - if [[ $(cat ${PACKAGES}) == "NetworkManager" ]]; then - if [[ -e /mnt/.openrc ]]; then - arch_chroot "rc-update add NetworkManager default" 2>$ERR - check_for_error "add default NetworkManager." $? - else - arch_chroot "systemctl enable NetworkManager NetworkManager-dispatcher" >/tmp/.symlink 2>$ERR - check_for_error "enable NetworkManager." $? - fi - else - if [[ -e /mnt/.openrc ]]; then - arch_chroot "rc-update add $(cat ${PACKAGES}) default" 2>$ERR - check_for_error "add default $(cat ${PACKAGES})." $? - else - arch_chroot "systemctl enable $(cat ${PACKAGES})" 2>$ERR - check_for_error "enable $(cat ${PACKAGES})." $? - fi - fi - NM_ENABLED=1 -} - -install_multimedia_menu() { - declare -i loopmenu=1 - while ((loopmenu)); do - local PARENT="$FUNCNAME" - - submenu 5 - DIALOG "$_InstMultMenuBody" --default-item ${HIGHLIGHT_SUB} --menu " $_InstMultMenuTitle " 0 0 5 \ - "1" "$_InstMulSnd" \ - "2" "$_InstMulCodec" \ - "3" "$_InstMulAcc" \ - "4" "$_InstMulCust" \ - "5" "$_Back" 2>${ANSWER} - - HIGHLIGHT_SUB=$(cat ${ANSWER}) - case $(cat ${ANSWER}) in - "1") install_alsa_pulse - ;; - "2") install_codecs - ;; - "3") install_acc_menu - ;; - "4") install_cust_pkgs - ;; - *) loopmenu=0 - ;; - esac - done -} - -install_alsa_pulse() { - # Prep Variables - echo "" > ${PACKAGES} - ALSA="" - PULSE_EXTRA="" - alsa=$(pacman -Ss alsa | awk '{print $1}' | grep "/alsa-" | sed "s/extra\///g" | sort -u) - pulse_extra=$(pacman -Ss pulseaudio- | awk '{print $1}' | sed "s/extra\///g" | grep "pulseaudio-" | sort -u) - - for i in ${alsa}; do - ALSA="${ALSA} ${i} - off" - done - - ALSA=$(echo $ALSA | sed "s/alsa-utils - off/alsa-utils - on/g" | sed "s/alsa-plugins - off/alsa-plugins - on/g") - - for i in ${pulse_extra}; do - PULSE_EXTRA="${PULSE_EXTRA} ${i} - off" - done - - DIALOG " $_InstMulSnd " --checklist "$_InstMulSndBody\n\n$_UseSpaceBar" 0 0 6 \ - $ALSA "pulseaudio" "-" off $PULSE_EXTRA \ - "paprefs" "pulseaudio GUI" off \ - "pavucontrol" "pulseaudio GUI" off \ - "ponymix" "pulseaudio CLI" off \ - "volumeicon" "ALSA GUI" off \ - "volwheel" "ASLA GUI" off 2>${PACKAGES} - - clear - # If at least one package, install. - if [[ $(cat ${PACKAGES}) != "" ]]; then - basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR - check_for_error "$FUNCNAME" "$?" - fi -} - -install_codecs() { - # Prep Variables - echo "" > ${PACKAGES} - GSTREAMER="" - gstreamer=$(pacman -Ss gstreamer | awk '{print $1}' | grep "/gstreamer" | sed "s/extra\///g" | sed "s/community\///g" | sort -u) - echo $gstreamer - for i in ${gstreamer}; do - GSTREAMER="${GSTREAMER} ${i} - off" - done - - DIALOG " $_InstMulCodec " --checklist "$_InstMulCodBody\n\n$_UseSpaceBar" 0 0 14 \ - $GSTREAMER "xine-lib" "-" off 2>${PACKAGES} - - clear - # If at least one package, install. - if [[ $(cat ${PACKAGES}) != "" ]]; then - basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR - check_for_error "$FUNCNAME" "$?" - fi -} - -install_cust_pkgs() { - echo "" > ${PACKAGES} - DIALOG " $_InstMulCust " --inputbox "$_InstMulCustBody" 0 0 "" 2>${PACKAGES} || return 0 - - clear - # If at least one package, install. - if [[ $(cat ${PACKAGES}) != "" ]]; then - if [[ $(cat ${PACKAGES}) == "hen poem" ]]; then - DIALOG " \"My Sweet Buckies\" by Atiya & Carl " --msgbox "\nMy Sweet Buckies,\nYou are the sweetest Buckies that ever did \"buck\",\nLily, Rosie, Trumpet, and Flute,\nMy love for you all is absolute!\n\nThey buck: \"We love our treats, we are the Booyakka sisters,\"\n\"Sometimes we squabble and give each other comb-twisters,\"\n\"And in our garden we love to sunbathe, forage, hop and jump,\"\n\"We love our freedom far, far away from that factory farm dump,\"\n\n\"For so long we were trapped in cramped prisons full of disease,\"\n\"No sunlight, no fresh air, no one who cared for even our basic needs,\"\n\"We suffered in fear, pain, and misery for such a long time,\"\n\"But now we are so happy, we wanted to tell you in this rhyme!\"\n\n" 0 0 - else - basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR - check_for_error "$FUNCNAME $(cat ${PACKAGES})" "$?" - fi - fi -} diff --git a/lib/util-menu-full.sh b/lib/util-menu-full.sh index 7adbaf4..a245dca 100644 --- a/lib/util-menu-full.sh +++ b/lib/util-menu-full.sh @@ -80,3 +80,298 @@ install_graphics_menu_full() { esac done } + +install_desktop_menu() { + local PARENT="$FUNCNAME" + declare -i loopmenu=1 + while ((loopmenu)); do + submenu 4 + DIALOG " $_InstGrMenuTitle " --default-item ${HIGHLIGHT_SUB} \ + --menu "$_InstDEMenuTitle" 0 0 4 \ + "1" "$_InstDEStable" \ + "2" "$_InstDEGit" \ + "3" "$_InstDE|>" \ + "4" "$_Back" 2>${ANSWER} + HIGHLIGHT_SUB=$(cat ${ANSWER}) + + case $(cat ${ANSWER}) in + "1") install_manjaro_de_wm_pkg + ;; + "2") install_manjaro_de_wm_git + ;; + "3") install_vanilla_de_wm + ;; + *) loopmenu=0 + return 0 + ;; + esac + done +} + +install_vanilla_de_wm() { + local PARENT="$FUNCNAME" + declare -i loopmenu=1 + while ((loopmenu)); do + submenu 4 + DIALOG " $_InstGrMenuTitle " --default-item ${HIGHLIGHT_SUB} \ + --menu "$_InstGrMenuBody" 0 0 4 \ + "1" "$_InstGrMenuDS" \ + "2" "$_InstGrDE" \ + "3" "$_InstGrMenuDM" \ + "4" "$_Back" 2>${ANSWER} + HIGHLIGHT_SUB=$(cat ${ANSWER}) + + case $(cat ${ANSWER}) in + "1") install_xorg_input + ;; + "2") install_de_wm + ;; + "3") install_dm + ;; + *) loopmenu=0 + return 0 + ;; + esac + done +} + +install_de_wm() { + # Only show this information box once + if [[ $SHOW_ONCE -eq 0 ]]; then + DIALOG " $_InstDETitle " --msgbox "$_DEInfoBody" 0 0 + SHOW_ONCE=1 + fi + + # DE/WM Menu + DIALOG " $_InstDETitle " --checklist "\n$_InstDEBody\n\n$_UseSpaceBar" 0 0 12 \ + "budgie-desktop" "-" off \ + "cinnamon" "-" off \ + "deepin" "-" off \ + "deepin-extra" "-" off \ + "enlightenment + terminology" "-" off \ + "gnome-shell" "-" off \ + "gnome" "-" off \ + "gnome-extra" "-" off \ + "plasma-desktop" "-" off \ + "plasma" "-" off \ + "kde-applications" "-" off \ + "lxde" "-" off \ + "lxqt + oxygen-icons" "-" off \ + "mate" "-" off \ + "mate-extra" "-" off \ + "mate-gtk3" "-" off \ + "mate-extra-gtk3" "-" off \ + "xfce4" "-" off \ + "xfce4-goodies" "-" off \ + "awesome + vicious" "-" off \ + "fluxbox + fbnews" "-" off \ + "i3-wm + i3lock + i3status" "-" off \ + "icewm + icewm-themes" "-" off \ + "openbox + openbox-themes" "-" off \ + "pekwm + pekwm-themes" "-" off \ + "windowmaker" "-" off 2>${PACKAGES} + + # If something has been selected, install + if [[ $(cat ${PACKAGES}) != "" ]]; then + clear + sed -i 's/+\|\"//g' ${PACKAGES} + basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR + check_for_error "${FUNCNAME}: ${PACKAGES}" "$?" + + # Clear the packages file for installation of "common" packages + echo "" > ${PACKAGES} + + # Offer to install various "common" packages. + DIALOG " $_InstComTitle " --checklist "\n$_InstComBody\n\n$_UseSpaceBar" 0 50 14 \ + "bash-completion" "-" on \ + "gamin" "-" on \ + "gksu" "-" on \ + "gnome-icon-theme" "-" on \ + "gnome-keyring" "-" on \ + "gvfs" "-" on \ + "gvfs-afc" "-" on \ + "gvfs-smb" "-" on \ + "polkit" "-" on \ + "poppler" "-" on \ + "python2-xdg" "-" on \ + "ntfs-3g" "-" on \ + "ttf-dejavu" "-" on \ + "xdg-user-dirs" "-" on \ + "xdg-utils" "-" on \ + "xterm" "-" on 2>${PACKAGES} + + # If at least one package, install. + if [[ $(cat ${PACKAGES}) != "" ]]; then + clear + basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR + check_for_error "basestrap ${MOUNTPOINT} $(cat ${PACKAGES})" "$?" + fi + fi +} + +install_network_menu() { + declare -i loopmenu=1 + while ((loopmenu)); do + local PARENT="$FUNCNAME" + + submenu 5 + DIALOG " $_InstNMMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "$_InstNMMenuBody" 0 0 5 \ + "1" "$_SeeWirelessDev" \ + "2" "$_InstNMMenuPkg" \ + "3" "$_InstNMMenuNM" \ + "4" "$_InstNMMenuCups" \ + "5" "$_Back" 2>${ANSWER} + + case $(cat ${ANSWER}) in + "1") # Identify the Wireless Device + lspci -k | grep -i -A 2 "network controller" > /tmp/.wireless + if [[ $(cat /tmp/.wireless) != "" ]]; then + DIALOG " $_WirelessShowTitle " --textbox /tmp/.wireless 0 0 + else + DIALOG " $_WirelessShowTitle " --msgbox "$_WirelessErrBody" 7 30 + fi + ;; + "2") install_wireless_packages + ;; + "3") install_nm + ;; + "4") install_cups + ;; + *) loopmenu=0 + return 0 + ;; + esac + done +} + +install_multimedia_menu() { + declare -i loopmenu=1 + while ((loopmenu)); do + local PARENT="$FUNCNAME" + + submenu 5 + DIALOG "$_InstMultMenuBody" --default-item ${HIGHLIGHT_SUB} --menu " $_InstMultMenuTitle " 0 0 5 \ + "1" "$_InstMulSnd" \ + "2" "$_InstMulCodec" \ + "3" "$_InstMulAcc" \ + "4" "$_InstMulCust" \ + "5" "$_Back" 2>${ANSWER} + + HIGHLIGHT_SUB=$(cat ${ANSWER}) + case $(cat ${ANSWER}) in + "1") install_alsa_pulse + ;; + "2") install_codecs + ;; + "3") install_acc_menu + ;; + "4") install_cust_pkgs + ;; + *) loopmenu=0 + ;; + esac + done +} + +# Install Accessibility Applications +install_acc_menu() { + echo "" > ${PACKAGES} + + DIALOG " $_InstAccTitle " --checklist "$_InstAccBody" 0 0 15 \ + "accerciser" "-" off \ + "at-spi2-atk" "-" off \ + "at-spi2-core" "-" off \ + "brltty" "-" off \ + "caribou" "-" off \ + "dasher" "-" off \ + "espeak" "-" off \ + "espeakup" "-" off \ + "festival" "-" off \ + "java-access-bridge" "-" off \ + "java-atk-wrapper" "-" off \ + "julius" "-" off \ + "orca" "-" off \ + "qt-at-spi" "-" off \ + "speech-dispatcher" "-" off 2>${PACKAGES} + + clear + # If something has been selected, install + if [[ $(cat ${PACKAGES}) != "" ]]; then + basestrap ${MOUNTPOINT} ${PACKAGES} 2>$ERR + check_for_error "$FUNCNAME" $? || return $? + fi +} + +security_menu() { + declare -i loopmenu=1 + while ((loopmenu)); do + local PARENT="$FUNCNAME" + + submenu 4 + DIALOG " $_SecMenuTitle " --default-item ${HIGHLIGHT_SUB} \ + --menu "$_SecMenuBody" 0 0 4 \ + "1" "$_SecJournTitle" \ + "2" "$_SecCoreTitle" \ + "3" "$_SecKernTitle " \ + "4" "$_Back" 2>${ANSWER} + + HIGHLIGHT_SUB=$(cat ${ANSWER}) + case $(cat ${ANSWER}) in + # systemd-journald + "1") DIALOG " $_SecJournTitle " --menu "$_SecJournBody" 0 0 7 \ + "$_Edit" "/etc/systemd/journald.conf" \ + "10M" "SystemMaxUse=10M" \ + "20M" "SystemMaxUse=20M" \ + "50M" "SystemMaxUse=50M" \ + "100M" "SystemMaxUse=100M" \ + "200M" "SystemMaxUse=200M" \ + "$_Disable" "Storage=none" 2>${ANSWER} + + if [[ $(cat ${ANSWER}) != "" ]]; then + if [[ $(cat ${ANSWER}) == "$_Disable" ]]; then + sed -i "s/#Storage.*\|Storage.*/Storage=none/g" ${MOUNTPOINT}/etc/systemd/journald.conf + sed -i "s/SystemMaxUse.*/#&/g" ${MOUNTPOINT}/etc/systemd/journald.conf + DIALOG " $_SecJournTitle " --infobox "\n$_Done!\n\n" 0 0 + sleep 2 + elif [[ $(cat ${ANSWER}) == "$_Edit" ]]; then + nano ${MOUNTPOINT}/etc/systemd/journald.conf + else + sed -i "s/#SystemMaxUse.*\|SystemMaxUse.*/SystemMaxUse=$(cat ${ANSWER})/g" ${MOUNTPOINT}/etc/systemd/journald.conf + sed -i "s/Storage.*/#&/g" ${MOUNTPOINT}/etc/systemd/journald.conf + DIALOG " $_SecJournTitle " --infobox "\n$_Done!\n\n" 0 0 + sleep 2 + fi + fi + ;; + # core dump + "2") DIALOG " $_SecCoreTitle " --menu "$_SecCoreBody" 0 0 2 \ + "$_Disable" "Storage=none" \ + "$_Edit" "/etc/systemd/coredump.conf" 2>${ANSWER} + + if [[ $(cat ${ANSWER}) == "$_Disable" ]]; then + sed -i "s/#Storage.*\|Storage.*/Storage=none/g" ${MOUNTPOINT}/etc/systemd/coredump.conf + DIALOG " $_SecCoreTitle " --infobox "\n$_Done!\n\n" 0 0 + sleep 2 + elif [[ $(cat ${ANSWER}) == "$_Edit" ]]; then + nano ${MOUNTPOINT}/etc/systemd/coredump.conf + fi + ;; + # Kernel log access + "3") DIALOG " $_SecKernTitle " --menu "$_SecKernBody" 0 0 2 \ + "$_Disable" "kernel.dmesg_restrict = 1" \ + "$_Edit" "/etc/systemd/coredump.conf.d/custom.conf" 2>${ANSWER} + + case $(cat ${ANSWER}) in + "$_Disable") echo "kernel.dmesg_restrict = 1" > ${MOUNTPOINT}/etc/sysctl.d/50-dmesg-restrict.conf + DIALOG " $_SecKernTitle " --infobox "\n$_Done!\n\n" 0 0 + sleep 2 ;; + "$_Edit") [[ -e ${MOUNTPOINT}/etc/sysctl.d/50-dmesg-restrict.conf ]] && nano ${MOUNTPOINT}/etc/sysctl.d/50-dmesg-restrict.conf || \ + DIALOG " $_SeeConfErrTitle " --msgbox "$_SeeConfErrBody1" 0 0 ;; + esac + ;; + *) loopmenu=0 + return 0 + ;; + esac + done +} diff --git a/lib/util-menu.sh b/lib/util-menu.sh index 3c35004..1331ba4 100644 --- a/lib/util-menu.sh +++ b/lib/util-menu.sh @@ -1,4 +1,3 @@ - # !/bin/bash # # Architect Installation Framework (2016-2017) @@ -187,89 +186,6 @@ install_graphics_menu() { done } -install_vanilla_de_wm() { - local PARENT="$FUNCNAME" - declare -i loopmenu=1 - while ((loopmenu)); do - submenu 4 - DIALOG " $_InstGrMenuTitle " --default-item ${HIGHLIGHT_SUB} \ - --menu "$_InstGrMenuBody" 0 0 4 \ - "1" "$_InstGrMenuDS" \ - "2" "$_InstGrDE" \ - "3" "$_InstGrMenuDM" \ - "4" "$_Back" 2>${ANSWER} - HIGHLIGHT_SUB=$(cat ${ANSWER}) - - case $(cat ${ANSWER}) in - "1") install_xorg_input - ;; - "2") install_de_wm - ;; - "3") install_dm - ;; - *) loopmenu=0 - return 0 - ;; - esac - done -} - -install_desktop_menu() { - local PARENT="$FUNCNAME" - declare -i loopmenu=1 - while ((loopmenu)); do - submenu 4 - DIALOG " $_InstGrMenuTitle " --default-item ${HIGHLIGHT_SUB} \ - --menu "$_InstDEMenuTitle" 0 0 4 \ - "1" "$_InstDEStable" \ - "2" "$_InstDEGit" \ - "3" "$_InstDE|>" \ - "4" "$_Back" 2>${ANSWER} - HIGHLIGHT_SUB=$(cat ${ANSWER}) - - case $(cat ${ANSWER}) in - "1") install_manjaro_de_wm_pkg - ;; - "2") install_manjaro_de_wm_git - ;; - "3") install_vanilla_de_wm - ;; - *) loopmenu=0 - return 0 - ;; - esac - done -} - -# Install Accessibility Applications -install_acc_menu() { - echo "" > ${PACKAGES} - - DIALOG " $_InstAccTitle " --checklist "$_InstAccBody" 0 0 15 \ - "accerciser" "-" off \ - "at-spi2-atk" "-" off \ - "at-spi2-core" "-" off \ - "brltty" "-" off \ - "caribou" "-" off \ - "dasher" "-" off \ - "espeak" "-" off \ - "espeakup" "-" off \ - "festival" "-" off \ - "java-access-bridge" "-" off \ - "java-atk-wrapper" "-" off \ - "julius" "-" off \ - "orca" "-" off \ - "qt-at-spi" "-" off \ - "speech-dispatcher" "-" off 2>${PACKAGES} - - clear - # If something has been selected, install - if [[ $(cat ${PACKAGES}) != "" ]]; then - basestrap ${MOUNTPOINT} ${PACKAGES} 2>$ERR - check_for_error "$FUNCNAME" $? || return $? - fi -} - edit_configs() { declare -i loopmenu=1 while ((loopmenu)); do @@ -350,373 +266,4 @@ edit_configs() { DIALOG " $_ErrTitle " --msgbox "$_SeeConfErrBody" 0 0 fi done -} - - - - - - - - - - - - - - - - - - - - - - - - - - -#################################################################################################################### -#################################################################################################################### - -main_menu() { - declare -i loopmenu=1 - while ((loopmenu)); do - if [[ $HIGHLIGHT != 5 ]]; then - HIGHLIGHT=$(( HIGHLIGHT + 1 )) - fi - - DIALOG " $_MMTitle " --default-item ${HIGHLIGHT} \ - --menu "$_MMBody" 0 0 6 \ - "1" "$_PrepMenuTitle|>" \ - "2" "$_InstBsMenuTitle|>" \ - "3" "$_InstGrMenuTitle|>" \ - "4" "$_ConfBseMenuTitle|>" \ - "5" "$_SeeConfOptTitle|>" \ - "6" "$_Done" 2>${ANSWER} - HIGHLIGHT=$(cat ${ANSWER}) - - case $(cat ${ANSWER}) in - "1") prep_menu - ;; - "2") check_mount && install_base_menu - ;; - "3") check_base && install_graphics_menu - ;; - "4") check_base && config_base_menu - ;; - "5") check_base && edit_configs - ;; - *) loopmenu=0 - exit_done - ;; - esac - done -} - -# Preparation -prep_menu() { - local PARENT="$FUNCNAME" - declare -i loopmenu=1 - while ((loopmenu)); do - submenu 7 - DIALOG "$_PrepMenuTitle " --default-item ${HIGHLIGHT_SUB} \ - --menu "$_PrepMenuBody" 0 0 7 \ - "1" "$_VCKeymapTitle" \ - "2" "$_DevShowOpt" \ - "3" "$_PrepPartDisk" \ - "4" "$_PrepLUKS" \ - "5" "$_PrepLVM $_PrepLVM2" \ - "6" "$_PrepMntPart" \ - "7" "$_Back" 2>${ANSWER} - HIGHLIGHT_SUB=$(cat ${ANSWER}) - - case $(cat ${ANSWER}) in - "1") set_keymap - ;; - "2") show_devices - ;; - "3") umount_partitions - select_device - create_partitions - ;; - "4") luks_menu - ;; - "5") lvm_menu - ;; - "6") mount_partitions - ;; - *) loopmenu=0 - return 0 - ;; - esac - done -} - -# Base Installation -install_base_menu() { - local PARENT="$FUNCNAME" - declare -i loopmenu=1 - while ((loopmenu)); do - submenu 5 - DIALOG " $_InstBsMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "$_InstBseMenuBody" 0 0 5 \ - "1" "$_PrepMirror" \ - "2" "$_PrepPacKey" \ - "3" "$_InstBse" \ - "4" "$_InstBootldr" \ - "5" "$_Back" 2>${ANSWER} - HIGHLIGHT_SUB=$(cat ${ANSWER}) - - case $(cat ${ANSWER}) in - "1") configure_mirrorlist - ;; - "2") clear - pacman-key --init - pacman-key --populate archlinux manjaro - pacman-key --refresh-keys - check_for_error "refresh pacman-keys" - ;; - "3") install_base - ;; - "4") install_bootloader - ;; - *) loopmenu=0 - return 0 - ;; - esac - done -} - -# Base Configuration -config_base_menu() { - local PARENT="$FUNCNAME" - declare -i loopmenu=1 - while ((loopmenu)); do - submenu 8 - DIALOG "$_ConfBseBody" --default-item ${HIGHLIGHT_SUB} --menu " $_ConfBseMenuTitle " \ - 0 0 8 \ - "1" "$_ConfBseFstab" \ - "2" "$_ConfBseHost" \ - "3" "$_ConfBseSysLoc" \ - "4" "$_ConfBseTimeHC" \ - "5" "$_ConfUsrRoot" \ - "6" "$_ConfUsrNew" \ - "7" "$_MMRunMkinit" \ - "8" "$_Back" 2>${ANSWER} - HIGHLIGHT_SUB=$(cat ${ANSWER}) - - case $(cat ${ANSWER}) in - "1") generate_fstab - ;; - "2") set_hostname - ;; - "3") set_locale - ;; - "4") set_timezone - set_hw_clock - ;; - "5") set_root_password - ;; - "6") create_new_user - ;; - "7") run_mkinitcpio - ;; - *) loopmenu=0 - return 0 - ;; - esac - done -} - -install_graphics_menu() { - local PARENT="$FUNCNAME" - declare -i loopmenu=1 - while ((loopmenu)); do - submenu 4 - DIALOG " $_InstGrMenuTitle " --default-item ${HIGHLIGHT_SUB} \ - --menu "$_InstGrMenuBody" 0 0 4 \ - "1" "$_InstGrMenuDD" \ - "2" "$_InstGrMenuGE|>" \ - "3" "$_PrepKBLayout" \ - "4" "$_Back" 2>${ANSWER} - HIGHLIGHT_SUB=$(cat ${ANSWER}) - - case $(cat ${ANSWER}) in - "1") setup_graphics_card - ;; - "2") install_manjaro_de_wm_pkg - ;; - "3") set_xkbmap - ;; - *) loopmenu=0 - return 0 - ;; - esac - done -} - -install_vanilla_de_wm() { - local PARENT="$FUNCNAME" - declare -i loopmenu=1 - while ((loopmenu)); do - submenu 4 - DIALOG " $_InstGrMenuTitle " --default-item ${HIGHLIGHT_SUB} \ - --menu "$_InstGrMenuBody" 0 0 4 \ - "1" "$_InstGrMenuDS" \ - "2" "$_InstGrDE" \ - "3" "$_InstGrMenuDM" \ - "4" "$_Back" 2>${ANSWER} - HIGHLIGHT_SUB=$(cat ${ANSWER}) - - case $(cat ${ANSWER}) in - "1") install_xorg_input - ;; - "2") install_de_wm - ;; - "3") install_dm - ;; - *) loopmenu=0 - return 0 - ;; - esac - done -} - -install_desktop_menu() { - local PARENT="$FUNCNAME" - declare -i loopmenu=1 - while ((loopmenu)); do - submenu 4 - DIALOG " $_InstGrMenuTitle " --default-item ${HIGHLIGHT_SUB} \ - --menu "$_InstDEMenuTitle" 0 0 4 \ - "1" "$_InstDEStable" \ - "2" "$_InstDEGit" \ - "3" "$_InstDE|>" \ - "4" "$_Back" 2>${ANSWER} - HIGHLIGHT_SUB=$(cat ${ANSWER}) - - case $(cat ${ANSWER}) in - "1") install_manjaro_de_wm_pkg - ;; - "2") install_manjaro_de_wm_git - ;; - "3") install_vanilla_de_wm - ;; - *) loopmenu=0 - return 0 - ;; - esac - done -} - -# Install Accessibility Applications -install_acc_menu() { - echo "" > ${PACKAGES} - - DIALOG " $_InstAccTitle " --checklist "$_InstAccBody" 0 0 15 \ - "accerciser" "-" off \ - "at-spi2-atk" "-" off \ - "at-spi2-core" "-" off \ - "brltty" "-" off \ - "caribou" "-" off \ - "dasher" "-" off \ - "espeak" "-" off \ - "espeakup" "-" off \ - "festival" "-" off \ - "java-access-bridge" "-" off \ - "java-atk-wrapper" "-" off \ - "julius" "-" off \ - "orca" "-" off \ - "qt-at-spi" "-" off \ - "speech-dispatcher" "-" off 2>${PACKAGES} - - clear - # If something has been selected, install - if [[ $(cat ${PACKAGES}) != "" ]]; then - basestrap ${MOUNTPOINT} ${PACKAGES} 2>$ERR - check_for_error "$FUNCNAME" $? || return $? - fi -} - -edit_configs() { - declare -i loopmenu=1 - while ((loopmenu)); do - local PARENT="$FUNCNAME" - - # Clear the file variables - FILE="" - user_list="" - - submenu 13 - DIALOG " $_SeeConfOptTitle " --default-item ${HIGHLIGHT_SUB} --menu "$_SeeConfOptBody" 0 0 13 \ - "1" "/etc/vconsole.conf" \ - "2" "/etc/locale.conf" \ - "3" "/etc/hostname" \ - "4" "/etc/hosts" \ - "5" "/etc/sudoers" \ - "6" "/etc/mkinitcpio.conf" \ - "7" "/etc/fstab" \ - "8" "/etc/crypttab" \ - "9" "grub/syslinux/systemd-boot" \ - "10" "lxdm/lightdm/sddm" \ - "11" "/etc/pacman.conf" \ - "12" "~/.xinitrc" \ - "13" "$_Back" 2>${ANSWER} - HIGHLIGHT_SUB=$(cat ${ANSWER}) - - case $(cat ${ANSWER}) in - "1") [[ -e ${MOUNTPOINT}/etc/vconsole.conf ]] && FILE="${MOUNTPOINT}/etc/vconsole.conf" - ;; - "2") [[ -e ${MOUNTPOINT}/etc/locale.conf ]] && FILE="${MOUNTPOINT}/etc/locale.conf" - ;; - "3") [[ -e ${MOUNTPOINT}/etc/hostname ]] && FILE="${MOUNTPOINT}/etc/hostname" - ;; - "4") [[ -e ${MOUNTPOINT}/etc/hosts ]] && FILE="${MOUNTPOINT}/etc/hosts" - ;; - "5") [[ -e ${MOUNTPOINT}/etc/sudoers ]] && FILE="${MOUNTPOINT}/etc/sudoers" - ;; - "6") [[ -e ${MOUNTPOINT}/etc/mkinitcpio.conf ]] && FILE="${MOUNTPOINT}/etc/mkinitcpio.conf" - ;; - "7") [[ -e ${MOUNTPOINT}/etc/fstab ]] && FILE="${MOUNTPOINT}/etc/fstab" - ;; - "8") [[ -e ${MOUNTPOINT}/etc/crypttab ]] && FILE="${MOUNTPOINT}/etc/crypttab" - ;; - "9") [[ -e ${MOUNTPOINT}/etc/default/grub ]] && FILE="${MOUNTPOINT}/etc/default/grub" - [[ -e ${MOUNTPOINT}/boot/syslinux/syslinux.cfg ]] && FILE="$FILE ${MOUNTPOINT}/boot/syslinux/syslinux.cfg" - if [[ -e ${MOUNTPOINT}${UEFI_MOUNT}/loader/loader.conf ]]; then - files=$(ls ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/*.conf) - for i in ${files}; do - FILE="$FILE ${i}" - done - fi - ;; - "10") [[ -e ${MOUNTPOINT}/etc/lxdm/lxdm.conf ]] && FILE="${MOUNTPOINT}/etc/lxdm/lxdm.conf" - [[ -e ${MOUNTPOINT}/etc/lightdm/lightdm.conf ]] && FILE="${MOUNTPOINT}/etc/lightdm/lightdm.conf" - [[ -e ${MOUNTPOINT}/etc/sddm.conf ]] && FILE="${MOUNTPOINT}/etc/sddm.conf" - ;; - "11") [[ -e ${MOUNTPOINT}/etc/pacman.conf ]] && FILE="${MOUNTPOINT}/etc/pacman.conf" - ;; - "12") user_list=$(ls ${MOUNTPOINT}/home/ | sed "s/lost+found//") - for i in ${user_list}; do - [[ -e ${MOUNTPOINT}/home/$i/.xinitrc ]] && FILE="$FILE ${MOUNTPOINT}/home/$i/.xinitrc" - done - ;; - *) loopmenu=0 - return 0 - ;; - esac - - if [[ $FILE != "" ]]; then - nano $FILE - if [[ $FILE == "${MOUNTPOINT}/etc/mkinitcpio.conf" ]]; then - dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --yesno "${_MMRunMkinit}?" 0 0 && { - run_mkinitcpio 2>$ERR - check_for_error "run_mkinitcpio" $? - } - fi - else - DIALOG " $_ErrTitle " --msgbox "$_SeeConfErrBody" 0 0 - fi - done -} +} \ No newline at end of file