Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel
authorArt Cancro <ajc@citadel.org>
Sun, 18 Jul 2021 17:45:38 +0000 (13:45 -0400)
committerArt Cancro <ajc@citadel.org>
Sun, 18 Jul 2021 17:45:38 +0000 (13:45 -0400)
appimage/README.txt
appimage/build_appimage.sh
appimage/citadel.AppDir/AppRun
appimage/ctdlvisor.c
textclient/commands.c

index ec936957775b983be1cc64a18885bc75da268deb..a2949fb366dd567d7b26e7d4f9b34e41a334a0b7 100644 (file)
@@ -6,9 +6,9 @@ The tooling in this directory can be used to build an AppImage, the entire Citad
 distributed as a single binary file.  Visit https://appimage.org/ to learn more about the
 AppImage format and how it works.
 
-Again, do NOT try to run this on your production machine.  For that matter, don't try to
-run it on anything other than a dedicated build host.  It may ERASE data you intended to
-keep.
+Again, do NOT try to build this on your production machine.  For that matter, don't try
+to build it on anything other than a dedicated build host.  It may ERASE data you
+intended to keep.
 
 If you're an end user you shouldn't have any need to do this at all.  The whole point of
 this is that we can supply ready-to-run binaries that will run on any Linux/Linux system
index 4fddec1a54083bd3769255e4acdddeafb41685db..1a07c7c6a98298af8cc3655e9a9238a2fb134daa 100755 (executable)
@@ -1,10 +1,15 @@
 #!/bin/bash
 
+# Work from the directory this script is in
+APPIMAGE_BUILD_DIR=$(dirname $(readlink -f $0))
+cd $APPIMAGE_BUILD_DIR || exit 28
+echo APPIMAGE_BUILD_DIR is `pwd`
+
+# Remove old versions
 rm -vf citadel-*appimage
 
 export CITADEL_BUILD_DIR=/tmp/citadel-build-$$
 export WEBCIT_BUILD_DIR=/tmp/webcit-build-$$
-rm -fr $CITADEL_BUILD_DIR $WEBCIT_BUILD_DIR
 
 # libcitadel has to be built in a "real" library directory
 pushd ../libcitadel || exit 1
@@ -96,7 +101,7 @@ basefilename=citadel-`cat ../release_version.txt`
 if [ $CPU == x86_64 ] ; then
        export ARCH=x86_64
 elif [ $CPU == armv7l ] ; then
-       export ARCH=armhf
+       export ARCH=arm
 elif [ $CPU == aarch64 ] ; then
        export ARCH=aarch64
 fi
index 70f00b9202c73325faeec58aa2413f57bc0c1ed2..860b36b37eb20f878a1fdd9160447abe7bcb788b 100755 (executable)
@@ -31,15 +31,19 @@ usage() {
 # Permanently install the Citadel AppImage to this system
 installation() {
 
-       clear
-       echo
+       # Clear the screen and draw the banner
+       echo -e '\033[2J\033[H\033[44m\033[37m\033[K\033[0m'
+       echo -e '\033[44m\033[37m\033[1m  Citadel installation\033[K\033[0m'
+       echo -e '\033[44m\033[37m \033[K\033[0m'
        echo
 
        # First ... check to make sure Citadel isn't already running.
        echo Checking to make sure Citadel is not already running...
        if ps ax | grep citserver | grep -v grep ; then
-               echo Installation cannot proceed while Citadel is running.
+               echo
+               echo -e '\033[31m\033[1mInstallation cannot proceed while Citadel is running.\033[0m'
                echo Stop your services and try again.
+               echo
                exit 1
        fi
        echo OK
@@ -51,13 +55,25 @@ installation() {
                export LD_LIBRARY_PATH=$APPDIR/usr/lib
                export PATH=$APPDIR/usr/bin
                $APPDIR/usr/local/citadel/citserver -c || {
-                       echo Compatibility failed.
+                       echo
+                       echo -e '\033[31m\033[1mCompatibility failed.\033[0m'
+                       echo 'This AppImage is not compatible with your system.'
+                       echo 'If you are attempting to run it on a compatible platform, please make sure you'
+                       echo 'have all of the latest updates and patches applied.  Otherwise, you may have'
+                       echo 'better luck with the Easy Install method.'
+                       echo ''
                        exit 2
                }
-       )
+       ) || exit 2
        echo OK
        echo
 
+       # Clear the screen and draw the banner
+       echo -e '\033[2J\033[H\033[44m\033[37m\033[K\033[0m'
+       echo -e '\033[44m\033[37m\033[1m  Citadel installation\033[K\033[0m'
+       echo -e '\033[44m\033[37m \033[K\033[0m'
+       echo
+
        # Locate the Citadel run directory
        confirmed=0
        while [ ${confirmed} == 0 ] 
@@ -90,7 +106,7 @@ installation() {
                echo Automatic installation is only supported with systemd.
                echo You can still run Citadel but you will need to start it some other way.
                exit 3
-       }
+       } | exit 3
        echo OK
        echo
 
