User accessible apps list

This commit is contained in:
Bob Mottram 2016-09-30 17:30:32 +01:00
parent ce4afbf5a1
commit 615aaf9b1f
2 changed files with 54 additions and 36 deletions

View File

@ -31,50 +31,57 @@
OPEN_PORTS=()
function install_final {
if grep -Fxq "install_final" $COMPLETION_FILE; then
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
echo 'install_final' >> $COMPLETION_FILE
clear
echo ''
if grep -Fxq "install_final" $COMPLETION_FILE; then
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
echo 'install_final' >> $COMPLETION_FILE
clear
echo ''
echo $"
*** ${PROJECT_NAME} installation is complete. Rebooting... ***
echo $"
*** ${PROJECT_NAME} installation is complete. Rebooting... ***
Now forward these ports from your internet router
Now forward these ports from your internet router
"
for p in "${OPEN_PORTS[@]}"
do
echo " $p"
done
echo ''
for p in "${OPEN_PORTS[@]}"
do
echo " $p"
done
echo ''
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
reboot
fi
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
reboot
fi
}
function update_installed_apps_list {
cat $COMPLETION_FILE | grep "install_" > /usr/share/${PROJECT_NAME}/installed.txt
}
function setup_final {
function_check install_tripwire
install_tripwire
function_check update_installed_apps_list
update_installed_apps_list
function_check install_final
install_final
function_check install_tripwire
install_tripwire
function_check install_final
install_final
}
# NOTE: deliberately no exit 0

View File

@ -64,6 +64,15 @@ function app_is_installed {
return
fi
if [ -f /usr/share/${PROJECT_NAME}/installed.txt ]; then
if ! grep -Fxq "install_${app_name}" /usr/share/${PROJECT_NAME}/installed.txt; then
echo "0"
else
echo "1"
fi
return
fi
if ! grep -Fxq "install_${app_name}" $COMPLETION_FILE; then
echo "0"
else
@ -206,6 +215,7 @@ function remove_apps {
fi
app_index=$[app_index+1]
done
update_installed_apps_list
}
function install_apps {
@ -228,6 +238,7 @@ function install_apps {
fi
app_index=$[app_index+1]
done
update_installed_apps_list
}
# NOTE: deliberately no exit 0