obosdi-pkg/install/system/services/menu
2015-08-20 22:37:06 +02:00

87 lines
2.6 KiB
Bash

#!/bin/bash
. ./lib
options=()
options+=("networkmanager" "Network Management" on)
options+=("openssh" "Server SSH" on)
options+=("cronie" "Cron tasks server" on)
options+=("ntp" "Client NTP for clock sync" on)
options+=("numlockon" "numlock on on tty" on)
options+=("net-snmp" "SNMP Server" off)
options+=("syslog-ng" "" off)
#options+=("rsyslog" "" off)
#options+=("systemd-readahead" "(AUR) boot improvement" off)
sel=$(whiptail --backtitle "$apptitle" --title "Services Install" --checklist "" --cancel-button "Back" 0 0 0 \
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
exit 1
fi
for itm in $sel; do
case $itm in
'"numlockon"') ;;
'"systemd-readahead"') aurpkg="$aurpkg $(echo $itm | sed 's/"//g')";;
*) pkg="$pkg $(echo $itm | sed 's/"//g')";;
esac
done
instpkg "$pkg" "$aurpkg"
for itm in $sel; do
case $itm in
'"networkmanager"')
systemctl disable dhcpcd
if (svcenable NetworkManager) then
svcdisable dhcpd
fi
;;
'"openssh"')
svcenable sshd "SSH Server"
;;
'"cronie"')
svcenable cronie
;;
'"ntp"')
svcenable ntpd "NTP Server"
;;
'"numlockon"') script install/system/services/numlockon;;
'"syslog-ng"')
#echo "ForwardToSyslog=yes" >> /etc/systemd/journald.conf
systemctl enable syslog-ng
;;
'"rsyslog"')
systemctl enable rsyslog
;;
'"net-snmp"')
if (confirm "Create and edit /etc/snmp/snmpd.conf ?") then
mkdir /etc/snmp > /dev/null
echo "# SNMP Server Config" > /etc/snmp/snmpd.conf
echo "# ------------------" >> /etc/snmp/snmpd.conf
echo "" >> /etc/snmp/snmpd.conf
echo "# SNMP 1 and 2" >> /etc/snmp/snmpd.conf
echo "#rocommunity read_only_user" >> /etc/snmp/snmpd.conf
echo "#rwcommunity read_write_user" >> /etc/snmp/snmpd.conf
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
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
fi
svcenable snmpd "SNMP Server"
;;
'"systemd-readahead"')
svcenable systemd-readahead
;;
esac
done
exit 0