Add editor choice feature

This commit is contained in:
MatMoul 2015-11-01 18:21:57 +01:00
parent 36f1230d51
commit 6487a54850

31
archfi
View file

@ -26,6 +26,7 @@ mainmenu(){
options=() options=()
options+=("$txtlanguage" "") options+=("$txtlanguage" "")
options+=("$txtsetkeymap" "(loadkeys ...)") options+=("$txtsetkeymap" "(loadkeys ...)")
options+=("$txteditor" "")
options+=("$txtdiskpartmenu" "") options+=("$txtdiskpartmenu" "")
options+=("$txtselectpartsmenu" "") options+=("$txtselectpartsmenu" "")
options+=("" "") options+=("" "")
@ -110,6 +111,23 @@ setkeymap(){
fi fi
} }
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
clear
echo "export EDITOR=$sel"
export EDITOR=$sel
pressanykey
fi
}
rebootpc(){ rebootpc(){
if (whiptail --backtitle "$apptitle" --title "$txtreboot" --yesno "$txtreboot ?" --defaultno 0 0) then if (whiptail --backtitle "$apptitle" --title "$txtreboot" --yesno "$txtreboot ?" --defaultno 0 0) then
clear clear
@ -644,7 +662,7 @@ installmenu(){
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then
case $sel in case $sel in
"$txteditmirrorlist") "$txteditmirrorlist")
nano /etc/pacman.d/mirrorlist $EDITOR /etc/pacman.d/mirrorlist
nextitem="$txtinstallarchlinux" nextitem="$txtinstallarchlinux"
;; ;;
"$txtinstallarchlinux") "$txtinstallarchlinux")
@ -762,11 +780,11 @@ archmenu(){
nextitem="${txtinstall//%1/grub}" nextitem="${txtinstall//%1/grub}"
;; ;;
"${txtedit//%1/fstab}") "${txtedit//%1/fstab}")
nano /mnt/etc/fstab $EDITOR /mnt/etc/fstab
nextitem="${txtedit//%1/fstab}" nextitem="${txtedit//%1/fstab}"
;; ;;
"${txtedit//%1/cryptotab}") "${txtedit//%1/cryptotab}")
nano /mnt/etc/cryptotab $EDITOR /mnt/etc/cryptotab
nextitem="${txtedit//%1/cryptotab}" nextitem="${txtedit//%1/cryptotab}"
;; ;;
"${txtedit//%1/mkinitcpio.conf}") "${txtedit//%1/mkinitcpio.conf}")
@ -774,7 +792,7 @@ archmenu(){
nextitem="${txtedit//%1/mkinitcpio.conf}" nextitem="${txtedit//%1/mkinitcpio.conf}"
;; ;;
"${txtedit//%1/mirrorlist}") "${txtedit//%1/mirrorlist}")
nano /mnt/etc/pacman.d/mirrorlist $EDITOR /mnt/etc/pacman.d/mirrorlist
nextitem="${txtedit//%1/mirrorlist}" nextitem="${txtedit//%1/mirrorlist}"
;; ;;
"${txtinstall//%1/grub}") "${txtinstall//%1/grub}")
@ -782,7 +800,7 @@ archmenu(){
nextitem="${txtinstall//%1/bootloader}" nextitem="${txtinstall//%1/bootloader}"
;; ;;
"${txtedit//%1/grub}") "${txtedit//%1/grub}")
nano /mnt/etc/default/grub $EDITOR /mnt/etc/default/grub
if (whiptail --backtitle "$apptitle" --title "${txtedit//%1/grub}" --yesno "$txtrungrubmakeconfig" 0 0) then if (whiptail --backtitle "$apptitle" --title "${txtedit//%1/grub}" --yesno "$txtrungrubmakeconfig" 0 0) then
clear clear
archchroot installgrub archchroot installgrub
@ -966,7 +984,7 @@ archgenmkinitcpio(){
} }
archeditmkinitcpio(){ archeditmkinitcpio(){
nano /mnt/etc/mkinitcpio.conf $EDITOR /mnt/etc/mkinitcpio.conf
if (whiptail --backtitle "$apptitle" --title "${txtedit//%1/mkinitcpio.conf}" --yesno "${txtgenerate//%1/mkinitcpio} ?" 0 0) then if (whiptail --backtitle "$apptitle" --title "${txtedit//%1/mkinitcpio.conf}" --yesno "${txtgenerate//%1/mkinitcpio} ?" 0 0) then
clear clear
archchroot genmkinitcpio archchroot genmkinitcpio
@ -1185,6 +1203,7 @@ loadstrings(){
txtmainmenu="Main Menu" txtmainmenu="Main Menu"
txtlanguage="Language" txtlanguage="Language"
txtsetkeymap="Set Keyboard Layout" txtsetkeymap="Set Keyboard Layout"
txteditor="Editor"
txtdiskpartmenu="Disk Partitions" txtdiskpartmenu="Disk Partitions"
txtselectpartsmenu="Select Partitions and Install" txtselectpartsmenu="Select Partitions and Install"
txthelp="Help" txthelp="Help"