Hier beschreiben wir das Installer Script und die Erfahrungen damit.
Eine Installation mit den vorhandenen Scripten funktioniert so:
mv functions.sh functions.cfg
export HD=/dev/sda # hard disc device
export MP=/hd # mount point
export PS=(2048M 10M 1024M rest)
source functions.cfg
partition_disk # or manually by fdisk, parted, ...
make_filesystems
mount_disk
copy_system
misc_setup
grub-install --root-directory=$MP $HD
umount_disk
Im Verzeichnis /root/Installer liegen:
- Eine Installation mit den vorhandenen Scripten funktioniert so:
Im Verzeichnis /root/Installer liegen:- Readme
- functions.sh
- fstab.tjener
- menu.lits-tjener
Readme
#! /bin/sh
#
# receipt to install the tjener skole server from a
# tjener Live-System to hard disc
#
#
# check for hard disc(s)
#
# fdisk -l
#
# and set the proper device, example:
#
HD=/dev/sda # hard disc device
MP=/hd # mount point
#
# define partition sizes
#
# boot+root+usr 10GB
# swap 8GB
# var 30GB
# skole <rest of disk>
#
# on a 4GB test disk you can use
#
# PS=(2048M 10M 1024M rest)
#
PS=(10240M 8192M 30720M rest)
#
# get the functions we need to proceed
#
source functions.cfg
#
# now you can type in the bash shell:
#
# disk must be empty without partition table !!!
partition_disk # or manually by fdisk, parted, ...
make_filesystems
mount_disk
copy_system
misc_setup
grub-install --root-directory=$MP $HD
umount_disk
#### you are done, here are some general hints #########
#
# to use another linux kernel package (i.e. 2.6.28.1-tjener):
#
# cp /mnt/media/Extra-Packages/linux-image-2.6.28-rlp*.deb /harddisk/tmp/
#
# mount --bind /proc /harddisk/proc
# mount --bind /sys /harddisk/sys
# mount --bind /dev /harddisk/dev
#
# chroot /harddisk
# chroot> dpkg -i /tmp/linux-image-2.6.28*.deb
# chroot> update-grub
#
# check/fix: fstab
# check/fix: menu.lst
#
#
# HINT: if you test the installation procedure inside a virtual machine
# you may want to adjust partition sizes, see tjener.cfg ...
#
#
# HINT: if grub-install script fails you need to install grub manually
# with grub-shell
#
# use:
# fdisk -l <device>
#
# to read disc geomentry
#
# - cylinder C
# - heads H
# - sectors S
#
# now start grub, example:
#
# grub --device-map=/dev/null
# grub> device (hd0,0) /dev/sda1
# grub> device (hd0) /dev/sda
# grub> geometry (hd0) <C> <H> <S>
# grub> root (hd0,0)
# grub> setup (hd0)
# grub> quit
#
# on the final installed tjener you may want to check
# not needed
# apt-get remove rwhod
# configure DNS forwarders
# /etc/bind/debian-edu/named.conf.options
# install
# /usr/local/bin/dhcp_get_current_leases
# insert MAC addresses of TS in file
# edit /etc/dhcp3/dhcpd.conf
functions.sh
#
# functions to simplify the installation
#
# required variables:
#
# HD : hard disc device
# MP : directory used as mount point
# PS : array defining partition sizes
#
#
# this is probably to simple, it should be improved to script around
# parted (like FAI does) or just use FAI::setup-storage
#
function partition_disk()
{
echo "automated creation of partitions is currently not"
echo "supported. Please read the source an volunteer"
return
echo ""
echo "have you checked the configuration?"
echo -n "press return to continue: "
read ans
parted --script $HD mklabel msdos
parted --script $HD mkpart primary ext2 0 ${PS[0]}
parted --script $HD mkpart primary linux-swap ${PS[0]} ${PS[1]}
parted --script $HD mkpart primary ext2 ${PS[1]} ${PS[2]}
parted --script $HD mkpart primary ext2 ${PS[2]} ${PS[3]}
parted --script $HD set 1 boot on
}
function make_filesystems()
{
mkfs.ext3 ${HD}1
mkswap ${HD}2
mkfs.ext3 ${HD}3
mkfs.ext3 ${HD}4
return 0
}
function mount_disk()
{
mkdir -p $MP
mount ${HD}1 $MP
mkdir -p $MP/var
mount ${HD}3 $MP/var
mkdir -p $MP/skole
mount ${HD}4 $MP/skole
}
function umount_disk()
{
umount $MP/var
umount $MP/skole
umount $MP
}
function copy_system()
{
rsync -aHv --exclude 'TRANS.TBL' /mnt/image/* $MP
}
function misc_setup()
{
sed s:"<HD_DISK>":"${HD}":g fstab.tjener > $MP/etc/fstab
sed s:"<HD_DISK>":"${HD}":g menu.lst.tjener > $MP/boot/grub/menu.lst
mkdir -p $MP/var/log
mkdir -p $MP/var/run
mkdir -p $MP/proc
mkdir -p $MP/sys
mkdir -p $MP/etc
mkdir -p $MP/root
empty $MP/etc/ioctl.save
empty $MP/etc/pnm2ppa.conf
for name in $(find $MP/var/log -type l); do
rm -f $name
done
empty $MP/var/log/messages
empty $MP/var/log/syslog
empty $MP/var/log/debug
empty $MP/var/log/dmesg
# /var/run
for name in $(find $MP/var/run/ -type f); do
rm -f $name
done
# Create empty utmp and wtmp
empty $MP/var/run/utmp $MP/var/run/wtmp
rm -f $MP/var/log/utmp $MP/var/log/wtmp
( cd $MP/var/log
ln -s /var/run/utmp utmp
ln -s /var/run/wtmp wtmp
)
# misc to remove if it exists
rm -f $MP/etc/nologin
rm -f $MP/etc/crypttab
# clean from previous udev
rm -rf $MP/dev/.udev*
# prepare clean tmp directories
rm -rf $MP/tmp
mkdir -p $MP/tmp
chmod 777 $MP/tmp
chmod +t $MP/tmp
rm -rf $MP/var/tmp
mkdir -p $MP/var/tmp
chmod 777 $MP/var/tmp
chmod +t $MP/var/tmp
if [ -d /etc/apt ]; then
mkdir -p $MP/var/cache/apt/archives/partial/
fi
#
# check for essential devices
#
if [ ! -e $MP/dev/console ]; then
mknod $MP/dev/console c 5 1
fi
if [ ! -d $MP/dev/pts ]; then
mkdir $MP/dev/pts
fi
}
empty()
{
for name in "$@"; do rm -f $name; :> $name; done
}
#
# Local Variables:
# mode: shell-script
# End:
#
fstab.tjener
#
# /etc/fstab
#
<HD_DISK>1 / ext3 defaults,noatime,errors=remount-ro 0 1
<HD_DISK>2 none swap sw 0 0
<HD_DISK>3 /var ext3 defaults 0 0
<HD_DISK>4 /skole ext3 defaults 0 0
menu.lits-tjener
# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 5
# Pretty colours
color cyan/blue white/blue
## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret
#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below
## DO NOT UNCOMMENT THEM, Just edit them to your needs
## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/mapper/vg_system-root ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=<HD_DISK>1 ro quiet
## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,0)
## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true
## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false
## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=
# defoptions=
## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false
## Xen hypervisor options to use with the default Xen boot option
# xenhopt=
## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0
## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(single-user) single
# altoptions=(single-user mode) single
## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all
## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true
## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false
## ## End Default Options ##
title Debian GNU/Linux, kernel 2.6.31
root (hd0,0)
kernel /boot/vmlinuz-2.6.31 root=<HD_DISK>1 ro quiet
initrd /boot/initrd.img-2.6.31
savedefault
title Debian GNU/Linux, kernel 2.6.24-etchnhalf.1-486
root (hd0,0)
kernel /boot/vmlinuz-2.6.24-etchnhalf.1-486 root=<HD_DISK>1 ro quiet
initrd /boot/initrd.img-2.6.24-etchnhalf.1-486
savedefault
### END DEBIAN AUTOMAGIC KERNELS LIST
Fehlerrückmeldung bei Installation: Version 091129
source functions.sh nicht .cfg
misc_setup legt nicht alle Unterordner an für /var/z.B.
/var/cache/
/var/www/
/var/log/apache2
/var/log/munin
/var/lib/
usw.
Kernel und vmlinuz mit .6 ergänzen
title Debian GNU/Linux, kernel 2.6.31
root (hd0,0)
kernel /boot/vmlinuz-2.6.31.6 root=<HD_DISK>1 ro quiet
initrd /boot/initrd.img-2.6.31.6
savedefault