Re: another way to keep Slackware up-to-date -----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----- |