@@ -105,13 +121,19 @@ installation() {
        echo OK
        echo
 
+       # Clear the screen and draw the banner
+       echo -e '\033[2J\033[H\033[44m\033[37m\033[K\033[0m'
+       echo -e '\033[44m\033[37m\033[1m  Citadel installation\033[K\033[0m'
+       echo -e '\033[44m\033[37m \033[K\033[0m'
+       echo
+
        echo Ready to install ${APPIMAGE} in ${CTDL_DIR}
        echo Copying the AppImage...
        rm -f ${CTDL_DIR}/citadel.appimage 2>/dev/null
        cp ${APPIMAGE} ${CTDL_DIR}/citadel.appimage || {
                echo Installation has failed with error code $? .
                exit 4
-       }
+       } | exit 4
 
        echo Creating the systemd unit file...
        (
@@ -134,7 +156,7 @@ installation() {
        ) >/etc/systemd/system/citadel.service || {
                echo Installation has failed with error code $? .
                exit 5
-       }
+       } | exit 5
        echo OK
        echo
 
@@ -142,7 +164,7 @@ installation() {
        systemctl enable citadel || {
                echo Installation has failed with error code $? .
                exit 6
-       }
+       } | exit 6
        echo OK
        echo
 
@@ -150,12 +172,21 @@ installation() {
        systemctl start citadel || {
                echo Installation has failed with error code $? .
                exit 6
-       }
+       } || exit 6
        echo OK
        echo
 
-       echo Installation has completed.
+       # Clear the screen and draw the banner
+       echo -e '\033[2J\033[H\033[44m\033[37m\033[K\033[0m'
+       echo -e '\033[44m\033[37m\033[1m  Citadel installation\033[K\033[0m'
+       echo -e '\033[44m\033[37m \033[K\033[0m'
+       echo
+
+       echo -e '\033[32m\033[1mInstallation has completed.\033[0m'
        echo Please continue by browsing to http://`hostname`:${HTTP_PORT}
+       echo
+       echo -e 'If this is a new installation, the default administrator'
+       echo -e 'will be named \033[7madmin\033[0m with password \033[7mcitadel\033[0m.'
        exit
 }
 
@@ -218,12 +249,6 @@ case ${1} in
                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
index 3c7be88cc514159689e7012f2e8cccf4d2f65470..f14b67c59668f3638955a33aad576cc754bbe62c 100644 (file)
@@ -187,6 +187,31 @@ void main_loop(void) {
 }
 
 
+void install_client_link(void) {
+
+       FILE *fp;
+       char path_to_link[PATH_MAX];
+       snprintf(path_to_link, sizeof path_to_link, "%s/citadel", getenv("CTDL_DIR"));
+       fp = fopen(path_to_link, "w");
+       if (!fp) {
+               fprintf(stderr, "%s\n", strerror(errno));
+               return;
+       }
+
+       fprintf(fp,     "#!/bin/bash\n"
+                       "export APPDIR=%s\n"
+                       "export LD_LIBRARY_PATH=${APPDIR}/usr/bin:$LD_LIBRARY_PATH\n"
+                       "export PATH=${APPDIR}/usr/bin:$PATH\n"
+                       "exec citadel\n"
+       ,
+                       getenv("APPDIR")
+       );
+
+       fchmod(fileno(fp), 0755);
+       fclose(fp);
+}
+
+
 int main(int argc, char **argv) {
        int a;
        int migrate_mode = 0;
@@ -248,9 +273,11 @@ int main(int argc, char **argv) {
                signal(SIGINT, signal_handler);
                signal(SIGQUIT, signal_handler);
        
-               citserver_pid = start_citadel();
-               webcit_pid = start_webcit();
-               webcits_pid = start_webcits();
+               citserver_pid = start_citadel();                // start Citadel Server
+               webcit_pid = start_webcit();                    // start WebCit HTTP
+               webcits_pid = start_webcits();                  // start WebCit HTTPS
+
+               install_client_link();
        
                main_loop();
        }
index cecbb4d1fa5d073e3263848785db50d243afee46..81fef751a9bc017b1b6c4c499292f6df9ebe6e7d 100644 (file)
@@ -932,6 +932,10 @@ void load_command_set(void)
                snprintf(buf, sizeof buf, "%s/.citadelrc", getenv("HOME"));
                ccfile = fopen(buf, "r");
        }
+       if (getenv("APPDIR") != NULL) {
+               snprintf(buf, sizeof buf, "%s/citadel.rc", getenv("APPDIR"));
+               ccfile = fopen(buf, "r");
+       }
        if (ccfile == NULL) {
                ccfile = fopen(file_citadel_rc, "r");
        }