Config : Add Systemd timedatectl
This commit is contained in:
parent
b0f495a6d8
commit
11e5acc160
4 changed files with 74 additions and 0 deletions
|
@ -6,6 +6,7 @@ options+=("Bash" "")
|
|||
options+=("Firewall" "")
|
||||
options+=("Users" "")
|
||||
options+=("Sudoers" "")
|
||||
options+=("Systemd" "")
|
||||
if [ -f /usr/bin/Xorg ]; then
|
||||
options+=("XOrg" "")
|
||||
fi
|
||||
|
@ -25,6 +26,7 @@ case $sel in
|
|||
'Firewall') menu config/firewall/menu;;
|
||||
'Users') menu config/users/menu;;
|
||||
'Sudoers') menu config/sudoers/menu;;
|
||||
'Systemd') menu config/systemd/menu;;
|
||||
'XOrg') menu config/xorg/menu;;
|
||||
'Grub') nano /etc/default/grub
|
||||
if(confirm "Run grub-mkconfig -o /boot/grub/grub.cfg ?") then
|
||||
|
|
20
config/systemd/menu
Normal file
20
config/systemd/menu
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
. ./lib
|
||||
|
||||
options=()
|
||||
options+=("timedatectl" "")
|
||||
|
||||
defaultitem="timedatectl"
|
||||
sel=$(whiptail --backtitle "$apptitle" --title "Systemd Menu :" --menu "" --default-item "$defaultitem" --cancel-button "Back" 0 0 0 \
|
||||
"${options[@]}" \
|
||||
3>&1 1>&2 2>&3)
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 1
|
||||
fi
|
||||
sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0
|
||||
|
||||
case $sel in
|
||||
'timedatectl') menu config/systemd/timedatectl/menu;;
|
||||
esac
|
||||
|
||||
exit 0
|
41
config/systemd/timedatectl/menu
Normal file
41
config/systemd/timedatectl/menu
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
. ./lib
|
||||
|
||||
options=()
|
||||
timedatectl status | grep inactive> /dev/null
|
||||
if [ "$?" = "0" ]; then
|
||||
options+=("Enable" "timedatectl set-ntp true")
|
||||
else
|
||||
options+=("Disable" "timedatectl set-ntp false")
|
||||
fi
|
||||
options+=("Edit" "/etc/systemd/timesyncd.conf")
|
||||
|
||||
defaultitem="timedatectl"
|
||||
sel=$(whiptail --backtitle "$apptitle" --title "Systemd timedatectl Menu :" --menu "" --default-item "$defaultitem" --cancel-button "Back" 0 0 0 \
|
||||
"${options[@]}" \
|
||||
3>&1 1>&2 2>&3)
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 1
|
||||
fi
|
||||
sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0
|
||||
|
||||
case $sel in
|
||||
'Enable')
|
||||
clear
|
||||
echo "timedatectl set-ntp true"
|
||||
timedatectl set-ntp true
|
||||
pressanykey
|
||||
;;
|
||||
'Disable')
|
||||
clear
|
||||
echo "timedatectl set-ntp false"
|
||||
timedatectl set-ntp false
|
||||
pressanykey
|
||||
;;
|
||||
'Edit')
|
||||
clear
|
||||
editfile /etc/systemd/timesyncd.conf
|
||||
pressanykey
|
||||
esac
|
||||
|
||||
exit 0
|
11
lib
11
lib
|
@ -174,6 +174,17 @@ pressanykey(){
|
|||
}
|
||||
|
||||
|
||||
# $1 : filename
|
||||
editfile(){
|
||||
editor=$EDITOR
|
||||
if [ "$editor" == "" ]; then
|
||||
editor="nano"
|
||||
fi
|
||||
echo "$editor $1"
|
||||
$editor "$1"
|
||||
}
|
||||
|
||||
|
||||
# $1 : servicename
|
||||
# $2 : [displayname]
|
||||
svcstart(){
|
||||
|
|
Loading…
Reference in a new issue