diff --git a/README.md b/README.md index 8f163aa..f643f26 100644 --- a/README.md +++ b/README.md @@ -31,3 +31,14 @@ Finally, launch the script: Then follow the on-screen instructions to completion. If you require extra help, visit the provided video playlist and follow my example. + + +## For developpers + +You can test your script with this command : + + sh archfi -t {githubusername} {branchname} + +Example : + + sh archfi -t matmoul master diff --git a/archfi b/archfi index 7bf0b84..26666aa 100644 --- a/archfi +++ b/archfi @@ -12,7 +12,7 @@ # referance : https://wiki.archlinux.org/index.php/Installation_guide -apptitle="Arch Linux Fast Install (archfi) - Version: 2019.11.02.00.13.01 (GPLv3)" +apptitle="Arch Linux Fast Install (archfi) - Version: 2020.01.11.03.53.30 (GPLv3)" baseurl=https://raw.githubusercontent.com/MatMoul/archfi/master skipfont="0" @@ -105,7 +105,7 @@ chooselanguage(){ fi font= if [ "$(cat /etc/locale.gen | grep ""#${locale}"")" != "" ]; then - sed -i "/${locale}/s/^#//g" /etc/locale.gen + sed -i "/#${locale}/s/^#//g" /etc/locale.gen locale-gen fi export LANG=${locale} @@ -565,13 +565,13 @@ formatswapdevice(){ formatdevice(){ options=() options+=("btrfs" "") - options+=("reiserfs" "") options+=("ext4" "") options+=("ext3" "") options+=("ext2" "") options+=("xfs" "") options+=("f2fs" "") options+=("jfs" "") + options+=("reiserfs" "") if [ ! "${3}" = "noluks" ]; then options+=("luks" "encrypted") fi @@ -599,10 +599,6 @@ formatdevice(){ umount /mnt fi ;; - reiserfs) - echo "mkfs.reiserfs -f ${2}" - mkfs.reiserfs -f ${2} - ;; ext4) echo "mkfs.ext4 ${2}" mkfs.ext4 ${2} @@ -627,6 +623,10 @@ formatdevice(){ echo "mkfs.xfs -f ${2}" mkfs.jfs -f ${2} ;; + reiserfs) + echo "mkfs.reiserfs -f ${2}" + mkfs.reiserfs -f ${2} + ;; luks) echo "${txtcreateluksdevice}" echo "cryptsetup luksFormat ${2}" @@ -725,28 +725,28 @@ installmenu(){ nextitem=${1} fi options=() + options+=("${txtselectmirrorsbycountry}" "(${txtoptional})") options+=("${txteditmirrorlist}" "(${txtoptional})") - options+=("${txtinstallarchlinux}" "pacstrap base kernel") - options+=("${txtinstallfirmware}" "(${txtoptional}) pacstrap linux-firmware") + options+=("${txtinstallarchlinux}" "pacstrap base kernel firmwares") options+=("${txtconfigarchlinux}" "") sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallmenu}" --menu "" --cancel-button "${txtunmount}" --default-item "${nextitem}" 0 0 0 \ "${options[@]}" \ 3>&1 1>&2 2>&3) if [ "$?" = "0" ]; then case ${sel} in + "${txtselectmirrorsbycountry}") + selectmirrorsbycountry + nextitem="${txtinstallarchlinux}" + ;; "${txteditmirrorlist}") ${EDITOR} /etc/pacman.d/mirrorlist nextitem="${txtinstallarchlinux}" ;; "${txtinstallarchlinux}") if(installbase) then - nextitem="${txtinstallfirmware}" + nextitem="${txtconfigarchlinux}" fi ;; - "${txtinstallfirmware}") - installfirmware - nextitem="${txtconfigarchlinux}" - ;; "${txtconfigarchlinux}") archmenu nextitem="${txtconfigarchlinux}" @@ -758,6 +758,25 @@ installmenu(){ fi } +selectmirrorsbycountry() { + if [[ ! -f /etc/pacman.d/mirrorlist.backup ]]; then + cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup + fi + items=$( sed -n "/^##.*/N; {s/^## \(.*\)\nServer.*/\1/p}" < /etc/pacman.d/mirrorlist.backup | sort -u ) + options=() + IFS_ORIG=$IFS + IFS=$'\n' + for item in ${items}; do + options+=("${item}" "") + done + IFS=$IFS_ORIG + country=$(whiptail --backtitle "${APPTITLE}" --title "${txtselectcountry}" --menu "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3) + if [ "$?" != "0" ]; then + return 1 + fi + sed "s/^\(Server .*\)/\#\1/;/^## $country/N; {s/^\(## .*\n\)\#Server \(.*\)/\1Server \2/}" < /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist +} + installbase(){ clear pkgs="base" @@ -774,18 +793,22 @@ installbase(){ else return 1 fi + options=() + options+=("linux-firmware" "(${txtoptional})" on) + sel=$(whiptail --backtitle "${apptitle}" --title "Firmwares" --checklist "" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ ! "$?" = "0" ]; then + return 1 + fi + for itm in $sel; do + pkgs="$pkgs $(echo $itm | sed 's/"//g')" + done echo "pacstrap /mnt ${pkgs}" pacstrap /mnt ${pkgs} pressanykey } -installfirmware(){ - clear - echo "pacstrap /mnt linux-firmware" - pacstrap /mnt linux-firmware - pressanykey -} - unmountdevices(){ clear echo "umount -R /mnt" @@ -1016,8 +1039,8 @@ archsetlocale(){ echo "LANG=${locale}.UTF-8" > /mnt/etc/locale.conf echo "echo \"LC_COLLATE=C\" >> /mnt/etc/locale.conf" echo "LC_COLLATE=C" >> /mnt/etc/locale.conf - echo "sed -i '/"${locale}".UTF-8/s/^#//g' /mnt/etc/locale.gen" - sed -i '/'${locale}'.UTF-8/s/^#//g' /mnt/etc/locale.gen + echo "sed -i '/#${locale}.UTF-8/s/^#//g' /mnt/etc/locale.gen" + sed -i '/#'${locale}'.UTF-8/s/^#//g' /mnt/etc/locale.gen archchroot setlocale pressanykey fi @@ -1746,6 +1769,8 @@ loadstrings(){ txtarchinstallmenu="Arch Install Menu" + txtselectmirrorsbycountry="Select mirrors by country" + txtselectcountry="Select country" txteditmirrorlist="Edit mirrorlist" txtinstallarchlinux="Install Arch Linux" txtinstallfirmware="Install Firmware" @@ -1804,14 +1829,18 @@ while (( "$#" )); do --help) echo "archfi" echo "------" - echo "-sf | --skip-font Skip setfont from language files" - echo "-efiX -efi0 : disable EFI, -efi1 efi inst, -efi2 efi hybrid inst" - echo "-t | --test ghusername ghbranch Test language files" + echo "-sf | --skip-font Skip setfont from language files" + echo "-efiX -efi0 : disable EFI, -efi1 efi inst, -efi2 efi hybrid inst" + echo "-t | --test ghusername ghbranch Test archfi script and language" exit 0 ;; -sf | --skip-font) skipfont=1;; - -t | --test) baseurl="https://raw.githubusercontent" - baseurl="${baseurl}.com/""${2}/archfi/${3}";; + -t | --test) + wget -O archfi https://raw.githubusercontent.com/${2}/archfi/${3}/archfi + sh archfi -tt ${2} ${3} + exit 0 + ;; + -tt) baseurl="https://raw.githubusercontent.com/${2}/archfi/${3}";; -efi0) efimode=0;; -efi1) eficomputer=1 diff --git a/lng/Brazilian b/lng/Brazilian index 6bcf8dc..ed0a25f 100644 --- a/lng/Brazilian +++ b/lng/Brazilian @@ -44,7 +44,7 @@ txtformatdevices="Formatar Dispositivos" txtformatdevice="Formatar Dispositivo" txtmount="Montar" txtunmount="Desmontar" -txtmountdesc="Instalar e Configurar" +txtmountdesc="Instalar ou Configurar" txtformatdeviceconfirm="Aviso, todos os dados nas partições selecionadas serão apagados ! \nFormatar partições ?"