#!/bin/bash # # Destroys /dev/sda # set -e [[ -z $1 ]] && echo target hostname? && exit 1 sshhost=$1 [[ ! -f slackstart.conf ]] && echo setup slackstart.conf first && exit 1 . ./slackstart.conf [[ -z $mirror ]] && echo define \$mirror in slackstart.conf && exit 1 [[ -z $pubkeys ]] && echo define \$pubkeys in slackstart.conf && exit 1 [[ ! -x `which fdisk` ]] && echo fdisk not found && exit 1 [[ ! -x `which sfdisk` ]] && echo sfdisk not found && exit 1 [[ ! -x `which head` ]] && echo head not found && exit 1 [[ ! -x `which awk` ]] && echo awk not found && exit 1 function diskprep { total=`fdisk -l /dev/sda | head -1 | awk '{print $7}'` #2048 * 512 = 1048576 echo -n writing sda.sfdisk... cat > sda.sfdisk < lala/etc/fstab <<-EOF && echo done /dev/sda1 / ext4 defaults 1 1 devpts /dev/pts devpts gid=5,mode=620 0 0 proc /proc proc defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 EOF echo '' echo -n HOSTNAME $sshhost... echo $sshhost > lala/etc/HOSTNAME && echo done echo '' echo -n ssh pubkeys... mkdir -p lala/root/.ssh/ cat > lala/root/.ssh/authorized_keys < lala/etc/ssh/sshd_config cat >> lala/etc/ssh/sshd_config < lala/etc/lilo.conf.clean sed -r ' /^[[:space:]]*(#|$)/d; /^timeout =/d; /^vga =/d; ' lala/etc/lilo.conf.clean > lala/etc/lilo.conf cat >> lala/etc/lilo.conf < efi/EFI/boot/grub.cfg < [boot|full]' elif [[ $2 = boot ]]; then sysboot elif [[ $2 = full ]]; then diskprep ./slackstrap.bash lala/ $mirror full sysboot else diskprep ./slackstrap.bash lala/ $mirror sysboot fi