From: Art Cancro Date: Thu, 7 Jan 2021 17:35:54 +0000 (-0500) Subject: Moved the appimage project into the main tree X-Git-Tag: v939~171 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=168a9ec0fb1b47c3602804b8af26f28b207a953d Moved the appimage project into the main tree --- diff --git a/appimage/.gitignore b/appimage/.gitignore new file mode 100644 index 000000000..8a7f3512c --- /dev/null +++ b/appimage/.gitignore @@ -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 index 000000000..1fcc7cea7 --- /dev/null +++ b/appimage/build_appimage.sh @@ -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 index 000000000..98ba0b277 --- /dev/null +++ b/appimage/citadel.AppDir/.DirIcon @@ -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 index 000000000..83c86a45b --- /dev/null +++ b/appimage/citadel.AppDir/AppRun @@ -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 index 000000000..4560c31dc --- /dev/null +++ b/appimage/citadel.AppDir/citadel.desktop @@ -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 index 000000000..dbabbb0fd 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 index 000000000..5aca68859 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 index 000000000..b2e6a184f --- /dev/null +++ b/appimage/citadel.AppDir/ctdlvisor.c @@ -0,0 +1,73 @@ +#include +#include +#include +#include + + + + +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); +}