2015-07-18 18:12:26 -06:00
#!/bin/bash
# Arch Linux Fast Install (archfi)
# --------------------------------
2015-08-20 11:14:17 -06:00
# author : MatMoul
# https://github.com/MatMoul
# http://sourceforge.net/u/matmoul
2015-07-21 13:45:16 -06:00
# project : https://github.com/MatMoul/archfi
2015-08-20 11:14:17 -06:00
# http://sourceforge.net/projects/archfi/
2015-07-21 13:45:16 -06:00
# license : LGPL-3.0 (http://opensource.org/licenses/lgpl-3.0.html)
2015-07-18 18:12:26 -06:00
#
# referance : https://wiki.archlinux.org/index.php/Installation_guide
2018-09-03 17:10:58 -06:00
apptitle="Arch Linux Fast Install (archfi) - Version: 2018.09.04.01.10.52 (GPLv3)"
2015-07-18 18:12:26 -06:00
baseurl=https://raw.githubusercontent.com/MatMoul/archfi/master
# --------------------------------------------------------
mainmenu(){
if [ "$1" = "" ]; then
nextitem="."
else
nextitem=$1
fi
options=()
2016-03-29 15:01:28 -06:00
options+=("$txtlanguage" "Language")
2015-07-18 18:12:26 -06:00
options+=("$txtsetkeymap" "(loadkeys ...)")
2018-09-03 16:25:47 -06:00
options+=("$txteditor" "($txtoptional)")
2015-07-18 18:12:26 -06:00
options+=("$txtdiskpartmenu" "")
options+=("$txtselectpartsmenu" "")
options+=("" "")
options+=("$txtreboot" "")
2016-03-27 17:41:16 -06:00
sel=$(whiptail --backtitle "$apptitle" --title "$txtmainmenu" --menu "" --cancel-button "$txtexit" --default-item "$nextitem" 0 0 0 \
2015-07-18 18:12:26 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case $sel in
"$txtlanguage")
chooselanguage
nextitem="$txtsetkeymap"
;;
"$txtsetkeymap")
setkeymap
2018-09-03 16:25:47 -06:00
nextitem="$txtdiskpartmenu"
2015-11-01 10:23:32 -07:00
;;
"$txteditor")
chooseeditor
2015-07-18 18:12:26 -06:00
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)")
2016-01-01 08:23:41 -07:00
options+=("German" "(By untergrundbiber)")
2017-11-11 13:33:35 -07:00
options+=("Italian" "(By thegoldgoat)")
2016-02-24 16:05:13 -07:00
options+=("Hungarian" "(By KardiWeb)")
2016-03-29 15:00:46 -06:00
options+=("Polish" "(By dawidd6)")
2016-05-23 21:05:53 -06:00
options+=("Portuguese" "(By MaxWilliamJF)")
2016-03-03 13:26:59 -07:00
options+=("Russian" "(By Anonymous_Prodject)")
2016-03-27 13:30:50 -06:00
options+=("Spanish" "(By Mystogab)")
2016-04-09 10:00:36 -06:00
options+=("Turkish" "(By c0b41)")
2015-07-18 18:12:26 -06:00
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')
fi
2016-03-05 14:59:38 -07:00
eval $(setfont $font)
font=
2016-03-12 09:52:25 -07:00
if [ "$(cat /etc/locale.gen | grep ""#$locale"")" != "" ]; then
sed -i "/$locale/s/^#//g" /etc/locale.gen
locale-gen
fi
2016-03-05 14:59:38 -07:00
export LANG=$locale
2015-07-18 18:12:26 -06:00
fi
}
setkeymap(){
2015-10-02 09:04:03 -06:00
#items=$(localectl list-keymaps)
#options=()
#for item in $items; do
# options+=("$item" "")
#done
2015-10-02 10:10:11 -06:00
items=$(find /usr/share/kbd/keymaps/ -type f -printf "%f\n" | sort -V)
2015-07-18 18:12:26 -06:00
options=()
for item in $items; do
2015-10-02 10:10:11 -06:00
options+=("${item%%.*}" "")
2015-07-18 18:12:26 -06:00
done
keymap=$(whiptail --backtitle "$apptitle" --title "$txtsetkeymap" --menu "" 0 0 0 \
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
clear
2015-11-01 09:51:34 -07:00
echo "loadkeys $keymap"
2015-07-18 18:12:26 -06:00
loadkeys $keymap
2015-11-01 09:51:34 -07:00
pressanykey
2015-07-18 18:12:26 -06:00
fi
}
2015-11-01 10:21:57 -07:00
chooseeditor(){
options=()
options+=("nano" "")
options+=("vim" "")
options+=("vi" "")
options+=("edit" "")
sel=$(whiptail --backtitle "$apptitle" --title "$txteditor" --menu "" 0 0 0 \
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
2016-05-14 08:08:39 -06:00
clear
2016-05-14 08:15:51 -06:00
echo "export EDITOR=$sel"
export EDITOR=$sel
2015-11-01 10:41:01 -07:00
EDITOR=$sel
2016-05-14 08:06:23 -06:00
pressanykey
2015-11-01 10:21:57 -07:00
fi
}
2015-07-18 18:12:26 -06:00
rebootpc(){
if (whiptail --backtitle "$apptitle" --title "$txtreboot" --yesno "$txtreboot ?" --defaultno 0 0) then
clear
reboot
fi
}
# --------------------------------------------------------
# --------------------------------------------------------
diskpartmenu(){
if [ "$1" = "" ]; then
nextitem="."
else
nextitem=$1
fi
options=()
if [ "$eficomputer" == "0" ]; then
options+=("$txtautoparts (gpt)" "")
options+=("$txtautoparts (dos)" "")
else
options+=("$txtautoparts (gpt,efi)" "")
options+=("$txtautoparts (gpt)" "")
options+=("$txtautoparts (dos)" "")
options+=("$txtautoparts (gpt,bios+efi,noswap)" "")
fi
options+=("$txteditparts (cfdisk)" "")
options+=("$txteditparts (cgdisk)" "")
2016-03-27 17:41:16 -06:00
sel=$(whiptail --backtitle "$apptitle" --title "$txtdiskpartmenu" --menu "" --cancel-button "$txtback" --default-item "$nextitem" 0 0 0 \
2015-07-18 18:12:26 -06:00
"${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(){
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(){
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(){
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(){
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(){
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(){
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(){
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")
2016-03-27 17:41:16 -06:00
sel=$(whiptail --backtitle "$apptitle" --title "$txtformatmountmenu" --menu "" --cancel-button "$txtback" --default-item "$nextitem" 0 0 0 \
2015-07-18 18:12:26 -06:00
"${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
2018-09-03 17:15:26 -06:00
formatswapdevice swap $swapdev
2015-07-18 18:12:26 -06:00
fi
formatdevice root $rootdev
if [ ! "$homedev" = "" ]; then
formatdevice home $homedev
fi
fi
}
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
2015-11-01 09:51:34 -07:00
ext2)
echo "mkfs.ext2 $2"
mkfs.ext2 $2
;;
ext3)
echo "mkfs.ext3 $2"
mkfs.ext3 $2
;;
ext4)
echo "mkfs.ext4 $2"
mkfs.ext4 $2
;;
fat32)
echo "mkfs.fat $2"
mkfs.fat $2
;;
2015-07-18 18:12:26 -06:00
esac
echo ""
pressanykey
}
formatswapdevice(){
2018-09-03 16:57:16 -06:00
options=()
options+=("swap" "")
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
2015-07-18 18:12:26 -06:00
clear
echo "${txtformatingpart//%1/$swapdev} swap"
2018-09-03 16:57:16 -06:00
echo "----------------------------------------------------"
case $sel in
swap)
echo "mkswap $swapdev"
mkswap $swapdev
echo ""
pressanykey
;;
esac
clear
2015-07-18 18:12:26 -06:00
}
formatdevice(){
options=()
options+=("btrfs" "")
options+=("reiserfs" "")
options+=("ext4" "")
options+=("ext3" "")
options+=("ext2" "")
options+=("xfs" "")
options+=("jfs" "")
2015-08-22 11:48:34 -06:00
if [ ! "$3" = "noluks" ]; then
options+=("luks" "encrypted")
fi
2015-07-18 18:12:26 -06:00
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
2015-11-01 09:51:34 -07:00
btrfs)
echo "mkfs.btrfs -f $2"
mkfs.btrfs -f $2
;;
reiserfs)
echo "mkfs.reiserfs -f $2"
mkfs.reiserfs -f $2
;;
ext4)
echo "mkfs.ext4 $2"
mkfs.ext4 $2
;;
ext3)
echo "mkfs.ext3 $2"
mkfs.ext3 $2
;;
ext2)
echo "mkfs.ext2 $2"
mkfs.ext2 $2
;;
xfs)
echo "mkfs.xfs -f $2"
mkfs.xfs -f $2
;;
jfs)
echo "mkfs.xfs -f $2"
mkfs.jfs -f $2
;;
2015-08-22 11:48:34 -06:00
luks)
2015-08-22 14:30:25 -06:00
echo "$txtcreateluksdevice"
2015-11-01 09:51:34 -07:00
echo "cryptsetup luksFormat $2"
2015-08-22 11:48:34 -06:00
cryptsetup luksFormat $2
2015-11-01 10:55:33 -07:00
if [ ! "$?" = "0" ]; then
2015-11-01 10:57:03 -07:00
pressanykey
2015-11-01 11:05:10 -07:00
return 1
2015-11-01 10:53:01 -07:00
fi
2015-11-01 10:57:03 -07:00
pressanykey
2015-08-22 12:08:17 -06:00
echo ""
2015-08-22 14:30:25 -06:00
echo "$txtopenluksdevice"
2015-11-01 09:51:34 -07:00
echo "cryptsetup luksOpen $2 $1"
2015-08-22 11:48:34 -06:00
cryptsetup luksOpen $2 $1
2015-11-01 10:55:33 -07:00
if [ ! "$?" = "0" ]; then
2015-11-01 10:57:03 -07:00
pressanykey
2015-11-01 11:05:10 -07:00
return 1
2015-11-01 10:53:01 -07:00
fi
2015-11-01 10:57:03 -07:00
pressanykey
2015-08-23 06:01:01 -06:00
options=()
options+=("normal" "")
options+=("fast" "")
2016-03-27 17:41:16 -06:00
sel=$(whiptail --backtitle "$apptitle" --title "$txtformatdevice" --menu "Wipe device ?" --cancel-button="$txtignore" 0 0 0 \
2015-08-23 06:01:01 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
2015-08-23 06:02:55 -06:00
if [ "$?" = "0" ]; then
2015-08-23 06:01:01 -06:00
case $sel in
2015-08-23 06:24:18 -06:00
normal)
echo "dd if=/dev/zero of=/dev/mapper/$1"
dd if=/dev/zero of=/dev/mapper/$1 & PID=$! &>/dev/null
;;
fast)
echo "dd if=/dev/zero of=/dev/mapper/$1 bs=60M"
dd if=/dev/zero of=/dev/mapper/$1 bs=60M & PID=$! &>/dev/null
;;
2015-08-23 06:01:01 -06:00
esac
2015-08-23 06:02:55 -06:00
clear
2015-08-23 06:01:01 -06:00
sleep 1
while kill -USR1 $PID &>/dev/null
do
sleep 1
done
2015-08-22 15:15:10 -06:00
fi
2015-08-23 06:01:01 -06:00
echo ""
2015-08-22 12:08:17 -06:00
pressanykey
2015-08-22 11:48:34 -06:00
formatdevice $1 /dev/mapper/$1 noluks
2015-08-22 13:02:44 -06:00
if [ "$1" = "root" ]; then
2015-08-22 13:55:01 -06:00
rootdev=/dev/mapper/$1
2015-08-22 13:02:44 -06:00
luksroot=1
luksrootuuid=$(cryptsetup luksUUID $2)
2015-08-22 13:51:03 -06:00
else
2015-08-22 13:55:01 -06:00
case $1 in
home) homedev=/dev/mapper/$1 ;;
esac
2015-08-22 13:51:03 -06:00
luksdrive=1
2015-08-22 13:55:01 -06:00
crypttab="\n$1 UUID=$(cryptsetup luksUUID $2) none"
2015-08-22 13:02:44 -06:00
fi
2015-08-22 12:08:17 -06:00
echo ""
2015-08-22 14:30:25 -06:00
echo "$txtluksdevicecreated"
2015-08-22 11:48:34 -06:00
;;
2015-07-18 18:12:26 -06:00
esac
echo ""
pressanykey
}
mountparts(){
clear
echo "mount $rootdev /mnt"
mount $rootdev /mnt
2015-11-01 09:51:34 -07:00
echo "mkdir /mnt/{boot,home}"
2015-11-01 10:09:36 -07:00
mkdir /mnt/{boot,home} 2>/dev/null
2015-07-18 18:12:26 -06:00
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" "")
2016-03-27 17:41:16 -06:00
sel=$(whiptail --backtitle "$apptitle" --title "$txtinstallmenu" --menu "" --cancel-button "$txtunmount" --default-item "$nextitem" 0 0 0 \
2015-07-18 18:12:26 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case $sel in
"$txteditmirrorlist")
2015-11-01 10:21:57 -07:00
$EDITOR /etc/pacman.d/mirrorlist
2015-07-18 18:12:26 -06:00
nextitem="$txtinstallarchlinux"
;;
"$txtinstallarchlinux")
installbase
nextitem="$txtconfigarchlinux"
;;
"$txtconfigarchlinux")
archmenu
nextitem="$txtconfigarchlinux"
;;
esac
installmenu "$nextitem"
else
unmountdevices
fi
}
installbase(){
clear
2015-11-01 09:51:34 -07:00
echo "pacstrap /mnt base"
2015-07-18 18:12:26 -06:00
pacstrap /mnt base
2015-11-01 09:51:34 -07:00
pressanykey
2015-07-18 18:12:26 -06:00
}
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")
2016-03-12 10:56:26 -07:00
options+=("$txtsetfont" "/etc/vconsole.conf ($txtoptional)")
2015-07-18 18:12:26 -06:00
options+=("$txtsetlocale" "/etc/locale.conf, /etc/locale.gen")
options+=("$txtsettime" "/etc/localtime")
options+=("$txtsetrootpassword" "")
options+=("${txtgenerate//%1/fstab}" "")
2015-08-22 13:02:44 -06:00
if [ "$luksdrive" = "1" ]; then
2015-12-18 15:47:56 -07:00
options+=("${txtgenerate//%1/crypttab}" "")
2015-08-22 13:02:44 -06:00
fi
if [ "$luksroot" = "1" ]; then
2015-08-22 13:37:40 -06:00
options+=("${txtgenerate//%1/mkinitcpio.conf}" "(encrypt hooks)")
2015-08-22 13:02:44 -06:00
fi
2015-07-18 18:12:26 -06:00
options+=("${txtedit//%1/fstab}" "($txtoptional)")
2015-12-18 15:47:56 -07:00
options+=("${txtedit//%1/crypttab}" "($txtoptional)")
2015-07-18 18:12:26 -06:00
options+=("${txtedit//%1/mkinitcpio.conf}" "($txtoptional)")
options+=("${txtedit//%1/mirrorlist}" "($txtoptional)")
2015-10-10 14:51:33 -06:00
options+=("${txtinstall//%1/grub}" "pacstrap grub (efibootmgr), grub-mkconfig")
2015-07-18 18:12:26 -06:00
options+=("${txtedit//%1/grub}" "($txtoptional)")
options+=("${txtinstall//%1/bootloader}" "grub-install")
options+=("${txtenable//%1/dhcpcd}" "systemctl enable dhcpd")
options+=("archdi" "$txtarchdidesc")
2016-03-27 17:41:16 -06:00
sel=$(whiptail --backtitle "$apptitle" --title "$txtarchinstallmenu" --menu "" --cancel-button "$txtback" --default-item "$nextitem" 0 0 0 \
2015-07-18 18:12:26 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case $sel in
"$txtsethostname")
archsethostname
nextitem="$txtsetkeymap"
;;
"$txtsetkeymap")
archsetkeymap
2016-03-12 12:00:39 -07:00
nextitem="$txtsetlocale"
2016-03-12 10:56:26 -07:00
;;
"$txtsetfont")
archsetfont
2015-07-18 18:12:26 -06:00
nextitem="$txtsetlocale"
;;
"$txtsetlocale")
archsetlocale
nextitem="$txtsettime"
;;
"$txtsettime")
archsettime
nextitem="$txtsetrootpassword"
;;
"$txtsetrootpassword")
archsetrootpassword
nextitem="${txtgenerate//%1/fstab}"
;;
"${txtgenerate//%1/fstab}")
archgenfstab
2015-08-22 13:02:44 -06:00
if [ "$luksdrive" = "1" ]; then
2015-12-18 15:47:56 -07:00
nextitem="${txtgenerate//%1/crypttab}"
2015-08-22 13:02:44 -06:00
else
if [ "$luksroot" = "1" ]; then
2015-08-22 13:37:40 -06:00
nextitem="${txtgenerate//%1/mkinitcpio.conf}"
2015-08-22 13:02:44 -06:00
else
nextitem="${txtinstall//%1/grub}"
fi
fi
;;
2015-12-18 15:47:56 -07:00
"${txtgenerate//%1/crypttab}")
archgencrypttab
2015-08-22 13:02:44 -06:00
if [ "$luksroot" = "1" ]; then
2015-08-22 13:37:40 -06:00
nextitem="${txtgenerate//%1/mkinitcpio.conf}"
2015-08-22 13:02:44 -06:00
else
nextitem="${txtinstall//%1/grub}"
fi
;;
2015-08-22 13:37:40 -06:00
"${txtgenerate//%1/mkinitcpio.conf}")
2015-08-22 13:02:44 -06:00
archgenmkinitcpio
2015-07-18 18:12:26 -06:00
nextitem="${txtinstall//%1/grub}"
;;
"${txtedit//%1/fstab}")
2015-11-01 10:21:57 -07:00
$EDITOR /mnt/etc/fstab
2015-07-18 18:12:26 -06:00
nextitem="${txtedit//%1/fstab}"
;;
2015-12-18 15:47:56 -07:00
"${txtedit//%1/crypttab}")
$EDITOR /mnt/etc/crypttab
nextitem="${txtedit//%1/crypttab}"
2015-08-22 14:30:25 -06:00
;;
2015-07-18 18:12:26 -06:00
"${txtedit//%1/mkinitcpio.conf}")
archeditmkinitcpio
nextitem="${txtedit//%1/mkinitcpio.conf}"
;;
"${txtedit//%1/mirrorlist}")
2015-11-01 10:21:57 -07:00
$EDITOR /mnt/etc/pacman.d/mirrorlist
2015-07-18 18:12:26 -06:00
nextitem="${txtedit//%1/mirrorlist}"
;;
"${txtinstall//%1/grub}")
archinstallgrub
nextitem="${txtinstall//%1/bootloader}"
;;
"${txtedit//%1/grub}")
2015-11-01 10:21:57 -07:00
$EDITOR /mnt/etc/default/grub
2015-07-18 18:12:26 -06:00
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(){
2015-11-01 09:51:34 -07:00
echo "arch-chroot /mnt /root"
2015-07-18 18:12:26 -06:00
cp $0 /mnt/root
chmod 755 /mnt/root/$(basename "$0")
2015-10-10 13:26:50 -06:00
arch-chroot /mnt /root/$(basename "$0") --chroot $1 $2
2015-07-18 18:12:26 -06:00
rm /mnt/root/$(basename "$0")
2015-11-01 09:51:34 -07:00
echo "exit"
2015-07-18 18:12:26 -06:00
}
archsethostname(){
2017-02-03 11:31:16 -07:00
hostname=$(whiptail --backtitle "$apptitle" --title "$txtsethostname" --inputbox "" 0 0 "archlinux" 3>&1 1>&2 2>&3)
2015-07-18 18:12:26 -06:00
if [ "$?" = "0" ]; then
2015-11-01 09:51:34 -07:00
clear
echo "echo \"$hostname\" > /mnt/etc/hostname"
2015-07-18 18:12:26 -06:00
echo "$hostname" > /mnt/etc/hostname
2015-11-01 09:51:34 -07:00
pressanykey
2015-07-18 18:12:26 -06:00
fi
}
archsetkeymap(){
2015-10-02 09:04:03 -06:00
#items=$(localectl list-keymaps)
#options=()
#for item in $items; do
# options+=("$item" "")
#done
2015-10-02 10:10:11 -06:00
items=$(find /usr/share/kbd/keymaps/ -type f -printf "%f\n" | sort -V)
2015-07-18 18:12:26 -06:00
options=()
for item in $items; do
2015-10-02 10:10:11 -06:00
options+=("${item%%.*}" "")
2015-07-18 18:12:26 -06:00
done
keymap=$(whiptail --backtitle "$apptitle" --title "$txtsetkeymap" --menu "" 0 0 0 \
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
2015-11-01 09:51:34 -07:00
clear
echo "echo \"KEYMAP=$keymap\" > /mnt/etc/vconsole.conf"
2015-07-18 18:12:26 -06:00
echo "KEYMAP=$keymap" > /mnt/etc/vconsole.conf
2016-03-12 10:56:26 -07:00
pressanykey
fi
}
archsetfont(){
items=$(find /usr/share/kbd/consolefonts/*.psfu.gz -printf "%f\n")
2016-05-24 15:38:47 -06:00
2016-03-12 10:56:26 -07:00
options=()
for item in $items; do
options+=("${item%%.*}" "")
done
vcfont=$(whiptail --backtitle "$apptitle" --title "$txtsetfont ($txtoptional)" --menu "" 0 0 0 \
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
clear
echo "echo \"FONT=$vcfont\" >> /mnt/etc/vconsole.conf"
echo "FONT=$vcfont" >> /mnt/etc/vconsole.conf
2015-11-01 09:51:34 -07:00
pressanykey
2015-07-18 18:12:26 -06:00
fi
}
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
2015-11-01 09:51:34 -07:00
echo "echo \"LANG=$locale.UTF-8\" > /mnt/etc/locale.conf"
2015-07-18 18:12:26 -06:00
echo "LANG=$locale.UTF-8" > /mnt/etc/locale.conf
2015-11-01 09:51:34 -07:00
echo "echo \"LC_COLLATE=C\" >> /mnt/etc/locale.conf"
2015-07-18 18:12:26 -06:00
echo "LC_COLLATE=C" >> /mnt/etc/locale.conf
2018-06-03 08:37:48 -06:00
echo "sed -i '/"$locale".UTF-8/s/^#//g' /mnt/etc/locale.gen"
2015-07-18 18:12:26 -06:00
sed -i '/'$locale'.UTF-8/s/^#//g' /mnt/etc/locale.gen
archchroot setlocale
2015-11-01 09:51:34 -07:00
pressanykey
2015-07-18 18:12:26 -06:00
fi
}
archsetlocalechroot(){
2015-11-01 09:51:34 -07:00
echo "locale-gen"
2015-07-18 18:12:26 -06:00
locale-gen
exit
}
archsettime(){
2016-04-02 07:09:35 -06:00
items=$(ls -l /mnt/usr/share/zoneinfo/ | grep '^d' | gawk -F':[0-9]* ' '/:/{print $2}')
2015-07-18 18:12:26 -06:00
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
2016-05-24 15:38:47 -06:00
2015-07-18 18:12:26 -06:00
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
2016-05-24 15:38:47 -06:00
2015-11-01 09:51:34 -07:00
clear
2016-05-14 08:06:23 -06:00
echo "ln -sf /mnt/usr/share/zoneinfo/$timezone /mnt/etc/localtime"
2015-07-18 18:12:26 -06:00
ln -sf /usr/share/zoneinfo/$timezone /mnt/etc/localtime
2015-11-01 10:00:26 -07:00
pressanykey
2016-05-24 15:38:47 -06:00
2015-07-18 18:12:26 -06:00
if (whiptail --backtitle "$apptitle" --title "$txtsettime" --yesno "$txtuseutcclock" 0 0) then
2015-11-01 10:00:26 -07:00
clear
2015-07-18 18:12:26 -06:00
archchroot settimeutc
else
2015-11-01 10:00:26 -07:00
clear
2015-07-18 18:12:26 -06:00
archchroot settimelocal
fi
2016-05-24 15:38:47 -06:00
2015-11-01 09:51:34 -07:00
pressanykey
2016-05-24 15:38:47 -06:00
2015-07-18 18:12:26 -06:00
}
archsettimeutcchroot(){
2015-11-01 09:51:34 -07:00
echo "hwclock --systohc --utc"
2015-07-18 18:12:26 -06:00
hwclock --systohc --utc
exit
}
archsettimelocalchroot(){
2015-11-01 09:51:34 -07:00
echo "hwclock --systohc --localtime"
2015-07-18 18:12:26 -06:00
hwclock --systohc --localtime
exit
}
archsetrootpassword(){
clear
archchroot setrootpassword
pressanykey
}
archsetrootpasswordchroot(){
2015-11-01 09:51:34 -07:00
echo "passwd root"
2015-07-18 18:12:26 -06:00
passwd root
exit
}
archgenfstab(){
clear
2015-11-01 10:07:21 -07:00
echo "genfstab -U -p /mnt > /mnt/etc/fstab"
genfstab -U -p /mnt > /mnt/etc/fstab
2015-11-01 09:51:34 -07:00
pressanykey
2015-07-18 18:12:26 -06:00
}
2015-12-18 15:47:56 -07:00
archgencrypttab(){
2015-08-22 13:51:03 -06:00
clear
2015-11-01 09:51:34 -07:00
echo "echo -e \"$crypttab\" >> /mnt/etc/crypttab"
2015-08-22 13:55:01 -06:00
echo -e "$crypttab" >> /mnt/etc/crypttab
2015-11-01 09:51:34 -07:00
pressanykey
2015-08-22 13:02:44 -06:00
}
2015-08-22 13:05:21 -06:00
2015-08-22 13:02:44 -06:00
archgenmkinitcpio(){
clear
2015-11-01 09:51:34 -07:00
echo "sed -i \"s/block filesystems/block encrypt filesystems/g\" /mnt/etc/mkinitcpio.conf"
2015-08-22 13:24:16 -06:00
sed -i "s/block filesystems/block encrypt filesystems/g" /mnt/etc/mkinitcpio.conf
2015-08-22 13:02:44 -06:00
archchroot genmkinitcpio
pressanykey
}
2015-07-18 18:12:26 -06:00
archeditmkinitcpio(){
2015-11-01 10:21:57 -07:00
$EDITOR /mnt/etc/mkinitcpio.conf
2015-07-18 18:12:26 -06:00
if (whiptail --backtitle "$apptitle" --title "${txtedit//%1/mkinitcpio.conf}" --yesno "${txtgenerate//%1/mkinitcpio} ?" 0 0) then
clear
archchroot genmkinitcpio
pressanykey
fi
}
archgenmkinitcpiochroot(){
2015-11-01 09:51:34 -07:00
echo "mkinitcpio -p linux"
2015-07-18 18:12:26 -06:00
mkinitcpio -p linux
exit
}
archinstallgrub(){
clear
2015-11-01 09:51:34 -07:00
echo "pacstrap /mnt grub"
2015-07-18 18:12:26 -06:00
pacstrap /mnt grub
2015-11-01 09:51:34 -07:00
pressanykey
2016-05-24 15:38:47 -06:00
2015-10-10 15:00:50 -06:00
if [ "$eficomputer" == "1" ]; then
if [ "$efimode" == "1" ]||[ "$efimode" == "2" ]; then
2015-10-10 14:18:24 -06:00
if (whiptail --backtitle "$apptitle" --title "${txtinstall//%1/efibootmgr}" --yesno "$txtefibootmgr" 0 0) then
clear
2015-11-01 09:51:34 -07:00
echo "pacstrap /mnt efibootmgr"
2015-10-10 14:18:24 -06:00
pacstrap /mnt efibootmgr
2015-11-01 09:51:34 -07:00
pressanykey
2015-10-10 14:18:24 -06:00
fi
else
if (whiptail --backtitle "$apptitle" --title "${txtinstall//%1/efibootmgr}" --yesno "$txtefibootmgr" --defaultno 0 0) then
clear
2015-11-01 09:51:34 -07:00
echo "pacstrap /mnt efibootmgr"
2015-10-10 14:18:24 -06:00
pacstrap /mnt efibootmgr
2015-11-01 09:51:34 -07:00
pressanykey
2015-10-10 14:18:24 -06:00
fi
2015-07-18 18:12:26 -06:00
fi
fi
2016-05-24 15:38:47 -06:00
2015-08-22 13:02:44 -06:00
if [ "$luksroot" = "1" ]; then
2015-08-22 14:30:25 -06:00
if (whiptail --backtitle "$apptitle" --title "${txtinstall//%1/grub}" --yesno "$txtgrubluksdetected" 0 0) then
2015-08-22 13:02:44 -06:00
clear
2015-11-01 09:51:34 -07:00
echo "sed -i /GRUB_CMDLINE_LINUX=/c\GRUB_CMDLINE_LINUX=\\\"cryptdevice=/dev/disk/by-uuid/$luksrootuuid:root\\\" /mnt/etc/default/grub"
2015-08-22 13:37:40 -06:00
sed -i /GRUB_CMDLINE_LINUX=/c\GRUB_CMDLINE_LINUX=\"cryptdevice=/dev/disk/by-uuid/$luksrootuuid:root\" /mnt/etc/default/grub
2015-11-01 09:51:34 -07:00
pressanykey
2015-08-22 13:02:44 -06:00
fi
fi
2016-05-24 15:38:47 -06:00
2015-07-18 18:12:26 -06:00
clear
archchroot installgrub
2015-11-01 09:51:34 -07:00
pressanykey
2015-07-18 18:12:26 -06:00
}
archinstallgrubchroot(){
2015-11-01 09:51:34 -07:00
echo "grub-mkconfig -o /boot/grub/grub.cfg"
2015-07-18 18:12:26 -06:00
grub-mkconfig -o /boot/grub/grub.cfg
exit
}
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
2015-10-10 15:09:19 -06:00
if [ "$eficomputer" == "1" ]; 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
2016-03-27 17:41:16 -06:00
sel=$(whiptail --backtitle "$apptitle" --title "${txtinstall//%1/bootloader}" --menu "" --cancel-button "$txtback" 0 0 0 \
2015-10-10 15:09:19 -06:00
"${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
2015-07-18 18:12:26 -06:00
else
2015-10-10 15:11:07 -06:00
clear
2015-10-10 15:09:57 -06:00
archchroot installbootloader $device
2015-07-18 18:12:26 -06:00
pressanykey
fi
fi
}
archinstallbootloaderchroot(){
if [ ! "$1" = "none" ]; then
2015-11-01 09:51:34 -07:00
echo "grub-install --target=i386-pc --recheck $1"
2015-07-18 18:12:26 -06:00
grub-install --target=i386-pc --recheck $1
fi
exit
}
archinstallbootloaderefichroot(){
if [ ! "$1" = "none" ]; then
2015-11-01 09:51:34 -07:00
echo "grub-install --target=x86_64-efi --efi-directory=/boot --recheck $1"
2015-07-18 18:12:26 -06:00
grub-install --target=x86_64-efi --efi-directory=/boot --recheck $1
fi
exit
}
archinstallbootloaderefiusbchroot(){
if [ ! "$1" = "none" ]; then
2015-11-01 09:51:34 -07:00
echo "grub-install --target=i386-pc --recheck $1"
2015-07-18 18:12:26 -06:00
grub-install --target=i386-pc --recheck $1
2015-11-01 09:51:34 -07:00
echo "grub-install --target=x86_64-efi --efi-directory=/boot --removable --recheck $1"
2015-07-18 18:12:26 -06:00
grub-install --target=x86_64-efi --efi-directory=/boot --removable --recheck $1
fi
exit
}
archenabledhcpcd(){
if (whiptail --backtitle "$apptitle" --title "${txtenable//%1/dhcpcd}" --yesno "${txtenable//%1/dhcpcd} ?" 0 0) then
clear
archchroot enabledhcpcd
2015-11-01 09:51:34 -07:00
pressanykey
2015-07-18 18:12:26 -06:00
fi
}
archenabledhcpcdchroot(){
2015-11-01 09:51:34 -07:00
echo "systemctl enable dhcpcd"
2015-07-18 18:12:26 -06:00
systemctl enable dhcpcd
exit
}
installarchdi(){
2018-09-03 17:25:32 -06:00
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 ?"
2015-07-18 18:12:26 -06:00
if(whiptail --backtitle "$apptitle" --title "archdi" --yesno "$txtinstallarchdi" 0 0) then
clear
2015-11-01 09:51:34 -07:00
echo "pacstrap /mnt wget libnewt"
2015-07-18 18:12:26 -06:00
pacstrap /mnt wget libnewt
fi
if [ "$?" = "0" ]; then
options=()
options+=("$txtarchdiinstallandlaunch" "")
options+=("$txtarchdilaunch" "")
options+=("$txtarchdiinstall" "")
2016-03-27 17:41:16 -06:00
sel=$(whiptail --backtitle "$apptitle" --title "$txtarchdimenu" --menu "" --cancel-button "$txtback" 0 0 0 \
2015-07-18 18:12:26 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case $sel in
"$txtarchdiinstallandlaunch") archchroot archdiinstallandlaunch;;
"$txtarchdilaunch") archchroot archdilaunch;;
2015-11-01 10:00:26 -07:00
"$txtarchdiinstall")
clear
archchroot archdiinstall
pressanykey
;;
2015-07-18 18:12:26 -06:00
esac
fi
fi
}
2015-08-20 11:14:17 -06:00
archdidownload(){
2018-09-03 17:22:31 -06:00
txtselectserver="Select source server :"
txtback="Back"
2015-08-20 11:14:17 -06:00
options=()
options+=("sourceforge.net" "recommended")
options+=("github.com" "")
2016-03-27 17:41:16 -06:00
sel=$(whiptail --backtitle "$apptitle" --title "$txtselectserver" --menu "" --cancel-button "$txtback" 0 0 0 \
2015-08-20 11:14:17 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case $sel in
"sourceforge.net")
archdiurl=archdi.sourceforge.net/archdi
;;
"github.com")
archdiurl=matmoul.github.io/archdi >archdi
;;
esac
fi
2015-11-01 10:00:26 -07:00
echo "curl -L $archdiurl >archdi"
2015-08-20 11:14:17 -06:00
curl -L $archdiurl >archdi
}
2015-07-18 18:12:26 -06:00
archdiinstallandlaunchchroot(){
cd
2015-08-20 11:14:17 -06:00
archdidownload
2015-07-18 18:12:26 -06:00
sh archdi -i
archdi --chroot
exit
}
archdilaunchchroot(){
cd
2015-08-20 11:14:17 -06:00
archdidownload
2015-07-18 18:12:26 -06:00
sh archdi --chroot
rm archdi
exit
}
archdiinstallchroot(){
cd
2015-08-20 11:14:17 -06:00
archdidownload
2015-07-18 18:12:26 -06:00
sh archdi -i
exit
}
# --------------------------------------------------------
# --------------------------------------------------------
pressanykey(){
read -n1 -p "$txtpressanykey"
}
loadstrings(){
2016-05-24 15:38:47 -06:00
2016-03-12 09:52:25 -07:00
locale=en_US.UTF-8
#font=
2016-05-24 15:38:47 -06:00
2016-03-27 17:41:16 -06:00
txtexit="Exit"
txtback="Back"
txtignore="Ignore"
2016-05-24 15:38:47 -06:00
2015-08-20 11:14:17 -06:00
txtselectserver="Select source server :"
2016-05-24 15:38:47 -06:00
2015-07-18 18:12:26 -06:00
txtmainmenu="Main Menu"
txtlanguage="Language"
txtsetkeymap="Set Keyboard Layout"
2015-11-01 10:21:57 -07:00
txteditor="Editor"
2015-07-18 18:12:26 -06:00
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"
2016-03-27 17:41:16 -06:00
txtunmount="Unmount"
2015-07-18 18:12:26 -06:00
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"
2015-08-22 14:30:25 -06:00
txtcreateluksdevice="Create luks device :"
txtopenluksdevice="Open luks device :"
txtluksdevicecreated="luks device created !"
2015-07-18 18:12:26 -06:00
txtinstallmenu="Install Menu"
2016-05-24 15:38:47 -06:00
2015-07-18 18:12:26 -06:00
txtarchinstallmenu="Arch Install Menu"
txtrungrubmakeconfig="Run grub-mkconfig ?"
2016-05-24 15:38:47 -06:00
2015-07-18 18:12:26 -06:00
txteditmirrorlist="Edit mirrorlist"
txtinstallarchlinux="Install Arch Linux"
txtconfigarchlinux="Config Arch Linux"
txtsethostname="Set Computer Name"
2016-03-12 10:56:26 -07:00
txtsetfont="Set Font"
2015-07-18 18:12:26 -06:00
txtsetlocale="Set Locale"
txtsettime="Set Time"
txtsetrootpassword="Set root password"
2016-05-24 15:38:47 -06:00
2015-07-18 18:12:26 -06:00
txtuseutcclock="Use UTC hardware clock ?"
2016-05-24 15:38:47 -06:00
2015-07-18 18:12:26 -06:00
txtoptional="Optional"
txtrecommandeasyinst="Recommanded for easy install"
txtset="Set %1"
txtgenerate="Generate %1"
txtedit="Edit %1"
txtinstall="Install %1"
txtenable="Enable %1"
2016-05-24 15:38:47 -06:00
2015-08-22 14:30:25 -06:00
txtgrubluksdetected="Encrypted root partion !\n\nAdd cryptdevice= to GRUB_CMDLINE_LINUX in /etc/default/grub ?"
2015-07-18 18:12:26 -06:00
txtpressanykey="Press any key to continue."
2016-05-24 15:38:47 -06:00
2015-07-18 18:12:26 -06:00
txtinstallosprober="os-prober is a good solution if you want to use mutli-boot.\nInstall os-prober ?"
2017-12-03 15:49:39 -07:00
txtefibootmgr="efibootmgr is required for EFI computers."
2016-05-24 15:38:47 -06:00
2015-07-18 18:12:26 -06:00
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"
}
# --------------------------------------------------------
# --------------------------------------------------------
while (( "$#" )); do
case $1 in
2016-04-12 16:13:57 -06:00
-t | --test) baseurl="https://raw.githubusercontent"
baseurl="$baseurl.com/""$2/archfi/$3";;
2015-07-18 18:12:26 -06:00
--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
2015-11-01 10:42:23 -07:00
EDITOR=nano
2015-07-18 18:12:26 -06:00
mainmenu
fi
exit 0
# --------------------------------------------------------