script fixups

pull/40/head
TomasM 2017-11-04 05:36:01 -04:00
parent 3f92d8d653
commit ed7524050d
2 changed files with 28 additions and 7 deletions

View File

@ -39,11 +39,23 @@ rm -Rf /usr/share/man/*_*
rm -f /root/.fehbg
rm -f /root/.fluxbox/lastwallpaper
# Unzip gzipped files (man pages), so LZMA can compress 2times better.
# First we fix symlinks, then uncompress files
# $1 = search directory
uncompress_files()
{
local LINK LINE
# Unzip gzipped man pages, so LZMA can compress 2times better.
# First we gunzip symlinks, which will be overwritten by the content of targets
# this doesn't matter as mksquashfs will handle duplicate files correctly
find /usr/share/man -type l -name "*.gz" | xargs gunzip -f
find /usr/share/man -name "*.gz" | xargs gunzip
find "$1" -type l -name "*.gz" | while read LINE; do
LINK="$(readlink "$LINE" | sed -r 's/.gz$//')"
FILE="$(echo "$LINE" | sed -r 's/.gz$//')"
ln -sfn "$LINK" "$FILE"
rm -f "$LINE"
done
find "$1" -type f -name "*.gz" | xargs gunzip
}
uncompress_files /etc/alternatives
uncompress_files /usr/share/man
rm -Rf /usr/share/icons/elementaryXubuntu-dark

View File

@ -1,11 +1,20 @@
#!/bin/bash
TMP=/tmp/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|^root/.Xauthority|^root/.xsession-errors|^etc/mtab|^etc/fstab|^boot/|^dev/|^mnt/|^proc/|^run/|^sys/|^tmp/"
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|^root/[.]Xauthority|^root/[.]xsession-errors|^root/[.]fehbg|^root/[.]fluxbox/lastwallpaper|^etc/mtab|^etc/fstab|^boot/|^dev/|^mnt/|^proc/|^run/|^sys/|^tmp/"
CHANGES=/mnt/live/memory/changes
if [ "$1" = "" ]; then
echo "Usage: $0 [ target_file.sb ] [ optional_changes_directory ]"
echo ""
echo "savechanges - save all changed files in a compressed filesystem bundle"
echo " - excluding some predefined files such as /etc/mtab,"
echo " temp & log files, empty directories, apt cache, and such"
echo ""
echo "Usage:"
echo " $0 [ target_file.sb ] [ changes_directory ]"
echo ""
echo "If changes_directory is not specified, /mnt/live/memory/changes is used."
echo ""
exit 1
fi