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.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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. # UGLY HACK #2, to upgrade from 12.1 to -current you need
  129. # libxz because of lzma compression of newer packages
  130. if [ "$PKG_XZ" != "" -a ! -x "/bin/xz" ]; then
  131. pkg_install "xz is not installed. Installing it." $PKG_XZ
  132. fi
  133. # UGLY HACK #3, to upgrade from 13.0 to -current you need
  134. # coreutils-8.4 has new dependency for the expr program
  135. if [ "$PKG_GMP" != "" -a \( ! -f "/usr/lib/libgmp.la" -a ! -f "/usr/lib64/libgmp.la" \) ]; then
  136. pkg_install "gmp is not installed. Installing it." $PKG_GMP
  137. fi
  138. # UGLY HACK #4, to upgrade from 13.1 to 14 you need
  139. # kmod otherwise would get unbootable machine
  140. if [ "$PKG_KMOD" != "" -a \( ! -f "/lib/libkmod.so.2" -a ! -f "/lib64/libkmod.so.2" \) ]; then
  141. pkg_install "kmod is not installed. Installing it." $PKG_KMOD
  142. fi
  143. for PKG in $UPDATE; do
  144. upgradepkg `basename $PKG`
  145. # UGLY HACK! sed was split from 'bin' package and
  146. # upgrading 'bin' package will cause sed to dissapear
  147. # however sed is used by pkgtools so this hack is needed
  148. # to allow clear 8.1 -> 9.0 upgrading
  149. if [ ! -x "/usr/bin/sed" ]; then
  150. pkg_install "Sed is not installed. Installing it." $PKG_SED
  151. fi
  152. done
  153. # Workaround for aaa_elflibs, for more info see
  154. # slackware-current ChangeLog (Mon Dec 15 17:49:23 PST 2003)
  155. if [ "$PKG_AAAELFLIBS" != "" ]; then
  156. if [ "`ls /var/adm/packages/aaa_elflibs-* 2>/dev/null`" = "" -a \
  157. "`ls /var/adm/packages/elflibs-* 2>/dev/null`" != "" ]
  158. then
  159. pkg_upgrade "Replacing elflibs packaet with aaa_elflibs." $PKG_AAAELFLIBS elflibs
  160. fi
  161. fi
  162. # Workaround for coreutils, for more info see
  163. # slackware-current ChangeLog (Wed May 21 16:05:37 PDT 2003)
  164. if [ "$PKG_COREUTILS" != "" ]; then
  165. if [ "`ls /var/adm/packages/coreutils-* 2>/dev/null`" = "" ]; then
  166. pkg_install "Coreutils package is not installed! Installing it." $PKG_COREUTILS
  167. removepkg fileutils
  168. removepkg textutils
  169. removepkg sh-utils
  170. fi
  171. fi
  172. # Replace modutils with module-init-tools, for more info see
  173. # slackware-current ChangeLog (Thu Sep 4 19:40:01 PDT 2003)
  174. if [ "$PKG_MODULEINITTOOLS" != "" ]; then
  175. if [ "`ls /var/adm/packages/module-init-tools-* 2>/dev/null`" = "" -a \
  176. "`ls /var/adm/packages/modutils-* 2>/dev/null`" != "" ]; then
  177. pkg_upgrade "module-init-tools package is not installed! Installing it." $PKG_MODULEINITTOOLS modutils
  178. fi
  179. fi
  180. # Workaround for utempter, for more info see
  181. # slackware-current ChangeLog (Sun Jun 8 20:53:01 PDT 2003)
  182. if [ "$PKG_UTEMPTER" != "" ]; then
  183. if [ "`ls /var/adm/packages/utempter-* 2>/dev/null`" = "" ]; then
  184. pkg_install "Utempter package is not installed! Installing it." $PKG_UTEMPTER
  185. fi
  186. fi
  187. if [ "$SMART_UPGRADE" = "1" ]; then
  188. echo "===> Finishing upgrades..."
  189. LILO_UPGRADED="0"
  190. KERNEL_UPGRADED="0"
  191. echo $UPDATE | grep lilo- >/dev/null 2>&1 && LILO_UPGRADED="1"
  192. echo $UPDATE | grep kernel- >/dev/null 2>&1 && KERNEL_UPGRADED="1"
  193. if [ "$LILO_UPGRADED" = "1" -o "$KERNEL_UPGRADED" = "1" ]; then
  194. echo " -> lilo or kernel were upgraded. Running '/sbin/lilo'..."
  195. /sbin/lilo
  196. fi
  197. fi
  198. if [ "$REMOTE_DIR_DEL" = "1" ]; then
  199. echo "===> Deleting '${REMOTE_DIR}' directory..."
  200. cd ..
  201. rm -rfv ${REMOTE_DIR}
  202. fi
  203. )