From baa1cfb1e2f9a3d9443c481028f9499bcfbe6e93 Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Wed, 13 May 2020 03:19:29 +0300 Subject: change directory in a subshell --- mkrootfs.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mkrootfs.sh b/mkrootfs.sh index db59291..a65d2aa 100755 --- a/mkrootfs.sh +++ b/mkrootfs.sh @@ -91,7 +91,8 @@ msg "Removing root cache" rm -rf "$MNTDIR/root/.cache" msg "Generating rootfs to $BASEDIR" -cd "$MNTDIR" || die "Could not change directory to $MNTDIR" -tar -cpvJf "$BASEDIR/carbs-rootfs-$(date +%Y%m%d).tar.xz" . -cd "$BASEDIR" || die "Could not change directory to $BASEDIR" +( + cd "$MNTDIR" || die "Could not change directory to $MNTDIR" + tar -cpvJf "$BASEDIR/carbs-rootfs-$(date +%Y%m%d)-$(uname -m).tar.xz" . +) msg "Done!" -- cgit v1.2.3