obos-fi/obosfi

2112 lines
56 KiB
Text
Raw Normal View History

2015-07-18 18:12:26 -06:00
#!/bin/bash
2023-08-10 10:13:32 -06:00
# Ourobor.OS Fast Install (obos-fi)
2015-07-18 18:12:26 -06:00
# --------------------------------
2023-08-10 10:13:32 -06:00
# archfi author : MatMoul
2015-08-20 11:14:17 -06:00
# https://github.com/MatMoul
# http://sourceforge.net/u/matmoul
2023-08-10 10:13:32 -06:00
# obosfi author : LimePotato (Ouroboros)
# https://limepot.xyz/
# https://git.ouroboros.group/Ouroboros/
# https://git.ouroboros.group/LimePotato/
#
# project : https://git.ouroboros.group/Ouroboros/obos-fi
#
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
#
# reference : https://wiki.archlinux.org/index.php/Installation_guide
2015-07-18 18:12:26 -06:00
2023-08-10 10:13:32 -06:00
apptitle="Ourobor.OS Fast Install (obosfi) - Version: 0.0.1 (GPLv3)"
baseurl=https://git.ouroboros.group/Ouroboros/obos-fi/raw/branch/master
2020-04-07 20:17:25 -06:00
cpl=0
2018-12-25 18:11:56 -07:00
skipfont="0"
2020-04-03 12:21:19 -06:00
fspkgs=""
2015-07-18 18:12:26 -06:00
# --------------------------------------------------------
mainmenu(){
2020-04-03 12:34:09 -06:00
if [ "${1}" = "" ]; then
nextitem="."
else
nextitem=${1}
fi
options=()
options+=("${txtlanguage}" "Language")
options+=("${txtsetkeymap}" "(loadkeys ...)")
options+=("${txteditor}" "(${txtoptional})")
options+=("${txtdiskpartmenu}" "")
options+=("${txtselectpartsmenu}" "")
options+=("" "")
options+=("${txtreboot}" "")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtmainmenu}" --cancel-button "${txtexit}" --default-item "${nextitem}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case ${sel} in
"${txtlanguage}")
chooselanguage
nextitem="${txtsetkeymap}"
;;
"${txtsetkeymap}")
setkeymap
nextitem="${txtdiskpartmenu}"
;;
"${txteditor}")
chooseeditor
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
2015-07-18 18:12:26 -06:00
}
chooselanguage(){
2020-04-03 12:34:09 -06:00
options=()
2020-04-03 15:06:18 -06:00
options+=("Arabic" "(By Mohammad Alawadi)")
2020-04-03 12:34:09 -06:00
options+=("Brazilian" "(By MaxWilliamJF)")
options+=("Dutch" "(By bowero)")
options+=("English" "(By MatMoul)")
options+=("French" "(By MatMoul)")
options+=("German" "(By untergrundbiber)")
options+=("Greek" "(By quelotic)")
options+=("Italian" "(By thegoldgoat)")
options+=("Hungarian" "(By KardiWeb)")
2020-04-04 21:24:23 -06:00
options+=("Norwegian" "(By mrboen94)")
2020-04-03 12:34:09 -06:00
options+=("Polish" "(By dawidd6)")
options+=("Portuguese" "(By hugok)")
options+=("Russian" "(By Anonymous_Prodject)")
options+=("Spanish" "(By Mystogab)")
options+=("Turkish" "(By c0b41)")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtlanguage}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${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
if [ "${skipfont}" = "0" ]; then
eval $(setfont ${font})
fi
font=
if [ "$(cat /etc/locale.gen | grep ""#${locale}"")" != "" ]; then
sed -i "/#${locale}/s/^#//g" /etc/locale.gen
locale-gen
fi
export LANG=${locale}
fi
2015-07-18 18:12:26 -06:00
}
setkeymap(){
2020-04-03 12:34:09 -06:00
#items=$(localectl list-keymaps)
#options=()
#for item in ${items}; do
# options+=("${item}" "")
#done
items=$(find /usr/share/kbd/keymaps/ -type f -printf "%f\n" | sort -V)
options=()
for item in ${items}; do
options+=("${item%%.*}" "")
done
2022-11-10 12:33:17 -07:00
keymap=$(dialog --backtitle "${apptitle}" --title "${txtsetkeymap}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
clear
echo "loadkeys ${keymap}"
loadkeys ${keymap}
pressanykey
fi
2015-07-18 18:12:26 -06:00
}
2015-11-01 10:21:57 -07:00
chooseeditor(){
2020-04-03 12:34:09 -06:00
options=()
options+=("nano" "")
options+=("vim" "")
options+=("vi" "")
options+=("edit" "")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txteditor}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
clear
echo "export EDITOR=${sel}"
export EDITOR=${sel}
EDITOR=${sel}
pressanykey
fi
2015-11-01 10:21:57 -07:00
}
2015-07-18 18:12:26 -06:00
rebootpc(){
2022-11-10 12:33:17 -07:00
if (dialog --backtitle "${apptitle}" --title "${txtreboot}" --defaultno --yesno "${txtreboot} ?" 0 0) then
2020-04-03 12:34:09 -06:00
clear
reboot
fi
2015-07-18 18:12:26 -06:00
}
# --------------------------------------------------------
# --------------------------------------------------------
selectdisk(){
2020-04-03 12:34:09 -06:00
items=$(lsblk -d -p -n -l -o NAME,SIZE -e 7,11)
options=()
IFS_ORIG=$IFS
IFS=$'\n'
for item in ${items}
do
options+=("${item}" "")
done
IFS=$IFS_ORIG
2022-11-10 12:33:17 -07:00
result=$(dialog --backtitle "${APPTITLE}" --title "${1}" --menu "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3)
2020-04-03 12:34:09 -06:00
if [ "$?" != "0" ]
then
return 1
fi
echo ${result%%\ *}
return 0
}
2015-07-18 18:12:26 -06:00
diskpartmenu(){
2020-04-03 12:34:09 -06:00
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)" "")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtdiskpartmenu}" --cancel-button "${txtback}" --default-item "${nextitem}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -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
2015-07-18 18:12:26 -06:00
}
diskpartautodos(){
2020-04-03 12:34:09 -06:00
device=$(selectdisk "${txtautoparts} (dos)")
if [ "$?" = "0" ]; then
2022-11-10 12:33:17 -07:00
if (dialog --backtitle "${apptitle}" --title "${txtautoparts} (dos)" --defaultno --yesno "${txtautopartsconfirm//%1/${device}}" 0 0) then
2020-04-03 12:34:09 -06:00
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
if [ "${device::8}" == "/dev/nvm" ]; then
bootdev=${device}"p1"
swapdev=${device}"p2"
rootdev=${device}"p3"
else
bootdev=${device}"1"
swapdev=${device}"2"
rootdev=${device}"3"
fi
efimode="0"
fi
fi
2015-07-18 18:12:26 -06:00
}
diskpartautogpt(){
2020-04-03 12:34:09 -06:00
device=$(selectdisk "${txtautoparts} (gpt)")
if [ "$?" = "0" ]; then
2022-11-10 12:33:17 -07:00
if (dialog --backtitle "${apptitle}" --title "${txtautoparts} (gpt)" --defaultno --yesno "${txtautopartsconfirm//%1/${device}}" 0 0) then
2020-04-03 12:34:09 -06:00
clear
echo "${txtautopartclear}"
parted ${device} mklabel gpt
echo "${txtautopartcreate//%1/BIOS boot}"
sgdisk ${device} -n=1:0:+31M -t=1:ef02 -c=0:mbrboot
2020-04-03 12:34:09 -06:00
echo "${txtautopartcreate//%1/boot}"
sgdisk ${device} -n=2:0:+512M -c=0:boot
2020-04-03 12:34:09 -06:00
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 -c=0:swap
2020-04-03 12:34:09 -06:00
echo "${txtautopartcreate//%1/root}"
sgdisk ${device} -n=4:0:0 -c=0:root
2020-04-03 12:34:09 -06:00
echo ""
pressanykey
if [ "${device::8}" == "/dev/nvm" ]; then
bootdev=${device}"p2"
swapdev=${device}"p3"
rootdev=${device}"p4"
else
bootdev=${device}"2"
swapdev=${device}"3"
rootdev=${device}"4"
fi
efimode="0"
fi
fi
2015-07-18 18:12:26 -06:00
}
diskpartautoefi(){
2020-04-03 12:34:09 -06:00
device=$(selectdisk "${txtautoparts} (gpt,efi)")
if [ "$?" = "0" ]; then
2022-11-10 12:33:17 -07:00
if (dialog --backtitle "${apptitle}" --title "${txtautoparts} (gpt,efi)" --defaultno --yesno "${txtautopartsconfirm//%1/${device}}" 0 0) then
2020-04-03 12:34:09 -06:00
clear
echo "${txtautopartclear}"
parted ${device} mklabel gpt
echo "${txtautopartcreate//%1/EFI boot}"
sgdisk ${device} -n=1:0:+1024M -t=1:ef00 -c=0:boot
2020-04-03 12:34:09 -06:00
echo "${txtautopartcreate//%1/swap}"
swapsize=$(cat /proc/meminfo | grep MemTotal | awk '{ print $2 }')
swapsize=$((${swapsize}/1000))"M"
sgdisk ${device} -n=2:0:+${swapsize} -t=2:8200 -c=0:swap
2020-04-03 12:34:09 -06:00
echo "${txtautopartcreate//%1/root}"
sgdisk ${device} -n=3:0:0 -c=0:root
2020-04-03 12:34:09 -06:00
echo ""
pressanykey
if [ "${device::8}" == "/dev/nvm" ]; then
bootdev=${device}"p1"
swapdev=${device}"p2"
rootdev=${device}"p3"
2020-04-03 12:34:09 -06:00
else
bootdev=${device}"1"
swapdev=${device}"2"
rootdev=${device}"3"
2020-04-03 12:34:09 -06:00
fi
efimode="1"
fi
fi
2015-07-18 18:12:26 -06:00
}
diskpartautoefiusb(){
2020-04-03 12:34:09 -06:00
device=$(selectdisk "${txtautoparts} (gpt,efi)")
if [ "$?" = "0" ]; then
2022-11-10 12:33:17 -07:00
if (dialog --backtitle "${apptitle}" --title "${txtautoparts} (gpt,efi)" --defaultno --yesno "${txtautopartsconfirm//%1/${device}}" 0 0) then
2020-04-03 12:34:09 -06:00
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=2:0:+31M -t=2:ef02
2020-04-03 12:34:09 -06:00
echo "${txtautopartcreate//%1/root}"
sgdisk ${device} -n=3:0:0
2020-04-03 12:34:09 -06:00
echo "${txthybridpartcreate}"
echo -e "r\nh\n3\nN\n\nY\nN\nw\nY\n" | gdisk ${device}
echo ""
pressanykey
if [ "${device::8}" == "/dev/nvm" ]; then
bootdev=${device}"p1"
swapdev=
rootdev=${device}"p3"
2020-04-03 12:34:09 -06:00
else
bootdev=${device}"1"
swapdev=
rootdev=${device}"3"
2020-04-03 12:34:09 -06:00
fi
efimode="2"
fi
fi
2015-07-18 18:12:26 -06:00
}
diskpartcfdisk(){
2020-04-03 12:34:09 -06:00
device=$( selectdisk "${txteditparts} (cfdisk)" )
if [ "$?" = "0" ]; then
clear
cfdisk ${device}
fi
2015-07-18 18:12:26 -06:00
}
diskpartcgdisk(){
2020-04-03 12:34:09 -06:00
device=$( selectdisk "${txteditparts} (cgdisk)" )
if [ "$?" = "0" ]; then
clear
cgdisk ${device}
fi
2015-07-18 18:12:26 -06:00
}
# --------------------------------------------------------
# --------------------------------------------------------
selectparts(){
2020-04-03 12:34:09 -06:00
items=$(lsblk -p -n -l -o NAME -e 7,11)
options=()
for item in ${items}; do
options+=("${item}" "")
done
2022-11-10 12:33:17 -07:00
bootdev=$(dialog --backtitle "${apptitle}" --title "${txtselectpartsmenu}" --default-item "${bootdev}" --menu "${txtselectdevice//%1/boot}" 0 0 0 \
2020-04-03 12:34:09 -06:00
"none" "-" \
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
return 1
else
if [ "${bootdev}" = "none" ]; then
bootdev=
fi
fi
2022-11-10 12:33:17 -07:00
swapdev=$(dialog --backtitle "${apptitle}" --title "${txtselectpartsmenu}" --default-item "${swapdev}" --menu "${txtselectdevice//%1/swap}" 0 0 0 \
2020-04-03 12:34:09 -06:00
"none" "-" \
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
return 1
else
if [ "${swapdev}" = "none" ]; then
swapdev=
fi
fi
2022-11-10 12:33:17 -07:00
rootdev=$(dialog --backtitle "${apptitle}" --title "${txtselectpartsmenu}" --default-item "${rootdev}" --menu "${txtselectdevice//%1/root}" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
return 1
fi
realrootdev=${rootdev}
2022-11-10 12:33:17 -07:00
homedev=$(dialog --backtitle "${apptitle}" --title "${txtselectpartsmenu}" --menu "${txtselectdevice//%1/home}" 0 0 0 \
2020-04-03 12:34:09 -06:00
"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"
2022-11-10 12:33:17 -07:00
if (dialog --backtitle "${apptitle}" --title "${txtselectpartsmenu}" --yesno "${msg}" 0 0) then
2020-04-03 12:34:09 -06:00
isnvme=0
if [ "${bootdev::8}" == "/dev/nvm" ]; then
isnvme=1
fi
if [ "${rootdev::8}" == "/dev/nvm" ]; then
isnvme=1
fi
mountmenu
fi
2015-07-18 18:12:26 -06:00
}
# --------------------------------------------------------
# --------------------------------------------------------
mountmenu(){
2020-04-03 12:34:09 -06:00
if [ "${1}" = "" ]; then
nextitem="."
else
nextitem=${1}
fi
options=()
options+=("${txtformatdevices}" "")
options+=("${txtmount}" "${txtmountdesc}")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtformatmountmenu}" --cancel-button "${txtback}" --default-item "${nextitem}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -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
2015-07-18 18:12:26 -06:00
}
formatdevices(){
2022-11-10 12:33:17 -07:00
if (dialog --backtitle "${apptitle}" --title "${txtformatdevices}" --defaultno --yesno "${txtformatdeviceconfirm}" 0 0) then
2020-04-03 12:34:09 -06:00
fspkgs=""
if [ ! "${bootdev}" = "" ]; then
formatbootdevice boot ${bootdev}
fi
if [ ! "${swapdev}" = "" ]; then
formatswapdevice swap ${swapdev}
fi
formatdevice root ${rootdev}
if [ ! "${homedev}" = "" ]; then
formatdevice home ${homedev}
fi
fi
2015-07-18 18:12:26 -06:00
}
formatbootdevice(){
2020-04-03 12:34:09 -06:00
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
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtformatdevice}" --menu "${txtselectpartformat//%1/${1} (${2})}" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
return 1
fi
clear
echo "${txtformatingpart//%1/${2}} ${sel}"
echo "----------------------------------------------"
case ${sel} in
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)
fspkgs="${fspkgs[@]} dosfstools"
echo "mkfs.fat ${2}"
mkfs.fat ${2}
;;
esac
echo ""
pressanykey
2015-07-18 18:12:26 -06:00
}
formatswapdevice(){
2020-04-03 12:34:09 -06:00
options=()
options+=("swap" "")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtformatdevice}" --menu "${txtselectpartformat//%1/${1} (${2})}" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
return 1
fi
clear
echo "${txtformatingpart//%1/${swapdev}} swap"
echo "----------------------------------------------------"
case ${sel} in
swap)
echo "mkswap ${swapdev}"
mkswap ${swapdev}
echo ""
pressanykey
;;
esac
clear
2015-07-18 18:12:26 -06:00
}
formatdevice(){
2020-04-03 12:34:09 -06:00
options=()
options+=("btrfs" "")
options+=("ext4" "")
options+=("ext3" "")
options+=("ext2" "")
options+=("xfs" "")
options+=("f2fs" "")
options+=("jfs" "")
options+=("reiserfs" "")
if [ ! "${3}" = "noluks" ]; then
options+=("luks" "encrypted")
fi
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtformatdevice}" --menu "${txtselectpartformat//%1/${1} (${2})}" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
return 1
fi
clear
echo "${txtformatingpart//%1/${2}} ${sel}"
echo "----------------------------------------------"
case ${sel} in
btrfs)
fspkgs="${fspkgs[@]} btrfs-progs"
echo "mkfs.btrfs -f ${2}"
mkfs.btrfs -f ${2}
if [ "${1}" = "root" ]; then
echo "mount ${2} /mnt"
echo "btrfs subvolume create /mnt/root"
echo "btrfs subvolume set-default /mnt/root"
echo "umount /mnt"
mount ${2} /mnt
btrfs subvolume create /mnt/root
btrfs subvolume set-default /mnt/root
umount /mnt
fi
;;
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)
fspkgs="${fspkgs[@]} xfsprogs"
echo "mkfs.xfs -f ${2}"
mkfs.xfs -f ${2}
;;
f2fs)
fspkgs="${fspkgs[@]} f2fs-tools"
2020-06-18 17:40:43 -06:00
echo "mkfs.f2fs -f $2"
mkfs.f2fs -f $2
2020-04-03 12:34:09 -06:00
;;
jfs)
fspkgs="${fspkgs[@]} jfsutils"
2020-06-18 17:44:12 -06:00
echo "mkfs.jfs -f ${2}"
2020-04-03 12:34:09 -06:00
mkfs.jfs -f ${2}
;;
reiserfs)
fspkgs="${fspkgs[@]} reiserfsprogs"
echo "mkfs.reiserfs -f ${2}"
mkfs.reiserfs -f ${2}
;;
luks)
echo "${txtcreateluksdevice}"
echo "cryptsetup luksFormat ${2}"
cryptsetup luksFormat ${2}
if [ ! "$?" = "0" ]; then
pressanykey
return 1
fi
pressanykey
echo ""
echo "${txtopenluksdevice}"
echo "cryptsetup luksOpen ${2} ${1}"
cryptsetup luksOpen ${2} ${1}
if [ ! "$?" = "0" ]; then
pressanykey
return 1
fi
pressanykey
options=()
options+=("normal" "")
options+=("fast" "")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtformatdevice}" --menu "Wipe device ?" --cancel-button="${txtignore}" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case ${sel} in
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
;;
esac
clear
sleep 1
while kill -USR1 ${PID} &>/dev/null
do
sleep 1
done
fi
echo ""
pressanykey
formatdevice ${1} /dev/mapper/${1} noluks
if [ "${1}" = "root" ]; then
realrootdev=${rootdev}
rootdev=/dev/mapper/${1}
luksroot=1
luksrootuuid=$(cryptsetup luksUUID ${2})
else
case ${1} in
home) homedev=/dev/mapper/${1} ;;
esac
luksdrive=1
crypttab="\n${1} UUID=$(cryptsetup luksUUID ${2}) none"
fi
echo ""
echo "${txtluksdevicecreated}"
;;
esac
echo ""
pressanykey
2015-07-18 18:12:26 -06:00
}
mountparts(){
2020-04-03 12:34:09 -06:00
clear
echo "mount ${rootdev} /mnt"
mount ${rootdev} /mnt
echo "mkdir /mnt/{boot,home}"
mkdir /mnt/{boot,home} 2>/dev/null
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
2015-07-18 18:12:26 -06:00
}
# --------------------------------------------------------
# --------------------------------------------------------
installmenu(){
2020-04-03 12:34:09 -06:00
if [ "${1}" = "" ]; then
nextitem="${txtinstallarchlinux}"
else
nextitem=${1}
fi
options=()
2020-12-08 13:58:43 -07:00
#options+=("${txtselectmirrorsbycountry}" "(${txtoptional})")
2020-04-03 12:34:09 -06:00
options+=("${txteditmirrorlist}" "(${txtoptional})")
options+=("${txtfiltermirrorlist}" "reflector (${txtoptional})")
options+=("${txtparalleldownloads}" "(${txtoptional})")
2020-04-03 12:34:09 -06:00
options+=("${txtinstallarchlinux}" "pacstrap")
options+=("${txtconfigarchlinux}" "")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtinstallmenu}" --cancel-button "${txtunmount}" --default-item "${nextitem}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${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}"
;;
"${txtfiltermirrorlist}")
filtermirrorlist
nextitem="${txtparalleldownloads}"
;;
"${txtparalleldownloads}")
paralleldownloads
nextitem="${txtinstallarchlinuk}"
2021-10-20 08:50:54 -06:00
;;
2020-04-03 12:34:09 -06:00
"${txtinstallarchlinux}")
if(installbase) then
nextitem="${txtconfigarchlinux}"
fi
;;
"${txtconfigarchlinux}")
archmenu
nextitem="${txtconfigarchlinux}"
;;
esac
installmenu "${nextitem}"
else
unmountdevices
fi
2015-07-18 18:12:26 -06:00
}
selectmirrorsbycountry() {
2020-04-03 12:34:09 -06:00
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
2022-11-10 12:33:17 -07:00
country=$(dialog --backtitle "${APPTITLE}" --title "${txtselectcountry}" --menu "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3)
2020-04-03 12:34:09 -06:00
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
}
filtermirrorlist() {
2021-10-20 08:50:54 -06:00
command -v reflector > /dev/null || {
echo "pacman -S --noconfirm reflector"
pacman -S --noconfirm reflector
}
options=()
options+=("${txtfiltermirrorlist}" "")
options+=("${txtedit//%1/reflector.conf}" "")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtinstallmenu}" --cancel-button "${txtback}" --default-item "Filter mirrorlist" --menu "" 0 0 0 \
2021-10-20 08:50:54 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
case ${sel} in
"${txtfiltermirrorlist}")
clear
2021-10-20 08:50:54 -06:00
echo "systemctl start reflector.service"
systemctl start reflector.service
pressanykey
;;
"${txtedit//%1/reflector.conf}")
2021-10-20 08:50:54 -06:00
${EDITOR} /etc/xdg/reflector/reflector.conf
filtermirrorlist
2021-10-20 08:50:54 -06:00
;;
esac
}
paralleldownloads() {
2022-11-10 12:33:17 -07:00
numpkg=$(dialog --backtitle "${apptitle}" --title "${txtparallelprompt}" --inputbox "" 0 0 "5" 3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
if [[ "$numpkg" =~ ^[1-9][0-9]*$ ]] ; then
sed -i "s/.*ParallelDownloads.*/ParallelDownloads = ${numpkg}/" /etc/pacman.conf
else
clear
unset numpkg
echo ${txtincorrectinput}
pressanykey
fi
fi
}
2015-07-18 18:12:26 -06:00
installbase(){
2020-04-03 12:34:09 -06:00
pkgs="base"
options=()
options+=("linux" "")
options+=("linux-lts" "")
options+=("linux-zen" "")
options+=("linux-hardened" "")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtinstallarchlinuxkernel}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
pkgs+=" ${sel}"
else
return 1
fi
options=()
options+=("linux-firmware" "(${txtoptional})" on)
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtinstallarchlinuxfirmwares}" --checklist "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${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
options=()
if [[ "${fspkgs}" == *"dosfstools"* ]]; then
options+=("dosfstools" "" on)
else
options+=("dosfstools" "" off)
fi
if [[ "${fspkgs}" == *"btrfs-progs"* ]]; then
options+=("btrfs-progs" "" on)
else
options+=("btrfs-progs" "" off)
fi
if [[ "${fspkgs}" == *"xfsprogs"* ]]; then
options+=("xfsprogs" "" on)
else
options+=("xfsprogs" "" off)
fi
if [[ "${fspkgs}" == *"f2fs-tools"* ]]; then
options+=("f2fs-tools" "" on)
else
options+=("f2fs-tools" "" off)
fi
if [[ "${fspkgs}" == *"jfsutils"* ]]; then
options+=("jfsutils" "" on)
else
options+=("jfsutils" "" off)
fi
if [[ "${fspkgs}" == *"reiserfsprogs"* ]]; then
options+=("reiserfsprogs" "" on)
else
options+=("reiserfsprogs" "" off)
fi
options+=("lvm2" "" off)
options+=("dmraid" "" off)
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtinstallarchlinuxfilesystems}" --checklist "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${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
2020-04-07 20:17:25 -06:00
if [[ ${cpl} == 1 ]]; then
2023-08-10 10:13:32 -06:00
sed -i '/^\s*$/d' /tmp/obosfi-custom-package-list
sed -i '/^#/ d' /tmp/obosfi-custom-package-list
2020-04-07 20:17:25 -06:00
options=()
while read pkg; do
options+=("${pkg}" "" on)
2023-08-10 10:13:32 -06:00
done < /tmp/obosfi-custom-package-list
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtinstallarchlinuxcustompackagelist}" --checklist "" 0 0 0 \
2020-04-07 20:17:25 -06:00
"${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
fi
2020-04-03 12:34:09 -06:00
clear
echo "pacstrap /mnt ${pkgs}"
pacstrap /mnt ${pkgs}
if [ ! -z $numpkg ]; then
sed -i "s/.*ParallelDownloads.*/ParallelDownloads = ${numpkg}/" /mnt/etc/pacman.conf
fi
2020-04-03 12:34:09 -06:00
pressanykey
2019-11-01 17:03:50 -06:00
}
2015-07-18 18:12:26 -06:00
unmountdevices(){
2020-04-03 12:34:09 -06:00
clear
echo "umount -R /mnt"
umount -R /mnt
if [ ! "${swapdev}" = "" ]; then
echo "swapoff ${swapdev}"
swapoff ${swapdev}
fi
pressanykey
2015-07-18 18:12:26 -06:00
}
# --------------------------------------------------------
# --------------------------------------------------------
archmenu(){
2020-04-03 12:34:09 -06:00
if [ "${1}" = "" ]; then
nextitem="."
else
nextitem=${1}
fi
options=()
options+=("${txtsethostname}" "/etc/hostname")
options+=("${txtsetkeymap}" "/etc/vconsole.conf")
options+=("${txtsetfont}" "/etc/vconsole.conf (${txtoptional})")
options+=("${txtsetlocale}" "/etc/locale.conf, /etc/locale.gen")
options+=("${txtsettime}" "/etc/localtime")
options+=("${txtsetrootpassword}" "")
options+=("${txtgenerate//%1/fstab}" "")
if [ "${luksdrive}" = "1" ]; then
options+=("${txtgenerate//%1/crypttab}" "")
fi
if [ "${luksroot}" = "1" ]; then
options+=("${txtgenerate//%1/mkinitcpio.conf-luks}" "(encrypt hooks)")
fi
if [ "${isnvme}" = "1" ]; then
options+=("${txtgenerate//%1/mkinitcpio.conf-nvme}" "(nvme module)")
fi
options+=("${txtedit//%1/fstab}" "(${txtoptional})")
options+=("${txtedit//%1/crypttab}" "(${txtoptional})")
options+=("${txtedit//%1/mkinitcpio.conf}" "(${txtoptional})")
options+=("${txtedit//%1/mirrorlist}" "(${txtoptional})")
options+=("${txtbootloader}" "")
2020-04-03 14:37:19 -06:00
options+=("${txtextrasmenu}" "")
2023-08-10 10:13:32 -06:00
options+=("obosdi" "${txtobosdidesc}")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtarchinstallmenu}" --cancel-button "${txtback}" --default-item "${nextitem}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case ${sel} in
"${txtsethostname}")
archsethostname
nextitem="${txtsetkeymap}"
;;
"${txtsetkeymap}")
archsetkeymap
nextitem="${txtsetlocale}"
;;
"${txtsetfont}")
archsetfont
nextitem="${txtsetlocale}"
;;
"${txtsetlocale}")
archsetlocale
nextitem="${txtsettime}"
;;
"${txtsettime}")
archsettime
nextitem="${txtsetrootpassword}"
;;
"${txtsetrootpassword}")
archsetrootpassword
nextitem="${txtgenerate//%1/fstab}"
;;
"${txtgenerate//%1/fstab}")
archgenfstabmenu
if [ "${luksdrive}" = "1" ]; then
nextitem="${txtgenerate//%1/crypttab}"
else
if [ "${luksroot}" = "1" ]; then
nextitem="${txtgenerate//%1/mkinitcpio.conf-luks}"
else
if [ "${isnvme}" = "1" ]; then
nextitem="${txtgenerate//%1/mkinitcpio.conf-nvme}"
else
nextitem="${txtbootloader}"
fi
fi
fi
;;
"${txtgenerate//%1/crypttab}")
archgencrypttab
if [ "${luksroot}" = "1" ]; then
nextitem="${txtgenerate//%1/mkinitcpio.conf-luks}"
else
if [ "${isnvme}" = "1" ]; then
nextitem="${txtgenerate//%1/mkinitcpio.conf-nvme}"
else
nextitem="${txtbootloader}"
fi
fi
;;
"${txtgenerate//%1/mkinitcpio.conf-luks}")
archgenmkinitcpioluks
if [ "${isnvme}" = "1" ]; then
nextitem="${txtgenerate//%1/mkinitcpio.conf-nvme}"
else
nextitem="${txtbootloader}"
fi
;;
"${txtgenerate//%1/mkinitcpio.conf-nvme}")
archgenmkinitcpionvme
nextitem="${txtbootloader}"
;;
"${txtedit//%1/fstab}")
${EDITOR} /mnt/etc/fstab
nextitem="${txtedit//%1/fstab}"
;;
"${txtedit//%1/crypttab}")
${EDITOR} /mnt/etc/crypttab
nextitem="${txtedit//%1/crypttab}"
;;
"${txtedit//%1/mkinitcpio.conf}")
archeditmkinitcpio
nextitem="${txtedit//%1/mkinitcpio.conf}"
;;
"${txtedit//%1/mirrorlist}")
${EDITOR} /mnt/etc/pacman.d/mirrorlist
nextitem="${txtedit//%1/mirrorlist}"
;;
"${txtbootloader}")
archbootloadermenu
2020-04-03 14:37:19 -06:00
nextitem="${txtextrasmenu}"
2020-04-03 12:34:09 -06:00
;;
2020-04-03 14:37:19 -06:00
"${txtextrasmenu}")
archextrasmenu
2023-08-10 10:13:32 -06:00
nextitem="obosdi"
2020-04-03 12:34:09 -06:00
;;
2023-08-10 10:13:32 -06:00
"obosdi")
installobosdi
nextitem="obosdi"
2020-04-03 12:34:09 -06:00
;;
esac
archmenu "${nextitem}"
fi
2015-07-18 18:12:26 -06:00
}
archchroot(){
2020-04-03 12:34:09 -06:00
echo "arch-chroot /mnt /root"
cp ${0} /mnt/root
chmod 755 /mnt/root/$(basename "${0}")
2023-08-10 10:13:32 -06:00
echo "dialog is required for obosfi, it will be installed as dep. Then it will removed when cleaning orphan."
2022-11-10 12:33:17 -07:00
echo "arch-chroot /mnt pacman -S --asdeps --needed --noconfirm dialog"
arch-chroot /mnt pacman -S --asdeps --needed --noconfirm dialog
2020-04-03 12:34:09 -06:00
arch-chroot /mnt /root/$(basename "${0}") --chroot ${1} ${2}
rm /mnt/root/$(basename "${0}")
echo "exit"
2015-07-18 18:12:26 -06:00
}
archsethostname(){
2022-11-10 12:33:17 -07:00
hostname=$(dialog --backtitle "${apptitle}" --title "${txtsethostname}" --inputbox "" 0 0 "archlinux" 3>&1 1>&2 2>&3)
2020-04-03 12:34:09 -06:00
if [ "$?" = "0" ]; then
clear
echo "echo \"${hostname}\" > /mnt/etc/hostname"
echo "${hostname}" > /mnt/etc/hostname
pressanykey
fi
2015-07-18 18:12:26 -06:00
}
archsetkeymap(){
2020-04-03 12:34:09 -06:00
#items=$(localectl list-keymaps)
#options=()
#for item in ${items}; do
# options+=("${item}" "")
#done
items=$(find /usr/share/kbd/keymaps/ -type f -printf "%f\n" | sort -V)
options=()
defsel=""
for item in ${items}; do
if [ "${item%%.*}" == "${keymap}" ]; then
defsel="${item%%.*}"
fi
options+=("${item%%.*}" "")
done
2022-11-10 12:33:17 -07:00
keymap=$(dialog --backtitle "${apptitle}" --title "${txtsetkeymap}" --default-item "${defsel}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
clear
echo "echo \"KEYMAP=${keymap}\" > /mnt/etc/vconsole.conf"
echo "KEYMAP=${keymap}" > /mnt/etc/vconsole.conf
pressanykey
fi
2016-03-12 10:56:26 -07:00
}
archsetfont(){
2020-04-03 12:34:09 -06:00
items=$(find /usr/share/kbd/consolefonts/*.psfu.gz -printf "%f\n")
options=()
for item in ${items}; do
options+=("${item%%.*}" "")
done
2022-11-10 12:33:17 -07:00
vcfont=$(dialog --backtitle "${apptitle}" --title "${txtsetfont} (${txtoptional})" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${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
pressanykey
fi
2015-07-18 18:12:26 -06:00
}
archsetlocale(){
2020-04-03 12:34:09 -06:00
items=$(ls /usr/share/i18n/locales)
options=()
defsel=""
for item in ${items}; do
if [ "${defsel}" == "" ]&&[ "${keymap::2}" == "${item::2}" ]; then
defsel="${item}"
fi
options+=("${item}" "")
done
2022-11-10 12:33:17 -07:00
locale=$(dialog --backtitle "${apptitle}" --title "${txtsetlocale}" --default-item "${defsel}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
clear
echo "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 "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
archchroot setlocale
pressanykey
fi
2015-07-18 18:12:26 -06:00
}
archsetlocalechroot(){
2020-04-03 12:34:09 -06:00
echo "locale-gen"
locale-gen
exit
2015-07-18 18:12:26 -06:00
}
archsettime(){
2020-04-03 12:34:09 -06:00
items=$(ls -l /mnt/usr/share/zoneinfo/ | grep '^d' | gawk -F':[0-9]* ' '/:/{print $2}')
options=()
for item in ${items}; do
options+=("${item}" "")
done
2022-11-10 12:33:17 -07:00
timezone=$(dialog --backtitle "${apptitle}" --title "${txtsettime}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${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
2022-11-10 12:33:17 -07:00
timezone=${timezone}/$(dialog --backtitle "${apptitle}" --title "${txtsettime}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
return 1
fi
clear
echo "ln -sf /mnt/usr/share/zoneinfo/${timezone} /mnt/etc/localtime"
ln -sf /usr/share/zoneinfo/${timezone} /mnt/etc/localtime
pressanykey
2020-04-03 14:46:56 -06:00
options=()
options+=("UTC" "")
options+=("Local" "")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtsettime}" --menu "${txthwclock}" 0 0 0 \
2020-04-03 14:46:56 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
return 1
2020-04-03 12:34:09 -06:00
fi
2020-04-03 14:46:56 -06:00
clear
case ${sel} in
"${txthwclockutc}")
archchroot settimeutc
;;
"${txthwclocklocal}")
archchroot settimelocal
;;
esac
2022-11-10 12:33:17 -07:00
# if (dialog --backtitle "${apptitle}" --title "${txtsettime}" --yesno "${txtuseutcclock}" 0 0) then
2020-04-03 14:46:56 -06:00
# clear
# archchroot settimeutc
# else
# clear
# archchroot settimelocal
# fi
2020-04-03 12:34:09 -06:00
pressanykey
2019-06-07 17:40:45 -06:00
2015-07-18 18:12:26 -06:00
}
archsettimeutcchroot(){
2020-04-03 12:34:09 -06:00
echo "hwclock --systohc --utc"
hwclock --systohc --utc
exit
2015-07-18 18:12:26 -06:00
}
archsettimelocalchroot(){
2020-04-03 12:34:09 -06:00
echo "hwclock --systohc --localtime"
hwclock --systohc --localtime
exit
2015-07-18 18:12:26 -06:00
}
archsetrootpassword(){
2020-04-03 12:34:09 -06:00
clear
archchroot setrootpassword
pressanykey
2015-07-18 18:12:26 -06:00
}
archsetrootpasswordchroot(){
2020-04-03 12:34:09 -06:00
echo "passwd root"
2020-04-03 13:03:03 -06:00
passed=1
while [[ ${passed} != 0 ]]; do
passwd root
passed=$?
done
2020-04-03 12:34:09 -06:00
exit
2015-07-18 18:12:26 -06:00
}
2018-12-31 15:18:09 -07:00
archgenfstabmenu(){
2020-04-03 12:34:09 -06:00
options=()
options+=("UUID" "genfstab -U")
options+=("LABEL" "genfstab -L")
options+=("PARTUUID" "genfstab -t PARTUUID")
options+=("PARTLABEL" "genfstab -t PARTLABEL")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtgenerate//%1/fstab}" --cancel-button "${txtback}" --default-item "${nextitem}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case ${sel} in
"UUID")
clear
echo "genfstab -U -p /mnt > /mnt/etc/fstab"
genfstab -U -p /mnt > /mnt/etc/fstab
;;
"LABEL")
clear
echo "genfstab -L -p /mnt > /mnt/etc/fstab"
genfstab -L -p /mnt > /mnt/etc/fstab
;;
"PARTUUID")
clear
echo "genfstab -t PARTUUID -p /mnt > /mnt/etc/fstab"
genfstab -t PARTUUID -p /mnt > /mnt/etc/fstab
;;
"PARTLABEL")
clear
echo "genfstab -t PARTLABEL -p /mnt > /mnt/etc/fstab"
genfstab -t PARTLABEL -p /mnt > /mnt/etc/fstab
;;
esac
fi
pressanykey
2015-07-18 18:12:26 -06:00
}
2015-12-18 15:47:56 -07:00
archgencrypttab(){
2020-04-03 12:34:09 -06:00
clear
echo "echo -e \"${crypttab}\" >> /mnt/etc/crypttab"
echo -e "${crypttab}" >> /mnt/etc/crypttab
pressanykey
2015-08-22 13:02:44 -06:00
}
2015-08-22 13:05:21 -06:00
archgenmkinitcpioluks(){
2020-04-03 12:34:09 -06:00
clear
echo "sed -i \"s/block filesystems/block encrypt filesystems/g\" /mnt/etc/mkinitcpio.conf"
sed -i "s/block filesystems/block encrypt filesystems/g" /mnt/etc/mkinitcpio.conf
archchroot genmkinitcpio
pressanykey
2015-08-22 13:02:44 -06:00
}
archgenmkinitcpionvme(){
2020-04-03 12:34:09 -06:00
clear
echo "sed -i \"s/MODULES=()/MODULES=(nvme)/g\" /mnt/etc/mkinitcpio.conf"
sed -i "s/MODULES=()/MODULES=(nvme)/g" /mnt/etc/mkinitcpio.conf
archchroot genmkinitcpio
pressanykey
}
2015-08-22 13:02:44 -06:00
2015-07-18 18:12:26 -06:00
archeditmkinitcpio(){
2020-04-03 12:34:09 -06:00
${EDITOR} /mnt/etc/mkinitcpio.conf
2022-11-10 12:33:17 -07:00
if (dialog --backtitle "${apptitle}" --title "${txtedit//%1/mkinitcpio.conf}" --yesno "${txtgenerate//%1/mkinitcpio} ?" 0 0) then
2020-04-03 12:34:09 -06:00
clear
archchroot genmkinitcpio
pressanykey
fi
2015-07-18 18:12:26 -06:00
}
archgenmkinitcpiochroot(){
2020-04-03 12:34:09 -06:00
echo "mkinitcpio -p linux"
mkinitcpio -p linux
exit
2015-07-18 18:12:26 -06:00
}
2018-12-30 12:46:28 -07:00
archbootloadermenu(){
2020-04-03 12:34:09 -06:00
options=()
options+=("grub" "")
if [ "${efimode}" == "1" ]; then
options+=("systemd-boot" "")
options+=("refind" "")
fi
if [ "${efimode}" != "2" ]; then
options+=("syslinux" "")
fi
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtbootloadermenu}" --cancel-button "${txtback}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case ${sel} in
"grub") archbootloadergrubmenu;;
"systemd-boot")archbootloadersystemdbmenu;;
"refind") archbootloaderrefindmenu;;
"syslinux")archbootloadersyslinuxbmenu;;
esac
fi
2018-12-30 12:46:28 -07:00
}
archbootloadergrubmenu(){
2020-04-03 12:34:09 -06:00
if [ "${1}" = "" ]; then
nextblitem="."
else
nextblitem=${1}
fi
options=()
options+=("${txtinstall//%1/grub}" "pacstrap grub (efibootmgr), grub-mkconfig")
options+=("${txtedit//%1/grub}" "(${txtoptional})")
options+=("${txtinstall//%1/bootloader}" "grub-install")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtbootloadergrubmenu}" --cancel-button "${txtback}" --default-item "${nextblitem}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case ${sel} in
"${txtinstall//%1/grub}")
archgrubinstall
nextblitem="${txtinstall//%1/bootloader}"
;;
"${txtedit//%1/grub}")
${EDITOR} /mnt/etc/default/grub
2022-11-10 12:33:17 -07:00
if (dialog --backtitle "${apptitle}" --title "${txtedit//%1/grub}" --yesno "${txtrungrubmakeconfig}" 0 0) then
2020-04-03 12:34:09 -06:00
clear
archchroot grubinstall
pressanykey
fi
nextblitem="${txtinstall//%1/bootloader}"
;;
"${txtinstall//%1/bootloader}")
archgrubinstallbootloader
nextblitem="${txtinstall//%1/bootloader}"
;;
esac
archbootloadergrubmenu "${nextblitem}"
fi
2018-12-30 12:46:28 -07:00
}
archgrubinstall(){
2020-04-03 12:34:09 -06:00
clear
echo "pacstrap /mnt grub"
pacstrap /mnt grub
pressanykey
if [ "${eficomputer}" == "1" ]; then
if [ "${efimode}" == "1" ]||[ "${efimode}" == "2" ]; then
2022-11-10 12:33:17 -07:00
if (dialog --backtitle "${apptitle}" --title "${txtinstall//%1/efibootmgr}" --yesno "${txtefibootmgr}" 0 0) then
2020-04-03 12:34:09 -06:00
clear
echo "pacstrap /mnt efibootmgr"
pacstrap /mnt efibootmgr
pressanykey
fi
else
2022-11-10 12:33:17 -07:00
if (dialog --backtitle "${apptitle}" --title "${txtinstall//%1/efibootmgr}" --defaultno --yesno "${txtefibootmgr}" 0 0) then
2020-04-03 12:34:09 -06:00
clear
echo "pacstrap /mnt efibootmgr"
pacstrap /mnt efibootmgr
pressanykey
fi
fi
fi
if [ "${luksroot}" = "1" ]; then
2022-11-10 12:33:17 -07:00
if (dialog --backtitle "${apptitle}" --title "${txtinstall//%1/grub}" --yesno "${txtgrubluksdetected}" 0 0) then
2020-04-03 12:34:09 -06:00
clear
echo "sed -i /GRUB_CMDLINE_LINUX=/c\GRUB_CMDLINE_LINUX=\\\"cryptdevice=/dev/disk/by-uuid/${luksrootuuid}:root\\\" /mnt/etc/default/grub"
sed -i /GRUB_CMDLINE_LINUX=/c\GRUB_CMDLINE_LINUX=\"cryptdevice=/dev/disk/by-uuid/${luksrootuuid}:root\" /mnt/etc/default/grub
pressanykey
fi
fi
clear
archchroot grubinstall
pressanykey
2015-07-18 18:12:26 -06:00
}
2018-12-30 12:46:28 -07:00
archgrubinstallchroot(){
2020-04-03 12:34:09 -06:00
echo "mkdir /boot/grub"
echo "grub-mkconfig -o /boot/grub/grub.cfg"
mkdir /boot/grub
grub-mkconfig -o /boot/grub/grub.cfg
exit
2015-07-18 18:12:26 -06:00
}
2018-12-30 12:46:28 -07:00
archgrubinstallbootloader(){
2020-04-03 12:34:09 -06:00
device=$( selectdisk "${txtinstall//%1/bootloader}" )
if [ "$?" = "0" ]; then
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
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtinstall//%1/bootloader}" --cancel-button "${txtback}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
clear
case ${sel} in
"BIOS") archchroot grubbootloaderinstall ${device};;
"EFI") archchroot grubbootloaderefiinstall ${device};;
"BIOS+EFI") archchroot grubbootloaderefiusbinstall ${device};;
esac
pressanykey
fi
else
clear
archchroot grubbootloaderinstall ${device}
pressanykey
fi
fi
2015-07-18 18:12:26 -06:00
}
2018-12-30 12:46:28 -07:00
archgrubinstallbootloaderchroot(){
2020-04-03 12:34:09 -06:00
if [ ! "${1}" = "none" ]; then
echo "grub-install --target=i386-pc --recheck ${1}"
grub-install --target=i386-pc --recheck ${1}
fi
exit
2015-07-18 18:12:26 -06:00
}
2018-12-30 12:46:28 -07:00
archgrubinstallbootloaderefichroot(){
2020-04-03 12:34:09 -06:00
if [ ! "${1}" = "none" ]; then
echo "grub-install --target=x86_64-efi --efi-directory=/boot --recheck ${1}"
grub-install --target=x86_64-efi --efi-directory=/boot --recheck ${1}
isvbox=$(lspci | grep "VirtualBox G")
if [ "${isvbox}" ]; then
echo "VirtualBox detected, creating startup.nsh..."
echo "\EFI\arch\grubx64.efi" > /boot/startup.nsh
fi
fi
exit
2015-07-18 18:12:26 -06:00
}
2018-12-30 12:46:28 -07:00
archgrubinstallbootloaderefiusbchroot(){
2020-04-03 12:34:09 -06:00
if [ ! "${1}" = "none" ]; then
echo "grub-install --target=i386-pc --recheck ${1}"
grub-install --target=i386-pc --recheck ${1}
echo "grub-install --target=x86_64-efi --efi-directory=/boot --removable --recheck ${1}"
grub-install --target=x86_64-efi --efi-directory=/boot --removable --recheck ${1}
isvbox=$(lspci | grep "VirtualBox G")
if [ "${isvbox}" ]; then
echo "VirtualBox detected, creating startup.nsh..."
echo "\EFI\arch\grubx64.efi" > /boot/startup.nsh
fi
fi
exit
2015-07-18 18:12:26 -06:00
}
2018-12-30 12:46:28 -07:00
2018-12-30 16:07:07 -07:00
archbootloadersyslinuxbmenu(){
2020-04-03 12:34:09 -06:00
if [ "${1}" = "" ]; then
nextblitem="."
else
nextblitem=${1}
fi
options=()
options+=("${txtinstall//%1/syslinux}" "pacstrap syslinux (gptfdisk,mtools)")
options+=("${txtedit//%1/syslinux}" "(${txtoptional})")
options+=("${txtinstall//%1/bootloader}" "syslinux-install_update")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtbootloadersyslinuxmenu}" --cancel-button "${txtback}" --default-item "${nextblitem}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case ${sel} in
"${txtinstall//%1/syslinux}")
archsyslinuxinstall
nextblitem="${txtinstall//%1/bootloader}"
;;
"${txtedit//%1/syslinux}")
${EDITOR} /mnt/boot/syslinux/syslinux.cfg
nextblitem="${txtinstall//%1/bootloader}"
;;
"${txtinstall//%1/bootloader}")
archsyslinuxinstallbootloader
nextblitem="${txtinstall//%1/bootloader}"
;;
esac
archbootloadersyslinuxbmenu "${nextblitem}"
fi
2018-12-30 16:07:07 -07:00
}
archsyslinuxinstall(){
2020-04-03 12:34:09 -06:00
clear
if [ "${efimode}" == "1" ]||[ "${efimode}" == "2" ]; then
echo "${txtsyslinuxaddefibootmgr}"
additionalpkg=${additionalpkg}"efibootmgr "
fi
if [ "${isnvme}" = "1" ]; then
if [ "$(parted ${realrootdev::(-2)} print|grep gpt)" != "" ]; then
echo "${txtsyslinuxaddgptfdisk}"
additionalpkg=${additionalpkg}"gptfdisk "
fi
else
if [ "$(parted ${realrootdev::8} print|grep gpt)" != "" ]; then
echo "${txtsyslinuxaddgptfdisk}"
additionalpkg=${additionalpkg}"gptfdisk "
fi
fi
if [ "${bootdev}" != "" ]; then
if [ "$(parted ${bootdev} print|grep fat)" != "" ]; then
echo "${txtsyslinuxaddmtools}"
additionalpkg=${additionalpkg}"mtools "
fi
fi
echo "pacstrap /mnt syslinux ${additionalpkg}"
pacstrap /mnt syslinux ${additionalpkg}
pressanykey
clear
echo "Updating /boot/syslinux/syslinux.cfg"
if [ "${luksroot}" = "1" ]; then
echo "sed -i \"/APPEND\ root=/c\ APPEND root=/dev/mapper/root cryptdevice=${realrootdev}:root rw\" /mnt/boot/syslinux/syslinux.cfg"
sed -i "/APPEND\ root=/c\ APPEND root=/dev/mapper/root cryptdevice=${realrootdev}:root\ rw" /mnt/boot/syslinux/syslinux.cfg
else
echo "sed -i \"/APPEND\ root=/c\ APPEND root=${rootdev} rw\" /mnt/boot/syslinux/syslinux.cfg"
sed -i "/APPEND\ root=/c\ APPEND root=${rootdev}\ rw" /mnt/boot/syslinux/syslinux.cfg
fi
pressanykey
2018-12-30 16:07:07 -07:00
}
archsyslinuxinstallbootloader(){
2020-04-03 12:34:09 -06:00
clear
if [ "${efimode}" == "1" ]||[ "${efimode}" == "2" ]; then
archchroot syslinuxbootloaderefiinstall ${bootdev}
else
archchroot syslinuxbootloaderinstall ${bootdev}
fi
pressanykey
2018-12-30 16:07:07 -07:00
}
archsyslinuxinstallbootloaderchroot(){
2020-04-03 12:34:09 -06:00
if [ ! "${1}" = "none" ]; then
echo "syslinux-install_update -i -a -m"
syslinux-install_update -i -a -m
fi
exit
2018-12-30 16:07:07 -07:00
}
2018-12-31 09:15:19 -07:00
archsyslinuxinstallbootloaderefichroot(){
2020-04-03 12:34:09 -06:00
if [ ! "${1}" = "none" ]; then
echo "cp -r /usr/lib/syslinux/efi64/* /boot/syslinux"
cp -r /usr/lib/syslinux/efi64/* /boot/syslinux
if [ "${1::8}" == "/dev/nvm" ]; then
echo "efibootmgr --create --disk ${1::(-2)} --part ${1:(-1)} --loader /syslinux/syslinux.efi --label "Syslinux" --verbose"
efibootmgr --create --disk ${1::(-2)} --part ${1:(-1)} --loader /syslinux/syslinux.efi --label "Syslinux" --verbose
else
echo "efibootmgr --create --disk ${1::8} --part ${1:(-1)} --loader /syslinux/syslinux.efi --label "Syslinux" --verbose"
efibootmgr --create --disk ${1::8} --part ${1:(-1)} --loader /syslinux/syslinux.efi --label "Syslinux" --verbose
fi
isvbox=$(lspci | grep "VirtualBox G")
if [ "${isvbox}" ]; then
echo "VirtualBox detected, creating startup.nsh..."
echo "\syslinux\syslinux.efi" > /boot/startup.nsh
fi
fi
exit
2018-12-31 09:15:19 -07:00
}
2018-12-30 16:07:07 -07:00
2018-12-30 12:46:28 -07:00
2018-12-31 11:47:57 -07:00
archbootloadersystemdbmenu(){
2020-04-03 12:34:09 -06:00
if [ "${1}" = "" ]; then
nextblitem="."
else
nextblitem=${1}
fi
options=()
options+=("${txtinstall//%1/systemd-boot}" "bootctl install")
options+=("${txtedit//%1/loader.conf}" "(${txtoptional})")
options+=("${txtedit//%1/entries}" "(${txtoptional})")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtbootloadersystemdmenu}" --cancel-button "${txtback}" --default-item "${nextblitem}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case ${sel} in
"${txtinstall//%1/systemd-boot}")
archsystemdinstall
nextblitem="${txtinstall//%1/loader.conf}"
;;
"${txtedit//%1/loader.conf}")
${EDITOR} /mnt/boot/loader/loader.conf
nextblitem="${txtedit//%1/entries}"
;;
"${txtedit//%1/entries}")
${EDITOR} /mnt/boot/loader/entries/*
nextblitem="${txtedit//%1/entries}"
;;
esac
archbootloadersystemdbmenu "${nextblitem}"
fi
2018-12-31 11:47:57 -07:00
}
archsystemdinstall(){
2020-04-03 12:34:09 -06:00
clear
archchroot systemdbootloaderinstall ${realrootdev}
partuuid=$(blkid -s PARTUUID -o value ${realrootdev})
parttype=$(blkid -s TYPE -o value ${rootdev})
echo "cp /mnt/usr/share/systemd/bootctl/arch.conf /mnt/boot/loader/entries"
echo "echo \"timeout 2\" >> /mnt/boot/loader/loader.conf"
echo "cp /mnt/usr/share/systemd/bootctl/loader.conf /mnt/boot/loader"
if [ "${luksroot}" = "1" ]; then
cryptuuid=$(blkid -s UUID -o value ${realrootdev})
echo "sed -i \"s/PARTUUID=XXXX/\\/dev\\/mapper\\/root/\" /mnt/boot/loader/entries/arch.conf"
echo "sed -i \"s/XXXX/${parttype}/\" /mnt/boot/loader/entries/arch.conf"
echo "sed -i \"s/root=/cryptdevice=UUID=${cryptuuid}:root root=/\" /mnt/boot/loader/entries/arch.conf"
else
echo "sed -i \"s/PARTUUID=XXXX/PARTUUID=${partuuid}/\" /mnt/boot/loader/entries/arch.conf"
echo "sed -i \"s/XXXX/${parttype}/\" /mnt/boot/loader/entries/arch.conf"
fi
echo "cp /mnt/boot/loader/entries/arch.conf /mnt/boot/loader/entries/arch-fallback.conf"
echo "sed -i \"s/Arch Linux/Arch Linux Fallback/\" /mnt/boot/loader/entries/arch-fallback.conf"
echo "sed -i \"s/initramfs-linux/initramfs-linux-fallback/\" /mnt/boot/loader/entries/arch-fallback.conf"
cp /mnt/usr/share/systemd/bootctl/loader.conf /mnt/boot/loader
echo "timeout 2" >> /mnt/boot/loader/loader.conf
cp /mnt/usr/share/systemd/bootctl/arch.conf /mnt/boot/loader/entries
if [ "${luksroot}" = "1" ]; then
sed -i "s/PARTUUID=XXXX/\/dev\/mapper\/root/" /mnt/boot/loader/entries/arch.conf
sed -i "s/XXXX/${parttype}/" /mnt/boot/loader/entries/arch.conf
sed -i "s/root=/cryptdevice=UUID=${cryptuuid}:root root=/" /mnt/boot/loader/entries/arch.conf
else
sed -i "s/PARTUUID=XXXX/PARTUUID=${partuuid}/" /mnt/boot/loader/entries/arch.conf
sed -i "s/XXXX/${parttype}/" /mnt/boot/loader/entries/arch.conf
fi
cp /mnt/boot/loader/entries/arch.conf /mnt/boot/loader/entries/arch-fallback.conf
sed -i "s/Arch Linux/Arch Linux Fallback/" /mnt/boot/loader/entries/arch-fallback.conf
sed -i "s/initramfs-linux/initramfs-linux-fallback/" /mnt/boot/loader/entries/arch-fallback.conf
pressanykey
2018-12-31 11:47:57 -07:00
}
archsystemdinstallchroot(){
2020-04-03 12:34:09 -06:00
echo "bootctl --path=/boot install"
bootctl --path=/boot install
isvbox=$(lspci | grep "VirtualBox G")
if [ "${isvbox}" ]; then
echo "VirtualBox detected, creating startup.nsh..."
echo "\EFI\systemd\systemd-bootx64.efi" > /boot/startup.nsh
fi
2018-12-31 11:47:57 -07:00
}
2018-12-30 12:46:28 -07:00
2018-12-31 14:47:14 -07:00
archbootloaderrefindmenu(){
2020-04-03 12:34:09 -06:00
if [ "${1}" = "" ]; then
nextblitem="."
else
nextblitem=${1}
fi
options=()
options+=("${txtinstall//%1/refind}" "pacstrap refind-efi")
options+=("${txtedit//%1/refind_linux.conf}" "(${txtoptional})")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtbootloaderrefindmenu}" --cancel-button "${txtback}" --default-item "${nextblitem}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case ${sel} in
"${txtinstall//%1/refind}")
archrefindinstall
nextblitem="${txtedit//%1/refind_linux.conf}"
;;
"${txtedit//%1/refind_linux.conf}")
${EDITOR} /mnt/boot/refind_linux.conf
nextblitem="${txtedit//%1/refind_linux.conf}"
;;
esac
archbootloaderrefindmenu "${nextblitem}"
fi
2018-12-31 14:47:14 -07:00
}
archrefindinstall(){
2020-04-03 12:34:09 -06:00
clear
2021-04-28 15:27:37 -06:00
echo "pacstrap /mnt refind"
2020-04-03 12:34:09 -06:00
echo "archchroot refindbootloaderinstall ${realrootdev}"
echo "echo \"\\\"Arch Linux \\\" \\\"root=UUID=${rootuuid} rw add_efi_memmap\\\"\" > /mnt/boot/refind_linux.conf"
echo "echo \"\\\"Arch Linux Fallback\\\" \\\"root=UUID=${rootuuid} rw add_efi_memmap initrd=/initramfs-linux-fallback.img\\\"\" >> /mnt/boot/refind_linux.conf"
echo "echo \"\\\"Arch Linux Terminal\\\" \\\"root=UUID=${rootuuid} rw add_efi_memmap systemd.unit=multi-user.target\\\"\" >> /mnt/boot/refind_linux.conf"
pacstrap /mnt refind-efi
archchroot refindbootloaderinstall ${realrootdev}
rootuuid=$(blkid -s UUID -o value ${realrootdev})
echo "\"Arch Linux \" \"root=UUID=${rootuuid} rw add_efi_memmap\"" > /mnt/boot/refind_linux.conf
echo "\"Arch Linux Fallback\" \"root=UUID=${rootuuid} rw add_efi_memmap initrd=/initramfs-linux-fallback.img\"" >> /mnt/boot/refind_linux.conf
echo "\"Arch Linux Terminal\" \"root=UUID=${rootuuid} rw add_efi_memmap systemd.unit=multi-user.target\"" >> /mnt/boot/refind_linux.conf
pressanykey
2018-12-31 14:47:14 -07:00
}
archrefindinstallchroot(){
2020-04-03 12:34:09 -06:00
#--usedefault /dev/sdXY --alldrivers
echo "refind-install"
refind-install
isvbox=$(lspci | grep "VirtualBox G")
if [ "${isvbox}" ]; then
echo "VirtualBox detected, creating startup.nsh..."
echo "\EFI\refind\refind_x64.efi" > /boot/startup.nsh
fi
2018-12-31 14:47:14 -07:00
}
2020-04-03 14:37:19 -06:00
archextrasmenu(){
pkgs=""
options=()
options+=("nano" "" on)
options+=("vim" "" on)
options+=("dhcpcd" "" on)
2021-04-01 14:12:37 -06:00
options+=("networkmanager" "" off)
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtextrasmenu}" --checklist "" 0 0 0 \
2020-04-03 14:37:19 -06:00
"${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
clear
echo "pacstrap /mnt ${pkgs}"
pacstrap /mnt ${pkgs}
if [[ "${pkgs}" == *"dhcpcd"* ]]; then
2020-04-03 12:34:09 -06:00
archchroot enabledhcpcd
fi
2021-04-01 14:12:37 -06:00
if [[ "${pkgs}" == *"networkmanager"* ]]; then
archchroot enablenetworkmanager
fi
2020-04-03 14:37:19 -06:00
pressanykey
2015-07-18 18:12:26 -06:00
}
archenabledhcpcdchroot(){
2020-04-03 12:34:09 -06:00
echo "systemctl enable dhcpcd"
systemctl enable dhcpcd
exit
2015-07-18 18:12:26 -06:00
}
2021-04-01 14:12:37 -06:00
archenablenetworkmanagerchroot(){
echo "systemctl enable NetworkManager"
systemctl enable NetworkManager
exit
}
2023-08-10 10:13:32 -06:00
installobosdi(){
dialog --backtitle "${apptitle}" --title "obosdi" --msgbox "${txtinstallobosdi}" 0 0
2020-04-03 12:34:09 -06:00
if [ "$?" = "0" ]; then
options=()
2023-08-10 10:13:32 -06:00
options+=("${txtobosdiinstallandlaunch}" "")
options+=("${txtobosdilaunch}" "")
options+=("${txtobosdiinstall}" "")
sel=$(dialog --backtitle "${apptitle}" --title "${txtobosdimenu}" --cancel-button "${txtback}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case ${sel} in
2023-08-10 10:13:32 -06:00
"${txtobosdiinstallandlaunch}") archchroot obosdiinstallandlaunch;;
"${txtobosdilaunch}") archchroot obosdilaunch;;
"${txtobosdiinstall}")
2020-04-03 12:34:09 -06:00
clear
2023-08-10 10:13:32 -06:00
archchroot obosdiinstall
2020-04-03 12:34:09 -06:00
pressanykey
;;
esac
fi
fi
2015-07-18 18:12:26 -06:00
}
2023-08-10 10:13:32 -06:00
obosdidownload(){
2020-04-03 12:34:09 -06:00
txtselectserver="Select source server :"
txtback="Back"
options=()
2023-08-10 12:47:52 -06:00
options+=("git.ouroboros.group" "(Recommended")
2022-11-10 12:33:17 -07:00
sel=$(dialog --backtitle "${apptitle}" --title "${txtselectserver}" --cancel-button "${txtback}" --menu "" 0 0 0 \
2020-04-03 12:34:09 -06:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case ${sel} in
"github.com")
2023-08-10 12:47:52 -06:00
obosdiurl=git.ouroboros.group/Ouroboros/obosdi/raw/branch/master/obosdi > obosdi
2020-04-03 12:34:09 -06:00
;;
esac
fi
2023-08-10 10:13:32 -06:00
echo "curl -L ${obosdiurl} >obosdi"
curl -L ${obosdiurl} >obosdi
2015-08-20 11:14:17 -06:00
}
2023-08-10 10:13:32 -06:00
obosdiinstallandlaunchchroot(){
2020-04-03 12:34:09 -06:00
cd
2023-08-10 10:13:32 -06:00
obosdidownload
sh obosdi -i
obosdi --chroot
2020-04-03 12:34:09 -06:00
exit
2015-07-18 18:12:26 -06:00
}
2023-08-10 10:13:32 -06:00
obosdilaunchchroot(){
2020-04-03 12:34:09 -06:00
cd
2023-08-10 10:13:32 -06:00
obosdidownload
sh obosdi --chroot
rm obosdi
2020-04-03 12:34:09 -06:00
exit
2015-07-18 18:12:26 -06:00
}
2023-08-10 10:13:32 -06:00
obosdiinstallchroot(){
2020-04-03 12:34:09 -06:00
cd
2023-08-10 10:13:32 -06:00
obosdidownload
sh obosdi -i
2020-04-03 12:34:09 -06:00
exit
2015-07-18 18:12:26 -06:00
}
# --------------------------------------------------------
# --------------------------------------------------------
pressanykey(){
2020-04-03 12:34:09 -06:00
read -n1 -p "${txtpressanykey}"
2015-07-18 18:12:26 -06:00
}
loadstrings(){
2019-06-07 17:40:45 -06:00
2020-04-03 12:34:09 -06:00
locale=en_US.UTF-8
#font=
2019-06-07 17:40:45 -06:00
2020-04-03 12:34:09 -06:00
txtexit="Exit"
txtback="Back"
txtignore="Ignore"
2019-06-07 17:40:45 -06:00
2020-04-03 12:34:09 -06:00
txtselectserver="Select source server :"
2019-06-07 17:40:45 -06:00
2020-04-03 12:34:09 -06:00
txtmainmenu="Main Menu"
txtlanguage="Language"
txtsetkeymap="Set Keyboard Layout"
txteditor="Editor"
txtdiskpartmenu="Disk Partitions"
txtselectpartsmenu="Select Partitions and Install"
txthelp="Help"
txtchangelog="Changelog"
txtreboot="Reboot"
2015-07-18 18:12:26 -06:00
2020-04-03 12:34:09 -06:00
txtautoparts="Auto Partitions"
txteditparts="Edit Partitions"
2015-07-18 18:12:26 -06:00
2020-04-03 12:34:09 -06:00
txtautopartsconfirm="Selected device : %1\n\nAll data will be erased ! \n\nContinue ?"
2015-07-18 18:12:26 -06:00
2020-04-03 12:34:09 -06:00
txtautopartclear="Clear all partition data"
txtautopartcreate="Create %1 partition"
txthybridpartcreate="Set hybrid MBR"
txtautopartsettype="Set %1 partition type"
2015-07-18 18:12:26 -06:00
2020-04-03 12:34:09 -06:00
txtselectdevice="Select %1 device :"
txtselecteddevices="Selected devices :"
2015-07-18 18:12:26 -06:00
2020-04-03 12:34:09 -06:00
txtformatmountmenu="Format and Mount"
txtformatdevices="Format Devices"
txtformatdevice="Format Device"
txtmount="Mount"
txtunmount="Unmount"
txtmountdesc="Install or Config"
2015-07-18 18:12:26 -06:00
2020-04-03 12:34:09 -06:00
txtformatdeviceconfirm="Warning, all data on selected devices will be erased ! \nFormat devices ?"
2015-07-18 18:12:26 -06:00
2020-04-03 12:34:09 -06:00
txtselectpartformat="Select partition format for %1 :"
txtformatingpart="Formatting partition %1 as"
txtcreateluksdevice="Create luks device :"
txtopenluksdevice="Open luks device :"
txtluksdevicecreated="luks device created !"
2015-07-18 18:12:26 -06:00
2020-04-03 12:34:09 -06:00
txtinstallmenu="Install Menu"
2019-06-07 17:40:45 -06:00
2020-04-03 12:34:09 -06:00
txtarchinstallmenu="Arch Install Menu"
2019-06-07 17:40:45 -06:00
2020-04-03 12:34:09 -06:00
txtselectmirrorsbycountry="Select mirrors by country"
txtselectcountry="Select country"
txteditmirrorlist="Edit mirrorlist"
txtfiltermirrorlist="Filter mirrorlist"
txtparalleldownloads="Parallel Downloads"
2020-04-03 12:34:09 -06:00
txtinstallarchlinux="Install Arch Linux"
txtinstallarchlinuxkernel="Kernel"
txtinstallarchlinuxfirmwares="Firmwares"
txtinstallarchlinuxfilesystems="File Systems"
2020-04-07 20:31:15 -06:00
txtinstallarchlinuxcustompackagelist="Custom Package List"
2020-04-03 12:34:09 -06:00
txtconfigarchlinux="Config Arch Linux"
txtparallelprompt="Number of packages to download in Parallel"
txtincorrectinput="Please enter a number greater than 0"
2015-07-18 18:12:26 -06:00
2020-04-03 12:34:09 -06:00
txtsethostname="Set Computer Name"
txtsetfont="Set Font"
txtsetlocale="Set Locale"
txtsettime="Set Time"
txtsetrootpassword="Set root password"
2019-06-07 17:40:45 -06:00
2020-04-03 14:46:56 -06:00
txthwclock="Hardware clock :"
txthwclockutc="UTC"
txthwclocklocal="Local"
2019-06-07 17:40:45 -06:00
2020-04-03 12:34:09 -06:00
txtbootloader="Bootloader"
txtbootloadermenu="Choose your bootloader"
2019-06-07 17:40:45 -06:00
2020-04-03 12:34:09 -06:00
txtefibootmgr="efibootmgr is required for EFI computers."
2019-06-07 17:40:45 -06:00
2020-04-03 12:34:09 -06:00
txtbootloadergrubmenu="Grub Install Menu"
txtrungrubmakeconfig="Run grub-mkconfig ?"
txtgrubluksdetected="Encrypted root partion !\n\nAdd cryptdevice= to GRUB_CMDLINE_LINUX in /etc/default/grub ?"
2019-06-07 17:40:45 -06:00
2020-04-03 12:34:09 -06:00
txtbootloadersyslinuxmenu="Syslinux Install Menu"
txtsyslinuxaddefibootmgr="EFI install require efibootmgr"
txtsyslinuxaddgptfdisk="GPT disk require gptfdisk"
txtsyslinuxaddmtools="FAT boot part require mtools"
2019-06-07 17:40:45 -06:00
2020-04-03 12:34:09 -06:00
txtbootloadersystemdmenu="Systemd-boot Install Menu"
2019-06-07 17:40:45 -06:00
2020-04-03 12:34:09 -06:00
txtbootloaderrefindmenu="rEFInd Install Menu"
2020-04-03 14:37:19 -06:00
txtextrasmenu="Extras"
2019-06-07 17:40:45 -06:00
2020-04-03 12:34:09 -06:00
txtoptional="Optional"
txtrecommandeasyinst="Recommanded for easy install"
txtset="Set %1"
txtgenerate="Generate %1"
txtedit="Edit %1"
txtinstall="Install %1"
txtenable="Enable %1"
2019-06-07 17:40:45 -06:00
2020-04-03 12:34:09 -06:00
txtpressanykey="Press any key to continue."
2019-06-07 17:40:45 -06:00
2023-08-10 10:13:32 -06:00
txtobosdidesc="Full desktop install script"
txtinstallobosdi="Arch Linux Desktop Install (obosdi) 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."
txtobosdiinstallandlaunch="Install and run obosdi"
txtobosdiinstall="Install obosdi"
txtobosdilaunch="Launch obosdi"
2015-07-18 18:12:26 -06:00
}
# --------------------------------------------------------
# --------------------------------------------------------
while (( "$#" )); do
2020-04-03 12:34:09 -06:00
case ${1} in
--help)
2023-08-10 10:13:32 -06:00
echo "obosfi"
2020-04-03 12:34:09 -06:00
echo "------"
2020-04-07 20:17:25 -06:00
echo "-cpl | --custom-package-list url Set custom package list url"
2020-04-03 12:34:09 -06:00
echo "-sf | --skip-font Skip setfont from language files"
echo "-efiX -efi0 : disable EFI, -efi1 efi inst, -efi2 efi hybrid inst"
2023-08-10 10:13:32 -06:00
echo "-t | --test ghusername ghbranch Test obosfi script and language"
2020-04-03 12:34:09 -06:00
exit 0
;;
2020-04-07 20:17:25 -06:00
-cpl | --custom-package-list)
2023-08-10 10:13:32 -06:00
curl -L ${2} > /tmp/obosfi-custom-package-list
2020-04-07 20:17:25 -06:00
if [[ "$?" != "0" ]]; then
echo "Error downloading custom package list"
exit 0
fi
cpl=1
;;
2020-04-03 12:34:09 -06:00
-sf | --skip-font) skipfont=1;;
-t | --test)
2023-08-10 10:13:32 -06:00
curl -L https://raw.githubusercontent.com/${2}/obosfi/${3}/obosfi > obosfi
sh obosfi -tt ${2} ${3}
2020-04-03 12:34:09 -06:00
exit 0
;;
2023-08-10 10:13:32 -06:00
-tt) baseurl="https://raw.githubusercontent.com/${2}/obosfi/${3}";;
2020-04-03 12:34:09 -06:00
-efi0) efimode=0;;
-efi1)
eficomputer=1
efimode=1
;;
-efi2)
eficomputer=1
efimode=2
;;
--chroot) chroot=1
command=${2}
args=${3};;
esac
shift
2015-07-18 18:12:26 -06:00
done
2019-06-07 17:40:45 -06:00
if [ "${chroot}" = "1" ]; then
2020-04-03 12:34:09 -06:00
case ${command} in
'setrootpassword') archsetrootpasswordchroot;;
'setlocale') archsetlocalechroot;;
'settimeutc') archsettimeutcchroot;;
'settimelocal') archsettimelocalchroot;;
'genmkinitcpio') archgenmkinitcpiochroot;;
'enabledhcpcd') archenabledhcpcdchroot;;
2021-04-01 14:12:37 -06:00
'enablenetworkmanager') archenablenetworkmanagerchroot;;
2020-04-03 12:34:09 -06:00
'grubinstall') archgrubinstallchroot;;
'grubbootloaderinstall') archgrubinstallbootloaderchroot ${args};;
'grubbootloaderefiinstall') archgrubinstallbootloaderefichroot ${args};;
'grubbootloaderefiusbinstall') archgrubinstallbootloaderefiusbchroot ${args};;
'syslinuxbootloaderinstall') archsyslinuxinstallbootloaderchroot ${args};;
'syslinuxbootloaderefiinstall') archsyslinuxinstallbootloaderefichroot ${args};;
'systemdbootloaderinstall') archsystemdinstallchroot ${args};;
'refindbootloaderinstall') archrefindinstallchroot ${args};;
2023-08-10 10:13:32 -06:00
'obosdiinstallandlaunch') obosdiinstallandlaunchchroot;;
'obosdiinstall') obosdiinstallchroot;;
'obosdilaunch') obosdilaunchchroot;;
2020-04-03 12:34:09 -06:00
esac
2015-07-18 18:12:26 -06:00
else
2022-11-20 17:44:30 -07:00
echo "Init pacman, please wait..."
2022-11-20 17:29:27 -07:00
systemctl start pacman-init.service
2022-11-10 12:33:17 -07:00
pacman -Sy --needed arch-install-scripts dialog
2020-04-03 12:34:09 -06:00
dmesg |grep efi: > /dev/null
if [ "$?" == "1" ]; then
if [ "${eficomputer}" != "1" ]; then
eficomputer=0
fi
else
eficomputer=1
if [ "${efimode}" == "" ]; then
efimode=1
fi
fi
2023-08-10 10:13:32 -06:00
cat << EOF > dialog.obosfi
2022-11-10 13:04:23 -07:00
use_shadow = OFF
2022-11-10 17:27:02 -07:00
title_color = (BLACK,WHITE,OFF)
2022-11-10 13:04:23 -07:00
button_label_active_color = (WHITE,BLUE,ON)
button_label_inactive_color = (BLACK,WHITE,OFF)
tag_color = (BLACK,WHITE,OFF)
tag_selected_color = (WHITE,BLUE,ON)
tag_key_color = (BLACK,WHITE,OFF)
tag_key_selected_color = (WHITE,BLUE,ON)
check_color = tag_color
check_selected_color = tag_selected_color
EOF
2023-08-10 10:13:32 -06:00
export DIALOGRC="dialog.obosfi"
2020-04-03 12:34:09 -06:00
loadstrings
EDITOR=nano
mainmenu
2023-08-10 10:13:32 -06:00
rm dialog.obosfi
2015-07-18 18:12:26 -06:00
fi
exit 0
# --------------------------------------------------------