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.
31 lines
550 B
Bash
31 lines
550 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
|
|
END
|
|
umount "$mount"
|
|
losetup -d "$loop"
|
|
popd
|
|
done
|