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=() OPEN_PORTS=()
function install_final { function install_final {
if grep -Fxq "install_final" $COMPLETION_FILE; then if grep -Fxq "install_final" $COMPLETION_FILE; then
return return
fi fi
# unmount any attached usb drive # unmount any attached usb drive
if [ -d $USB_MOUNT ]; then if [ -d $USB_MOUNT ]; then
umount $USB_MOUNT umount $USB_MOUNT
rm -rf $USB_MOUNT rm -rf $USB_MOUNT
fi fi
function_check split_gpg_key_into_fragments function_check split_gpg_key_into_fragments
split_gpg_key_into_fragments split_gpg_key_into_fragments
echo 'install_final' >> $COMPLETION_FILE echo 'install_final' >> $COMPLETION_FILE
clear clear
echo '' echo ''
echo $" echo $"
*** ${PROJECT_NAME} installation is complete. Rebooting... *** *** ${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[@]}" for p in "${OPEN_PORTS[@]}"
do do
echo " $p" echo " $p"
done done
echo '' echo ''
if [ -f "/home/$MY_USERNAME/README" ]; then if [ -f "/home/$MY_USERNAME/README" ]; then
echo $"See /home/$MY_USERNAME/README for post-installation instructions." echo $"See /home/$MY_USERNAME/README for post-installation instructions."
echo '' echo ''
fi fi
# add user menu on ssh login # add user menu on ssh login
if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then
echo 'control' >> /home/$MY_USERNAME/.bashrc echo 'control' >> /home/$MY_USERNAME/.bashrc
fi fi
if [ ! -f $IMAGE_PASSWORD_FILE ]; then if [ ! -f $IMAGE_PASSWORD_FILE ]; then
reboot reboot
fi fi
}
function update_installed_apps_list {
cat $COMPLETION_FILE | grep "install_" > /usr/share/${PROJECT_NAME}/installed.txt
} }
function setup_final { function setup_final {
function_check install_tripwire function_check update_installed_apps_list
install_tripwire update_installed_apps_list
function_check install_final function_check install_tripwire
install_final install_tripwire
function_check install_final
install_final
} }
# NOTE: deliberately no exit 0 # NOTE: deliberately no exit 0

View File

@ -64,6 +64,15 @@ function app_is_installed {
return return
fi 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 if ! grep -Fxq "install_${app_name}" $COMPLETION_FILE; then
echo "0" echo "0"
else else
@ -206,6 +215,7 @@ function remove_apps {
fi fi
app_index=$[app_index+1] app_index=$[app_index+1]
done done
update_installed_apps_list
} }
function install_apps { function install_apps {
@ -228,6 +238,7 @@ function install_apps {
fi fi
app_index=$[app_index+1] app_index=$[app_index+1]
done done
update_installed_apps_list
} }
# NOTE: deliberately no exit 0 # NOTE: deliberately no exit 0