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 ;;