Skip to content

Commit

Permalink
when adding default services also start them
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonb3 committed Aug 15, 2018
1 parent e2571f2 commit 663cdbb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
20 changes: 8 additions & 12 deletions sbin/bubba-restore-defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fi
fi

if [ ! -e /var/lib/bubba/bubba-default-config.tgz ]; then
echo "ERROR: bubba-default-config not found. Please reinstall the bubba package" >&2
echo "ERROR: bubba-default-config not found. Please reinstall the bubbagen package" >&2
exit 1
fi

Expand Down Expand Up @@ -158,24 +158,20 @@ rc-update add net.eth0 default
rc-update add net.eth1 default
cd - >/dev/null


# Services config
echo "Enable basic services"
delsrvcs="bootled iptables shorewall dhcpcd"
addsrvcs="apache2 bubba-adminphp bubba-buttond bubba-firewall dnsmasq haveged ntpd samba sshd"
cd /etc/runlevels/default
rm apache2 bootled bubba-adminphp bubba-buttond bubba-firewall dnsmasq haveged ntpd samba sshd iptables shorewall 2>/dev/null
rc-update add apache2 default
rc-update add bubba-adminphp default
rc-update add bubba-buttond default
rc-update add bubba-firewall default
rc-update add dnsmasq default
rc-update add haveged default
rc-update add ntpd default
rc-update add samba default
rc-update add sshd default
rm ${delsrvcs} ${addsrvcs} 2>/dev/null
cd - >/dev/null

for srvc in ${addsrvcs}; do
rc-update add ${srvc} default &>/dev/null && rc-service -iN ${srvc} start
done


echo ""
echo 'All done! Please reboot to activate the new settings.'
echo "Then visit http://$(hostname)/admin to get started with Bubbagen."

11 changes: 5 additions & 6 deletions systemd/sbin/bubba-restore-defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fi
fi

if [ ! -e /var/lib/bubba/bubba-default-config.tgz ]; then
echo "ERROR: bubba-default-config not found. Please reinstall the bubba package" >&2
echo "ERROR: bubba-default-config not found. Please reinstall the bubbagen package" >&2
exit 1
fi

Expand Down Expand Up @@ -163,19 +163,18 @@ fi

# Services config
echo "Enable basic services"
delsrvcs="bootled iptables shorewall dhcpcd"
addsrvcs="apache2 bubba-adminphp bubba-buttond bubba-firewall dnsmasq haveged ntpd samba sshd NetworkManager NetworkManager-dispatcher"
delsrvcs="bootled iptables shorewall dhcpcd samba"
addsrvcs="apache2 bubba-adminphp bubba-buttond bubba-firewall dnsmasq haveged ntpd smbd sshd NetworkManager NetworkManager-dispatcher"

for srvc in ${delsrvcs}; do
systemctl is-enabled ${srvc} &>/dev/null && systemctl disable ${srvc}
systemctl is-enabled ${srvc} &>/dev/null && systemctl disable ${srvc} && systemctl stop ${srvc}
done

for srvc in ${addsrvcs}; do
systemctl is-enabled ${srvc} &>/dev/null || systemctl enable ${srvc}
systemctl is-enabled ${srvc} &>/dev/null || systemctl enable ${srvc} && systemctl start ${srvc}
done


echo ""
echo 'All done! Please reboot to activate the new settings.'
echo "Then visit http://$(hostname)/admin to get started with Bubbagen."

0 comments on commit 663cdbb

Please sign in to comment.