From 12d38082821b6292b8d88e747f3f5e16549352d9 Mon Sep 17 00:00:00 2001 From: Jason Mehring Date: Thu, 16 Oct 2014 18:00:26 -0400 Subject: [PATCH] Changed user id from $USER ro user since $USER was root --- .../custom_wheezy_whonix/00_prepare_pre.sh | 22 +++++++++++++------ .../02_install_groups_packages_installed.sh | 13 +++++------ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/scripts_debian/custom_wheezy_whonix/00_prepare_pre.sh b/scripts_debian/custom_wheezy_whonix/00_prepare_pre.sh index 3c81ee6..421eb2b 100755 --- a/scripts_debian/custom_wheezy_whonix/00_prepare_pre.sh +++ b/scripts_debian/custom_wheezy_whonix/00_prepare_pre.sh @@ -36,19 +36,27 @@ else fi INSTALLDIR="$(readlink -m mnt)" -umount_kill "$INSTALLDIR" || : # ------------------------------------------------------------------------------ # Use a snapshot of the debootstraped debian image to install Whonix (for DEBUGGING) # ------------------------------------------------------------------------------ -splitPath "$IMG" path_parts -PREPARED_IMG="${path_parts[dir]}${path_parts[base]}-debootstrap${path_parts[dotext]}" -if [ -f "$PREPARED_IMG" ]; then - warn "Copying $PREPARED_IMG to $IMG" - mount -o loop "$PREPARED_IMG" "$INSTALLDIR" || exit 1 +copy_snapshot() { + warn "Copying $1 to $IMG" + umount_kill "$INSTALLDIR" || : + mount -o loop "$1" "$INSTALLDIR" || exit 1 rm -f "$INSTALLDIR/tmp/.prepared_groups" umount_kill "$INSTALLDIR" || : - cp -f "$PREPARED_IMG" "$IMG" + cp -f "$1" "$IMG" +} + +splitPath "$IMG" path_parts +debootstrap_snapshot="${path_parts[dir]}${path_parts[base]}-debootstrap${path_parts[dotext]}" +updated_snapshot="${path_parts[dir]}${path_parts[base]}-updated${path_parts[dotext]}" + +if [ -f "$updated_snapshot" ]; then + copy_snapshot "$updated_snapshot" +elif [ -f "$debootstrap_snapshot" ]; then + copy_snapshot "$debootstrap_snapshot" fi diff --git a/scripts_debian/custom_wheezy_whonix/02_install_groups_packages_installed.sh b/scripts_debian/custom_wheezy_whonix/02_install_groups_packages_installed.sh index f9074f2..cc9453f 100755 --- a/scripts_debian/custom_wheezy_whonix/02_install_groups_packages_installed.sh +++ b/scripts_debian/custom_wheezy_whonix/02_install_groups_packages_installed.sh @@ -33,7 +33,6 @@ if [ "$SNAPSHOT" == "1" ]; then fi fi - # ------------------------------------------------------------------------------ # chroot Whonix build script (Make sure set -e is not set) # ------------------------------------------------------------------------------ @@ -174,7 +173,7 @@ if ! [ -f "$INSTALLDIR/tmp/.prepared_whonix" ]; then # -------------------------------------------------------------------------- pushd "$WHONIX_DIR" { - su $USER -c "git submodule update --init --recursive" + su user -c "git submodule update --init --recursive" } popd @@ -187,23 +186,23 @@ if ! [ -f "$INSTALLDIR/tmp/.prepared_whonix" ]; then pushd "$WHONIX_DIR" { sed -i 's/grub-pc//g' grml_packages || :; - su $USER -c "git commit -am 'removed grub-pc depend'" || :; + su user -c "git commit -am 'removed grub-pc depend'" || :; } popd pushd "$WHONIX_DIR/packages/anon-meta-packages/debian" { sed -i 's/ grub-pc,//g' control || :; - su $USER -c "dpkg-source --commit" || :; - su $USER -c "git commit -am 'removed grub-pc depend'" || :; + su user -c "dpkg-source --commit" || :; + su user -c "git commit -am 'removed grub-pc depend'" || :; } popd pushd "$WHONIX_DIR/packages/anon-shared-build-fix-grub/usr/lib/anon-dist/chroot-scripts-post.d" { sed -i 's/update-grub/:/g' 85_update_grub || :; - su $USER -c "dpkg-source --commit" || :; - su $USER -c "git commit -am 'removed grub-pc depend'" || :; + su user -c "dpkg-source --commit" || :; + su user -c "git commit -am 'removed grub-pc depend'" || :; } popd