This commit is contained in:
Bob Mottram 2017-12-26 21:12:05 +00:00
commit 4bc71311c2
1 changed files with 36 additions and 0 deletions

View File

@ -91,10 +91,46 @@ function update_installed_apps_list {
cat $COMPLETION_FILE | grep "install_" > /usr/share/${PROJECT_NAME}/installed.txt
}
function create_default_user_removal_daemon {
# This daemon runs on first boot and removes the default fbone user
first_start_daemon_filename=/etc/systemd/system/firststart.service
first_start_script=/usr/local/bin/firststart
echo '#!/bin/bash' > $first_start_script
echo 'if [ -d /home/fbone]; then' >> $first_start_script
echo ' userdel -r fbone' >> $first_start_script
echo ' if [ -d /home/fbone]; then' >> $first_start_script
echo ' rm -rf /home/fbone' >> $first_start_script
echo ' fi' >> $first_start_script
echo 'fi' >> $first_start_script
echo 'systemctl disable firststart' >> $first_start_script
echo "rm $first_start_daemon_filename" >> $first_start_script
chmod +x $first_start_script
echo '[Unit]' > $first_start_daemon_filename
echo 'Description=Daemon run on first boot' >> $first_start_daemon_filename
echo 'After=syslog.target' >> $first_start_daemon_filename
echo 'After=network.target' >> $first_start_daemon_filename
echo '' >> $first_start_daemon_filename
echo '[Service]' >> $first_start_daemon_filename
echo 'User=root' >> $first_start_daemon_filename
echo 'Group=root' >> $first_start_daemon_filename
echo "ExecStart=$first_start_script" >> $first_start_daemon_filename
echo 'StandardOutput=syslog' >> $first_start_daemon_filename
echo 'StandardError=syslog' >> $first_start_daemon_filename
echo '' >> $first_start_daemon_filename
echo '[Install]' >> $first_start_daemon_filename
echo 'WantedBy=multi-user.target' >> $first_start_daemon_filename
systemctl enable firststart
}
function setup_final {
function_check update_installed_apps_list
update_installed_apps_list
function_check create_default_user_removal_daemon
create_default_user_removal_daemon
function_check install_tripwire
install_tripwire