Add linux install

This commit is contained in:
Rémi BERTHO 2018-11-18 17:35:34 +01:00
parent 9a508a53dd
commit 67530358a0
Signed by: dalan
GPG key ID: EE3B917931C07B64
3 changed files with 90 additions and 0 deletions

View file

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

10
install/pjpg.xml Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="image/pjpg">
<comment>Panoramic JPEG image</comment>
<comment xml:lang="fr">Image JPEG panoramique</comment>
<glob pattern="*.pjpeg"/>
<glob pattern="*.pjpg"/>
<glob pattern="*.pjpe"/>
</mime-type>
</mime-info>

68
utility.sh Executable file
View file

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