#!/bin/bash # (C) Eric Thibodeau GPL v2 kernel_links() { echo "=====================================" echo "Correcting kernel and initramfs links" echo "=====================================" cd /boot ln -s kernel-* vmlinuz ln -s initramfs-* initramfs } unionfs_prep() { echo "=====================================" echo "=adding unionfs required dirs========" echo "=====================================" for I in etc var tmp do mkdir -p /mnt/unionfs/$I done } set_runlevel() { ln -s /etc/runlevels/default /etc/runlevels/unionfs } run_depmod() { depmod -a -b /usr/src/linux } # We do this often in scripts to config files, change OPTION=something to OPTION=other # in: # $1: OPTION=other # $2: /path/to/file.conf # $3: (Optional) assignment token, defaults to = # out: # Changes are made inline change_opt() { SEP=${3:-=} KEY=${1#*${SEP}} VAL=${1%${SEP}*} # Replace old value with the new one ;) sed -e"s:${VAL}${SEP}.*:$1:" -i $2 } openrc_diskless_setup() { echo "=====================================" echo "=Setting up default RC configs=======" echo "=====================================" # /etc/rc.conf for I in 'rc_parallel="yes"' 'rc_depend_strict="NO"' 'rc_tty_number=2' do change_opt $I /etc/rc.conf done # /etc/conf.d/bootmisc for I in 'wipe_tmp="NO"' do change_opt $I /etc/conf.d/bootmisc done # /etc/conf.d/net echo 'dhcpcd_eth0="-p --inform"' >> /etc/conf.d/net } setup_services() { # Pre-generating sshd keys can be the source of philosophical debates: echo "=====================================" echo "=Pre-generating sshd keys============" echo "=====================================" . /etc/init.d/sshd gen_keys # ln -s /etc/runlevels/default /etc/runlevels/unionfs } dash_is_sh() { echo "=====================================" echo "=Replacing sh with dash==============" echo "=====================================" rm /bin/sh ln -s /bin/dash /bin/sh } #kernel_links dash_is_sh unionfs_prep #run_depmod openrc_diskless_setup # this one is a hack since catalyst doesn't do it for the moment for some reason setup_services # TEMPORARY for testing: echo "=====================================" echo "=Changing root password==============" echo "=====================================" echo root:test | chpasswd exit 0