Merge pull request #3 from MatMoul/master

Update
This commit is contained in:
Hugo Carvalho 2020-01-18 13:18:32 +00:00 committed by GitHub
commit 4174a2f8b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 29 deletions

View file

@ -31,3 +31,14 @@ Finally, launch the script:
Then follow the on-screen instructions to completion. Then follow the on-screen instructions to completion.
If you require extra help, visit the provided video playlist and follow my example. 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

85
archfi
View file

@ -12,7 +12,7 @@
# referance : https://wiki.archlinux.org/index.php/Installation_guide # 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 baseurl=https://raw.githubusercontent.com/MatMoul/archfi/master
skipfont="0" skipfont="0"
@ -105,7 +105,7 @@ chooselanguage(){
fi fi
font= font=
if [ "$(cat /etc/locale.gen | grep ""#${locale}"")" != "" ]; then 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 locale-gen
fi fi
export LANG=${locale} export LANG=${locale}
@ -565,13 +565,13 @@ formatswapdevice(){
formatdevice(){ formatdevice(){
options=() options=()
options+=("btrfs" "") options+=("btrfs" "")
options+=("reiserfs" "")
options+=("ext4" "") options+=("ext4" "")
options+=("ext3" "") options+=("ext3" "")
options+=("ext2" "") options+=("ext2" "")
options+=("xfs" "") options+=("xfs" "")
options+=("f2fs" "") options+=("f2fs" "")
options+=("jfs" "") options+=("jfs" "")
options+=("reiserfs" "")
if [ ! "${3}" = "noluks" ]; then if [ ! "${3}" = "noluks" ]; then
options+=("luks" "encrypted") options+=("luks" "encrypted")
fi fi
@ -599,10 +599,6 @@ formatdevice(){
umount /mnt umount /mnt
fi fi
;; ;;
reiserfs)
echo "mkfs.reiserfs -f ${2}"
mkfs.reiserfs -f ${2}
;;
ext4) ext4)
echo "mkfs.ext4 ${2}" echo "mkfs.ext4 ${2}"
mkfs.ext4 ${2} mkfs.ext4 ${2}
@ -627,6 +623,10 @@ formatdevice(){
echo "mkfs.xfs -f ${2}" echo "mkfs.xfs -f ${2}"
mkfs.jfs -f ${2} mkfs.jfs -f ${2}
;; ;;
reiserfs)
echo "mkfs.reiserfs -f ${2}"
mkfs.reiserfs -f ${2}
;;
luks) luks)
echo "${txtcreateluksdevice}" echo "${txtcreateluksdevice}"
echo "cryptsetup luksFormat ${2}" echo "cryptsetup luksFormat ${2}"
@ -725,28 +725,28 @@ installmenu(){
nextitem=${1} nextitem=${1}
fi fi
options=() options=()
options+=("${txtselectmirrorsbycountry}" "(${txtoptional})")
options+=("${txteditmirrorlist}" "(${txtoptional})") options+=("${txteditmirrorlist}" "(${txtoptional})")
options+=("${txtinstallarchlinux}" "pacstrap base kernel") options+=("${txtinstallarchlinux}" "pacstrap base kernel firmwares")
options+=("${txtinstallfirmware}" "(${txtoptional}) pacstrap linux-firmware")
options+=("${txtconfigarchlinux}" "") options+=("${txtconfigarchlinux}" "")
sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallmenu}" --menu "" --cancel-button "${txtunmount}" --default-item "${nextitem}" 0 0 0 \ sel=$(whiptail --backtitle "${apptitle}" --title "${txtinstallmenu}" --menu "" --cancel-button "${txtunmount}" --default-item "${nextitem}" 0 0 0 \
"${options[@]}" \ "${options[@]}" \
3>&1 1>&2 2>&3) 3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then
case ${sel} in case ${sel} in
"${txtselectmirrorsbycountry}")
selectmirrorsbycountry
nextitem="${txtinstallarchlinux}"
;;
"${txteditmirrorlist}") "${txteditmirrorlist}")
${EDITOR} /etc/pacman.d/mirrorlist ${EDITOR} /etc/pacman.d/mirrorlist
nextitem="${txtinstallarchlinux}" nextitem="${txtinstallarchlinux}"
;; ;;
"${txtinstallarchlinux}") "${txtinstallarchlinux}")
if(installbase) then if(installbase) then
nextitem="${txtinstallfirmware}" nextitem="${txtconfigarchlinux}"
fi fi
;; ;;
"${txtinstallfirmware}")
installfirmware
nextitem="${txtconfigarchlinux}"
;;
"${txtconfigarchlinux}") "${txtconfigarchlinux}")
archmenu archmenu
nextitem="${txtconfigarchlinux}" nextitem="${txtconfigarchlinux}"
@ -758,6 +758,25 @@ installmenu(){
fi 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(){ installbase(){
clear clear
pkgs="base" pkgs="base"
@ -774,18 +793,22 @@ installbase(){
else else
return 1 return 1
fi 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}" echo "pacstrap /mnt ${pkgs}"
pacstrap /mnt ${pkgs} pacstrap /mnt ${pkgs}
pressanykey pressanykey
} }
installfirmware(){
clear
echo "pacstrap /mnt linux-firmware"
pacstrap /mnt linux-firmware
pressanykey
}
unmountdevices(){ unmountdevices(){
clear clear
echo "umount -R /mnt" echo "umount -R /mnt"
@ -1016,8 +1039,8 @@ archsetlocale(){
echo "LANG=${locale}.UTF-8" > /mnt/etc/locale.conf echo "LANG=${locale}.UTF-8" > /mnt/etc/locale.conf
echo "echo \"LC_COLLATE=C\" >> /mnt/etc/locale.conf" echo "echo \"LC_COLLATE=C\" >> /mnt/etc/locale.conf"
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" echo "sed -i '/#${locale}.UTF-8/s/^#//g' /mnt/etc/locale.gen"
sed -i '/'${locale}'.UTF-8/s/^#//g' /mnt/etc/locale.gen sed -i '/#'${locale}'.UTF-8/s/^#//g' /mnt/etc/locale.gen
archchroot setlocale archchroot setlocale
pressanykey pressanykey
fi fi
@ -1746,6 +1769,8 @@ loadstrings(){
txtarchinstallmenu="Arch Install Menu" txtarchinstallmenu="Arch Install Menu"
txtselectmirrorsbycountry="Select mirrors by country"
txtselectcountry="Select country"
txteditmirrorlist="Edit mirrorlist" txteditmirrorlist="Edit mirrorlist"
txtinstallarchlinux="Install Arch Linux" txtinstallarchlinux="Install Arch Linux"
txtinstallfirmware="Install Firmware" txtinstallfirmware="Install Firmware"
@ -1804,14 +1829,18 @@ while (( "$#" )); do
--help) --help)
echo "archfi" echo "archfi"
echo "------" echo "------"
echo "-sf | --skip-font Skip setfont from language files" echo "-sf | --skip-font Skip setfont from language files"
echo "-efiX -efi0 : disable EFI, -efi1 efi inst, -efi2 efi hybrid inst" echo "-efiX -efi0 : disable EFI, -efi1 efi inst, -efi2 efi hybrid inst"
echo "-t | --test ghusername ghbranch Test language files" echo "-t | --test ghusername ghbranch Test archfi script and language"
exit 0 exit 0
;; ;;
-sf | --skip-font) skipfont=1;; -sf | --skip-font) skipfont=1;;
-t | --test) baseurl="https://raw.githubusercontent" -t | --test)
baseurl="${baseurl}.com/""${2}/archfi/${3}";; 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;; -efi0) efimode=0;;
-efi1) -efi1)
eficomputer=1 eficomputer=1

View file

@ -44,7 +44,7 @@ txtformatdevices="Formatar Dispositivos"
txtformatdevice="Formatar Dispositivo" txtformatdevice="Formatar Dispositivo"
txtmount="Montar" txtmount="Montar"
txtunmount="Desmontar" 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 ?" txtformatdeviceconfirm="Aviso, todos os dados nas partições selecionadas serão apagados ! \nFormatar partições ?"