This repository has been archived on 2023-12-20. You can view files and clone it, but cannot push or open issues or pull requests.
lis67-iso-builder/reset.sh

30 lines
579 B
Bash
Raw Normal View History

2021-01-22 16:45:43 +01:00
#!/bin/bash
SPATH=$(cd $(dirname $0) && pwd)
if [ -z $1 ]; then
echo "Usage: reset.sh <work_path>"
exit 1
fi
full_iso=$1
iso_wo_ext=${full_iso##*/}
iso_wo_ext=${iso_wo_ext%.iso}
WORKDIR="$SPATH/$iso_wo_ext"
[ -z "$WORKDIR" ] && exit 1
echo "$WORKDIR"
# mount proc, sys, opens a shell (for changes), and clean everything after
echo "==== CHROOT ===="
sudo chroot "$WORKDIR/custom" /bin/bash << EOF
umount /sys
umount /proc
umount /dev/pts
EOF
# umount & clean
echo "==== Clean ===="
sudo umount "$WORKDIR/squashfs"
sudo umount /tmp/livecd
sudo rm -rf "$WORKDIR"
echo "Done"