commit b89991056cdba3650e3f4782b0a938b3c38116f9 from: smytht via: GitHub date: Wed Sep 06 14:43:23 2023 UTC Update rc.local-nsh-openbsd-integrate.sh Update script to copy config files not move them so that the user can return to using OpenBSD and standard config more easily. commit - 13b060f0bd029db1742acb1f3722c05cf079f2b1 commit + b89991056cdba3650e3f4782b0a938b3c38116f9 blob - 5f4a3afe34fe026099ac207a05088c925a2f85f9 blob + dc5505cffd68a7790cb3083a23f4a1e22419e3a7 --- scripts/shell/rc.local-nsh-openbsd-integrate.sh +++ scripts/shell/rc.local-nsh-openbsd-integrate.sh @@ -1,4 +1,12 @@ #!/bin/sh - +#This script is less invasive and allows integration of nsh +#with OpenBSD, config files are copied as opposed to moved +#to import configuration. +#With current nsh setup it is possible that a user would be confused +#between default locations of daemon config files and the nsh config file +#locations. +#this script assumes a basic openBSD installation with all daemons running +#in a single rdomain. dflt='No' @@ -37,7 +45,7 @@ else pf='/etc/pf.conf' if [ -f $pf ]; then cp /etc/pf.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/pf.conf /var/run/pf.conf.0 + cp /etc/pf.conf /var/run/pf.conf.0 chown root /var/run/pf.conf.0 chgrp wheel /var/run/pf.conf.0 chmod 660 /var/run/pf.conf.0 @@ -48,7 +56,7 @@ else ipsec='/etc/ipsec.conf' if [ -f $ipsec ]; then cp /etc/ipsec.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/ipsec.conf /var/run/ipsec.conf.0 + cp /etc/ipsec.conf /var/run/ipsec.conf.0 chown root /var/run/ipsec.conf.0 chgrp wheel /var/run/ipsec.conf.0 chmod 660 /var/run/ipsec.conf.0 @@ -59,7 +67,7 @@ else bgpd='/etc/bgpd.conf' if [ -f $bgpd ]; then cp /etc/bgpd.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/bgpd.conf /var/run/bgpd.conf.0 + cp /etc/bgpd.conf /var/run/bgpd.conf.0 chown root /var/run/bgpd.conf.0 chgrp wheel /var/run/bgpd.conf.0 chmod 660 /var/run/bgpd.conf.0 @@ -70,7 +78,7 @@ else ospfd='/etc/ospfd.conf' if [ -f $ospfd ]; then cp /etc/ospfd.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/ospfd.conf /var/run/ospfd.conf.0 + cp /etc/ospfd.conf /var/run/ospfd.conf.0 chown root /var/run/ospfd.conf.0 chgrp wheel /var/run/ospfd.conf.0 chmod 660 /var/run/ospfd.conf.0 @@ -82,7 +90,7 @@ else ospf6d='/etc/ospf6d.conf' if [ -f $ospf6d ]; then cp /etc/ospf6d.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/ospf6d.conf /var/run/ospf6d.conf.0 + cp /etc/ospf6d.conf /var/run/ospf6d.conf.0 chown root /var/run/ospf6d.conf.0 chgrp wheel /var/run/ospf6d.conf.0 chmod 660 /var/run/ospf6d.conf.0 @@ -93,7 +101,7 @@ else dhcpd='/etc/dhcpd.conf' if [ -f $dhcpd ]; then cp /etc/dhcpd.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/dhcpd.conf /var/run/dhcpd.conf.0 + cp /etc/dhcpd.conf /var/run/dhcpd.conf.0 chown root /var/run/dhcpd.conf.0 chgrp wheel /var/run/dhcpd.conf.0 chmod 660 /var/run/dhcpd.conf.0 @@ -104,7 +112,7 @@ else ntpd='/etc/ntpd.conf' if [ -f $ntpd ]; then cp /etc/ntpd.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/ntpd.conf /var/run/ntpd.conf.0 + cp /etc/ntpd.conf /var/run/ntpd.conf.0 chown root /var/run/ntpd.conf.0 chgrp wheel /var/run/ntpd.conf.0 chmod 660 /var/run/ntpd.conf.0 @@ -115,7 +123,7 @@ else sshd_config='/etc/ssh/sshd_config' if [ -f $sshd_config ]; then cp /etc/ssh/sshd_config /var/nsh/backup/pre-nsh-config/ - mv /etc/ssh/sshd_config /var/run/sshd.conf.0 + cp /etc/ssh/sshd_config /var/run/sshd.conf.0 chown root /var/run/sshd.conf.0 chgrp wheel /var/run/sshd.conf.0 chmod 660 /var/run/sshd.conf.0 @@ -126,7 +134,7 @@ else eigrpd='/etc/eigrpd.conf' if [ -f $eigrpd ]; then cp /etc/eigrpd.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/eigrpd.conf /var/run/eigrpd.conf.0 + cp /etc/eigrpd.conf /var/run/eigrpd.conf.0 chown root /var/run/eigrpd.conf.0 chgrp wheel /var/run/eigrpd.conf.0 chmod 660 /var/run/eigrpd.conf.0 @@ -137,7 +145,7 @@ else relayd='/etc/relayd.conf' if [ -f $relayd ]; then cp /etc/relayd.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/relayd.conf /var/run/relayd.conf.0 + cp /etc/relayd.conf /var/run/relayd.conf.0 chown root /var/run/relayd.conf.0 chgrp wheel /var/run/relayd.conf.0 chmod 660 /var/run/relayd.conf.0 @@ -148,7 +156,7 @@ else ripd='/etc/ripd.conf' if [ -f $ripd ]; then cp /etc/ripd.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/ripd.conf /var/run/ripd.conf.0 + cp /etc/ripd.conf /var/run/ripd.conf.0 chown root /var/run/ripd.conf.0 chgrp wheel /var/run/ripd.conf.0 chmod 660 /var/run/ripd.conf.0 @@ -159,7 +167,7 @@ else ldpd='/etc/ldpd.conf' if [ -f $ldpd ]; then cp /etc/ldpd.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/ldpd.conf /var/run/ldpd.conf.0 + cp /etc/ldpd.conf /var/run/ldpd.conf.0 chown root /var/run/ldpd.conf.0 chgrp wheel /var/run/ldpd.conf.0 chmod 660 /var/run/ldpd.conf.0 @@ -170,7 +178,7 @@ else iked='/etc/iked.conf' if [ -f $iked ]; then cp /etc/iked.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/iked.conf /var/run/iked.conf.0 + cp /etc/iked.conf /var/run/iked.conf.0 chown root /var/run/iked.conf.0 chgrp wheel /var/run/iked.conf.0 chmod 660 /var/run/iked.conf.0 @@ -181,7 +189,7 @@ else snmpd='/etc/snmpd.conf' if [ -f $snmpd ]; then cp /etc/snmpd.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/snmpd.conf /var/run/snmpd.conf.0 + cp /etc/snmpd.conf /var/run/snmpd.conf.0 chown root /var/run/snmpd.conf.0 chgrp wheel /var/run/snmpd.conf.0 chmod 660 /var/run/snmpd.conf.0 @@ -192,7 +200,7 @@ else ldapd='/etc/ldapd.conf' if [ -f $ldapd ]; then cp /etc/ldapd.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/ldapd.conf /var/run/ldapd.conf.0 + cp /etc/ldapd.conf /var/run/ldapd.conf.0 chown root /var/run/ldapd.conf.0 chgrp wheel /var/run/ldapd.conf.0 chmod 660 /var/run/ldapd.conf.0 @@ -211,7 +219,7 @@ else motd='/etc/motd' if [ -f $motd ]; then cp /etc/motd /var/nsh/backup/pre-nsh-config/ - mv /etc/motd /var/run/motd.0 + cp /etc/motd /var/run/motd.0 sed -i 's/Welcome to OpenBSD/OpenBSD/g' /var/run/motd.0 ln -s /var/run/motd.0 /etc/motd chown root /var/run/motd.0 @@ -224,7 +232,7 @@ else smtpd='/etc/mail/smtpd.conf' if [ -f $smtpd ]; then cp /etc/mail/smtpd.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/mail/smtpd.conf /var/run/smtpd.conf.0 + cp /etc/mail/smtpd.conf /var/run/smtpd.conf.0 chown root /var/run/smtpd.conf.0 chgrp wheel /var/run/smtpd.conf.0 chmod 660 /var/run/smtpd.conf.0 @@ -235,7 +243,7 @@ else dvmrpd='/etc/dvmrpd.conf' if [ -f $dvmrpd ]; then cp /etc/dvmrpd.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/dvmrpd.conf /var/run/dvmrpd.conf.0 + cp /etc/dvmrpd.conf /var/run/dvmrpd.conf.0 chown root /var/run/dvmrpd.conf.0 chgrp wheel /var/run/dvmrpd.conf.0 chmod 660 /var/run/dvmrpd.conf.0 @@ -246,7 +254,7 @@ else sasync='/etc/sasync.conf' if [ -f $sasync ]; then cp /etc/sasync.conf /var/nsh/backup/pre-nsh-config/ - mv /etc/sasync.conf /var/run/sasync.conf.0 + cp /etc/sasync.conf /var/run/sasync.conf.0 chown root /var/run/sasync.conf.0 chgrp wheel /var/run/sasync.conf.0 chmod 660 /var/run/sasync.conf.0