Guest User

Untitled

a guest
Jul 16th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.26 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # Copyright 2003 by Tony Brijeski
  4. #
  5. # Licensed under the GPL2 License
  6. #
  7. #
  8. # This little script is used to repackage a Slackware package
  9. # that is installed on your system back into the original tgz package.
  10. #
  11. # Main uses are for repacking your customizations or for making a backup
  12. # of the package before removing it from the system so you can reinstall
  13. # it if you wish (nobody is perfect!).
  14. #
  15. # This version only works on 1 package at a time
  16. #
  17. #
  18.  
  19. lodir="`pwd`"
  20.  
  21. if [ -a /tmp/retgz.tmp ]; then
  22. rm -f /tmp/retgz.tmp
  23. fi
  24.  
  25.  
  26. if [ "$1" = "" ]; then
  27. echo "Usage - retgz package-name "
  28. echo " "
  29. echo " package-name is the entry in /var/log/packages"
  30. echo " "
  31. exit 1
  32. fi
  33.  
  34. if [ -a /var/log/packages/$1 ]; then
  35. cd /
  36. mkdir /install
  37.  
  38. if [ -a /var/log/scripts/$1 ]; then
  39. cp /var/log/scripts/$1 /install/doinst.sh
  40. fi
  41.  
  42. cat /var/log/packages/$1 | grep ":" >>/install/slack-desc
  43. cat /var/log/packages/$1 | grep "/" >>/tmp/retgz.tmp
  44.  
  45. if [ -a /install/doinst.sh ]; then
  46. tar cvpf $lodir/$1 ./install/doinst.sh ./install/slack-desc
  47. else
  48. tar cvpf $lodir/$1 ./install/slack-desc
  49. fi
  50.  
  51.  
  52.  
  53. cat /tmp/retgz.tmp | while read LINE; do
  54. if [ ! "$LINE" = "" ]; then
  55. tst1=`echo "$LINE" | grep "doinst.sh"`
  56. tst2=`echo "$LINE" | grep "slack-desc"`
  57. tst3=`echo "$LINE" | awk -F/ '{print $NF}'`
  58. if [ "$tst1" = "" ] && [ "$tst2" = "" ]; then
  59. if [ ! "$tst3" = "" ]; then
  60. tar rvpf $lodir/$1 ./$LINE
  61. fi
  62. fi
  63. fi
  64. done
  65.  
  66. else
  67. echo "Package $1 not installed"
  68. exit 1
  69. fi
  70.  
  71.  
  72. rm -rf /install
  73. rm -f /tmp/retgz.tmp
  74. cd $lodir
  75.  
  76. #gzip -S .tgz $1
  77. xz -S .txz $1 &
  78. echo " Package $1.txz is in $lodir "
  79. exit 0
Add Comment
Please, Sign In to add comment