Code: Select all
root@porteus:~# /opt/porteus-scripts/dump-session
syncing what's left in buffers
saving changes to /mnt/sdb3//porteus - this may take a while...
find: ‘bin’: No such file or directory
find: ‘lib’: No such file or directory
find: ‘lib64’: No such file or directory
find: ‘opt’: No such file or directory
find: ‘sbin’: No such file or directory
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
...maybe 100 or so identical lines skipped...
sed: -e expression #4, char 1: unknown command: `_'
find: ‘bin’: No such file or directory
find: ‘lib’: No such file or directory
find: ‘lib64’: No such file or directory
find: ‘opt’: No such file or directory
find: ‘sbin’: No such file or directory
session saved
Code: Select all
# Folders listed in this config file will be saved during reboot and shutdown when 'changes=EXIT:' cheatcode is used.
# Folders starting with '!' are omitted. This is useful if you want to save whole folder except for particular subfolder(s).
# An example is inclued in default config below: Porteus will save whole /var folder except for /var/run and /var/tmp subfolders.
# Other example: "!/home/guest/.mozilla/firefox/c3pp43bg.default/Cache" will skip saving of Firefox caches from guest account.
# Thanks to Rava for suggesting implementation of '!' exceptions.
/bin
/etc
#/home
/lib
/lib64
/opt
/root
/sbin
/usr
#Let's try to exclude var completely and see what happens
!/var
#!/var/run
#!/var/tmp
#!/var/cache
!/root/.cache
#!/root/.local/share/TelegramDesktop/tdata/emoji
#!/root/.local/share/TelegramDesktop/tdata/user_data/cache
#!/root/.local/share/TelegramDesktop/tdata/user_data/media_cache
#!/root/.local/share/TelegramDesktop/tupdates
!/root/.pfilesearch
!/root/.mozilla/firefox/FirefoxProfile
!/root/.waterfox/WaterfoxProfile
!/root/.config/google-chrome
!/root/.config/chromium-ungoogled
!/.cache
!/root/.Mathematica
!/var/lib/sbopkg/SBo
Code: Select all
#!/bin/bash
# Save live session ...
# Script takes action only when 'changes=EXIT' cheatcode is used.
# Author: fanthom <[email protected]>
# Modifications proposed by: abelM -- forum.porteus.org
# Check if 'changes=EXIT' cheatcode is active:
test -f /mnt/live/tmp/changes-exit || { echo "'changes=EXIT:' cheatcode is not active - exiting..."; exit; }
## Variables:
DEST="$(cat /mnt/live/tmp/changes-exit)"; NAME="$(basename $DEST)"
MNAME=/mnt/live/memory/images/changes ; INAME=/mnt/live/memory/images
CHNEXIT_CONF=/etc/changes-exit.conf ; EXCL=/tmp/save.excl.tmp
SFILES=/tmp/save.sfiles.tmp ; UPDATE=/tmp/save.update.tmp
# Fix folder names and make `egrep' interpret wildcards
fixdir() { sed -e 's_\._\\._g' -e 's_?_._g' -e 's_*_.*_g' -e 's@..@^@'; }
# Fix whiteout names so `egrep' doesn't interpret special characters as regex
fixwh() { sed -e 's_\._\\._g' -e 's_?_\\?_g' -e 's_+_\\+_g' -e '_*_\\*_g' -e 's_\$_\\$_g' -e 's_\[_\\[_g' -e 's_(_\\(_g' -e 's_\&_\\&_g' -e 's@^@^@'; }
# Folders to save: argument for `find'
FOLDERS="$(grep ^/ $CHNEXIT_CONF | sed s/.//)"
# Folders to exclude: argument for `egrep'
grep ^!/ $CHNEXIT_CONF | fixdir > $EXCL
## Save session:
echo "syncing what's left in buffers"
sync
# Remount aufs with 'udba=notify' flag:
mount -o remount,udba=notify /
echo "saving changes to $DEST - this may take a while..."
cd /mnt/live/memory/changes
# Handle filenames with spaces.
IFS="
"
# Remove deleted files and non matching whiteouts
for y in $(find $FOLDERS -name ".wh.*"); do
f="$(echo $y | sed 's@\.wh\.@@g')"
test -e "$MNAME/$f" && rm -rf "$MNAME/$f";
test -e "$INAME/"*"/$f" || { echo "$y" | fixwh >> $EXCL; test -e "$MNAME/$y" && rm -f "$MNAME/$y"; }
done
# Copy new and modified files -- skip excluded whiteouts and folders
{ test -s "$EXCL" && find $FOLDERS -not -type d | egrep -vf $EXCL || find $FOLDERS -not -type d; } > $SFILES
cp -uafv --parents $(cat $SFILES) $MNAME > $UPDATE
# Remove conflicting whiteouts
for y in $(find $MNAME -name ".wh.*"); do
f="$(echo $y | sed -e 's^$MNAME^^g' -e 's^\.wh\.^^g')";
test -e "$f" && rm "$y";
done
# Reset IFS to default
unset IFS
# Remount aufs with 'udba=none' flag:
mount -o remount,udba=none /
echo "session saved"