Moved the appimage project into the main tree
authorArt Cancro <ajc@citadel.org>
Thu, 7 Jan 2021 17:35:54 +0000 (12:35 -0500)
committerArt Cancro <ajc@citadel.org>
Thu, 7 Jan 2021 17:35:54 +0000 (12:35 -0500)
appimage/.gitignore [new file with mode: 0644]
appimage/build_appimage.sh [new file with mode: 0755]
appimage/citadel.AppDir/.DirIcon [new symlink]
appimage/citadel.AppDir/AppRun [new file with mode: 0755]
appimage/citadel.AppDir/citadel.desktop [new file with mode: 0644]
appimage/citadel.AppDir/citadel.png [new file with mode: 0644]
appimage/citadel.AppDir/ctdlvisor [new file with mode: 0755]
appimage/citadel.AppDir/ctdlvisor.c [new file with mode: 0644]

diff --git a/appimage/.gitignore b/appimage/.gitignore
new file mode 100644 (file)
index 0000000..8a7f351
--- /dev/null
@@ -0,0 +1,2 @@
+citadel.AppDir/usr
+Citadel-x86_64.AppImage
diff --git a/appimage/build_appimage.sh b/appimage/build_appimage.sh
new file mode 100755 (executable)
index 0000000..1fcc7ce
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+CTDLROOT=../citadel
+
+rm -frv citadel.AppDir/usr
+mkdir -p citadel.AppDir/usr/bin
+mkdir -p citadel.AppDir/usr/lib
+
+pushd citadel.AppDir
+cc ctdlvisor.c -o ctdlvisor || exit 1
+popd
+
+for bin in $CTDLROOT/citadel/citserver $CTDLROOT/webcit/webcit
+do
+       cp -v $bin citadel.AppDir/usr/bin/
+       for x in `ldd $bin | awk ' { print $3 } ' | grep -v -e '^$' | grep -v 'libc.so' | grep -v 'libpthread.so' | grep -v 'libresolv.so'`
+       do
+               cp -v -L $x citadel.AppDir/usr/lib/
+       done
+done
+ldconfig -v citadel.AppDir/usr/lib
+
+ARCH=x86_64 appimagetool citadel.AppDir/
+
+# Hint: do this on your build server first!
+# apt-get install make build-essential autoconf zlib1g-dev libldap2-dev libssl-dev gettext libical-dev libexpat1-dev libcurl4-openssl-dev
diff --git a/appimage/citadel.AppDir/.DirIcon b/appimage/citadel.AppDir/.DirIcon
new file mode 120000 (symlink)
index 0000000..98ba0b2
--- /dev/null
@@ -0,0 +1 @@
+citadel.png
\ No newline at end of file
diff --git a/appimage/citadel.AppDir/AppRun b/appimage/citadel.AppDir/AppRun
new file mode 100755 (executable)
index 0000000..83c86a4
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+export LD_LIBRARY_PATH=$APPDIR/usr/lib
+export PATH=$APPDIR/usr/bin
+exec $APPDIR/ctdlvisor
diff --git a/appimage/citadel.AppDir/citadel.desktop b/appimage/citadel.AppDir/citadel.desktop
new file mode 100644 (file)
index 0000000..4560c31
--- /dev/null
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+Categories=Network
+Terminal=true
+Exec=AppRun
+Name=Citadel
+Icon=citadel
diff --git a/appimage/citadel.AppDir/citadel.png b/appimage/citadel.AppDir/citadel.png
new file mode 100644 (file)
index 0000000..dbabbb0
Binary files /dev/null and b/appimage/citadel.AppDir/citadel.png differ
diff --git a/appimage/citadel.AppDir/ctdlvisor b/appimage/citadel.AppDir/ctdlvisor
new file mode 100755 (executable)
index 0000000..5aca688
Binary files /dev/null and b/appimage/citadel.AppDir/ctdlvisor differ
diff --git a/appimage/citadel.AppDir/ctdlvisor.c b/appimage/citadel.AppDir/ctdlvisor.c
new file mode 100644 (file)
index 0000000..b2e6a18
--- /dev/null
@@ -0,0 +1,73 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/wait.h>
+
+
+
+
+pid_t start_citadel() {
+       pid_t pid = fork();
+       if (pid == 0) {
+               execlp("citserver", "citserver", "-x9", "-h/usr/local/citadel", NULL);
+               exit(1);
+       }
+       else {
+               return(pid);
+       }
+}
+
+
+pid_t start_webcit() {
+       pid_t pid = fork();
+       if (pid == 0) {
+               execlp("/bin/bash", "bash", "-c", "sleep 7", NULL);
+               exit(1);
+       }
+       else {
+               return(pid);
+       }
+}
+
+
+pid_t start_webcits() {
+       pid_t pid = fork();
+       if (pid == 0) {
+               execlp("/bin/bash", "bash", "-c", "sleep 9", NULL);
+               exit(1);
+       }
+       else {
+               return(pid);
+       }
+}
+
+
+
+
+
+main() {
+       int status;
+       pid_t who_exited;
+
+       pid_t citserver_pid = start_citadel();
+       //pid_t webcit_pid = start_webcit();
+       //pid_t webcits_pid = start_webcits();
+
+       do {
+               printf("LD_LIBRARY_PATH = %s\n", getenv("LD_LIBRARY_PATH"));
+               printf("PATH = %s\n", getenv("PATH"));
+
+
+               printf("waiting...\n");
+               who_exited = waitpid(-1, &status, 0);
+               printf("pid=%d exited, status=%d\n", who_exited, status);
+
+               if (who_exited == citserver_pid)        citserver_pid = start_citadel();
+               //if (who_exited == webcit_pid)         webcit_pid = start_webcit();
+               //if (who_exited == webcits_pid)        webcits_pid = start_webcits();
+
+               sleep(1);                               // for sanity
+
+       } while(who_exited >= 0);
+       exit(0);
+}