You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
613 B
Bash
33 lines
613 B
Bash
#!/bin/sh
|
|
|
|
# Run as root.
|
|
|
|
set -eux
|
|
|
|
mount="$(mktemp --directory)"
|
|
trap "rmdir $mount" EXIT
|
|
|
|
modprobe loop
|
|
|
|
origdir="$(pwd)"
|
|
|
|
for dir in output/*/; do
|
|
pushd $dir
|
|
cp --preserve=mode,ownership "$origdir/dummydisk.img" "./disk.img"
|
|
loop="$(losetup --partscan --show --find ./disk.img)"
|
|
mount -t ext4 "${loop}p2" "$mount"
|
|
while read what where; do
|
|
cp "$what" "$mount$where"
|
|
done << END
|
|
bird.conf /etc/bird.conf
|
|
interfaces /etc/network/interfaces
|
|
hosts /etc/hosts
|
|
hostname /etc/hostname
|
|
mactab /etc/mactab
|
|
routing.conf /etc/sysctl.d/routing.conf
|
|
END
|
|
umount "$mount"
|
|
losetup -d "$loop"
|
|
popd
|
|
done
|