Add linux package function

This commit is contained in:
Rémi BERTHO 2018-11-18 17:56:37 +01:00
parent 67530358a0
commit 4bc4e44db7
Signed by: dalan
GPG key ID: EE3B917931C07B64

View file

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