Browse Source

Merge branch 'stretch' of https://github.com/bashrc/freedombone

Bob Mottram 7 years ago
parent
commit
806fd6aa06
2 changed files with 41 additions and 1 deletions
  1. 5
    1
      src/freedombone
  2. 36
    0
      src/freedombone-utils-final

+ 5
- 1
src/freedombone View File

358
 setup_final
358
 setup_final
359
 
359
 
360
 echo ''
360
 echo ''
361
-echo "${PROJECT_NAME} installation is complete"
361
+echo $"${PROJECT_NAME} installation is complete."
362
+echo ''
363
+echo $'The default fbone user will be deleted when the system restarts.'
364
+echo $'Next time you login use the username you gave during the install.'
365
+echo ''
362
 
366
 
363
 exit 0
367
 exit 0

+ 36
- 0
src/freedombone-utils-final View File

91
     cat $COMPLETION_FILE | grep "install_" > /usr/share/${PROJECT_NAME}/installed.txt
91
     cat $COMPLETION_FILE | grep "install_" > /usr/share/${PROJECT_NAME}/installed.txt
92
 }
92
 }
93
 
93
 
94
+function create_default_user_removal_daemon {
95
+    # This daemon runs on first boot and removes the default fbone user
96
+
97
+    first_start_daemon_filename=/etc/systemd/system/firststart.service
98
+    first_start_script=/usr/local/bin/firststart
99
+    echo '#!/bin/bash' > $first_start_script
100
+    echo 'if [ -d /home/fbone]; then' >> $first_start_script
101
+    echo '    userdel -r fbone' >> $first_start_script
102
+    echo '    if [ -d /home/fbone]; then' >> $first_start_script
103
+    echo '        rm -rf /home/fbone' >> $first_start_script
104
+    echo '    fi' >> $first_start_script
105
+    echo 'fi' >> $first_start_script
106
+    echo 'systemctl disable firststart' >> $first_start_script
107
+    echo "rm $first_start_daemon_filename" >> $first_start_script
108
+    chmod +x $first_start_script
109
+
110
+    echo '[Unit]' > $first_start_daemon_filename
111
+    echo 'Description=Daemon run on first boot' >> $first_start_daemon_filename
112
+    echo 'After=syslog.target' >> $first_start_daemon_filename
113
+    echo 'After=network.target' >> $first_start_daemon_filename
114
+    echo '' >> $first_start_daemon_filename
115
+    echo '[Service]' >> $first_start_daemon_filename
116
+    echo 'User=root' >> $first_start_daemon_filename
117
+    echo 'Group=root' >> $first_start_daemon_filename
118
+    echo "ExecStart=$first_start_script" >> $first_start_daemon_filename
119
+    echo 'StandardOutput=syslog' >> $first_start_daemon_filename
120
+    echo 'StandardError=syslog' >> $first_start_daemon_filename
121
+    echo '' >> $first_start_daemon_filename
122
+    echo '[Install]' >> $first_start_daemon_filename
123
+    echo 'WantedBy=multi-user.target' >> $first_start_daemon_filename
124
+    systemctl enable firststart
125
+}
126
+
94
 function setup_final {
127
 function setup_final {
95
     function_check update_installed_apps_list
128
     function_check update_installed_apps_list
96
     update_installed_apps_list
129
     update_installed_apps_list
97
 
130
 
131
+    function_check create_default_user_removal_daemon
132
+    create_default_user_removal_daemon
133
+
98
     function_check install_tripwire
134
     function_check install_tripwire
99
     install_tripwire
135
     install_tripwire
100
 
136