@@ -14,6 +14,7 @@ function includeDependencies() {
14
14
15
15
current_dir=$( getCurrentDir)
16
16
includeDependencies
17
+ output_file=" output.log"
17
18
18
19
function setupSwap() {
19
20
createSwap
@@ -62,21 +63,25 @@ addUserAccount "${username}" "${password}"
62
63
63
64
read -rp $' Paste in the public SSH key for the new user:\n ' sshKey
64
65
echo ' Running setup script...'
65
- logTimestamp " output.log"
66
- disableSudoPassword " ${username} " >> output.log 2>&1
67
- addSSHKey " ${username} " " ${sshKey} " >> output.log 2>&1
68
- changeSSHConfig >> output.log 2>&1
69
- setupUfw >> output.log 2>&1
66
+ logTimestamp " ${output_file} "
67
+
68
+ disableSudoPassword " ${username} " >> " ${output_file} " 2>&1
69
+ addSSHKey " ${username} " " ${sshKey} " >> " ${output_file} " 2>&1
70
+ changeSSHConfig >> " ${output_file} " 2>&1
71
+ setupUfw >> " ${output_file} " 2>&1
70
72
71
73
if [[ $( hasSwap) == " false" ]]; then
72
- setupSwap >> output.log 2>&1
74
+ setupSwap >> " ${output_file} " 2>&1
73
75
fi
74
76
75
- setTimezone " Asia/Singapore" >> output.log 2>&1
76
- configureNTP >> output.log 2>&1
77
+ timezone=" Asia/Singapore"
78
+ setTimezone " ${timezone} " >> " ${output_file} " 2>&1
79
+ echo " Timezone is set to ${timezone} "
80
+
81
+ configureNTP >> " ${output_file} " 2>&1
77
82
78
83
sudo service ssh restart
79
84
80
85
cleanup
81
86
82
- echo ' Setup Done! Log file is located at output.log '
87
+ echo " Setup Done! Log file is located at ${output_file} "
0 commit comments