LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 01-04-2005, 10:58 AM   #1
halo14
Senior Member
 
Registered: Apr 2004
Location: Surprise, AZ
Distribution: Debian | CentOS | Arch
Posts: 1,103

Rep: Reputation: 45
How to use rsync and upgradepkg...


Hey, I just did a new install of slackware-current 1/3/05 (courtesy of 'ananke' from #slackware)

and I'm trying to figure out how to use rsync and then check and see about doing an upgradepkg * to stay up to date...

I want to do this because it seems like the "correct" way from what everyone is saying... and that swaret and slapt-get are both notorious for borking systems to an unusable state...

If someone could please post a HOWTO do this.. I think it would be of great use to myself and a number of other users.. thanks a lot..
 
Old 01-04-2005, 11:27 AM   #2
dhave
Member
 
Registered: Oct 2004
Location: still outside the Matrix
Distribution: Arch, formerly Gentoo and Slackware
Posts: 438

Rep: Reputation: 31
I'm no expert (four whole months with Slackware, heh), but isn't it better to handle the updates manually so that you have a chance to read the comments in the changelog? It helps me to know my system a lot better. Also, I've realized that there's a lot of stuff that I really don't need now, but if I've read the changelog, I at least know it's there. And on Current, occasionally there's an update that comes with a caveat.

On the other hand, I'd still like to know more about the semi-automated rsync system, too, so I hope somebody responds with a good How-To.

Last edited by dhave; 01-04-2005 at 01:10 PM.
 
Old 01-04-2005, 11:53 AM   #3
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 242Reputation: 242Reputation: 242
There is a rsync howto in this site :
http://www.linuxquestions.org/questi...ticle&artid=80
 
Old 01-04-2005, 01:09 PM   #4
cathectic
Member
 
Registered: Sep 2004
Location: UK, Europe
Distribution: Slackware64
Posts: 761

Rep: Reputation: 34
Quote:
I want to do this because it seems like the "correct" way from what everyone is saying... and that swaret and slapt-get are both notorious for borking systems to an unusable state...
You can use the automated tools (I use swaret, and prefer it over slackpkg. I haven't tried any of the others yet), *provided* you read the ChangeLog beforehand (which you should do anyway with any update of Slackware). Many problems with updates come from people who run these update tools blindly, miss vital packages, or don't follow Pat's instructions for changes that need to be made (such as the notorious 'Keyboard' to 'kbd' driver change from Xorg 6.7 to 6.8.1, which many people never saw about as they never read the ChangeLog.) These tools are an aid to updating if used wisely, but they are no replacement for doing your homework before and understanding what you're going to upgrade, and what changes you will need to make afterwards.
 
Old 01-04-2005, 05:15 PM   #5
ringwraith
Senior Member
 
Registered: Sep 2003
Location: Indiana
Distribution: Slackware-current
Posts: 1,244

Rep: Reputation: 47
if you go to alt.os.linux.slackware on groups.google.com and search there, iirc there are some scripts you can run in conjunction with rsync. i still prefer to read the changelogs, use wget and proceed according to Pat's notes.
 
Old 01-04-2005, 07:41 PM   #6
PDock
Member
 
Registered: Aug 2004
Distribution: Slack10 & curr. tried numerous
Posts: 189

Rep: Reputation: 36
Fully support posts about need to read changelog first.

I do have a script which I only use with stable (but can be used with current [unwisely] ). Basic steps are: Mirror (rsync) Slackware ; in new /ourpatches directory link patches you want autoinstalled; modified init scripts check that directory on the server using a copy of upgradepkg called patchpkg which just downloads the package (see below); changes to init 1, uses Pat's upgradepkg to install; then reboots that computer. Note: this is designed for desktops that are turned on and off rather than servers or people crazy about uptime.


Here's the diff file which is 80% of the task just add a few more scripts and you don't need mine.
Code:
--- /sbin/upgradepkg 2004-05-30 00:22:41.000000000 +0000
+++ /sbin/patchpkg 2004-09-27 12:06:11.000000000 +0000
@@ -106,6 +106,10 @@
     # but don't actually perform the upgrades.
     DRY_RUN="true"
     shift 1
+  elif [ "$1" = "--patch" ]; then
+    # We're adding a --patch  mode that finds packages for networked hosts
+    PATCH="true"
+    shift 1
   else # no more args
     break;
   fi
@@ -174,15 +178,17 @@
 
 if [ ! -r $ROOT/var/log/packages/$OLD ]; then
   if [ ! "$INSTALL_NEW" = "yes" ]; then
-    if [ "$DRY_RUN" = "true" ]; then
-      echo "$OLD would not be upgraded (no installed package named $SHORT)."
-    else  
-      echo
-      echo "Error:  there is no installed package named $OLD."
-      echo "        (looking for $ROOT/var/log/packages/$OLD)"
-      echo
-    fi
+    if [ ! "$PATCH" = "true" ]; then #suppress error msg:
+      if [ "$DRY_RUN" = "true" ]; then
+        echo "$OLD would not be upgraded (no installed package named $SHORT)."
+      else  
+        echo
+        echo "Error:  there is no installed package named $OLD."
+        echo "        (looking for $ROOT/var/log/packages/$OLD)"
+        echo
+      fi
     ERRCODE=1
+    fi
   else # --install-new was given, so install the new package:
     if [ "$DRY_RUN" = "true" ]; then
       echo "$NEW would be installed (new package)."
@@ -231,6 +237,22 @@
     continue; 
   fi
 fi
+  
+# Check if in patch mode. If so then copy the package, shift 1 and continue-
+# loopback to check for more packages. We do NOT fall thru to actually do 
+# the upgrade.
+
+if [ "$PATCH" = "true" ]; then
+  # Check/create directory
+  if [ ! -d $TMP/patch ]; then
+    rm -rf $TMP/patch # make sure it's not a symlink or something stupid
+    mkdir $TMP/patch
+    chmod 700 $TMP/patch # no need to leave it open
+  fi
+cp $INCOMINGDIR/$NEW.tgz $TMP/patch
+     shift 1
+     continue;
+fi
 
 # Showtime.  Let's do the upgrade.  First, we will rename all the
 # installed packages with this basename to make them easy to remove later:
oh heck here's rc.patch
Code:
#!/bin/sh
# Find/apply patches on a local network server.
#
# This is a script to upgrade small network/office installations
# for any security patches.
#
# Written for Slackware Linux by Patrick J. Volkerding <volkerdi@slackware.com>.

usage() {
  cat << EOF
Usage: rc.patch find|apply|usage

HOWEVER YOU MOST LIKELY DON'T WANT TO BE DOING THIS!!

rc.patch automates package upgrades for small networks.
rc.patch -find is initiated from rc.inet2.
rc.patch -apply is initiated from rc.K.
You may need to edit the mount point located at the beginning of this script.
You need to edit /etc/fstab to include:
Ourserver:/path/to/slack/ourpatches /mnt/patches nfs noauto,ro,rsize=8192,
   wsize=8192,timeo=14,intr
Of course /etc/exports on the server must also be modified.

It is expected an administrator will create a server directory /ourpatches.
AFTER reviewing the changelog or other upgrade texts, if a package
is appropriate for automated upgrading then and only then
will the administrator copy that package from /patches to /ourpatches.

If a patch, for a package already on the users computer, is found; the script
will: copy the package to the local drive; drop to init 1; apply the upgrade;
delete the package from the local drive; then reboot.

Symbolic links can be used on the server if space is a problem but they are
difficult to set up correctly. Assuming you use rsync with delete to obtain 
upgrades/patches then you would create /ourpatches at the same level as /patches.
You must --exclude ourpatches/ when syncing or the directory will be deleted.
The symbolic link can not be absolute but must be in the form of
../patches/nameofpatch.tgz. The MOUNTPNT is set to the level above /patches and
/ourpatches, and cd $ MOUNTPNT needs to be changed to cd $ MOUNTPNT/ourpatches. 
NOTE: there is no space between $ and MOUNTPNT (shown this way to avoid substitution)

EOF
}

#Edit the next line if needed
MOUNTPNT=/home/ftp/pub/Slackware-10.0

#This TMP file must be the same as shown in /sbin/upgradepkg
TMP=/var/log/setup/tmp


patches_find() {
  # Sanity checks.  Exit if there's no MOUNTPNT, or its not
  # defined in /etc/fstab.
  if [ ! -d $MOUNTPNT ]; then # no mount directory, exit:
    echo $MOUNTPNT ' not a valid mount point.'
    exit
  elif grep $MOUNTPNT /etc/fstab 1> /dev/null 2> /dev/null ; then 
      true # mount defined, continue:
    else 
      echo $MOUNTPNT ' not in /etc/fstab.'
      exit
  fi
  
  if grep $MOUNTPNT /proc/mounts 1> /dev/null 2> /dev/null ; then
    true # MOUNTPNT is already mounted, continue:
  else # MOUNTPNT is defined so try and mount, continue:
    mount $MOUNTPNT 
  fi
  
  if grep $MOUNTPNT /proc/mounts 1> /dev/null 2> /dev/null ; then
    true # MOUNTPNT was successfully mounted, continue:
  else # MOUNTPNT :
    echo $MOUNTPNT ' defined in /etc/fstab does not mount; check export file'
    exit
  fi

  # If using symbolic links then edit next line to: cd $MOUNTPNT/ourpatches
  cd $MOUNTPNT/ourpatches
  /sbin/patchpkg --patch *.tgz
  cd
  umount $MOUNTPNT

  # Sanity check. No TMP/patch directory exit
  if [ ! -d $TMP/patch ]; then 
    return
  fi
  init 1
}

patches_apply() {
  # Sanity check. No TMP/patch directory exit
  if [ ! -d $TMP/patch ]; then 
    return
  fi
  cd $TMP/patch
  /sbin/upgradepkg *.tgz
  cd /
  rmdir --ignore-fail-on-non-empty $TMP/patch
  shutdown -r now
}

case "$1" in
'find')
  patches_find
  ;;
'apply')
  patches_apply
  ;;
'usage')
  usage
  ;;
*)
  usage
  ;;
esac
Still credit Pat cause his great scripts enabled writting this. Has been offered to Pat but was declined which is fine.
ppd
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Rsync Upload to Linux Rsync - permissions inspleak Linux - Software 0 10-12-2004 02:49 PM
Does upgradepkg keep filepermissions? Worstje Slackware 4 06-19-2004 09:07 AM
question about upgradepkg on slackware 9.1 artistik Linux - Software 3 01-31-2004 11:33 PM
upgradepkg on mozilla ivansv Slackware 2 12-29-2003 10:51 AM
upgradepkg problem strudli Linux - Software 0 09-10-2003 02:05 AM


All times are GMT -5. The time now is 09:45 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration