add the ability to run the client from the appimage
[citadel.git] / appimage / citadel.AppDir / AppRun
index 25205607933ea3626ff1cffa600be0fe5405160b..5766ff2e55b47514890d7e30547b06e8b58a0d03 100755 (executable)
@@ -1,18 +1,18 @@
 #!/bin/bash
 
-## This is an AppImage control script for the Citadel system.
-##
-## Copyright (c) 2021 by the citadel.org team
-##
-## This program is open source software.  It runs great on the
-## Linux operating system (and probably elsewhere).  You can use,
-## copy, and run it under the terms of the GNU General Public
-## License version 3.  Richard Stallman is an asshole communist.
-##
-## 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 General Public License for more details.
+# This is an AppImage control script for the Citadel system.
+#
+# Copyright (c) 2021 by the citadel.org team
+#
+# This program is open source software.  It runs great on the
+# Linux operating system (and probably elsewhere).  You can use,
+# copy, and run it under the terms of the GNU General Public
+# License version 3.
+#
+# 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 General Public License for more details.
 
 # Default values
 HTTP_PORT=80
@@ -23,7 +23,7 @@ ulimit -c unlimited
 
 usage() {
        echo ${APPIMAGE}: usage: ${APPIMAGE} '[-h data_directory] [-p http_port] [-s https_port] command'
-       echo 'command must be one of: run, test, install'
+       echo 'command must be one of: run, test, install, client, database_cleanup, migrate'
        exit 2
 }
 
@@ -194,6 +194,39 @@ case ${1} in
        install)
                installation
                ;;
+       client)
+               exec $APPDIR/usr/bin/citadel
+               ;;
+       database_cleanup)
+               export LD_LIBRARY_PATH=$APPDIR/usr/lib
+               export PATH=$APPDIR/usr/bin:$PATH
+               exec $APPDIR/usr/local/citadel/database_cleanup.sh -h $CTDL_DIR
+               ;;
+       migrate)
+               export APPDIR CTDL_DIR HTTP_PORT HTTPS_PORT
+               export LD_LIBRARY_PATH=$APPDIR/usr/lib
+               export PATH=$APPDIR/usr/bin
+               exec ctdlvisor -m
+               ;;
+       mount)
+               echo This mode of operation mounts the AppImage but does not run anything.
+               echo -n Kill it when you are finished...
+               while true
+               do
+                       sleep 1
+               done
+               ;;
+       debug)
+               export LD_LIBRARY_PATH=$APPDIR/usr/lib
+               export PATH=$APPDIR/usr/bin:$PATH
+               exec $APPDIR/usr/local/citadel/citserver -x9 -h $CTDL_DIR
+               ;;
+       connect)
+               export LD_LIBRARY_PATH=$APPDIR/usr/lib
+               export PATH=$APPDIR/usr/bin:$PATH
+               cd $APPDIR
+               exec citadel $*
+               ;;
        *)
                echo Unexpected command: ${1} 
                usage