Skip to content
Snippets Groups Projects
Commit dc59f745 authored by Bob Mottram's avatar Bob Mottram
Browse files

Use a file rather than variables to indicate adding an app

parent 8701e7d6
No related branches found
No related tags found
No related merge requests found
......@@ -29,29 +29,46 @@
# 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/>.
local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local
webadmin_install_dir="/var/www/${local_hostname}/htdocs/admin"
pending_installs="$webadmin_install_dir/pending_installs.txt"
arg1="$1"
arg2="$2"
adding_app_file=/root/.addremove_app_command
if [ -f "$adding_app_file" ]; then
rm "$adding_app_file"
fi
if [[ "$arg1" == 'add' ]]; then
if [ "$arg2" ]; then
touch "$adding_app_file"
fi
fi
/usr/local/bin/freedombone-addremove-base "$arg1" "$arg2" || \
(
if [[ "$arg1" == 'add' ]]; then
if [ "$arg2" ]; then
echo $"Failed to add app: $arg2"
# show the installation failed screen
sed -i "/install_$arg2/d" "$pending_installs"
#web_admin_create_add_apps
cp "$webadmin_install_dir/app_installing_failed.html" "$webadmin_install_dir/index.html"
cp "$webadmin_install_dir/app_installing_failed.html" "$webadmin_install_dir/installing_progress.html"
else
exit 0
fi
echo $'addremove fail state'
if [ -f "$adding_app_file" ]; then
echo $'Failed to add app'
rm "$adding_app_file"
local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local
webadmin_install_dir="/var/www/${local_hostname}/htdocs/admin"
pending_installs="$webadmin_install_dir/pending_installs.txt"
# show the installation failed screen
sed -i "/install_$arg2/d" "$pending_installs"
#web_admin_create_add_apps
cp "$webadmin_install_dir/app_installing_failed.html" "$webadmin_install_dir/index.html"
cp "$webadmin_install_dir/app_installing_failed.html" "$webadmin_install_dir/installing_progress.html"
exit 1
else
exit 0
fi
)
if [ -f "$adding_app_file" ]; then
rm "$adding_app_file"
fi
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment