Gnuru.org
Productive Linux


Subscribe

 Subscribe via Feedburner in a reader

Enter your email address:

Delivered by FeedBurner


Login
Login:
Password:



Don't have an account?
Sign up to Gnuru.org
Forgot your password?

Slackware Install Script
5 March 2004 @ 17:43 GMT
by Paul

William Park (opengeometry@yahoo.ca) created a script to install Slackware on many different machines. I think it's cool, so here it is:

#! /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

Latest version can be found here: http://home.eol.ca/~parkw/index.html




Comments disabled