SlackCheck allows users to keep many Slackware machines up to date with the latest packages. All upgrades are performed from single machine though SSH (or RSH). It generates an upgrade script and list of non-standard packages for every machine. https://georgi.unixsol.org/programs/slackcheck/
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.

update_script.sh 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. #!/bin/sh
  2. # Upgrade script template
  3. #
  4. # Copyright (c) 2002-2004 Georgi Chorbadzhiyski, Sofia, Bulgaria
  5. # All rights reserved.
  6. #
  7. # Redistribution and use of this script, with or without modification, is
  8. # permitted provided that the following conditions are met:
  9. #
  10. # 1. Redistributions of this script must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. #
  13. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
  14. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  15. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  16. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  19. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  20. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  21. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  22. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. #
  24. PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
  25. export PATH
  26. # *******************
  27. # THE UPDATE SCRIPT
  28. # *******************
  29. if [ "$GENERATED" != "1" ]; then
  30. echo "Use slcheck.sh to generate upgrade scripts!"
  31. exit
  32. fi
  33. which $DL_PRG >/dev/null 2>&1
  34. if [ $? != 0 ]; then
  35. echo "*** Can't find \"$DL_PRG\" in $PATH. Exiting."
  36. echo
  37. exit 1
  38. fi
  39. if [ "$MD5_CHECK" == "1" ]; then
  40. which md5sum >/dev/null 2>&1
  41. if [ $? != 0 ]; then
  42. echo "*** Can't find \"md5sum\" MD5 sums will not be checked"
  43. echo
  44. MD5_CHECK="0"
  45. fi
  46. fi
  47. if [ "$SIG_CHECK" == "1" ]; then
  48. which gpg >/dev/null 2>&1
  49. if [ $? != 0 ]; then
  50. echo "*** Can't find \"gpg\" digital signatures will not be checked"
  51. echo
  52. SIG_CHECK="0"
  53. fi
  54. fi
  55. if [ "$SIG_CHECK" == "1" ]; then
  56. gpg --list-sigs | grep security@slackware.com >/dev/null
  57. if [ $? != 0 ]; then
  58. echo "*** You don't have the public key of 'security@slackware.com'"
  59. echo "*** Digital signatures can not be verified"
  60. echo "*** Get slackware's public key from here:"
  61. echo "*** http://www.slackware.com/gpg-key"
  62. echo "*** After obtaining the key, execute 'gpg --import gpg-key'"
  63. echo
  64. SIG_CHECK="0"
  65. fi
  66. fi
  67. pkg_install() {
  68. MSG="$1"
  69. PKG="$2"
  70. echo $MSG
  71. $DL_PRG $DL_PRG_OPTS ${DL_HOST}/$PKG
  72. installpkg `basename $PKG`
  73. }
  74. pkg_upgrade() {
  75. MSG="$1"
  76. PKG="$2"
  77. OLD="$3"
  78. echo $MSG
  79. $DL_PRG $DL_PRG_OPTS ${DL_HOST}/$PKG
  80. upgradepkg ${OLD}%`basename $PKG`
  81. }
  82. mkdir ${REMOTE_DIR} 2>/dev/null
  83. (
  84. # Get, verify and update packages
  85. set -e # Halt on any error
  86. cd ${REMOTE_DIR}
  87. if [ "$MD5_CHECK" == "1" ]; then
  88. if [ ! -f CHECKSUMS.md5 ]; then
  89. $DL_PRG $DL_PRG_OPTS ${DL_HOST}/CHECKSUMS.md5
  90. fi
  91. fi
  92. echo "===> Getting packages..."
  93. for PKG in $UPDATE; do
  94. pkgfile=`basename $PKG`
  95. if [ ! -f $pkgfile ]; then
  96. echo " - Getting $PKG"
  97. $DL_PRG $DL_PRG_OPTS ${DL_HOST}/$PKG
  98. else
  99. echo " -> $pkgfile already exists."
  100. fi
  101. if [ "$SIG_CHECK" == "1" ]; then
  102. if [ ! -f $pkgfile.asc ]; then
  103. $DL_PRG $DL_PRG_OPTS ${DL_HOST}/$PKG.asc
  104. fi
  105. fi
  106. done
  107. if [ "$MD5_CHECK" == "1" ]; then
  108. echo "===> Checking MD5 sums..."
  109. for PKG in $UPDATE; do
  110. pkgfile=`basename $PKG`
  111. if [ "$SIG_CHECK" == "1" ]; then
  112. grep /$pkgfile CHECKSUMS.md5 | head -1 | sed -e 's|\./.*/||' > ${pkgfile}.md5
  113. else
  114. grep /$pkgfile CHECKSUMS.md5 | head -1 | sed -e 's|\./.*/||' | grep -v .asc$ > ${pkgfile}.md5
  115. fi
  116. md5sum -c ${pkgfile}.md5
  117. done
  118. fi
  119. if [ "$SIG_CHECK" == "1" ]; then
  120. echo "===> Checking digital signatures..."
  121. for PKG in $UPDATE; do
  122. pkgfile=`basename $PKG`
  123. echo " -> Checking digital signature of $pkgfile:"
  124. gpg --verify ${pkgfile}.asc
  125. done
  126. fi
  127. echo "===> Upgrating packages..."
  128. for PKG in $UPDATE; do
  129. pkgfile=`basename $PKG | sed -e 's|\.t[a-z]z$||'`
  130. upgradepkg ${pkgfile}
  131. # UGLY HACK! sed was split from 'bin' package and
  132. # upgrading 'bin' package will cause sed to dissapear
  133. # however sed is used by pkgtools so this hack is needed
  134. # to allow clear 8.1 -> 9.0 upgrading
  135. if [ ! -x "/usr/bin/sed" ]; then
  136. pkg_install "Sed is not installed. Installing it." $PKG_SED
  137. fi
  138. done
  139. # Workaround for aaa_elflibs, for more info see
  140. # slackware-current ChangeLog (Mon Dec 15 17:49:23 PST 2003)
  141. if [ "$PKG_AAAELFLIBS" != "" ]; then
  142. if [ "`ls /var/adm/packages/aaa_elflibs-* 2>/dev/null`" = "" -a \
  143. "`ls /var/adm/packages/elflibs-* 2>/dev/null`" != "" ]
  144. then
  145. pkg_upgrade "Replacing elflibs packaet with aaa_elflibs." $PKG_AAAELFLIBS elflibs
  146. fi
  147. fi
  148. # Workaround for coreutils, for more info see
  149. # slackware-current ChangeLog (Wed May 21 16:05:37 PDT 2003)
  150. if [ "$PKG_COREUTILS" != "" ]; then
  151. if [ "`ls /var/adm/packages/coreutils-* 2>/dev/null`" = "" ]; then
  152. pkg_install "Coreutils package is not installed! Installing it." $PKG_COREUTILS
  153. removepkg fileutils
  154. removepkg textutils
  155. removepkg sh-utils
  156. fi
  157. fi
  158. # Replace modutils with module-init-tools, for more info see
  159. # slackware-current ChangeLog (Thu Sep 4 19:40:01 PDT 2003)
  160. if [ "$PKG_MODULEINITTOOLS" != "" ]; then
  161. if [ "`ls /var/adm/packages/module-init-tools-* 2>/dev/null`" = "" -a \
  162. "`ls /var/adm/packages/modutils-* 2>/dev/null`" != "" ]; then
  163. pkg_upgrade "module-init-tools package is not installed! Installing it." $PKG_MODULEINITTOOLS modutils
  164. fi
  165. fi
  166. # Workaround for utempter, for more info see
  167. # slackware-current ChangeLog (Sun Jun 8 20:53:01 PDT 2003)
  168. if [ "$PKG_UTEMPTER" != "" ]; then
  169. if [ "`ls /var/adm/packages/utempter-* 2>/dev/null`" = "" ]; then
  170. pkg_install "Utempter package is not installed! Installing it." $PKG_UTEMPTER
  171. fi
  172. fi
  173. if [ "$SMART_UPGRADE" = "1" ]; then
  174. echo "===> Finishing upgrades..."
  175. LILO_UPGRADED="0"
  176. KERNEL_UPGRADED="0"
  177. echo $UPDATE | grep lilo- >/dev/null 2>&1 && LILO_UPGRADED="1"
  178. echo $UPDATE | grep kernel- >/dev/null 2>&1 && KERNEL_UPGRADED="1"
  179. if [ "$LILO_UPGRADED" = "1" -o "$KERNEL_UPGRADED" = "1" ]; then
  180. echo " -> lilo or kernel were upgraded. Running '/sbin/lilo'..."
  181. /sbin/lilo
  182. fi
  183. fi
  184. if [ "$REMOTE_DIR_DEL" = "1" ]; then
  185. echo "===> Deleting '${REMOTE_DIR}' directory..."
  186. cd ..
  187. rm -rfv ${REMOTE_DIR}
  188. fi
  189. )