30 lines
579 B
Bash
Executable File
30 lines
579 B
Bash
Executable File
#!/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"
|