This is a simple panorama viewer based on Photo Sphere Viewer. https://dalan.fr/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

utility.sh 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #!/bin/bash
  2. print_help()
  3. {
  4. echo "SimplePanoramaViewer utility script"
  5. echo
  6. echo "Use:"
  7. echo " bash utility.sh OPTION [PATH_TO_INSTALL_DIR]"
  8. echo
  9. echo "Options:"
  10. echo " -i, --install Install SimplePanoramaViewer in PATH_TO_INSTALL_DIR"
  11. echo " -u, --uninstall Uninstall SimplePanoramaViewer from PATH_TO_INSTALL_DIR"
  12. echo " -p, --package Generate a package for SimplePanoramaViewer"
  13. }
  14. check_dir()
  15. {
  16. if [ -z "$1" ]; then
  17. echo "You need to pass a directory"
  18. exit
  19. fi
  20. }
  21. install()
  22. {
  23. DESTDIR=$1
  24. check_dir "$DESTDIR"
  25. if [ -z "$2" ]; then
  26. PREFIX=$DESTDIR
  27. else
  28. PREFIX="$2"
  29. DESTDIR=$DESTDIR$PREFIX
  30. echo $DESTDIR
  31. fi
  32. mkdir -p "$DESTDIR/share/SimplePanoramaViewer/"
  33. mkdir -p "$DESTDIR/bin/"
  34. mkdir -p "$DESTDIR/share/applications"
  35. mkdir -p "$DESTDIR/share/mime/image"
  36. cp SimplePanoramaViewer "$DESTDIR/share/SimplePanoramaViewer"
  37. cp -r css "$DESTDIR/share/SimplePanoramaViewer"
  38. cp -r html "$DESTDIR/share/SimplePanoramaViewer"
  39. cp -r js "$DESTDIR/share/SimplePanoramaViewer"
  40. cp install/SimplePanoramaViewer.desktop "$DESTDIR/share/applications"
  41. cp install/pjpg.xml "$DESTDIR/share/mime/image"
  42. echo "#!/bin/bash
  43. $PREFIX/share/SimplePanoramaViewer/SimplePanoramaViewer \"\$@\"" > "$DESTDIR/bin/SimplePanoramaViewer"
  44. chmod a+x "$DESTDIR/bin/SimplePanoramaViewer"
  45. chmod -R a+r "$DESTDIR/share/SimplePanoramaViewer"
  46. }
  47. uninstall()
  48. {
  49. DIR=$1
  50. check_dir "$DIR"
  51. rm "$DIR/bin/SimplePanoramaViewer"
  52. rm -r "$DIR/share/SimplePanoramaViewer/"
  53. rm "$DIR/share/applications/SimplePanoramaViewer.desktop"
  54. rm "$DIR/share/mime/image/pjpg.xml"
  55. }
  56. package()
  57. {
  58. DIR="/tmp/SimplePanoramaViewer"
  59. mkdir "$DIR"
  60. cp SimplePanoramaViewer "$DIR"
  61. cp -r css "$DIR"
  62. cp -r html "$DIR"
  63. cp -r js "$DIR"
  64. chmod a+x "$DIR/SimplePanoramaViewer"
  65. mkdir -p dist
  66. cd /tmp || exit
  67. tar Jcvf "SimplePanoramaViewer.tar.xz" "SimplePanoramaViewer"
  68. cd - || exit
  69. cp -f "$DIR.tar.xz" dist
  70. rm -r "$DIR"
  71. rm "$DIR.tar.xz"
  72. }
  73. case "$1" in
  74. "-h" | "--help")
  75. print_help
  76. ;;
  77. "-i" | "--install")
  78. install "$2" "$3"
  79. ;;
  80. "-u" | "--uninstall")
  81. uninstall "$2"
  82. ;;
  83. "-p" | "--package")
  84. package
  85. ;;
  86. *)
  87. print_help
  88. ;;
  89. esac