Advertisement
barjac

get-picasa

Jul 10th, 2011
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.94 KB | None | 0 0
  1. #!/bin/bash
  2. # get-picasa
  3. # Installer for Picasa-3.0.5744-02.i386 (for 32 and 64bit systems)
  4. ############################
  5. # Description:
  6. # This script downloads and installs Picasa 3 from Google.com.
  7. # It also installs dependencies and corrected .desktop files.
  8. ############################
  9. # Instructions:
  10. # Save this file in your home folder as get-picasa
  11. # then in a terminal :-
  12. # $ chmod 755 get-picasa
  13. #
  14. # then to install Picasa :-
  15. # $ su
  16. # # ./get-picasa
  17. #
  18. # To uninstall Picasa :-
  19. # $ su
  20. # # ./get-picasa uninstall
  21. ############################
  22. # Changelog:
  23. #
  24. # Sunday 10 Jul 2011  First pasted
  25. #
  26. ############################
  27. md5=5990be842062ca483239c9f1efca9614
  28. mkdesktop()
  29. {
  30. cat > /usr/share/applications/picasa.desktop << EOF1
  31. [Desktop Entry]
  32. Name=Picasa
  33. Comment=The Photo Organizer from Google
  34. Exec=/opt/google/picasa/3.0/bin/picasa
  35. Icon=/opt/google/picasa/3.0/desktop/picasa.xpm
  36. Type=Application
  37. Terminal=false
  38. Categories=Graphics;
  39. EOF1
  40. }
  41. mkfontdesktop()
  42. {
  43. cat > /usr/share/applications/picasa-fontcfg.desktop << EOF2
  44. [Desktop Entry]
  45. Name=Picasa Font Settings
  46. Comment=Configure fonts used by Picasa
  47. Exec=/opt/google/picasa/3.0/bin/picasafontcfg
  48. Terminal=false
  49. Icon=/opt/google/picasa/3.0/desktop/picasa-fontcfg.xpm
  50. Type=Application
  51. Categories=Graphics;
  52. EOF2
  53. }
  54. chksu()
  55. {
  56. (((UID)) || [[ $USER = "root" ]]) &&\
  57. { echo "Sorry, you must run this as root. (Use su NOT su -)"; exit 1; }
  58. }
  59. chkdeps()
  60. {
  61. echo "Checking dependencies for Picasa"
  62. deps=(lsb-core-lib libasound.so.2 libaudiofile.so.0 \
  63. libcups.so.2 libexif.so.12 libfreetype.so.6 libgphoto2.so.2 \  
  64. libsane.so.1 libXau.so.6 libXmu.so.6 libXpm.so.4 \
  65. libxslt.so.1 libXxf86vm.so.1)
  66. for dp in ${deps[@]}; do
  67.       urpmi --force $dp || exit 1
  68. done
  69. }
  70. down()
  71. {
  72. tmp_dir=$(mktemp -d)
  73. [[ -d $tmp_dir ]] || { echo "Failed to create temporary directory"; exit 1; }
  74. cd $tmp_dir || { echo "Error changing to temporary directory"; exit 1; }
  75. wget --timeout=20 --tries=3 "http://dl.google.com/linux/rpm/testing/i386/picasa-3.0-current.i386.rpm"
  76. [[ -f picasa-3.0-current.i386.rpm ]] || { echo "Download failed"; rm -rf $tmp_dir; exit 1; }
  77. md5chk=$(md5sum picasa-3.0-current.i386.rpm | cut -d' ' -f1)
  78. cd .. || { echo "Error changing directory"; exit 1; }
  79. [[ $md5 = $md5chk ]] || { echo "Checksum Failed"; rm -rf $tmp_dir; exit 1; }
  80. }
  81. inst()
  82. {
  83. [[ -f $tmp_dir/picasa-3.0-current.i386.rpm ]] || exit 1
  84. rpm -Uvh --nodeps $tmp_dir/picasa-3.0-current.i386.rpm 2> /dev/null
  85. [[ $? = 0 ]] || { echo "There was an error during install"; rm -rf $tmp_dir; exit 1; }
  86. }
  87. chkinst()
  88. {
  89. if rpm -qa | grep -q ^picasa; then
  90. echo "Picasa seems to be already installed - uninstall it before running this again"
  91. exit 1
  92. fi
  93. }
  94. chksu
  95. [[ $1 != *uninstall* ]] || { urpme picasa; exit 0; }
  96. chkinst
  97. chkdeps
  98. down
  99. inst
  100. rm -rf /usr/share/applications/picasa.desktop
  101. rm -rf /usr/share/applications/picasa-fontcfg.desktop
  102. mkdesktop
  103. mkfontdesktop
  104. rm -rf $tmp_dir
  105. echo "Picasa was successfully installed"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement