Merge pull request #80 from mipimipi/src

added disk size to disk selection menues (issue #77)
This commit is contained in:
MatMoul 2019-11-01 22:27:22 +01:00 committed by GitHub
commit a4b8a596d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

82
archfi
View file

@ -163,6 +163,25 @@ rebootpc(){
# -------------------------------------------------------- # --------------------------------------------------------
selectdisk(){
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
result=$(whiptail --backtitle "${APPTITLE}" --title "${1}" --menu "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3)
if [ "$?" != "0" ]
then
return 1
fi
echo ${result%%\ *}
return 0
}
diskpartmenu(){ diskpartmenu(){
if [ "${1}" = "" ]; then if [ "${1}" = "" ]; then
nextitem="." nextitem="."
@ -217,14 +236,7 @@ diskpartmenu(){
diskpartautodos(){ diskpartautodos(){
items=$(lsblk -d -p -n -l -o NAME -e 7,11) device=$(selectdisk "${txtautoparts} (dos)")
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 [ "$?" = "0" ]; then
if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (dos)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0) then if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (dos)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0) then
clear clear
@ -259,14 +271,7 @@ diskpartautodos(){
} }
diskpartautogpt(){ diskpartautogpt(){
items=$(lsblk -d -p -n -l -o NAME -e 7,11) device=$(selectdisk "${txtautoparts} (gpt)")
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 [ "$?" = "0" ]; then
if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (gpt)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0) then if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (gpt)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0) then
clear clear
@ -299,14 +304,7 @@ diskpartautogpt(){
} }
diskpartautoefi(){ diskpartautoefi(){
items=$(lsblk -d -p -n -l -o NAME -e 7,11) device=$(selectdisk "${txtautoparts} (gpt,efi)")
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 [ "$?" = "0" ]; then
if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (gpt,efi)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0) then if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (gpt,efi)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0) then
clear clear
@ -337,14 +335,7 @@ diskpartautoefi(){
} }
diskpartautoefiusb(){ diskpartautoefiusb(){
items=$(lsblk -d -p -n -l -o NAME -e 7,11) device=$(selectdisk "${txtautoparts} (gpt,efi)")
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 [ "$?" = "0" ]; then
if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (gpt,efi)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0) then if (whiptail --backtitle "${apptitle}" --title "${txtautoparts} (gpt,efi)" --yesno "${txtautopartsconfirm//%1/${device}}" --defaultno 0 0) then
clear clear
@ -375,14 +366,7 @@ diskpartautoefiusb(){
} }
diskpartcfdisk(){ diskpartcfdisk(){
items=$(lsblk -d -p -n -l -o NAME -e 7,11) device=$( selectdisk "${txteditparts} (cfdisk)" )
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 if [ "$?" = "0" ]; then
clear clear
cfdisk ${device} cfdisk ${device}
@ -390,14 +374,7 @@ diskpartcfdisk(){
} }
diskpartcgdisk(){ diskpartcgdisk(){
items=$(lsblk -d -p -n -l -o NAME -e 7,11) device=$( selectdisk "${txteditparts} (cgdisk)" )
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 if [ "$?" = "0" ]; then
clear clear
cgdisk ${device} cgdisk ${device}
@ -1270,14 +1247,7 @@ archgrubinstallchroot(){
} }
archgrubinstallbootloader(){ archgrubinstallbootloader(){
items=$(lsblk -d -p -n -l -o NAME -e 7,11) device=$( selectdisk "${txtinstall//%1/bootloader}" )
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 if [ "$?" = "0" ]; then
if [ "${eficomputer}" == "1" ]; then if [ "${eficomputer}" == "1" ]; then
options=() options=()