2015-05-29 22:54:50 +08:00
config( ) {
NEW = " $1 "
OLD = " $( dirname $NEW ) / $( basename $NEW .new) "
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ] ; then
mv $NEW $OLD
elif [ " $( cat $OLD | md5sum) " = " $( cat $NEW | md5sum) " ] ; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
preserve_perms( ) {
NEW = " $1 "
OLD = " $( dirname $NEW ) / $( basename $NEW .new) "
if [ -e $OLD ] ; then
cp -a $OLD ${ NEW } .incoming
cat $NEW > ${ NEW } .incoming
mv ${ NEW } .incoming $NEW
fi
config $NEW
}
2017-02-12 20:55:56 +08:00
openrc_accessibility = ( espeakup)
2015-06-12 02:46:07 +08:00
openrc_base = ( device-mapper dmcrypt lvm mdadm mdraid udev udev-settle udev-trigger)
2018-09-09 14:18:54 +08:00
openrc_desktop = ( acpid alsasound xdm gpm wpa_supplicant)
2018-11-07 16:57:16 +08:00
openrc_devel = ( git-daemon influxdb mysqld postgresql svn distccd jenkins redis)
openrc_misc = ( bitlbee cpupower connman ntpd ntp-client sntp rsyslog saned metalog pulseaudio syslog-ng sensord fancontrol lm_sensors lircd irexec haveged salt-master salt-minion salt-syncdic hdparm clamd boinc atd libvirtd docker)
openrc_net = ( named dhcpd dhcrelay dhcrelay6 hostapd dnsmasq iptables ip6tables rpcbind nfs nfsclient nginx openntpd slapd sshd openvpn quota rsyncd samba saslauthd squid transmission-daemon ufw vnstatd xinetd tor NetworkManager httpd syncthing)
openrc_slack = ( dcron sendmail snmpd snmptrapd sysklogd fail2ban)
openrc_video = ( vgl bumblebee nvidia-persistenced)
2015-05-29 22:54:50 +08:00
2017-02-12 20:55:56 +08:00
for file in " ${ openrc_accessibility [@] } " " ${ openrc_base [@] } " " ${ openrc_desktop [@] } " " ${ openrc_devel [@] } " " ${ openrc_misc [@] } " " ${ openrc_net [@] } " " ${ openrc_slack [@] } " " ${ openrc_video [@] } " ; do
2018-11-07 16:57:16 +08:00
config " etc/openrc/conf.d/ ${ file } .new "
2015-05-29 22:54:50 +08:00
done
2018-12-03 02:27:08 +08:00
BACKUP_LOCAL = ( rcM.start)
2017-02-20 03:13:10 +08:00
for file in " ${ BACKUP_LOCAL [@] } " ; do
2018-11-07 16:57:16 +08:00
preserve_perms " etc/openrc/local.d/ ${ file } .new "
2017-02-20 03:13:10 +08:00
done
2015-06-12 02:46:07 +08:00
# disable udev-postmount
2018-11-07 16:57:16 +08:00
[ -e "etc/openrc/runlevels/sysinit/udev-postmount" ] && rm -v "etc/openrc/runlevels/sysinit/udev-postmount"
2017-05-18 01:14:51 +08:00
# disable kmod-static-nodes (openrc-0.26.1, 2017-05-14)
2018-11-07 16:57:16 +08:00
[ -e "etc/openrc/runlevels/sysinit/kmod-static-nodes" ] && rm -v "etc/openrc/runlevels/sysinit/kmod-static-nodes"