#!/bin/sh #smprms #Create a script to restore the filesystem permissions from the MANIFEST (stdin) # about_text=' # Author: Cameron Kerr # Email: cameron.kerr@paradise.net.nz # Website: http://homepages.paradise.net.nz/~cameronk/ # Version: 27 August 2001' if [ $# -ne 0 ]; then echo "USAGE: zcat MANIFEST.gz | `basename $0` > /tmp/longscript.sh" >&2 echo " su - (if not root already)" >&2 echo " /tmp/longscript.sh" >&2 exit 255 fi echo "#!/bin/sh" echo "#This script was generated by `basename $0` from a Slackware MANIFEST.gz" echo "#It will restore permissions to all files listed in the MANIFEST.gz," echo "#even files not there, so you might like to filter out 'not found'" echo "#messages" echo "#" echo "#About the generator ${about_text}" cat | sed -e ' /^++==*/d /^||/d /^ *$/d /^[-dlcbps]/{ s/^\(.*\) \(.*\)\/\(.*[^ ]\) *.* .* .* *\(.*\)$/\ chown \2.\3 \/\4\ chmod PERM\1PERM \/\4/ /PERM.*PERM/{ s/PERM.\(...\)\(...\)\(...\)PERM/u=PERM\1PERM,g=PERM\2PERM,o=PERM\3PERM/ } /PERM.*[^ ]PERM/{ s/-//g } s/PERM//g } '