From 4bc4e44db7ba0178cc40bb7dbec260e73b6c281a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20BERTHO?= Date: Sun, 18 Nov 2018 17:56:37 +0100 Subject: [PATCH] Add linux package function --- utility.sh | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/utility.sh b/utility.sh index 6195dce..068b833 100755 --- a/utility.sh +++ b/utility.sh @@ -9,7 +9,8 @@ print_help() echo echo "Options:" echo " -i, --install Install SimplePanoramaViewer in PATH_TO_INSTALL_DIR" - echo " -u, --uninstall Uninstall SimplePanoramaViewer frome PATH_TO_INSTALL_DIR" + echo " -u, --uninstall Uninstall SimplePanoramaViewer from PATH_TO_INSTALL_DIR" + echo " -p, --package Generate a package for SimplePanoramaViewer" } check_dir() @@ -52,6 +53,28 @@ uninstall() rm "$DIR/share/mime/image/pjpg.xml" } +package() +{ + DIR="/tmp/SimplePanoramaViewer" + + mkdir "$DIR" + cp SimplePanoramaViewer "$DIR" + cp -r css "$DIR" + cp -r html "$DIR" + cp -r js "$DIR" + chmod a+x "$DIR/SimplePanoramaViewer" + + mkdir -p dist + cd /tmp || exit + tar Jcvf "SimplePanoramaViewer.tar.xz" "SimplePanoramaViewer" + + cd - || exit + cp -f "$DIR.tar.xz" dist + + rm -r "$DIR" + rm "$DIR.tar.xz" +} + case "$1" in "-h" | "--help") print_help @@ -62,6 +85,9 @@ case "$1" in "-u" | "--uninstall") uninstall "$2" ;; + "-p" | "--package") + package + ;; *) print_help ;;