Project : Update edit command
This commit is contained in:
parent
a29a20983f
commit
be940d8e29
8 changed files with 26 additions and 17 deletions
|
@ -2,10 +2,18 @@
|
|||
. ./lib
|
||||
|
||||
options=()
|
||||
if [ -f /usr/bin/nano ]; then
|
||||
options+=("nano" "")
|
||||
fi
|
||||
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" "")
|
||||
|
||||
editor=$(whiptail --backtitle "$apptitle" --title "Default global editor :" --menu "" --cancel-button "Back" 0 0 0 \
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
. ./lib
|
||||
|
||||
options=()
|
||||
options+=("Edit IPv4" "nano /etc/iptables/iptables.rules")
|
||||
options+=("Edit IPv6" "nano /etc/iptables/ip6tables.rules")
|
||||
options+=("Edit IPv4" "/etc/iptables/iptables.rules")
|
||||
options+=("Edit IPv6" "/etc/iptables/ip6tables.rules")
|
||||
options+=("" "")
|
||||
options+=("Load Rules" "iptables-restore & ip6tables-restore")
|
||||
options+=("" "")
|
||||
|
@ -20,8 +20,8 @@ fi
|
|||
sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0
|
||||
|
||||
case $sel in
|
||||
'Edit IPv4') nano /etc/iptables/iptables.rules;;
|
||||
'Edit IPv6') nano /etc/iptables/ip6tables.rules;;
|
||||
'Edit IPv4') editfile /etc/iptables/iptables.rules;;
|
||||
'Edit IPv6') editfile /etc/iptables/ip6tables.rules;;
|
||||
'Load Rules') iptables-restore < /etc/iptables/iptables.rules
|
||||
ip6tables-restore < /etc/iptables/ip6tables.rules;;
|
||||
'Start At Boot') systemctl enable iptables
|
||||
|
|
|
@ -28,7 +28,7 @@ case $sel in
|
|||
'Sudoers') menu config/sudoers/menu;;
|
||||
'Systemd') menu config/systemd/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
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
fi;;
|
||||
|
|
|
@ -43,7 +43,7 @@ case $sel in
|
|||
"${sudoerlist[@]}" \
|
||||
3>&1 1>&2 2>&3)
|
||||
if [ "$?" = "0" ]; then
|
||||
nano /etc/sudoers.d/$sel
|
||||
editfile /etc/sudoers.d/$sel
|
||||
fi
|
||||
;;
|
||||
'Delete sudoer')
|
||||
|
@ -64,7 +64,7 @@ case $sel in
|
|||
fi
|
||||
;;
|
||||
'Edit /etc/sudoers')
|
||||
nano /etc/sudoers
|
||||
editfile /etc/sudoers
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -29,10 +29,10 @@ case $sel in
|
|||
echo ' Option "XkbVariant" ""' >> /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
|
||||
nano /etc/X11/xorg.conf.d/00-keyboard.conf
|
||||
editfile /etc/X11/xorg.conf.d/00-keyboard.conf
|
||||
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
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -9,6 +9,7 @@ options+=("dmidecode" "Hardware infos" on)
|
|||
options+=("dialog" "Dialog boxes for script" on)
|
||||
options+=("nmon" "System monitor" off)
|
||||
options+=("mc" "Dual pane file explorer" off)
|
||||
options+=("vim" "Vi Improved" off)
|
||||
options+=("powertop" "power mon and management" off)
|
||||
options+=("gpm" "Console mouse support" off)
|
||||
|
||||
|
|
|
@ -78,14 +78,14 @@ for itm in $sel; do
|
|||
echo "" >> /etc/snmp/snmpd.conf
|
||||
echo "# SNMP 3" >> /etc/snmp/snmpd.conf
|
||||
echo "#rouser read_only_user" >> /etc/snmp/snmpd.conf
|
||||
nano /etc/snmp/snmpd.conf
|
||||
editfile /etc/snmp/snmpd.conf
|
||||
fi
|
||||
if (confirm "Create and edit /var/net-snmp/snmpd.conf (for SNMPv3) ?") then
|
||||
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 "" >> /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
|
||||
svcenable snmpd "SNMP Server"
|
||||
;;
|
||||
|
|
|
@ -133,8 +133,8 @@ case $sel in
|
|||
;;
|
||||
'Clean orphan') pacman -Rns $(pacman -Qqtd);;
|
||||
'Clean cache') pacman -Sc;;
|
||||
'Edit pacman.conf') nano /etc/pacman.conf;;
|
||||
'Edit mirrorlist') nano /etc/pacman.d/mirrorlist;;
|
||||
'Edit pacman.conf') editfile /etc/pacman.conf;;
|
||||
'Edit mirrorlist') editfile /etc/pacman.d/mirrorlist;;
|
||||
'Update keyring') pacman -S archlinux-keyring;;
|
||||
'Refresh pacman keys') pacman-key --refresh-keys;;
|
||||
'Add GPG key')
|
||||
|
|
Loading…
Reference in a new issue