Advertisement
Weremouse

backup_libfm.sh

Aug 11th, 2015
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.06 KB | None | 0 0
  1. #!/bin/dash
  2.  
  3. version="libfm.sh version 2015.08.10 Weremouse"
  4.  
  5. chlog() {
  6. echo "libfm ($libfm_version-1) wily; urgency=low"
  7. cat<<EOF
  8.  
  9.   * git pull
  10.     fixing #751 lxpanel wakes up external green drives
  11.     http://sourceforge.net/p/lxde/bugs/751/
  12.     Eliminate usage of GVolumeMonitor if no FmFolder object was created
  13.     https://github.com/lxde/libfm/commit/994a1e25ba0c3da80575fc002af17ab02ed5998b
  14.  
  15. EOF
  16. echo " -- Weremouse <silver.bullet@zoho.com>  $(date "+%a, %m %b %Y %T %z")"
  17. echo
  18. }
  19.  
  20. usage() {
  21. echo $version
  22. cat<<EOF
  23. Without root privileges run
  24.  ./libfm.sh
  25. EOF
  26. exit
  27. }
  28.  
  29. # start
  30. if [ "$(id -u)" = "0" ]; then usage; fi
  31. printf "\033[7m"; date "+%a, %m %b %Y %T %z"; printf "\033[0m"
  32. mkdir -p libfm.deb
  33. cd libfm.deb
  34.  
  35. # git pull
  36. if [ ! -d libfm ]; then
  37.   printf "\n\033[7mgit clone                                   \033[0m\n"
  38.   git clone https://github.com/lxde/libfm.git || exit 1
  39. fi
  40. printf "\n\033[7mgit pull --all                              \033[0m\n"
  41. cd libfm
  42. git pull --all || exit 1
  43. libfm_version=$(git describe --always --abbrev=10 | sed "s/-/./g")
  44. cd ..
  45. if [ -d libfm-$libfm_version ]; then
  46.   echo "Directory libfm-$libfm_version already exists."; exit 1
  47. fi
  48.  
  49. # update
  50. printf "\n\033[7mUpdate and simulate dist-upgrade? [y/N]     \033[0m "
  51. read char
  52. case $char in
  53.   y|Y)
  54.     sudo apt-get update && echo && sudo apt-get dist-upgrade --dry-run
  55.     printf "\n\033[7mContinue without upgrading or exit? [C/e]   \033[0m "
  56.     read char
  57.     case $char in
  58.       e|E) exit;;
  59.     esac;;
  60. esac
  61.  
  62. # get distro packages
  63. printf "\n\033[7mget distro packages                         \033[0m\n"
  64. if [ "$(ls -d libfm-1.2.3.*.g??????????)" = "" ]; then
  65.   printf "    this isn't an error\n\n"
  66.   gpg --keyserver hkp://pgp.uni-mainz.de --recv-keys 18F5FBCE
  67.   echo
  68.   apt-get source libfm
  69.   mv -i libfm-1.2.3 libfm-$libfm_version || exit 1
  70. else
  71.   mv -i $(ls -d libfm-1.2.3.*.g??????????) libfm-$libfm_version || exit 1
  72. fi
  73. sudo apt-get build-dep libfm || exit 1
  74.  
  75. # copy source
  76. printf "\n\033[7mcopy source from upstream to package source\033[0m\n"
  77. cd libfm
  78. tar -cf ../libfm-$libfm_version.tar $(ls -A ../libfm)
  79. cd ../libfm-$libfm_version
  80. tar -xf ../libfm-$libfm_version.tar || exit 1
  81. echo "done"
  82.  
  83. # add changelog entry
  84. printf "\n\033[7mlog changes                                \033[0m\n"
  85. libfm_chanlog=$(cat debian/changelog)
  86. chlog                  > debian/changelog
  87. echo "$libfm_chanlog" >> debian/changelog
  88. echo "done"
  89.  
  90. # build packages
  91. printf "\n\033[7mbuild packages                             \033[0m\n"
  92. printf "starting step 1 of 4 steps"
  93. libtoolize --force --copy --automake
  94. sleep 1
  95. printf "\033[26Dstarting step 2 of 4 steps"
  96. aclocal
  97. printf "\033[26Dstarting step 3 of 4 steps"
  98. autoreconf
  99. printf "\033[26Dstarting step 4 of 4 steps\n"
  100. debuild -b -us -uc
  101.  
  102. # install packages and resolve dependencies
  103. printf "\n\033[7minstall packages and resolve dependencies  \033[0m\n"
  104. sudo dpkg -i $(ls ../*$libfm_version*deb | grep -v dbg)
  105. echo
  106. sudo apt-get install -f
  107. echo
  108. printf "\033[7m"; date "+%a, %m %b %Y %T %z"; printf "\033[0m"
  109.  
  110. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement