Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-19-2008, 05:46 PM
christopherlmarshall@yahoo.com
 
Posts: n/a
Default another way to keep Slackware up-to-date

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-19-2008, 05:47 PM
Faux_Pseudo
 
Posts: n/a
Default Re: another way to keep Slackware up-to-date

-----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-----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-19-2008, 05:47 PM
christopherlmarshall@yahoo.com
 
Posts: n/a
Default Re: another way to keep Slackware up-to-date

>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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-19-2008, 05:48 PM
Faux_Pseudo
 
Posts: n/a
Default 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-----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-19-2008, 05:48 PM
christopherlmarshall@yahoo.com
 
Posts: n/a
Default Re: another way to keep Slackware up-to-date

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.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-19-2008, 05:48 PM
Faux_Pseudo
 
Posts: n/a
Default Re: another way to keep Slackware up-to-date

-----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-----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:08 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
UnixAdminTalk.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773