The script is included below. Just boot from CD as usual, and run the
script instead of 'setup'. Of course, you'll have to adjust to your
taste. It emulates what you would get from 'setup', though without
comments and unnecessary fluffs.
It's not for beginner, and there is minimal error checking. But, since
you're doing fresh install, you can always re-install if something goes
wrong.
--
William Park, Open Geometry Consulting, <openge...@yahoo.ca>
Linux solution for data management and processing.
#! /bin/sh
# Macros and functions.
rmln () { # Usage: rmln from to
rm -rf $2 && ln -sf $1 $2
}
###############################################################################
#
# Partition and install the Slackware series from CD.
#
###############################################################################
( echo -ne "n\np\n1\n\n+1000M\n" # /dev/hda1 --> 1GB swap
echo -ne "n\np\n2\n\n+6000M\n" # /dev/hda2 --> 6GB /
echo -ne "t\n1\n82\nw\n"
) | fdisk /dev/hda
mkswap /dev/hda1 # swap
swapon /dev/hda1
mke2fs -c /dev/hda2 # /
mount /dev/hda2 /mnt
mount /dev/hdc /cdrom # actually, /var/log/mount
cd /cdrom/slackware
for p in [a-z]*; do # a, ap, ..., y
installpkg -root /mnt -priority ADD $p/*.tgz
done
cat > /mnt/etc/rc.d/rc.keymap << EOF
#! /bin/sh
if [ -x /usr/bin/loadkeys ]; then
/usr/bin/loadkeys us.map
fi
EOF
cat > /mnt/etc/fstab << EOF
/dev/hda1 swap swap defaults 0 0
/dev/hda2 / ext2 defaults 1 1
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
EOF
rmln hdc /mnt/dev/cdrom
rmln hdc /mnt/dev/dvd
# chroot /mnt /usr/bin/passwd root
###############################################################################
#
# Configure the system:
# cd /mnt
# for p in ./var/log/setup/setup.*; do
# $p /mnt /dev/hda2
# done
#
###############################################################################
# setup.05.fontconfig
#
chroot /mnt /sbin/ldconfig
chroot /mnt /usr/X11R6/bin/fc-cache
# setup.70.install-kernel
#
cp /cdrom/kernels/bare.i/bzImage /mnt/boot/vmlinuz
# setup.80.make-bootdisk
# - not needed, since we can boot from CD.
# setup.90.modem-device
#
rmln ttyS0 /mnt/dev/modem
# setup.hotplug
#
chmod -x /mnt/etc/rc.d/rc.hotplug
# setup.liloconfig
#
cat > /mnt/etc/lilo.conf << EOF
boot = /dev/hda
delay = 100
vga=normal # or, 'ask' (80x25)
# vga=791 # VESA framebuffer console @ 1024x768x64k (128x48)
# vga=790 # VESA framebuffer console @ 1024x768x32k (128x48)
# vga=773 # VESA framebuffer console @ 1024x768x256 (128x48)
# vga=788 # VESA framebuffer console @ 800x600x64k (100x37)
# vga=787 # VESA framebuffer console @ 800x600x32k (100x37)
# vga=771 # VESA framebuffer console @ 800x600x256 (100x37)
# vga=785 # VESA framebuffer console @ 640x480x64k (80x30)
# vga=784 # VESA framebuffer console @ 640x480x32k (80x30)
# vga=769 # VESA framebuffer console @ 640x480x256 (80x30)
image = /boot/vmlinuz # Linux
root = /dev/hda2
label = bare.i
read-only
# other = /dev/hda1 # Windows
# label = win
# table = /dev/hda
EOF
lilo -r /mnt
# setup.mouse
#
rmln psaux /mnt/dev/mouse # or, 'input/mice' for usb mouse
cat > /mnt/etc/rc.d/rc.gpm << EOF
#! /bin/sh
case "$1" in
stop)
echo "Stopping gpm..."
/usr/sbin/gpm -k
;;
restart)
echo "Restarting gpm..."
/usr/sbin/gpm -k
sleep 1
/usr/sbin/gpm -m /dev/mouse -t ps2
;;
*)
echo "Starting gpm..."
/usr/sbin/gpm -m /dev/mouse -t ps2
;;
esac
EOF
# setup.netconfig
#
cat > /mnt/etc/rc.d/rc.inet1.conf << EOF
IPADDR=( 192.168.1.1 ) # array variables
NETMASK=( 255.255.255.0 )
USE_DHCP=( )
DHCP_HOSTNAME=( )
GATEWAY=""
DEBUG_ETH_UP="no"
EOF
cat > rc.netdevice << EOF
/sbin/modprobe 3c59x
EOF
cd /mnt/etc
cat > networks << EOF
loopback 127.0.0.0
localnet 192.168.1.0
EOF
cat > hosts << EOF
127.0.0.1 localhost
192.168.1.1 node1.example.net node1
EOF
cat > resolv.conf << EOF
search example.net
nameserver 127.0.0.1
EOF
cat > HOSTNAME << EOF
node1.example.net
EOF
# setup.services
#
while read mode rc; do
chmod $mode /mnt/etc/rc.d/$rc
done << EOF
-x rc.atalk
+x rc.bind
-x rc.cups
-x rc.httpd
+x rc.inetd
-x rc.ip_forward
-x rc.lprng
-x rc.mysqld
-x rc.pcmcia
+x rc.portmap
-x rc.samba
+x rc.sendmail
-x rc.sshd
+x rc.gpm
+x rc.netdevice
EOF
# setup.setconsolefont
#
cat > /mnt/etc/rc.d/rc.font << EOF
#! /bin/sh
setfont -v
EOF
# setup.timeconfig
#
rmln /usr/share/zoneinfo/Canada/Eastern /mnt/etc/localtime
cat > /mnt/etc/hardwareclock << EOF
localtime
EOF
# setup.xwmconfig
#
rmln xinitrc.fvwm95 /mnt/etc/X11/xinit/xinitrc
On 10 Nov 2003 21:59:09 GMT, William Park <openge...@yahoo.ca>
wrote:
>Menu is okey for installing once or twice. But, I need a way to install
>Slackware on many many machines; and, this means non-interactively.
>After dissecting 'setup' scripts and its friends, I've come up with a
>script that will
> - partition /dev/hda (1GB swap, 6GB /)
> - install all packages from CD to /
> - configure the system (ie. /etc/fstab, /etc/rc.d/*, ...)
Here is a simpler (and faster) way to accomplish the same thing over a
network:
rm /etc/hosts
echo "127.0.0.1 localhost" > /etc/hosts
echo "192.168.0.254 fakehost" >> /etc/hosts
ifconfig lo 127.0.0.1 up
ipconfig eth0 192.168.0.254 up
Assuming Master Linux box (from where you want to clone) is up and
running with IP 192.168.0.1.
target% nc -l -p 9000 | dd of=/dev/sda
(Replace /dev/sda with actual drive on your target machine)
master% dd if=/dev/sda | nc 192.168.0.254 9000
(Replace /dev/sda with actual drive on your master machine)
see http://www.rajeevnet.com/hacks_hints/os_clone/os_cloning.html for
details.
You can use the Slacware Live CD on the target machine, it has dd and
netcat (nc) available.
Bill
Main problem with 'dd' is that the two harddisks
- must be same size (at least, target should be bigger),
- must be free of bad sectors
- must have same packages
- must have network connection, which is not always guaranteed to be
available. Since you are booting from CD anyways, why not just
install packages from there.
If you want the target to be a "fresh system", then your source must
also be a "fresh system" just after fresh install. Why do 2 installs
instead of only one. :-)
My purpose was to produce a clean fresh system, as you would get from
doing 'fdisk' and 'setup', but only with single shell script. You still
need to edit it and put some command line arguments.
Useless use of rm. The first echo statement will overwrite whatever is
in /etc/hosts if /etc/hosts exists, making removing it redundant. Now
that I look at it, the entire thing can be handled with one command.
echo "127.0.0.1 localhost
> 192.168.0.254 fakehost" > /etc/hosts
--
It is better to hear the rebuke of the wise,
Than for a man to hear the song of fools.
Ecclesiastes 7:5
On 2003-11-12, Alan Hicks <10012...@ettin.custom-consulting.com> wrote:
>
> Useless use of rm.
Isn't rm usually useless? ;-0
not so cordially,
- --keith
- --
kkeller...@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/smtLhVcNCxZ5ID8RAvrNAJ4qkmmxaZxcW9goLOD58k0mVD8c7wCfZyf2
bSHDnmnB2l+IfBDKCbzD+gQ=
=uKuQ
-----END PGP SIGNATURE-----
Hi William. Delurking for a moment. With the exception of the bad
sector issue, your script assumes the remainder: It creates identical
partitions, installs the same mpackages, and configures the network.
An alternative may be to do a fresh install on a master, set
everything up including users, then $TAR up the filesystem to CD (or
two). Then your script, also on the first CD, would partition and
format the target disk and $UNTAR your master image. It might save
time because you're opening one tarball instead of dozens (or
hundreds) with one process. And each install should be identical to
the master.
Who actually runs a script downloaded from Usenet without checking it
out? In reality, I have command line arguments for 'host', 'domain',
'IP', etc. I omitted those in my post because it's not relevant to the
main issue, which is
- you can partition using 'fdisk' non-interactively,
- you can install packages non-interactively,
- you can configure the system non-interactively.
>
> An alternative may be to do a fresh install on a master, set
> everything up including users, then $TAR up the filesystem to CD (or
> two). Then your script, also on the first CD, would partition and
> format the target disk and $UNTAR your master image. It might save
> time because you're opening one tarball instead of dozens (or
> hundreds) with one process. And each install should be identical to
> the master.
You or your client already have installation CD(s). Why burn more
CD(s)? Have you tried to explain to a client (ie. those who pay you)
what they must do with a tarball? Keep in mind that they pay you, and
also keep in mind that they can fire you. Sigh!
:*)
myself was expecting one of the pgp trolls to be bitching
about William putting his code after the -- sig delimiter.
250 > 4
:*)
--
William Hunt, Portland Oregon USA
I'm sorry? I don't understand the reference. The script to which I
refer is the one you proposed/wrote, nothing more.
> In reality, I have command line arguments for 'host', 'domain',
> 'IP', etc. I omitted those in my post because it's not relevant to the
> main issue, which is
> - you can partition using 'fdisk' non-interactively,
> - you can install packages non-interactively,
> - you can configure the system non-interactively.
I understand, but your script did include those things, therefore they
are part of configuring the machine.
> You or your client already have installation CD(s). Why burn more
> CD(s)? Have you tried to explain to a client (ie. those who pay you)
> what they must do with a tarball? Keep in mind that they pay you, and
> also keep in mind that they can fire you. Sigh!
I don't recall reading that the client already has CDs, or that there
are clients. Sorry if I missed that.
But, to answer the questions, creating a process by which an
installation could be automated seemed to be the goal, and burning a
master CD to accomplish that goal seemed logical. As for the tarball,
there should be nothing to explain since the installation script (I'm
picturing a hands-off process) will take care of everything from the
moment the user powers up the computer to the moment the installation
is complete. The user may be prompted to insert a second CD if the
tarball is large, but that can be tamed with customized dialogs and
prompts.
IMHO yer script is an excellent proof of concept, and yer method shows
lots of promise. myself has been whacking at this, so as to have the
configuration specs read from a configuration file, and to work equally
well booted from cdrom or floppy, using slackware from cdrom or nfs.
also a few obvious enhancements, eg, installing according to custom
tagfiles instead of the whole shebang, support for custom package sets,
etc. so far, still a few problems, but also pretty damn stinkin' cool.
the only hard part, which i'm ignoring for now, being more trouble than
it's worth, :*) is compiling appropriate fdisk syntax from any given
table of disk and filesystem specs.
work-in-progress script at ftp://prv8.net/slackstuff/slackblast
Stuck right now on a bug - my installed system looks good before
reboot, but rebooting, init is terribly unhappy with agetty, ie:
INIT: cannot execute '/sbin/agetty'
which respawns till disabled, and kind of keeps me from logging in.
doesn't say -why- it can't execute... similarly, ctrl-alt-delete says,
INIT: cannot execute '/usr/bin/shutdown'
beats me! the files exist, perms + ownerships seem okay ... hmmmmmmm.
maybe i screwed up fstab and my disk isn't even mounting ? hmmmmmmm.
maybe i should diddle /sbin/initscript to see what's happening.
hmmmmmmmmmmmmmmmmmmmmm.
>> An alternative may be to do a fresh install on a master, set
>> everything up including users, then $TAR up the filesystem to CD (or
>> two). Then your script, also on the first CD, would partition and
>> format the target disk and $UNTAR your master image. It might save
>> time because you're opening one tarball instead of dozens (or
>> hundreds) with one process. And each install should be identical to
>> the master.
[...]
sounds like a lot more trouble then nesc, creating, for -each- targeted
platform, a -massive- tarball to deal with. also time-saving, if any,
during an unattended install is moot. who cares if it takes 5 minutes
less ?
with William's approach, you can prepare a single floppy (for example)
to carry the installation+configuration script (or script + spec file :*)
and use a standard unmodified slackware cdrom (or nfs mount :*) . carry
different specs in different files and clone systems at will.
other custom tweaks can be built as packages or tarballs, and installed
from cd, nfs, or floppy, before or after first boot. including users,
if that cooks yer beans ...
hmmmmmmmmmmmmmmmm
because the big dummy at the keyboard forgot to install glibc-solibs.
work in progress @ ftp://prv8.net/slackstuff/slackblast