From 67530358a0bebd7731ae4575b704110ba779a648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20BERTHO?= Date: Sun, 18 Nov 2018 17:35:34 +0100 Subject: [PATCH] Add linux install --- install/SimplePanoramaViewer.desktop | 12 +++++ install/pjpg.xml | 10 ++++ utility.sh | 68 ++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 install/SimplePanoramaViewer.desktop create mode 100644 install/pjpg.xml create mode 100755 utility.sh diff --git a/install/SimplePanoramaViewer.desktop b/install/SimplePanoramaViewer.desktop new file mode 100644 index 0000000..c53f6ab --- /dev/null +++ b/install/SimplePanoramaViewer.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=SimplePanoramaViewer +Comment=Simple web based panoram viewer +Icon=emblem-photos +Exec=SimplePanoramaViewer +NoDisplay=false +Categories=Graphics;Viewer +StartupNotify=false +Terminal=false +MimeType=image/jpeg;image/pjpg diff --git a/install/pjpg.xml b/install/pjpg.xml new file mode 100644 index 0000000..19fe6d5 --- /dev/null +++ b/install/pjpg.xml @@ -0,0 +1,10 @@ + + + + Panoramic JPEG image + Image JPEG panoramique + + + + + diff --git a/utility.sh b/utility.sh new file mode 100755 index 0000000..6195dce --- /dev/null +++ b/utility.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +print_help() +{ + echo "SimplePanoramaViewer utility script" + echo + echo "Use:" + echo " bash utility.sh OPTION [PATH_TO_INSTALL_DIR]" + echo + echo "Options:" + echo " -i, --install Install SimplePanoramaViewer in PATH_TO_INSTALL_DIR" + echo " -u, --uninstall Uninstall SimplePanoramaViewer frome PATH_TO_INSTALL_DIR" +} + +check_dir() +{ + if [ -z "$1" ]; then + echo "You need to pass a directory" + exit + fi +} + +install() +{ + DIR=$1 + check_dir "$DIR" + + mkdir -p "$DIR/share/SimplePanoramaViewer/" + mkdir -p "$DIR/bin/" + mkdir -p "$DIR/share/applications" + mkdir -p "$DIR/share/mime/image" + cp SimplePanoramaViewer "$DIR/share/SimplePanoramaViewer" + cp -r css "$DIR/share/SimplePanoramaViewer" + cp -r html "$DIR/share/SimplePanoramaViewer" + cp -r js "$DIR/share/SimplePanoramaViewer" + cp install/SimplePanoramaViewer.desktop "$DIR/share/applications" + cp install/pjpg.xml "$DIR/share/mime/image" + echo "#!/bin/bash + $DIR/share/SimplePanoramaViewer/SimplePanoramaViewer \"\$@\"" > "$DIR/bin/SimplePanoramaViewer" + chmod a+x "$DIR/bin/SimplePanoramaViewer" + sudo chmod -R a+r "$DIR/share/SimplePanoramaViewer" +} + +uninstall() +{ + DIR=$1 + check_dir "$DIR" + + rm "$DIR/bin/SimplePanoramaViewer" + rm -r "$DIR/share/SimplePanoramaViewer/" + rm "$DIR/share/applications/SimplePanoramaViewer.desktop" + rm "$DIR/share/mime/image/pjpg.xml" +} + +case "$1" in + "-h" | "--help") + print_help + ;; + "-i" | "--install") + install "$2" + ;; + "-u" | "--uninstall") + uninstall "$2" + ;; + *) + print_help + ;; +esac