2011-06-22 07:50:36 +00:00
|
|
|
#!/bin/sh -ex
|
|
|
|
|
|
|
|
dir_depth() {
|
|
|
|
dir="$1"
|
|
|
|
while [ "$dir" != "." ] && [ "$dir" != "/" ]; do
|
|
|
|
dir=`dirname "$dir"`
|
|
|
|
echo -n ../
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$#" -ne 1 ]; then
|
|
|
|
echo "you have to specify the new target name"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2011-07-17 11:48:06 +00:00
|
|
|
BOARD="$1"
|
2011-06-22 07:50:36 +00:00
|
|
|
|
2011-07-17 11:48:06 +00:00
|
|
|
if [ -e "$BOARD" ]; then
|
2011-06-22 07:50:36 +00:00
|
|
|
echo "target already exists"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2011-07-17 11:48:06 +00:00
|
|
|
mkdir -p $BOARD/
|
|
|
|
mkdir -p $BOARD/packages/
|
|
|
|
mkdir -p $BOARD/root/etc/network/
|
|
|
|
mkdir -p $BOARD/hooks/
|
2011-06-22 07:50:36 +00:00
|
|
|
|
2011-07-17 11:48:06 +00:00
|
|
|
cp default/config $BOARD
|
|
|
|
cp default/multistrap.conf $BOARD
|
|
|
|
cp default/debconfseed.txt $BOARD
|
2011-06-22 07:50:36 +00:00
|
|
|
|
|
|
|
for f in packages/base \
|
|
|
|
root/usr/sbin/policy-rc.d \
|
|
|
|
root/usr/bin/ldd \
|
|
|
|
root/etc/apt/apt.conf.d/99no-install-recommends \
|
|
|
|
root/etc/apt/apt.conf.d/99no-pdiffs \
|
|
|
|
root/etc/ld.so.conf \
|
|
|
|
root/etc/ssh/ssh_host_ecdsa_key \
|
|
|
|
root/etc/ssh/ssh_host_rsa_key \
|
|
|
|
root/etc/ssh/ssh_host_dsa_key \
|
|
|
|
root/sbin/ldconfig \
|
|
|
|
hooks/create_user \
|
|
|
|
hooks/serial_tty \
|
|
|
|
hooks/firstboot \
|
|
|
|
hooks/empty_password; do
|
2011-07-17 11:48:06 +00:00
|
|
|
mkdir -p `dirname $BOARD/$f`
|
|
|
|
ln -s `dir_depth $f`default/$f $BOARD/$f
|
2011-06-22 07:50:36 +00:00
|
|
|
done
|
|
|
|
|
2011-07-17 11:48:06 +00:00
|
|
|
cat << __END__ > $BOARD/root/etc/hosts
|
2011-06-22 07:50:36 +00:00
|
|
|
127.0.0.1 localhost
|
2011-07-17 11:48:06 +00:00
|
|
|
127.0.0.1 $BOARD
|
2011-06-22 07:50:36 +00:00
|
|
|
__END__
|
|
|
|
|
2011-07-17 11:48:06 +00:00
|
|
|
echo $BOARD > $BOARD/root/etc/hostname
|
2011-06-22 07:50:36 +00:00
|
|
|
|
2011-07-17 11:48:06 +00:00
|
|
|
cp default/root/etc/fstab $BOARD/root/etc/
|
|
|
|
cp default/root/etc/network/interfaces $BOARD/root/etc/network/
|