2016-07-03 17:13:34 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# .---. . .
|
|
|
|
# | | |
|
|
|
|
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
|
|
|
|
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
|
|
|
|
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
|
|
|
|
#
|
|
|
|
# Freedom in the Cloud
|
|
|
|
#
|
|
|
|
# Final stage of install
|
|
|
|
#
|
|
|
|
# License
|
|
|
|
# =======
|
|
|
|
#
|
2016-10-31 17:24:49 +01:00
|
|
|
# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
|
2016-07-03 17:13:34 +02:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
function install_final {
|
2016-10-16 20:50:56 +02:00
|
|
|
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
|
2016-09-30 18:30:32 +02:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
# unmount any attached usb drive
|
|
|
|
if [ -d $USB_MOUNT ]; then
|
|
|
|
umount $USB_MOUNT
|
|
|
|
rm -rf $USB_MOUNT
|
|
|
|
fi
|
|
|
|
function_check split_gpg_key_into_fragments
|
|
|
|
split_gpg_key_into_fragments
|
2016-11-29 21:49:11 +01:00
|
|
|
set_command_file_permissions
|
2016-11-18 15:43:19 +01:00
|
|
|
|
2016-10-16 20:50:56 +02:00
|
|
|
mark_completed $FUNCNAME
|
2016-09-30 18:30:32 +02:00
|
|
|
clear
|
|
|
|
echo ''
|
2016-07-03 17:13:34 +02:00
|
|
|
|
2016-09-30 18:30:32 +02:00
|
|
|
echo $"
|
2016-11-23 01:00:06 +01:00
|
|
|
*** ${PROJECT_NAME} installation is complete ***
|
2016-07-03 17:13:34 +02:00
|
|
|
|
2016-11-23 01:00:06 +01:00
|
|
|
If you wish to verify the server ssh public key at next login it is:
|
|
|
|
$(get_ssh_server_key)
|
2016-11-23 00:01:47 +01:00
|
|
|
|
2016-11-23 01:00:06 +01:00
|
|
|
Ensure that ports are forwarded from your internet router
|
2016-07-03 17:13:34 +02:00
|
|
|
"
|
2016-09-30 18:30:32 +02:00
|
|
|
echo ''
|
2016-07-03 17:13:34 +02:00
|
|
|
|
2016-09-30 18:30:32 +02:00
|
|
|
if [ -f "/home/$MY_USERNAME/README" ]; then
|
|
|
|
echo $"See /home/$MY_USERNAME/README for post-installation instructions."
|
|
|
|
echo ''
|
|
|
|
fi
|
|
|
|
# add user menu on ssh login
|
|
|
|
if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then
|
|
|
|
echo 'control' >> /home/$MY_USERNAME/.bashrc
|
|
|
|
fi
|
|
|
|
if [ ! -f $IMAGE_PASSWORD_FILE ]; then
|
2016-10-21 23:57:30 +02:00
|
|
|
if [ -f /root/${PROJECT_NAME}-wifi.cfg ]; then
|
2016-10-22 16:43:15 +02:00
|
|
|
create_wifi_startup_script
|
2016-10-22 20:10:12 +02:00
|
|
|
echo ''
|
2016-10-22 20:11:24 +02:00
|
|
|
echo $'Shutting down the system. Detatch the ethernet cable, attach wifi dongle, then power on again.'
|
2016-10-22 20:10:12 +02:00
|
|
|
echo ''
|
2016-11-23 00:03:55 +01:00
|
|
|
${PROJECT_NAME}-logging off
|
2016-10-22 16:43:15 +02:00
|
|
|
shutdown now
|
|
|
|
return
|
2016-10-21 23:57:30 +02:00
|
|
|
fi
|
2016-11-23 00:03:55 +01:00
|
|
|
${PROJECT_NAME}-logging off
|
2016-09-30 18:30:32 +02:00
|
|
|
reboot
|
|
|
|
fi
|
2016-11-23 00:03:55 +01:00
|
|
|
${PROJECT_NAME}-logging off
|
2016-09-30 18:30:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function update_installed_apps_list {
|
2016-09-30 18:49:24 +02:00
|
|
|
# Why does this secondary file exist, apart from COMPLETION_FILE ?
|
|
|
|
# It's so that it is visible to unprivileged users from the user control panel
|
2016-09-30 18:30:32 +02:00
|
|
|
cat $COMPLETION_FILE | grep "install_" > /usr/share/${PROJECT_NAME}/installed.txt
|
2016-07-03 17:13:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function setup_final {
|
2016-09-30 18:30:32 +02:00
|
|
|
function_check update_installed_apps_list
|
|
|
|
update_installed_apps_list
|
|
|
|
|
|
|
|
function_check install_tripwire
|
|
|
|
install_tripwire
|
2016-07-03 17:13:34 +02:00
|
|
|
|
2016-09-30 18:30:32 +02:00
|
|
|
function_check install_final
|
|
|
|
install_final
|
2016-10-23 20:38:14 +02:00
|
|
|
|
|
|
|
export DEBIAN_FRONTEND=
|
2016-07-03 17:13:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# NOTE: deliberately no exit 0
|