From f9a1d3e701d56524483abd305816b1e11abbc866 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Sun, 19 Jul 2015 02:12:26 +0200 Subject: [PATCH] Import from sourceforge --- CHANGELOG | 23 + archfi | 1147 +++++++++++++++++++++++++++++++++++++++++++++++++ learn/English | 284 ++++++++++++ lng/French | 76 ++++ 4 files changed, 1530 insertions(+) create mode 100755 CHANGELOG create mode 100755 archfi create mode 100755 learn/English create mode 100755 lng/French diff --git a/CHANGELOG b/CHANGELOG new file mode 100755 index 0000000..e1bfa1b --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,23 @@ +Current Version : +----------------- + +Global : +- Add EFI computer detection. + +MainMenu : +- Add Changelog item + +Languages : +- Add name of translatator in menu. +- Add header to language files. + +Disk Partitions : +- Add new Auto Partitions (gpt,bios+efi,noswap). Can be used for USB Key. +- Display gpt in first position if the computer is not EFI. +- Display gpt,efi in first position if the computer is EFI. + +Mount/Unmount : +- More verbose. + +Install bootloader : +- Add new option for BIOS+EFI. Can be used for USB Key. diff --git a/archfi b/archfi new file mode 100755 index 0000000..f2bc998 --- /dev/null +++ b/archfi @@ -0,0 +1,1147 @@ +#!/bin/bash + +# Arch Linux Fast Install (archfi) +# -------------------------------- +# author : matmoul[@sourceforge.net] +# project : http://sourceforge.net/projects/archfi +# license : GPLv3 (http://opensource.org/licenses/GPL-3.0) +# +# referance : https://wiki.archlinux.org/index.php/Installation_guide + + +apptitle="Arch Linux Fast Install (archfi) - Version: 2015.06.28.20.37.40 (GPLv3)" +baseurl=https://raw.githubusercontent.com/MatMoul/archfi/master + + + +# -------------------------------------------------------- +mainmenu(){ + if [ "$1" = "" ]; then + nextitem="." + else + nextitem=$1 + fi + options=() + options+=("$txtlanguage" "") + options+=("$txtsetkeymap" "(loadkeys ...)") + options+=("$txtdiskpartmenu" "") + options+=("$txtselectpartsmenu" "") + options+=("" "") + options+=("$txthelp" "") + options+=("$txtchangelog" "") + options+=("" "") + options+=("$txtreboot" "") + sel=$(whiptail --backtitle "$apptitle" --title "$txtmainmenu" --menu "" --cancel-button "Exit" --default-item "$nextitem" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + case $sel in + "$txtlanguage") + chooselanguage + nextitem="$txtsetkeymap" + ;; + "$txtsetkeymap") + setkeymap + nextitem="$txtdiskpartmenu" + ;; + "$txtdiskpartmenu") + diskpartmenu + nextitem="$txtselectpartsmenu" + ;; + "$txtselectpartsmenu") + selectparts + nextitem="$txtreboot" + ;; + "$txthelp") + help + nextitem="$txtreboot" + ;; + "$txtchangelog") + showchangelog + nextitem="$txtreboot" + ;; + "$txtreboot") + rebootpc + nextitem="$txtreboot" + ;; + esac + mainmenu "$nextitem" + else + clear + fi +} + + +chooselanguage(){ + options=() + options+=("English" "(By MatMoul)") + options+=("French" "(By MatMoul)") + sel=$(whiptail --backtitle "$apptitle" --title "$txtlanguage" --menu "" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + clear + if [ "$sel" = "English" ]; then + loadstrings + else + eval $(curl -L $baseurl/lng/$sel | sed '/^#/ d') + #if [ "$learning" = "1" ]; then + # eval $(curl -L $baseurl/learn/$sel | sed '/^#/ d') + #fi + fi + fi +} + +setkeymap(){ + learn setkeymap + items=$(localectl list-keymaps) + options=() + for item in $items; do + options+=("$item" "") + done + keymap=$(whiptail --backtitle "$apptitle" --title "$txtsetkeymap" --menu "" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + clear + loadkeys $keymap + fi +} + +help(){ + msg="" + msg=$msg"Command arguments :\n" + msg=$msg" -h --help : Show this help message\n" + msg=$msg" -l --learning : Show learning messages for each operations.\n" + msg=$msg"\n" + whiptail --backtitle "$apptitle" --title "$txthelp" --msgbox "$msg" 0 0 +} + +showchangelog(){ + clear + curl -L $baseurl/CHANGELOG > ~/archfi-CHANGELOG + less ~/archfi-CHANGELOG + rm ~/archfi-CHANGELOG +} + +rebootpc(){ + if (whiptail --backtitle "$apptitle" --title "$txtreboot" --yesno "$txtreboot ?" --defaultno 0 0) then + learn reboot + clear + reboot + fi +} +# -------------------------------------------------------- + + + +# -------------------------------------------------------- +diskpartmenu(){ + if [ "$1" = "" ]; then + learn diskpart + nextitem="." + else + nextitem=$1 + fi + options=() + if [ "$eficomputer" == "0" ]; then + options+=("$txtautoparts (gpt)" "") + options+=("$txtautoparts (dos)" "") + options+=("$txtautoparts (gpt,efi)" "") + options+=("$txtautoparts (gpt,bios+efi,noswap)" "") + else + options+=("$txtautoparts (gpt,efi)" "") + options+=("$txtautoparts (gpt)" "") + options+=("$txtautoparts (dos)" "") + options+=("$txtautoparts (gpt,bios+efi,noswap)" "") + fi + options+=("$txteditparts (cfdisk)" "") + options+=("$txteditparts (cgdisk)" "") + sel=$(whiptail --backtitle "$apptitle" --title "$txtdiskpartmenu" --menu "" --cancel-button "Back" --default-item "$nextitem" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + case $sel in + "$txtautoparts (dos)") + diskpartautodos + nextitem="$txtautoparts (dos)" + ;; + "$txtautoparts (gpt)") + diskpartautogpt + nextitem="$txtautoparts (gpt)" + ;; + "$txtautoparts (gpt,efi)") + diskpartautoefi + nextitem="$txtautoparts (gpt,efi)" + ;; + "$txtautoparts (gpt,bios+efi,noswap)") + diskpartautoefiusb + nextitem="$txtautoparts (gpt,bios+efi,noswap)" + ;; + "$txteditparts (cfdisk)") + diskpartcfdisk + nextitem="$txteditparts (cfdisk)" + ;; + "$txteditparts (cgdisk)") + diskpartcgdisk + nextitem="$txteditparts (cgdisk)" + ;; + esac + diskpartmenu "$nextitem" + fi +} + + +diskpartautodos(){ + learn diskpartautodos + items=$(lsblk -d -p -n -l -o NAME -e 7,11) + options=() + for item in $items; do + options+=("$item" "") + done + device=$(whiptail --backtitle "$apptitle" --title "$txtautoparts (dos)" --menu "" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + if (whiptail --backtitle "$apptitle" --title "$txtautoparts (dos)" --yesno "${txtautopartsconfirm//%1/$device}" --defaultno 0 0) then + clear + echo "$txtautopartclear" + parted $device mklabel msdos + sleep 1 + echo "${txtautopartcreate//%1/boot}" + echo -e "n\np\n\n\n+512M\na\nw" | fdisk $device + sleep 1 + echo "${txtautopartcreate//%1/swap}" + swapsize=$(cat /proc/meminfo | grep MemTotal | awk '{ print $2 }') + swapsize=$(($swapsize/1000))"M" + echo -e "n\np\n\n\n+$swapsize\nt\n\n82\nw" | fdisk $device + sleep 1 + echo "${txtautopartcreate//%1/root}" + echo -e "n\np\n\n\n\nw" | fdisk $device + sleep 1 + echo "" + pressanykey + bootdev=$device"1" + swapdev=$device"2" + rootdev=$device"3" + efimode="0" + fi + fi +} + +diskpartautogpt(){ + learn diskpartautogpt + items=$(lsblk -d -p -n -l -o NAME -e 7,11) + options=() + for item in $items; do + options+=("$item" "") + done + device=$(whiptail --backtitle "$apptitle" --title "$txtautoparts (gpt)" --menu "" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + if (whiptail --backtitle "$apptitle" --title "$txtautoparts (gpt)" --yesno "${txtautopartsconfirm//%1/$device}" --defaultno 0 0) then + clear + echo "$txtautopartclear" + parted $device mklabel gpt + echo "${txtautopartcreate//%1/BIOS boot}" + sgdisk $device -n=1:0:+31M -t=1:ef02 + echo "${txtautopartcreate//%1/boot}" + sgdisk $device -n=2:0:+512M + echo "${txtautopartcreate//%1/swap}" + swapsize=$(cat /proc/meminfo | grep MemTotal | awk '{ print $2 }') + swapsize=$(($swapsize/1000))"M" + sgdisk $device -n=3:0:+$swapsize -t=3:8200 + echo "${txtautopartcreate//%1/root}" + sgdisk $device -n=4:0:0 + echo "" + pressanykey + bootdev=$device"2" + swapdev=$device"3" + rootdev=$device"4" + efimode="0" + fi + fi +} + +diskpartautoefi(){ + learn diskpartautoefi + items=$(lsblk -d -p -n -l -o NAME -e 7,11) + options=() + for item in $items; do + options+=("$item" "") + done + device=$(whiptail --backtitle "$apptitle" --title "$txtautoparts (gpt,efi)" --menu "" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + if (whiptail --backtitle "$apptitle" --title "$txtautoparts (gpt,efi)" --yesno "${txtautopartsconfirm//%1/$device}" --defaultno 0 0) then + clear + echo "$txtautopartclear" + parted $device mklabel gpt + echo "${txtautopartcreate//%1/EFI boot}" + sgdisk $device -n=1:0:+1024M -t=1:ef00 + echo "${txtautopartcreate//%1/swap}" + swapsize=$(cat /proc/meminfo | grep MemTotal | awk '{ print $2 }') + swapsize=$(($swapsize/1000))"M" + sgdisk $device -n=3:0:+$swapsize -t=3:8200 + echo "${txtautopartcreate//%1/root}" + sgdisk $device -n=4:0:0 + echo "" + pressanykey + bootdev=$device"1" + swapdev=$device"3" + rootdev=$device"4" + efimode="1" + fi + fi +} + +diskpartautoefiusb(){ + learn diskpartautoefiusb + items=$(lsblk -d -p -n -l -o NAME -e 7,11) + options=() + for item in $items; do + options+=("$item" "") + done + device=$(whiptail --backtitle "$apptitle" --title "$txtautoparts (gpt,efi)" --menu "" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + if (whiptail --backtitle "$apptitle" --title "$txtautoparts (gpt,efi)" --yesno "${txtautopartsconfirm//%1/$device}" --defaultno 0 0) then + clear + echo "$txtautopartclear" + parted $device mklabel gpt + echo "${txtautopartcreate//%1/EFI boot}" + sgdisk $device -n=1:0:+1024M -t=1:ef00 + echo "${txtautopartcreate//%1/BIOS boot}" + sgdisk $device -n=3:0:+31M -t=3:ef02 + echo "${txtautopartcreate//%1/root}" + sgdisk $device -n=4:0:0 + echo "$txthybridpartcreate" + echo -e "r\nh\n3\nN\n\nY\nN\nw\nY\n" | gdisk $device + echo "" + pressanykey + bootdev=$device"1" + swapdev= + rootdev=$device"4" + efimode="2" + fi + fi +} + +diskpartcfdisk(){ + learn diskpartcfdisk + items=$(lsblk -d -p -n -l -o NAME -e 7,11) + options=() + for item in $items; do + options+=("$item" "") + done + device=$(whiptail --backtitle "$apptitle" --title "$txteditparts (cfdisk)" --menu "" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + clear + cfdisk $device + fi +} + +diskpartcgdisk(){ + learn diskpartcgdisk + items=$(lsblk -d -p -n -l -o NAME -e 7,11) + options=() + for item in $items; do + options+=("$item" "") + done + device=$(whiptail --backtitle "$apptitle" --title "$txteditparts (cfdisk)" --menu "" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + clear + cgdisk $device + fi +} +# -------------------------------------------------------- + + + +# -------------------------------------------------------- +selectparts(){ + learn selectparts + + items=$(lsblk -p -n -l -o NAME -e 7,11) + options=() + for item in $items; do + options+=("$item" "") + done + + bootdev=$(whiptail --backtitle "$apptitle" --title "$txtselectpartsmenu" --menu "${txtselectdevice//%1/boot}" --default-item "$bootdev" 0 0 0 \ + "none" "-" \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ ! "$?" = "0" ]; then + return 1 + else + if [ "$bootdev" = "none" ]; then + bootdev= + fi + fi + + swapdev=$(whiptail --backtitle "$apptitle" --title "$txtselectpartsmenu" --menu "${txtselectdevice//%1/swap}" --default-item "$swapdev" 0 0 0 \ + "none" "-" \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ ! "$?" = "0" ]; then + return 1 + else + if [ "$swapdev" = "none" ]; then + swapdev= + fi + fi + + rootdev=$(whiptail --backtitle "$apptitle" --title "$txtselectpartsmenu" --menu "${txtselectdevice//%1/root}" --default-item "$rootdev" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ ! "$?" = "0" ]; then + return 1 + fi + + homedev=$(whiptail --backtitle "$apptitle" --title "$txtselectpartsmenu" --menu "${txtselectdevice//%1/home}" 0 0 0 \ + "none" "-" \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ ! "$?" = "0" ]; then + return 1 + else + if [ "$homedev" = "none" ]; then + homedev= + fi + fi + + msg="$txtselecteddevices\n\n" + msg=$msg"boot : "$bootdev"\n" + msg=$msg"swap : "$swapdev"\n" + msg=$msg"root : "$rootdev"\n" + msg=$msg"home : "$homedev"\n\n" + if (whiptail --backtitle "$apptitle" --title "$txtselectpartsmenu" --yesno "$msg" 0 0) then + mountmenu + fi +} +# -------------------------------------------------------- + + + +# -------------------------------------------------------- +mountmenu(){ + if [ "$1" = "" ]; then + nextitem="." + else + nextitem=$1 + fi + options=() + options+=("$txtformatdevices" "") + options+=("$txtmount" "$txtmountdesc") + sel=$(whiptail --backtitle "$apptitle" --title "$txtformatmountmenu" --menu "" --cancel-button "Back" --default-item "$nextitem" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + case $sel in + "$txtformatdevices") + formatdevices + nextitem="$txtmount" + ;; + "$txtmount") + mountparts + nextitem="$txtmount" + ;; + esac + mountmenu "$nextitem" + fi +} + + +formatdevices(){ + if (whiptail --backtitle "$apptitle" --title "$txtformatdevices" --yesno "$txtformatdeviceconfirm" --defaultno 0 0) then + if [ ! "$bootdev" = "" ]; then + formatbootdevice boot $bootdev + fi + if [ ! "$swapdev" = "" ]; then + formatswapdevice + fi + formatdevice root $rootdev + if [ ! "$homedev" = "" ]; then + formatdevice home $homedev + fi + fi +} +formatbootdevice(){ + learn formatbootdevice + options=() + if [ "$efimode" == "1" ]||[ "$efimode" = "2" ]; then + options+=("fat32" "(EFI)") + fi + options+=("ext2" "") + options+=("ext3" "") + options+=("ext4" "") + if [ ! "$efimode" = "1" ]&&[ ! "$efimode" = "2" ]; then + options+=("fat32" "(EFI)") + fi + sel=$(whiptail --backtitle "$apptitle" --title "$txtformatdevice" --menu "${txtselectpartformat//%1/$1 ($2)}" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ ! "$?" = "0" ]; then + return 1 + fi + clear + echo "${txtformatingpart//%1/$2} $sel" + echo "----------------------------------------------" + case $sel in + ext2) mkfs.ext2 $2;; + ext3) mkfs.ext3 $2;; + ext4) mkfs.ext4 $2;; + fat32) mkfs.fat $2;; + esac + echo "" + pressanykey +} +formatswapdevice(){ + learn formatswapdevice + clear + echo "${txtformatingpart//%1/$swapdev} swap" + echo "----------------------------------------------" + mkswap $swapdev + echo "" + pressanykey +} +formatdevice(){ + learn formatdevice + options=() + options+=("btrfs" "") + options+=("reiserfs" "") + options+=("ext4" "") + options+=("ext3" "") + options+=("ext2" "") + options+=("xfs" "") + options+=("jfs" "") + sel=$(whiptail --backtitle "$apptitle" --title "$txtformatdevice" --menu "${txtselectpartformat//%1/$1 ($2)}" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ ! "$?" = "0" ]; then + return 1 + fi + clear + echo "${txtformatingpart//%1/$2} $sel" + echo "----------------------------------------------" + case $sel in + btrfs) mkfs.btrfs -f $2;; + reiserfs) mkfs.reiserfs -f $2;; + ext4) mkfs.ext4 $2;; + ext3) mkfs.ext3 $2;; + ext2) mkfs.ext2 $2;; + xfs) mkfs.xfs -f $2;; + jfs) mkfs.jfs -f $2;; + esac + echo "" + pressanykey +} + +mountparts(){ + learn mountparts + clear + echo "Mounting to /mnt ..." + echo "-----------------" + echo "mount $rootdev /mnt" + mount $rootdev /mnt + mkdir /mnt/{boot,home} + if [ ! "$bootdev" = "" ]; then + echo "mount $bootdev /mnt/boot" + mount $bootdev /mnt/boot + fi + if [ ! "$swapdev" = "" ]; then + echo "swapon $swapdev" + swapon $swapdev + fi + if [ ! "$homedev" = "" ]; then + echo "mount $homedev /mnt/home" + mount $homedev /mnt/home + fi + pressanykey + installmenu +} +# -------------------------------------------------------- + + + +# -------------------------------------------------------- +installmenu(){ + if [ "$1" = "" ]; then + nextitem="$txtinstallarchlinux" + else + nextitem=$1 + fi + options=() + options+=("$txteditmirrorlist" "($txtoptional)") + options+=("$txtinstallarchlinux" "pacstrap base") + options+=("$txtconfigarchlinux" "") + sel=$(whiptail --backtitle "$apptitle" --title "$txtinstallmenu" --menu "" --cancel-button "Unmount" --default-item "$nextitem" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + case $sel in + "$txteditmirrorlist") + nano /etc/pacman.d/mirrorlist + nextitem="$txtinstallarchlinux" + ;; + "$txtinstallarchlinux") + installbase + nextitem="$txtconfigarchlinux" + ;; + "$txtconfigarchlinux") + archmenu + nextitem="$txtconfigarchlinux" + ;; + esac + installmenu "$nextitem" + else + unmountdevices + fi +} + +installbase(){ + learn installbase + clear + pacstrap /mnt base +} + +unmountdevices(){ + learn unmountdevices + clear + echo "umount -R /mnt" + umount -R /mnt + if [ ! "$swapdev" = "" ]; then + echo "swapoff $swapdev" + swapoff $swapdev + fi + pressanykey +} +# -------------------------------------------------------- + + + +# -------------------------------------------------------- +archmenu(){ + if [ "$1" = "" ]; then + nextitem="." + else + nextitem=$1 + fi + options=() + options+=("$txtsethostname" "/etc/hostname") + options+=("$txtsetkeymap" "/etc/vconsole.conf") + options+=("$txtsetlocale" "/etc/locale.conf, /etc/locale.gen") + options+=("$txtsettime" "/etc/localtime") + options+=("$txtsetrootpassword" "") + options+=("${txtgenerate//%1/fstab}" "") + options+=("${txtedit//%1/fstab}" "($txtoptional)") + options+=("${txtedit//%1/mkinitcpio.conf}" "($txtoptional)") + options+=("${txtedit//%1/mirrorlist}" "($txtoptional)") + options+=("${txtinstall//%1/grub}" "pacstrap grub (os-prober), grub-mkconfig") + options+=("${txtedit//%1/grub}" "($txtoptional)") + options+=("${txtinstall//%1/bootloader}" "grub-install") + options+=("${txtenable//%1/dhcpcd}" "systemctl enable dhcpd") + options+=("archdi" "$txtarchdidesc") + sel=$(whiptail --backtitle "$apptitle" --title "$txtarchinstallmenu" --menu "" --cancel-button "Back" --default-item "$nextitem" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + case $sel in + "$txtsethostname") + archsethostname + nextitem="$txtsetkeymap" + ;; + "$txtsetkeymap") + archsetkeymap + nextitem="$txtsetlocale" + ;; + "$txtsetlocale") + archsetlocale + nextitem="$txtsettime" + ;; + "$txtsettime") + archsettime + nextitem="$txtsetrootpassword" + ;; + "$txtsetrootpassword") + archsetrootpassword + nextitem="${txtgenerate//%1/fstab}" + ;; + "${txtgenerate//%1/fstab}") + archgenfstab + nextitem="${txtinstall//%1/grub}" + ;; + "${txtedit//%1/fstab}") + nano /mnt/etc/fstab + nextitem="${txtedit//%1/fstab}" + ;; + "${txtedit//%1/mkinitcpio.conf}") + archeditmkinitcpio + nextitem="${txtedit//%1/mkinitcpio.conf}" + ;; + "${txtedit//%1/mirrorlist}") + nano /mnt/etc/pacman.d/mirrorlist + nextitem="${txtedit//%1/mirrorlist}" + ;; + "${txtinstall//%1/grub}") + archinstallgrub + nextitem="${txtinstall//%1/bootloader}" + ;; + "${txtedit//%1/grub}") + nano /mnt/etc/default/grub + if (whiptail --backtitle "$apptitle" --title "${txtedit//%1/grub}" --yesno "$txtrungrubmakeconfig" 0 0) then + clear + archchroot installgrub + pressanykey + fi + nextitem="${txtinstall//%1/bootloader}" + ;; + "${txtinstall//%1/bootloader}") + archinstallbootloader + nextitem="${txtenable//%1/dhcpcd}" + ;; + "${txtenable//%1/dhcpcd}") + archenabledhcpcd + nextitem="archdi" + ;; + "archdi") + installarchdi + nextitem="archdi" + ;; + esac + archmenu "$nextitem" + fi +} + +archchroot(){ + cp $0 /mnt/root + chmod 755 /mnt/root/$(basename "$0") + if [ "$learning" = "1" ]; then + arch-chroot /mnt /root/$(basename "$0") --chroot $1 $2 --learning + else + arch-chroot /mnt /root/$(basename "$0") --chroot $1 $2 + fi + rm /mnt/root/$(basename "$0") +} + + +archsethostname(){ + learn archsethostname + hostname=$(whiptail --backtitle "$apptitle" --title "$txtsethostname" --inputbox "" 0 0 "localhost" 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + echo "$hostname" > /mnt/etc/hostname + fi +} + +archsetkeymap(){ + learn archsetkeymap + items=$(localectl list-keymaps) + options=() + for item in $items; do + options+=("$item" "") + done + keymap=$(whiptail --backtitle "$apptitle" --title "$txtsetkeymap" --menu "" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + echo "KEYMAP=$keymap" > /mnt/etc/vconsole.conf + #echo "FONT=lat9w-16" >> /mnt/etc/vconsole.conf + fi +} + +archsetlocale(){ + learn archsetlocale + items=$(ls /usr/share/i18n/locales) + options=() + for item in $items; do + options+=("$item" "") + done + locale=$(whiptail --backtitle "$apptitle" --title "$txtsetlocale" --menu "" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + clear + echo "LANG=$locale.UTF-8" > /mnt/etc/locale.conf + echo "LC_COLLATE=C" >> /mnt/etc/locale.conf + sed -i '/'$locale'.UTF-8/s/^#//g' /mnt/etc/locale.gen + archchroot setlocale + fi +} +archsetlocalechroot(){ + locale-gen + exit +} + +archsettime(){ + learn archsettime + items=$(ls -l /mnt/usr/share/zoneinfo/ | grep '^d' | awk '{ print $9 }') + options=() + for item in $items; do + options+=("$item" "") + done + + timezone=$(whiptail --backtitle "$apptitle" --title "$txtsettime" --menu "" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ ! "$?" = "0" ]; then + return 1 + fi + + + items=$(ls /mnt/usr/share/zoneinfo/$timezone/) + options=() + for item in $items; do + options+=("$item" "") + done + + timezone=$timezone/$(whiptail --backtitle "$apptitle" --title "$txtsettime" --menu "" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ ! "$?" = "0" ]; then + return 1 + fi + + ln -sf /usr/share/zoneinfo/$timezone /mnt/etc/localtime + + if (whiptail --backtitle "$apptitle" --title "$txtsettime" --yesno "$txtuseutcclock" 0 0) then + clear + archchroot settimeutc + else + clear + archchroot settimelocal + fi + +} +archsettimeutcchroot(){ + hwclock --systohc --utc + exit +} +archsettimelocalchroot(){ + hwclock --systohc --localtime + exit +} + +archsetrootpassword(){ + learn archsetrootpassword + clear + echo "$txtsetrootpassword :" + echo "" + archchroot setrootpassword + pressanykey +} +archsetrootpasswordchroot(){ + passwd root + exit +} + +archgenfstab(){ + learn archgenfstab + clear + genfstab -U -p /mnt >> /mnt/etc/fstab +} + +archeditmkinitcpio(){ + nano /mnt/etc/mkinitcpio.conf + if (whiptail --backtitle "$apptitle" --title "${txtedit//%1/mkinitcpio.conf}" --yesno "${txtgenerate//%1/mkinitcpio} ?" 0 0) then + clear + archchroot genmkinitcpio + pressanykey + fi +} +archgenmkinitcpiochroot(){ + mkinitcpio -p linux + exit +} + +archinstallgrub(){ + learn archinstallgrub + clear + pacstrap /mnt grub + + if (whiptail --backtitle "$apptitle" --title "${txtinstall//%1/grub}" --yesno "$txtinstallosprober" --defaultno 0 0) then + clear + pacstrap /mnt os-prober + fi + + if [ "$efimode" = "1" ]||[ "$efimode" = "2" ]; then + if (whiptail --backtitle "$apptitle" --title "${txtinstall//%1/efibootmgr}" --yesno "$txtefibootmgr" 0 0) then + clear + pacstrap /mnt efibootmgr + fi + else + if (whiptail --backtitle "$apptitle" --title "${txtinstall//%1/efibootmgr}" --yesno "$txtefibootmgr" --defaultno 0 0) then + clear + pacstrap /mnt efibootmgr + fi + fi + + clear + archchroot installgrub +} +archinstallgrubchroot(){ + grub-mkconfig -o /boot/grub/grub.cfg + exit +} + +archinstallbootloader(){ + learn archinstallbootloader + + items=$(lsblk -d -p -n -l -o NAME -e 7,11) + options=() + for item in $items; do + options+=("$item" "") + done + device=$(whiptail --backtitle "$apptitle" --title "${txtinstall//%1/bootloader}" --menu "" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + options=() + if [ "$efimode" = "1" ]; then + options+=("EFI" "") + options+=("BIOS" "") + options+=("BIOS+EFI" "") + elif [ "$efimode" = "2" ]; then + options+=("BIOS+EFI" "") + options+=("BIOS" "") + options+=("EFI" "") + else + options+=("BIOS" "") + options+=("EFI" "") + options+=("BIOS+EFI" "") + fi + sel=$(whiptail --backtitle "$apptitle" --title "${txtinstall//%1/bootloader}" --menu "" --cancel-button "Back" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + clear + case $sel in + "BIOS") archchroot installbootloader $device;; + "EFI") archchroot installbootloaderefi $device;; + "BIOS+EFI") archchroot installbootloaderefiusb $device;; + esac + pressanykey + fi + fi +} +archinstallbootloaderchroot(){ + if [ ! "$1" = "none" ]; then + grub-install --target=i386-pc --recheck $1 + fi + exit +} +archinstallbootloaderefichroot(){ + if [ ! "$1" = "none" ]; then + grub-install --target=x86_64-efi --efi-directory=/boot --recheck $1 + fi + exit +} +archinstallbootloaderefiusbchroot(){ + if [ ! "$1" = "none" ]; then + grub-install --target=i386-pc --recheck $1 + grub-install --target=x86_64-efi --efi-directory=/boot --removable --recheck $1 + fi + exit +} + +archenabledhcpcd(){ + learn archenabledhcpcd + if (whiptail --backtitle "$apptitle" --title "${txtenable//%1/dhcpcd}" --yesno "${txtenable//%1/dhcpcd} ?" 0 0) then + clear + archchroot enabledhcpcd + fi +} +archenabledhcpcdchroot(){ + systemctl enable dhcpcd + exit +} + +installarchdi(){ + if(whiptail --backtitle "$apptitle" --title "archdi" --yesno "$txtinstallarchdi" 0 0) then + clear + pacstrap /mnt wget libnewt + fi + if [ "$?" = "0" ]; then + options=() + options+=("$txtarchdiinstallandlaunch" "") + options+=("$txtarchdilaunch" "") + options+=("$txtarchdiinstall" "") + sel=$(whiptail --backtitle "$apptitle" --title "$txtarchdimenu" --menu "" --cancel-button "Back" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + case $sel in + "$txtarchdiinstallandlaunch") archchroot archdiinstallandlaunch;; + "$txtarchdilaunch") archchroot archdilaunch;; + "$txtarchdiinstall") archchroot archdiinstall;; + esac + fi + fi +} +archdiinstallandlaunchchroot(){ + cd + curl -L archdi.sourceforge.net/archdi >archdi + sh archdi -i + archdi --chroot + exit +} +archdilaunchchroot(){ + cd + curl -L archdi.sourceforge.net/archdi >archdi + sh archdi --chroot + rm archdi + exit +} +archdiinstallchroot(){ + cd + curl -L archdi.sourceforge.net/archdi >archdi + sh archdi -i + exit +} +# -------------------------------------------------------- + + + +# -------------------------------------------------------- +pressanykey(){ + read -n1 -p "$txtpressanykey" +} + +loadstrings(){ + txtmainmenu="Main Menu" + txtlanguage="Language" + txtsetkeymap="Set Keyboard Layout" + txtdiskpartmenu="Disk Partitions" + txtselectpartsmenu="Select Partitions and Install" + txthelp="Help" + txtchangelog="Changelog" + txtreboot="Reboot" + + txtautoparts="Auto Partitions" + txteditparts="Edit Partitions" + + txtautopartsconfirm="Selected device : %1\n\nAll data will be erased ! \n\nContinue ?" + + txtautopartclear="Clear all partition data" + txtautopartcreate="Create %1 partition" + txthybridpartcreate="Set hybrid MBR" + txtautopartsettype="Set %1 partition type" + + txtselectdevice="Select %1 device :" + txtselecteddevices="Selected devices :" + + txtformatmountmenu="Format and Mount" + txtformatdevices="Format Devices" + txtformatdevice="Format Device" + txtmount="Mount" + txtmountdesc="Install or Config" + + txtformatdeviceconfirm="Warning, all data on selected devices will be erased ! \nFormat devices ?" + + txtselectpartformat="Select partition format for %1 :" + txtformatingpart="Formatting partition %1 as" + + txtinstallmenu="Install Menu" + + txtarchinstallmenu="Arch Install Menu" + txtrungrubmakeconfig="Run grub-mkconfig ?" + + txteditmirrorlist="Edit mirrorlist" + txtinstallarchlinux="Install Arch Linux" + txtconfigarchlinux="Config Arch Linux" + + txtsethostname="Set Computer Name" + txtsetlocale="Set Locale" + txtsettime="Set Time" + txtsetrootpassword="Set root password" + + txtuseutcclock="Use UTC hardware clock ?" + + txtoptional="Optional" + txtrecommandeasyinst="Recommanded for easy install" + txtset="Set %1" + txtgenerate="Generate %1" + txtedit="Edit %1" + txtinstall="Install %1" + txtenable="Enable %1" + + + txtpressanykey="Press any key to continue." + + txtinstallosprober="os-prober is a good solution if you want to use mutli-boot.\nInstall os-prober ?" + txtefibootmgr="efibootmgr is required for efi computer." + + txtarchdidesc="Full desktop install script" + txtinstallarchdi="Arch Linux Desktop Install (archdi) is a second script who can help you to install a full workstation.\n\nYou can just launch the script or install it. Choose in the next menu.\n\nArch Linux Desktop Install as two dependencies : wget and libnewt.\n\npacstrap wget libnewt ?" + txtarchdiinstallandlaunch="Install and run archdi" + txtarchdiinstall="Install archdi" + txtarchdilaunch="Launch archdi" + + if [ "$learning" = "1" ]; then + eval $(curl -L $baseurl/learn/English | sed '/^#/ d') + fi +} + +learn(){ + if [ "$learning" = "1" ]; then + clear + eval 'echo -e ""${learn'"$1}""" + echo "" + pressanykey + fi +} +# -------------------------------------------------------- + + + +# -------------------------------------------------------- +while (( "$#" )); do + case $1 in + -h|--help) help + exit 0;; + -l|--learning) learning=1;; + --chroot) chroot=1 + command=$2 + args=$3;; + esac + shift +done + +if [ "$chroot" = "1" ]; then + case $command in + 'setrootpassword') archsetrootpasswordchroot;; + 'setlocale') archsetlocalechroot;; + 'settimeutc') archsettimeutcchroot;; + 'settimelocal') archsettimelocalchroot;; + 'genmkinitcpio') archgenmkinitcpiochroot;; + 'enabledhcpcd') archenabledhcpcdchroot;; + 'installgrub') archinstallgrubchroot;; + 'installbootloader') archinstallbootloaderchroot $args;; + 'installbootloaderefi') archinstallbootloaderefichroot $args;; + 'installbootloaderefiusb') archinstallbootloaderefiusbchroot $args;; + 'archdiinstallandlaunch') archdiinstallandlaunchchroot;; + 'archdiinstall') archdiinstallchroot;; + 'archdilaunch') archdilaunchchroot;; + esac +else + pacman -S --needed arch-install-scripts wget libnewt + dmesg |grep efi: > /dev/null + if [ "$?" == "1" ]; then + eficomputer=0 + else + eficomputer=1 + efimode=1 + fi + loadstrings + mainmenu +fi + +exit 0 +# -------------------------------------------------------- diff --git a/learn/English b/learn/English new file mode 100755 index 0000000..2179b02 --- /dev/null +++ b/learn/English @@ -0,0 +1,284 @@ +# Arch Linux Fast Install (archfi) +# -------------------------------- +# project : http://sourceforge.net/projects/archfi +# language : English +# translator : matmoul (pseudo, name or e-mail.) +# notes : misc text... + + +learnsetkeymap="Set keyboard layout for installation. +\n------------------------------------- +\n +\nBefore start, is best to configure your keyboard. +\nUse the next command to list available keymap : +\nlocalectl list-keymaps +\n +\nAnd to apply your keymap : +\nloadkeys en" + +learnreboot="Reboot. +\n------- +\n +\nTo reboot, use the next command : +\nreboot" + +learndiskpart="Disk Partitions. +\n---------------- +\n +\nTo install Arch Linux, you need to partion your disk. +\nIt has many schemas to format a drive (See the doc for more). +\n +\nIf you don't know how to partion your disk, you can auto partition with dos, gpt or gpt+efi table : +\n - dos : recommanded for old computer +\n - gpt : for disk larger than 2Tb +\n - gpt+efi : for EFI computer +" + +learndiskpartautodos="Auto partition dos. +\n------------------- +\n +\nAuto partition make this next partitions : +\n - boot 512Mb (linux type) (bootable flag) +\n - swap RAM Size (swap type) +\n - root Free Space (linux type) +" + +learndiskpartautogpt="Auto partition gpt. +\n------------------- +\n +\nAuto partition make this next partitions : +\n - bios 31Mb (BIOS boot type) +\n - boot 512Mb (linux type) +\n - swap RAM Size (swap type) +\n - root Free Space (linux type) +" + +learndiskpartautoefi="Auto partition gpt,efi. +\n----------------------- +\n +\nAuto partition make this next partitions : +\n - boot 1024Mb (EFI boot type) +\n - swap RAM Size (swap type) +\n - root Free Space (linux type) +" + +learndiskpartautoefiusb="Auto partition gpt,bios+efi. +\n---------------------------- +\n +\nUse this option for USB Key. +\n +\nAuto partition make this next partitions : +\n - boot 1024Mb (EFI boot type) +\n - bios 31Mb (BIOS boot type / Hybrid MBR) +\n - root Free Space (linux type) +" + +learndiskpartcfdisk="Partition Tools : cfdisk +\n------------------------ +\n +\ncfdisk is primary maked to edit dos disk. +\n +\nTo enum available drives, use the next command : +\nlsblk -d -p -n -l -o NAME -e 7,11 +\n +\nTo edit partition on the desired drive : +\ncfdisk /dev/sdX" + +learndiskpartcgdisk="Partition Tools : cgdisk +\n------------------------ +\n +\ncgdisk is primary maked to edit gpt disk. +\n +\nTo enum available drives, use the next command : +\nlsblk -d -p -n -l -o NAME -e 7,11 +\n +\nTo edit partition on the desired drive : +\ncgdisk /dev/sdX" + +learnselectparts="Select install partitions. +\n-------------------------- +\n +\nTo enum available partitions, use the next command : +\nlsblk -d -p -n -l -o NAME -e 7,11 +\n +\nTo install Arch Linux, select a least one root partition : +\nOptionaly you can select : +\n - A boot partition +\n - A swap partition +\n - A home partition" + +learnformatbootdevice="Format boot partition. +\n---------------------- +\n +\nFor this partitions, you can choose many format. +\n +\nWith this wizard, you can choose the next format : +\n - ext2 : mkfs.ext2 /dev/sdX +\n - ext3 : mkfs.ext3 /dev/sdX +\n - ext4 : mkfs.ext4 /dev/sdX +\n +\nYou need to learn which format is best for you. +\next2 is a good choice." + +learnformatswapdevice="Format swap partition. +\n---------------------- +\n +\nTo format swap partition, use the next command : +\nmkswap /dev/sdX" + +learnformatdevice="Format root or home partition. +\n------------------------------ +\n +\nFor this partitions, you can choose many format. +\n - btrfs : mkfs.btrfs -f /dev/sdX +\n - reiserfs : mkfs.reiserfs -f /dev/sdX +\n - ext4 : mkfs.ext4 /dev/sdX +\n - ext3 : mkfs.ext3 /dev/sdX +\n - ext2 : mkfs.ext2 /dev/sdX +\n - jfs : mkfs.jfs -f /dev/sdX +\n - xfs : mkfs.xfs -f /dev/sdX +\n +\nYou need to learn which format is best for you. +\nbtrfs is a good choice because it work fine with snapper for snapshot (It's a good recovery method)." + +learnmountparts="Mount partitions. +\n----------------- +\n +\nTo install Arch Linux, you need to mount selected partitions. +\n +\nFirst mount root device in /mnt : +\nmount /dev/sdX /mnt +\n +\nMake child directories : +\nmkdir /mnt/{boot,home} +\n +\nIf you have a boot partition, mount it in /mnt/boot : +\nmount /dev/sdX /mtn/boot +\n +\nIf you have a swap partition, enable it : +\nswapon /dev/sdX +\n +\nIf you have a home partition, mount it in /mnt/home : +\nmount /dev/sdX /mnt/home" + +learninstallbase="Install base packages. +\n---------------------- +\n +\nTo install Arch Linux just use the next command : +\npacstrap /mnt base" + +learnunmountdevices="Unmount partitions. +\n------------------- +\n +\nWhen operation on new install is terminated, you need to unmount partitions in /mnt. +\nUse the next command : +\numount -R /mnt +\n +\nif you have selected a swap partition, disable it with the next command : +\nswapoff /dev/sdX" + +learnarchsetkeymap="Set keyboard layout for the new installation. +\n--------------------------------------------- +\n +\nUse the next command for list available keymap : +\nlocalectl list-keymaps +\n +\nAnd to apply the desired keymap : +\necho ""KEYMAP=en"" > /mnt/etc/vconsole.conf" + +learnarchsethostname="Set computer name for the new installation. +\n------------------------------------------- +\n +\nTo set your computer name just write it to /etc/hostname with : +\necho ""computer_name"" > /etc/hostname" + +learnarchsetlocale="Set locale for the new installation."" +\n------------------------------------ +\n +\nFor this, use the next command to enum available locales : +\nls /usr/share/i18n/locales +\n +\nAnd for apply selection (add .UTF-8 to the selection) : +\necho ""LANG=en_US.UTF-8"" > /mnt/etc/locale.conf +\necho ""LC_COLLATE=C"" >> /mnt/etc/locale.conf +\n +\nDon't miss to uncomment your locale in /mnt/etc/locale.gen +\nsed -i '/en_US.UTF-8/s/^#//g' /mnt/etc/locale.gen +\nor +\nnano /mnt/etc/locale.gen +\n +\nNow chroot the new installation and call locale-gen +\narch-chroot /mnt +\nlocale-gen +\nexit" + +learnarchsettime="Set time for new installation. +\n------------------------------ +\n +\nFor this, use the next command to enum available locale : +\nls -l /mnt/usr/share/zoneinfo +\nls -l /mnt/usr/share/zoneinfo/[zone] +\n +\nMake a symlink from the selection to /mnt/etc/localtime : +\nln -sf /usr/share/zoneinfo/America/New_York /mnt/etc/localtime +\n +\nNow chroot the new installation and set the hardware clock +\narch-chroot /mnt +\n +\nFor utc harware clock, use the next command : +\nhwclock --systohc --utc +\n +\nFor localtime harware clock, use the next command (if you use a dual boot with Windows) : +\nhwclock --systohc --localtime" + +learnarchsetrootpassword="Set root password. +\n------------------ +\n +\nNow you need to set root password, for this enter chroot and call passwd root : +\narch-chroot /mnt +\npasswd root +\nexit" + +learnarchgenfstab="Generate fstab. +\n--------------- +\n +\nTo write mounted partition in the installation fstab, use the next command : +\ngenfstab -U -p /mnt >> /mnt/etc/fstab" + +learnarchinstallgrub="Install Grub. +\n------------- +\n +\nNow you need a bootloader. +\nFor this, Grub is a great bootloader. +\n +\nFirstly install grub package +\nFor this, use the next command : +\npacstrap /mnt grub +\n +\nTo make configuration, you need to chroot the new installation and call the next commands : +\narch-chroot /mnt +\ngrub-mkconfig -o /boot/grub/grub.cfg +\nexit" + +learnarchinstallbootloader="Install Bootloader. +\n------------------- +\n +\nBefore reboot, you need to make bootable your drive. +\n +\nTo install Grub in your MBR, chroot the new installation and call the next commands for bios install: +\narch-chroot /mnt +\ngrub-install --recheck /dev/sdX +\n\nand for EFI install : +\ngrub-install --target=x86_64-efi --efi-directory=/boot --recheck /dev/sdX +\n\nand if you make a USB key, you can choose BIOS+EFI but you need the correct partitions. +\nexit" + +learnarchenabledhcpcd="Enable dhcpd. +\n------------- +\n +\nWhen boot the new install, dhcpcd is not enabled by default. +\nTo enable it and get your network connected at boot, enable it with the next command in chroot : +\n +\narch-chroot /mnt +\nsystemctl enable dhcpcd +\nexit" diff --git a/lng/French b/lng/French new file mode 100755 index 0000000..96426fe --- /dev/null +++ b/lng/French @@ -0,0 +1,76 @@ +# Arch Linux Fast Install (archfi) +# -------------------------------- +# project : http://sourceforge.net/projects/archfi +# language : Français +# translator : matmoul (pseudo, name or e-mail.) +# notes : misc text... + + +txtmainmenu="Menu Principal" +txtlanguage="Language" +txtsetkeymap="Disposition clavier" +txtdiskpartmenu="Partionner le disque" +txtselectpartsmenu="Sélectionner les partitions d'installation" +txthelp="Aide" +txtchangelog="Changelog" +txtreboot="Redémarrer" + +txtautoparts="Partitionnement Auto" +txteditparts="Editer partitions" + +txtautopartsconfirm="Périphérique séléctionné : %1\n\nToutes les données vont être effacées ! \n\nContinuer ?" + +txtautopartclear="Suppression des partitions" +txtautopartcreate="Créeation de la partition %1" +txthybridpartcreate="Définition du MBR hybride" +txtautopartsettype="Définition du type de la partition %1" + +txtselectdevice="Sélectionnez le périphérique %1 :" +txtselecteddevices="Périphériques sélectionnés :" + +txtformatmountmenu="Formatter et Monter" +txtformatdevices="Formatter les partitions" +txtformatdevice="Formatter une partition" +txtmount="Monter" +txtmountdesc="Installation ou Configuration" + +txtformatdeviceconfirm="Attention, toutes les données sur les partitions sélectionnées vont être effacées ! \nFormatter les partitions ?" + +txtselectpartformat="Sélectionnez le format de la parition %1 :" +txtformatingpart="Formatting partition %1 as" + +txtinstallmenu="Menu Installation" + +txtarchinstallmenu="Menu Installation Arch Linux" +txtrungrubmakeconfig="Exécuter grub-mkconfig ?" + +txteditmirrorlist="Editer mirrorlist" +txtinstallarchlinux="Installer Arch Linux" +txtconfigarchlinux="Configurer Arch Linux" + +txtsethostname="Définir le nom de l'ordinateur" +txtsetlocale="Définir Locale" +txtsettime="Définir l'horloge" +txtsetrootpassword="Définir le mot de passe root" + +txtuseutcclock="Utiliser une horloge matériel UTC ?" + +txtoptional="Optionnel" +txtrecommandeasyinst="Recommandé pour installation rapide" +txtset="Définir %1" +txtgenerate="Générer %1" +txtedit="Editer %1" +txtinstall="Installer %1" +txtenable="Activer %1" + + +txtpressanykey="Appuyez sur une touche pour continuer." + +txtinstallosprober="Pour démarrer sur plusieurs systèmes.\nInstaller os-prober ?" +txtefibootmgr="efibootmgr est requis pour un système EFI." + +txtarchdidesc="Installation d'un poste de travail" +txtinstallarchdi="Arch Linux Desktop Install (archdi) est un second script peut vous aidez à installer un poste de travail complet.\n\nVous pouvez exécuter ou installer le script en choisissant dans le menu suivant.\n\nArch Linux Desktop Install possède 2 dépendences : wget et libnewt.\n\npacstrap wget libnewt ?" +txtarchdiinstallandlaunch="Installer et exécuter archdi" +txtarchdiinstall="Installer archdi" +txtarchdilaunch="Exécuter archdi"