From 59503579f81721dc8c194f4889edbf4ae6ba98af Mon Sep 17 00:00:00 2001 From: Bernhard Landauer Date: Sun, 12 Feb 2017 16:54:20 +0100 Subject: [PATCH] more white-space cleaning --- manjaro-architect | 214 ++++++++++++++++++++++++---------------------- 1 file changed, 111 insertions(+), 103 deletions(-) diff --git a/manjaro-architect b/manjaro-architect index f1773c8..693fe67 100755 --- a/manjaro-architect +++ b/manjaro-architect @@ -295,61 +295,63 @@ configure_mirrorlist() { #Choose the branch for mirrorlist BRANCH="/tmp/.branch" dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " Choose Manjaro branch to use " --radiolist " $_UseSpaceBar" 0 0 3 \ - "stable" "-" on \ - "testing" "-" off \ - "unstable" "-" off 2>${BRANCH} + "stable" "-" on \ + "testing" "-" off \ + "unstable" "-" off 2>${BRANCH} pacman-mirrors -g -b $(cat ${BRANCH}) -i } dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_MirrorlistTitle " \ - --menu "$_MirrorlistBody" 0 0 4 \ - "1" "$_MirrorRankTitle" \ - "2" "$_MirrorConfig" \ - "3" "$_MirrorPacman" \ - "4" "$_Back" 2>${ANSWER} + --menu "$_MirrorlistBody" 0 0 4 \ + "1" "$_MirrorRankTitle" \ + "2" "$_MirrorConfig" \ + "3" "$_MirrorPacman" \ + "4" "$_Back" 2>${ANSWER} - case $(cat ${ANSWER}) in - "1") rank_mirrors - ;; - "2") nano /etc/pacman-mirrors.conf - ;; - "3") nano /etc/pacman.conf +case $(cat ${ANSWER}) in + "1") rank_mirrors + ;; + "2") nano /etc/pacman-mirrors.conf + ;; + "3") nano /etc/pacman.conf dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_MirrorPacman " --yesno "$_MIrrorPacQ" 0 0 && COPY_PACCONF=1 || COPY_PACCONF=0 pacman -Syy - ;; - *) install_base_menu - ;; - esac + ;; + *) install_base_menu + ;; +esac + +configure_mirrorlist - configure_mirrorlist } # virtual console keymap set_keymap() { - KEYMAPS="" + 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 --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_VCKeymapTitle " \ - --menu "$_VCKeymapBody" 20 40 16 ${KEYMAPS} 2>${ANSWER} || prep_menu + --menu "$_VCKeymapBody" 20 40 16 ${KEYMAPS} 2>${ANSWER} || prep_menu KEYMAP=$(cat ${ANSWER}) - loadkeys $KEYMAP 2>/tmp/.errlog + loadkeys $KEYMAP 2>/tmp/.errlog check_for_error echo -e "KEYMAP=${KEYMAP}\nFONT=${FONT}" > /tmp/vconsole.conf - } + +} # Set keymap for X11 - set_xkbmap() { +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") + 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 + for i in ${keymaps_xkb}; do XKBMAP_LIST="${XKBMAP_LIST} ${i} -" done @@ -362,19 +364,20 @@ set_keymap() { # 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 + 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 --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseSysLoc " --menu "$_localeBody" 0 0 12 ${LOCALES} 2>${ANSWER} || config_base_menu + dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseSysLoc " --menu "$_localeBody" 0 0 12 ${LOCALES} 2>${ANSWER} || config_base_menu - LOCALE=$(cat ${ANSWER}) + LOCALE=$(cat ${ANSWER}) + + echo "LANG=\"${LOCALE}\"" > ${MOUNTPOINT}/etc/locale.conf + sed -i "s/#${LOCALE}/${LOCALE}/" ${MOUNTPOINT}/etc/locale.gen 2>/tmp/.errlog + arch_chroot "locale-gen" >/dev/null 2>>/tmp/.errlog + check_for_error - echo "LANG=\"${LOCALE}\"" > ${MOUNTPOINT}/etc/locale.conf - sed -i "s/#${LOCALE}/${LOCALE}/" ${MOUNTPOINT}/etc/locale.gen 2>/tmp/.errlog - arch_chroot "locale-gen" >/dev/null 2>>/tmp/.errlog - check_for_error } # Set Zone and Sub-Zone @@ -382,71 +385,74 @@ 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} -" + ZONE="$ZONE ${i} -" done - dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseTimeHC " --menu "$_TimeZBody" 0 0 10 ${ZONE} 2>${ANSWER} || config_base_menu - ZONE=$(cat ${ANSWER}) + dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseTimeHC " --menu "$_TimeZBody" 0 0 10 ${ZONE} 2>${ANSWER} || config_base_menu + 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="" + 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 + done - dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseTimeHC " --menu "$_TimeSubZBody" 0 0 11 ${SUBZONE} 2>${ANSWER} || config_base_menu - SUBZONE=$(cat ${ANSWER}) + dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseTimeHC " --menu "$_TimeSubZBody" 0 0 11 ${SUBZONE} 2>${ANSWER} || config_base_menu + SUBZONE=$(cat ${ANSWER}) - dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseTimeHC " --yesno "$_TimeZQ ${ZONE}/${SUBZONE}?" 0 0 + dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseTimeHC " --yesno "$_TimeZQ ${ZONE}/${SUBZONE}?" 0 0 - if [[ $? -eq 0 ]]; then + if [[ $? -eq 0 ]]; then arch_chroot "ln -s /usr/share/zoneinfo/${ZONE}/${SUBZONE} /etc/localtime" 2>/tmp/.errlog check_for_error - else + else config_base_menu - fi + fi + } set_hw_clock() { - dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseTimeHC " --menu "$_HwCBody" 0 0 2 \ - "utc" "-" \ - "localtime" "-" 2>${ANSWER} + dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseTimeHC " --menu "$_HwCBody" 0 0 2 \ + "utc" "-" \ + "localtime" "-" 2>${ANSWER} [[ $(cat ${ANSWER}) != "" ]] && arch_chroot "hwclock --systohc --$(cat ${ANSWER})" 2>/tmp/.errlog && check_for_error + } # Function will not allow incorrect UUID type for installed system. generate_fstab() { dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_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 --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_FstabErr" 0 0 - generate_fstab - else - $(cat ${ANSWER}) ${MOUNTPOINT} > ${MOUNTPOINT}/etc/fstab 2>/tmp/.errlog - check_for_error - [[ -f ${MOUNTPOINT}/swapfile ]] && sed -i "s/\\${MOUNTPOINT}//" ${MOUNTPOINT}/etc/fstab + "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 --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_FstabErr" 0 0 + generate_fstab + else + $(cat ${ANSWER}) ${MOUNTPOINT} > ${MOUNTPOINT}/etc/fstab 2>/tmp/.errlog + check_for_error + [[ -f ${MOUNTPOINT}/swapfile ]] && sed -i "s/\\${MOUNTPOINT}//" ${MOUNTPOINT}/etc/fstab + fi fi - fi - config_base_menu + config_base_menu } set_hostname() { - dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseHost " --inputbox "$_HostNameBody" 0 0 "manjaro" 2>${ANSWER} || config_base_menu + dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfBseHost " --inputbox "$_HostNameBody" 0 0 "manjaro" 2>${ANSWER} || config_base_menu + + echo "$(cat ${ANSWER})" > ${MOUNTPOINT}/etc/hostname 2>/tmp/.errlog + 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>>/tmp/.errlog + check_for_error - echo "$(cat ${ANSWER})" > ${MOUNTPOINT}/etc/hostname 2>/tmp/.errlog - 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>>/tmp/.errlog - check_for_error } # Adapted and simplified from the Manjaro 0.8 and Antergos 2.0 installers @@ -459,13 +465,13 @@ set_root_password() { PASSWD2=$(cat ${ANSWER}) if [[ $PASSWD == $PASSWD2 ]]; then - echo -e "${PASSWD}\n${PASSWD}" > /tmp/.passwd - arch_chroot "passwd root" < /tmp/.passwd >/dev/null 2>/tmp/.errlog - rm /tmp/.passwd - check_for_error + echo -e "${PASSWD}\n${PASSWD}" > /tmp/.passwd + arch_chroot "passwd root" < /tmp/.passwd >/dev/null 2>/tmp/.errlog + rm /tmp/.passwd + check_for_error else - dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_PassErrBody" 0 0 - set_root_password + dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_PassErrBody" 0 0 + set_root_password fi } @@ -473,21 +479,21 @@ set_root_password() { # Originally adapted from the Antergos 2.0 installer create_new_user() { - dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_NUsrTitle " --inputbox "$_NUsrBody" 0 0 "" 2>${ANSWER} || config_base_menu - USER=$(cat ${ANSWER}) + dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_NUsrTitle " --inputbox "$_NUsrBody" 0 0 "" 2>${ANSWER} || config_base_menu + 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 --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_NUsrTitle " --inputbox "$_NUsrErrBody" 0 0 "" 2>${ANSWER} || config_base_menu - USER=$(cat ${ANSWER}) - done + # 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 --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_NUsrTitle " --inputbox "$_NUsrErrBody" 0 0 "" 2>${ANSWER} || config_base_menu + USER=$(cat ${ANSWER}) + done - # If zsh is installed, use that for users shell - if [[ -e /mnt/usr/bin/zsh ]]; then - shell="zsh" - else - shell="bash" - fi + # If zsh is installed, use that for users shell + if [[ -e /mnt/usr/bin/zsh ]]; then + shell="zsh" + else + shell="bash" + fi # Enter password. This step will only be reached where the loop has been skipped or broken. dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassNUsrBody $USER\n\n" 0 0 2> ${ANSWER} || config_base_menu PASSWD=$(cat ${ANSWER}) @@ -497,18 +503,19 @@ create_new_user() { # loop while passwords entered do not match. while [[ $PASSWD != $PASSWD2 ]]; do - dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_PassErrBody" 0 0 + dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ErrTitle " --msgbox "$_PassErrBody" 0 0 - dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassNUsrBody $USER\n\n" 0 0 2> ${ANSWER} || config_base_menu - PASSWD=$(cat ${ANSWER}) + dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassNUsrBody $USER\n\n" 0 0 2> ${ANSWER} || config_base_menu + PASSWD=$(cat ${ANSWER}) - dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 2> ${ANSWER} || config_base_menu - PASSWD2=$(cat ${ANSWER}) + dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 2> ${ANSWER} || config_base_menu + PASSWD2=$(cat ${ANSWER}) done # create new user. This step will only be reached where the password loop has been skipped or broken. dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_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>/tmp/.errlog @@ -517,6 +524,7 @@ create_new_user() { arch_chroot "passwd ${USER}" < /tmp/.passwd >/dev/null 2>/tmp/.errlog rm /tmp/.passwd check_for_error + # 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}" @@ -526,25 +534,25 @@ create_new_user() { run_mkinitcpio() { - clear + clear - KERNEL="" + 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>/tmp/.errlog + # 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>/tmp/.errlog ([[ $LVM -eq 1 ]] && [[ $LUKS -eq 1 ]]) && sed -i 's/block filesystems/block encrypt lvm2 filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>/tmp/.errlog ([[ $LVM -eq 0 ]] && [[ $LUKS -eq 1 ]]) && sed -i 's/block filesystems/block encrypt filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>/tmp/.errlog check_for_error arch_chroot "mkinitcpio -P" 2>>/tmp/.errlog - check_for_error + check_for_error } ###################################################################### -## ## -## System and Partitioning Functions ## -## ## +## ## +## System and Partitioning Functions ## +## ## ######################################################################