diff options
| author | Andrew Tridgell <tridge@samba.org> | 2008-07-11 21:50:54 +1000 |
|---|---|---|
| committer | Andrew Tridgell <tridge@samba.org> | 2008-07-11 21:50:54 +1000 |
| commit | eb280bc189c81276330d3f6d3a2ff522e23ecace (patch) | |
| tree | 6f119c38143e140f4aefbdddb8a2f0dd1ecdef85 /functions | |
| parent | dc6506ad9fdde3a2c7084f13d0c274551a2b8cc6 (diff) | |
added testproxy
attempt to allow running from another directory
Diffstat (limited to 'functions')
| -rw-r--r-- | functions | 25 |
1 files changed, 15 insertions, 10 deletions
@@ -34,40 +34,45 @@ mount_disk() { mount_ok=1 break } + umount mnt 2>/dev/null || true sleep 1 done [ $mount_ok = 1 ] || { echo "Failed to mount $1" exit 1 } + [ -d mnt/root ] || { + echo "Mounted directory does not look like a root filesystem" + ls -latr mnt + exit 1 + } } # unmount a qemu image unmount_disk() { echo "Unmounting disk" - sync + sync; sync; sync umount mnt || umount mnt nbd-client -d /dev/nb0 > /dev/null 2>&1 || true killall -9 -q nbd-client || true killall -q qemu-nbd || true } -# setup the files from base/, substituting any variables +# setup the files from $BASE_TEMPLATES/, substituting any variables # based on the config setup_base() { echo "Copy base files" - chmod 600 base/etc/ssh/*key base/root/.ssh/* for f in `cd base && find . \! -name '*~'`; do - perms=`stat -c %a base/$f` - if [ -d base/$f ]; then - mkdir -p mnt/$f - chown 0.0 mnt/$f - chmod $perms mnt/$f + if [ -d "$BASE_TEMPLATES/$f" ]; then + mkdir -p mnt/"$f" else - substitute_vars base/$f mnt/$f - chmod $perms mnt/$f + substitute_vars "$BASE_TEMPLATES/$f" "mnt/$f" fi + chmod --reference="$BASE_TEMPLATES/$f" "mnt/$f" done + # this is needed as git doesn't store file permissions other + # than execute + chmod 600 mnt/etc/ssh/*key mnt/root/.ssh/* } setup_repos() { |
