Project : Update edit command

This commit is contained in:
MatMoul 2018-09-16 03:36:14 +02:00
parent a29a20983f
commit be940d8e29
8 changed files with 26 additions and 17 deletions

View file

@ -2,10 +2,18 @@
. ./lib . ./lib
options=() options=()
options+=("nano" "") if [ -f /usr/bin/nano ]; then
options+=("vim" "") options+=("nano" "")
options+=("vi" "") fi
options+=("edit" "") if [ -f /usr/bin/vim ]; then
options+=("vim" "")
fi
if [ -f /usr/bin/vi ]; then
options+=("vi" "")
fi
if [ -f /usr/bin/edit ]; then
options+=("edit" "")
fi
options+=("unset" "") options+=("unset" "")
editor=$(whiptail --backtitle "$apptitle" --title "Default global editor :" --menu "" --cancel-button "Back" 0 0 0 \ editor=$(whiptail --backtitle "$apptitle" --title "Default global editor :" --menu "" --cancel-button "Back" 0 0 0 \

View file

@ -2,8 +2,8 @@
. ./lib . ./lib
options=() options=()
options+=("Edit IPv4" "nano /etc/iptables/iptables.rules") options+=("Edit IPv4" "/etc/iptables/iptables.rules")
options+=("Edit IPv6" "nano /etc/iptables/ip6tables.rules") options+=("Edit IPv6" "/etc/iptables/ip6tables.rules")
options+=("" "") options+=("" "")
options+=("Load Rules" "iptables-restore & ip6tables-restore") options+=("Load Rules" "iptables-restore & ip6tables-restore")
options+=("" "") options+=("" "")
@ -20,8 +20,8 @@ fi
sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0 sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0
case $sel in case $sel in
'Edit IPv4') nano /etc/iptables/iptables.rules;; 'Edit IPv4') editfile /etc/iptables/iptables.rules;;
'Edit IPv6') nano /etc/iptables/ip6tables.rules;; 'Edit IPv6') editfile /etc/iptables/ip6tables.rules;;
'Load Rules') iptables-restore < /etc/iptables/iptables.rules 'Load Rules') iptables-restore < /etc/iptables/iptables.rules
ip6tables-restore < /etc/iptables/ip6tables.rules;; ip6tables-restore < /etc/iptables/ip6tables.rules;;
'Start At Boot') systemctl enable iptables 'Start At Boot') systemctl enable iptables

View file

@ -28,7 +28,7 @@ case $sel in
'Sudoers') menu config/sudoers/menu;; 'Sudoers') menu config/sudoers/menu;;
'Systemd') menu config/systemd/menu;; 'Systemd') menu config/systemd/menu;;
'XOrg') menu config/xorg/menu;; 'XOrg') menu config/xorg/menu;;
'Grub') nano /etc/default/grub 'Grub') editfile /etc/default/grub
if(confirm "Run grub-mkconfig -o /boot/grub/grub.cfg ?") then if(confirm "Run grub-mkconfig -o /boot/grub/grub.cfg ?") then
grub-mkconfig -o /boot/grub/grub.cfg grub-mkconfig -o /boot/grub/grub.cfg
fi;; fi;;

View file

@ -43,7 +43,7 @@ case $sel in
"${sudoerlist[@]}" \ "${sudoerlist[@]}" \
3>&1 1>&2 2>&3) 3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then
nano /etc/sudoers.d/$sel editfile /etc/sudoers.d/$sel
fi fi
;; ;;
'Delete sudoer') 'Delete sudoer')
@ -64,7 +64,7 @@ case $sel in
fi fi
;; ;;
'Edit /etc/sudoers') 'Edit /etc/sudoers')
nano /etc/sudoers editfile /etc/sudoers
;; ;;
esac esac

View file

