+# Install the Citadel Server application tree
+mkdir -p citadel.AppDir/usr/local/citadel || exit 17
+rsync -va $CITADEL_BUILD_DIR/ ./citadel.AppDir/usr/local/citadel/ || exit 18
+
+# Install the WebCit application tree
+mkdir -p citadel.AppDir/usr/local/webcit || exit 19
+rsync -va $WEBCIT_BUILD_DIR/ ./citadel.AppDir/usr/local/webcit/ || exit 20
+
+# Remove the build directories
+rm -fr $CITADEL_BUILD_DIR $WEBCIT_BUILD_DIR
+
+cc ctdlvisor.c -o citadel.AppDir/usr/bin/ctdlvisor || exit 21
+
+cpu=`uname -p`
+basefilename=citadel-`date +%s`
+if [ $cpu == x86_64 ] ; then
+ ARCH=x86_64 appimagetool citadel.AppDir/ ${basefilename}-x64.appimage
+else
+ ARCH=ARM appimagetool citadel.AppDir/ ${basefilename}-arm32.appimage
+fi
+