vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I am curious what different approaches people take to keeping slackware up-to-date, and if the system I have worked out is of any interest to anyone besides me ;-) I'd be happy to post my scripts for this if anyone wants me to. In a nutshell, I set aside two partitions as root partitions and I switch between them as I upgrade. I simply start-over-from-scratch on the root partition I am not using. The key to making it all work is having a single script you can run that takes a newly installed slackware root partition to a fully configured state. The rest of this post fills in some of the specific details of how I do it. I have a separate partition for all of my user-data, and the home directory for all user accounts resides there and not on the either root so blowing away a root partition doesn't kill any user data. I have captured the entire process in a few scripts I can run and I can continue to use my computer while they are running. When they finish, I reboot into the other root partition with my downtime consisting of a single reboot (well, assuming I have worked out all the bugs in my scripts, of course). For concretness, let's say my partitions are as follows: device mount-point (root1) /dev/hda1 / (root2) /dev/hda2 /usr/root2 (root3) /dev/hda3 /usr/drive2 Say I am booted in root1, which has slackware-9.1 installed and I want to upgrade to slackware-10.0. I have the entire slackware 10.0 distribution sitting in /usr/drive2/slackware/slackware-10.0 (/usr/drive2 is where I mount my user-data partitions). I run a script that does, essentially, this: unmount /dev/hda2 mkreiserfs -q /dev/hda2 mount /dev/hda2 /usr/root2 cd /usr/drive2/slackware/slackware-10.0/slackware/a export ROOT=/usr/root2 installpkg aaa_base-10.0.0-noarch-1.tgz installpkg *.tgz cd ../ap installpkg *.tgz .... cd ../y installpkg *.tgz After installing all packages, it goes to /usr/drive2/slackware/slackware-10.0/patches and runs upgradepkg on every (non-kernel) tgz it finds. Finally, it runs ldconfig and several post install programs/scripts through chroot on /usr/root2. Essentially the script is doing what I would use pkgtool to do. I then have another script to copy any system-wide configuration files (like /etc/hosts, /etc/rc.d/rc.inet1, ...) onto the target root and run any config commands (like sambapasswd, useradd, usermod, ...) necessary to take a newly created slackware root partition up to a fully configured, for my purposes, state. I have debugged/automated these two scripts to the point where I can start them running and take it for granted that my next reboot will be into freshly setup slackware root partition. Am I a nutcase, or does anyone else do this? I have 4 machines at home and once I audit my existing config files for a new version of slackware, upgrading is as easy as rsyncing /usr/drive2/slackware to the other 3 and running my script. I have several machines at work I manage the same way also. Chris Marshall |
| |||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 _.-In alt.os.linux.slackware, christopherlmarshall wrote the following -._ > In a nutshell, I set aside two partitions as root partitions and I > switch between them as I upgrade. I simply start-over-from-scratch on > the root partition I am not using. <snip> > Am I a nutcase, or does anyone else do this? I love automation. I automate things all the time. But your bit here is going to bit you in the but one day. When major upgrades happen in applications that change the config files in /etc/ you are going to end up with a system that is going to cause some problems. Not today. But some day. If you could find a way to build an AI that can diff old and new /etc files and figure out how go go past major revision hurdles then it would work better. But only an AI could do it. - -- .-')) asciipr0n.com/fp ('-. | It's a damn poor mind that ' ..- .:" ) ( ":. -.. ' | can only think of one way to ((,,_;'.;' UIN=66618055 ';. ';_,,)) | spell a word. ((_.YIM=Faux_Pseudo :._)) | - Andrew Jackson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFB23fASJec2PH9pbURArXiAJ4rjnM0ZGE7OPVCfDNbQQ Ife6FscgCcCoqf T8oDMe3nq4wlV16PT+nk8kY= =fU5f -----END PGP SIGNATURE----- |
| |||
| >I love automation. I automate things all the time. But your bit here >is going to bit you in the but one day. When major upgrades happen in >applications that change the config files in /etc/ you are going to >end up with a system that is going to cause some problems. Well, whenever I make major transitions (like 9.1 to 10.0), I review my config files against the unmodified files in the new major version. I usually take the new rc.modules file, for example, and add whatever modules I need to the end of it rather than use my old rc.modules file and trust it to work. I have appended the script I use to install slackware from a harddrive directory to a root partition. Chris Marshall #!/bin/bash # this script installs the entire slackware distribution to a target # directory # we typically install all packages (except kdei) series="a ap d e f gnome k kde l n t tcl x xap y" aaa_base="aaa_base-10.0.0-noarch-1.tgz" export slack_dir="$1" export ROOT="$2" if [ -z "$2" ] ; then echo "usage: install_slack-10.0 <slack dir> <target root dir>" exit 1 fi if ! cd $slack_dir ; then echo "couldn't cd into slackware directory $slack_dir" exit 1 fi installpkg a/$aaa_base for dset in $series; do if ! cd $dset ; then echo "couldn't find ${slack_dir}/${series}" exit 1 fi packages=*.tgz for pkg in $packages; do if [ $pkg != "$aaa_base" ] ; then echo "installing $pkg" installpkg $pkg else echo "skipping $pkg" fi done cd .. done # apply non-kernel patches find ${slack_dir}/../patches/packages -type d -print | ( cdir=$(pwd) while read dir ; do cd $dir packages=$(ls *.tgz | grep -v kernel) for pkg in $packages ; do echo "upgrading $pkg" upgradepkg $pkg done done ) # install specific kernel # these three lines might have to be changed after a new rsync of the slackware # distribution #installpkg ${slack_dir}/../patches/packages/kernel-ide-2.4.24-i486-2.tgz #installpkg ${slack_dir}/../patches/packages/kernel-modules-2.4.24-i486-1.tgz #installpkg ${slack_dir}/../patches/packages/kernel-source-2.4.24-noarch-2.tgz # do standard slackware post-installpkg config echo "" echo "" echo "Slackware post-installpkg config" echo "" echo "running ldconfig" chroot $ROOT /sbin/ldconfig 1>/dev/null 2>/dev/null echo "" echo "running X font cataloger" chroot $ROOT /usr/X11R6/bin/fc-cache -f 1 > /dev/null 2>/dev/null echo "" echo "running GNOME scrollkeeper indexer" chroot $ROOT /usr/bin/scrollkeeper-update 2>/dev/null echo "" echo "running gstreamer plug-in setup" chroot $ROOT /usr/bin/gst-register 1>/dev/null 2>/dev/null echo "Setting localtime to Eastern Standard Time" echo "localtime" > ${ROOT}/etc/hardwareclock ln -sf /usr/share/zoneinfo/US/Eastern ${ROOT}/etc/localtime |
| |||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 _.-In alt.os.linux.slackware, christopherlmarshall wrote the following -._ > #!/bin/bash > # this script installs the entire slackware distribution to a target > # directory > > # we typically install all packages (except kdei) # there should be a getopts loop here for command line editing of this # list > series="a ap d e f gnome k kde l n t tcl x xap y" > aaa_base="aaa_base-10.0.0-noarch-1.tgz" > export slack_dir="$1" export ROOT="$2" > if [ -z "$2" ] ; then > echo "usage: install_slack-10.0 <slack dir> <target root dir>" > exit 1 > fi # the below is really bad code # it should test to see if $slack_dir /is/ a dir # and report if it isn't before reporting that # you can't cd into it. # also note that $slack_dir is not quoted which can also be an issue. > if ! cd $slack_dir ; then > echo "couldn't cd into slackware directory $slack_dir" > exit 1 > fi # Note in the two if's above that you are using two different styles # of test conditional. The same kind should always be used because as # a script/project gets larger this can be a big issue in debugging # # long befor now there should be a check to make # sure you are running as root. > installpkg a/$aaa_base > > for dset in $series; do > if ! cd $dset ; then > echo "couldn't find ${slack_dir}/${series}" > exit 1 > fi > packages=*.tgz > for pkg in $packages; do > if [ $pkg != "$aaa_base" ] ; then # note in the if before this one you use ${} and here you use "$" # this should also be uniform throught the script for scaling reasons # and if you are going to ${} one var you should do it to all of them > echo "installing $pkg" > installpkg $pkg > else > echo "skipping $pkg" > fi > done > cd .. > done > > # apply non-kernel patches # this could be made much more readable with an array and more # readable output redirection find ${slack_dir}/../patches/packages -type d -print | \ (cdir=$(pwd) ; while read dir ; do cd $dir packages=$(ls *.tgz | grep -v kernel) for pkg in $packages ; do echo "upgrading $pkg" upgradepkg $pkg done done) # This section seems to have the commands commented out: > # install specific kernel > # these three lines might have to be changed after a new rsync of the > # slackware > # distribution > #installpkg installpkg ${slack_dir}/../patches/packages/kernel-ide-2.4.24-i486-2.tgz > #installpkg installpkg ${slack_dir}/../patches/packages/kernel-modules-2.4.24-i486-1.tgz > #installpkg installpkg ${slack_dir}/../patches/packages/kernel-source-2.4.24-noarch-2.tgz > > # do standard slackware post-installpkg config # cut down on echo calls by using it more wisely # thus this: > echo "" > echo "" > echo "Slackware post-installpkg config" # Becomes this: echo -e "\n\nSlackware post-installpkg config" echo -e "\nrunning ldconfig" > chroot $ROOT /sbin/ldconfig 1>/dev/null 2>/dev/null # you probibly do not want to redirect error on that command. # if something goes wrong there you will want to know about it. # so much so that you may want to test its return code if [[ "${?}x" != "0x" ]] ; then echo -e "chroot did not exit cleanly.\n Bailing" exit 1 fi # in fact you will probibly want that on all the chroot commands # in which case a function would be good. # stick this near the top of the script: did_it_die() { if [[ "${?}x" != "0x" ]] ; then echo -e "chroot did not exit cleanly.\n Bailing" exit 1 fi } > echo "" > echo "running X font cataloger" > chroot $ROOT /usr/X11R6/bin/fc-cache -f 1 > /dev/null 2>/dev/null did_it_die > echo "" > echo "running GNOME scrollkeeper indexer" > chroot $ROOT /usr/bin/scrollkeeper-update 2>/dev/null did_it_die > echo "" > echo "running gstreamer plug-in setup" > chroot $ROOT /usr/bin/gst-register 1>/dev/null 2>/dev/null did_it_die > echo "Setting localtime to Eastern Standard Time" > echo "localtime" > ${ROOT}/etc/hardwareclock > ln -sf /usr/share/zoneinfo/US/Eastern ${ROOT}/etc/localtime Streamlined, indented, commented. - -- .-')) asciipr0n.com/fp ('-. | It's a damn poor mind that ' ..- .:" ) ( ":. -.. ' | can only think of one way to ((,,_;'.;' UIN=66618055 ';. ';_,,)) | spell a word. ((_.YIM=Faux_Pseudo :._)) | - Andrew Jackson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFB3DPgSJec2PH9pbURAp/OAJ41wEURsTk69ofh45rLGMlDjcQYAACfYx8i OjAtCBMpx5okMAeLrxZvkJ4= =3Z0k -----END PGP SIGNATURE----- |
| |||
| Faux_Pseudo: I realize I am not the best bash script writer. Thank you for pointing out the many error handling and other logical flaws. I'll review them before I attempt to publish my script. Well, assuming I can convince myself it is worth writing up. What do you think of the general approach of the script, though, as an installation/update method for slackware? Does the concept have any merit to you? Is it fatally flawed in some way? Do you use a similar mechanism to update your machines or another approach entirely? Chris Marshall p.s. The kernel package install lines were indeed commented out. That's because I would not normally want those lines uncommented but occassionaly I might so I left them there as a reminder. |
| ||||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 _.-In alt.os.linux.slackware, christopherlmarshall wrote the following -._ > What do you think of the general approach of the script, though, as an > installation/update method for slackware? I don't know that a chroot script is the way to go. I don't see the advantage other than the fact that you can install a new slack without much in the way of downtime. When I install I just pop the CD and prep for a day of potential problems. Not because I expect a day of problems but because it is good a reason to sit back and take some time for yourself. > Does the concept have any merit to you? Any new method of installing has merit. But marit and usefullness are sometimes very different. > Is it fatally flawed in some way? I already mentioned the bigest issue I can think of. The /etc dir could be a major problem between major revisions. /var might also be an dissue if you aren't carefull but not as much of one as /etc. > Do you use a similar mechanism to update your machines or another > approach entirely? I tar up /etc and put it someplace safe. I reboot with the install cd and take it from there. Normally I do every thing from scratch and only pull out the /etc to see if I forgot something. But my situtaion is different since I seem to have been unable to keep the same computer for more than a 12 month period over the last few years. Hd failure, stolen laptops, dead laptop displays and other things have prevented me from even doing one major revision upgrade in the last 4 years. Maybe when things settle down I will try out your way. > p.s. The kernel package install lines were indeed commented out. > That's because I would not normally want those lines uncommented but > occassionaly I might so I left them there as a reminder. Ah. Thanks for clearing that up. - -- .-')) asciipr0n.com/fp ('-. | It's a damn poor mind that ' ..- .:" ) ( ":. -.. ' | can only think of one way to ((,,_;'.;' UIN=66618055 ';. ';_,,)) | spell a word. ((_.YIM=Faux_Pseudo :._)) | - Andrew Jackson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFB3HpWSJec2PH9pbURAuPPAJ99gvllw/bFkAA/wkS5sk1MyFhfhQCfSBlZ McmgOSORgzfwDSKo3CK5C0w= =BhHI -----END PGP SIGNATURE----- |