@ -29,10 +29,10 @@ case $sel in
echo ' Option "XkbVariant" ""' >> /etc/X11/xorg.conf.d/00-keyboard.conf echo ' Option "XkbVariant" ""' >> /etc/X11/xorg.conf.d/00-keyboard.conf
echo ' Option "XkbOptions" ""' >> /etc/X11/xorg.conf.d/00-keyboard.conf echo ' Option "XkbOptions" ""' >> /etc/X11/xorg.conf.d/00-keyboard.conf
echo 'EndSection' >> /etc/X11/xorg.conf.d/00-keyboard.conf echo 'EndSection' >> /etc/X11/xorg.conf.d/00-keyboard.conf
nano /etc/X11/xorg.conf.d/00-keyboard.conf editfile /etc/X11/xorg.conf.d/00-keyboard.conf
fi fi
;; ;;
"Edit /etc/X11/xorg.conf.d/00-keyboard.conf") nano /etc/X11/xorg.conf.d/00-keyboard.conf;; "Edit /etc/X11/xorg.conf.d/00-keyboard.conf") editfile /etc/X11/xorg.conf.d/00-keyboard.conf;;
esac esac
exit 0 exit 0

View file

@ -9,6 +9,7 @@ options+=("dmidecode" "Hardware infos" on)
options+=("dialog" "Dialog boxes for script" on) options+=("dialog" "Dialog boxes for script" on)
options+=("nmon" "System monitor" off) options+=("nmon" "System monitor" off)
options+=("mc" "Dual pane file explorer" off) options+=("mc" "Dual pane file explorer" off)
options+=("vim" "Vi Improved" off)
options+=("powertop" "power mon and management" off) options+=("powertop" "power mon and management" off)
options+=("gpm" "Console mouse support" off) options+=("gpm" "Console mouse support" off)

View file

@ -78,14 +78,14 @@ for itm in $sel; do
echo "" >> /etc/snmp/snmpd.conf echo "" >> /etc/snmp/snmpd.conf
echo "# SNMP 3" >> /etc/snmp/snmpd.conf echo "# SNMP 3" >> /etc/snmp/snmpd.conf
echo "#rouser read_only_user" >> /etc/snmp/snmpd.conf echo "#rouser read_only_user" >> /etc/snmp/snmpd.conf
nano /etc/snmp/snmpd.conf editfile /etc/snmp/snmpd.conf
fi fi
if (confirm "Create and edit /var/net-snmp/snmpd.conf (for SNMPv3) ?") then if (confirm "Create and edit /var/net-snmp/snmpd.conf (for SNMPv3) ?") then
mkdir -p /var/net-snmp/ > /dev/null mkdir -p /var/net-snmp/ > /dev/null
echo "# Note : Clear text password will be encrypted when you restart snmpd." > /var/net-snmp/snmpd.conf echo "# Note : Clear text password will be encrypted when you restart snmpd." > /var/net-snmp/snmpd.conf
echo "" >> /var/net-snmp/snmpd.conf echo "" >> /var/net-snmp/snmpd.conf
echo "#createUser read_only_user SHA password1 AES password2" >> /var/net-snmp/snmpd.conf echo "#createUser read_only_user SHA password1 AES password2" >> /var/net-snmp/snmpd.conf
nano /var/net-snmp/snmpd.conf editfile /var/net-snmp/snmpd.conf
fi fi
svcenable snmpd "SNMP Server" svcenable snmpd "SNMP Server"
;; ;;

View file

@ -133,8 +133,8 @@ case $sel in
;; ;;
'Clean orphan') pacman -Rns $(pacman -Qqtd);; 'Clean orphan') pacman -Rns $(pacman -Qqtd);;
'Clean cache') pacman -Sc;; 'Clean cache') pacman -Sc;;
'Edit pacman.conf') nano /etc/pacman.conf;; 'Edit pacman.conf') editfile /etc/pacman.conf;;
'Edit mirrorlist') nano /etc/pacman.d/mirrorlist;; 'Edit mirrorlist') editfile /etc/pacman.d/mirrorlist;;
'Update keyring') pacman -S archlinux-keyring;; 'Update keyring') pacman -S archlinux-keyring;;
'Refresh pacman keys') pacman-key --refresh-keys;; 'Refresh pacman keys') pacman-key --refresh-keys;;
'Add GPG key') 'Add GPG key')