save changes script
parent
4ce0d58c5e
commit
d0d0b28b84
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ "$2" = "" ]; then
|
||||
echo "Usage: $0 [source directory] [target file.sb]"
|
||||
echo "Usage: $0 [source_directory] [target_file.sb]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
TMP=/tmp/changes$$
|
||||
CHANGES=/mnt/live/memory/changes
|
||||
EXCLUDE="^\$|/\$|[.]wh[.][.]wh[.]orph/|^[.]wh[.][.]wh[.]plnk/|^[.]wh[.][.]wh[.]aufs|^var/cache/|^var/backups/|^var/tmp/|^var/log/|^var/lib/apt/|^var/lib/dhcp/|^var/lib/systemd/|^sbin/fsck[.]aufs|^etc/resolv[.]conf|^etc/fstab|^etc/ld[.]so[.]cache|^boot/|^dev/|^mnt/|^proc/|^run/|^sys/|^tmp/"
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
echo "Usage: $0 [ target_file.sb ]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# exclude the safe_file itself of course
|
||||
EXCLUDE="$EXCLUDE|^""$(readlink -f "$1" | cut -b 2- | sed -r "s/[.]/[.]/")""\$"
|
||||
|
||||
CWD=$(pwd)
|
||||
|
||||
cd $CHANGES || exit
|
||||
|
||||
mkdir -p $TMP
|
||||
mount -t tmpfs tmpfs $TMP
|
||||
|
||||
find \( -type d -printf "%p/\n" , -type f -print \) \
|
||||
| sed -r "s/[.]\\///" | egrep -v "$EXCLUDE" \
|
||||
| while read FILE; do
|
||||
echo $FILE
|
||||
cp -v --parents -afr $FILE $TMP
|
||||
done
|
||||
|
||||
cd $CWD
|
||||
|
||||
mksquashfs $TMP "$1" -comp xz -b 512k -noappend
|
||||
|
||||
umount $TMP
|
||||
rmdir $TMP
|
||||
Loading…
Reference in New Issue