#!/bin/bash set -e [[ -z $1 ]] && echo "usage: ${0##*/} " && exit 1 target=$1 [[ ! -d $target/ ]] && echo $target/ does not exist && exit 1 [[ -z `mount | grep ${target%%/}` ]] && echo partition is not mounted into $target/ && exit 1 [[ ! -f slackstart.conf ]] && echo slackstart.conf missing && exit 1 echo -n sourcing slackstart.conf ... . ./slackstart.conf && echo done [[ -z $tz ]] && echo define tz && exit 1 [[ -z $vpartition ]] && echo define vpartition && exit 1 [[ -z $fs ]] && echo define fs && exit 1 [[ -z $serial ]] && echo define serial && exit 1 [[ -z $swap ]] && echo define swap && exit 1 [[ -z $boot ]] && echo define boot && exit 1 if [[ $fs = ext4 ]]; then addopts="" elif [[ $fs = reiser4 ]]; then addopts=",txmod=wa,discard" elif [[ $fs = btrfs ]]; then addopts=",compress=lzo" elif [[ $fs = f2fs ]]; then addopts=",compress_algorithm=lz4,compress_chksum,atgc,gc_merge,lazytime" else echo file-system $fs not supported exit 1 fi echo -n fstab ... cat > $target/etc/fstab <> $target/etc/fstab <> $target/etc/fstab < $target/etc/inittab echo "s1:12345:respawn:/sbin/agetty --noclear --local-line $serial 115200 linux" >> $target/etc/inittab echo $serial >> $target/etc/securetty && echo done fi #/ctrlaltdel/d; #/^c[[:digit:]]:/d; echo -n setting up timezone for $tz ... rm -f $target/etc/localtime-copied-from $target/etc/localtime ln -s ../usr/share/zoneinfo/$tz $target/etc/localtime && echo done #echo -n disabling setterm ... #chmod -x $target/etc/rc.d/rc.setterm && echo done if [[ $boot = lilo ]]; then rm -f $target/etc/lilo.conf echo -n checking whether the disk is unknown ... disk_major=`grep vda$ /proc/partitions | awk '{print $1}'` (( disk_major == 253 || disk_major == 252 )) && echo disk = /dev/vda bios=0x80 max-partitions=7 >> $target/etc/lilo.conf && echo yes/fixed || echo no echo -n setting up LILO ... cat >> $target/etc/lilo.conf < sda device=`echo $devicep1 | sed -r 's/p?1$//'` echo boot device is $device - all good? read -r dd if=$mbrbin of=$device mkdir -p $target/boot/syslinux/ extlinux --install $target/boot/syslinux --device $devicep1 unset devicep1 cp -fv $mboot $target/boot/syslinux/ cp -fv $libcom32 $target/boot/syslinux/ unset mbrbin mboot libcom32 echo -n writing $target/boot/syslinux/syslinux.cfg ... cat > $target/boot/syslinux/syslinux.cfg <