wok annotate fatattr/stuff/fatattr.sh @ rev 20772

updated cd-discid (1.1 -> 1.4)
author Hans-G?nter Theisgen
date Wed Feb 13 16:59:39 2019 +0100 (2019-02-13)
parents 46a4ae996aa7
children
rev   line source
pascal@14781 1 #!/bin/sh
pascal@14781 2
pascal@14781 3 ATTRS=.fatattr
pascal@14781 4
pascal@14781 5 cdfat() {
pascal@14781 6 fatattr $1 > /dev/null && cd $1
pascal@14781 7 }
pascal@14781 8
pascal@14781 9 case "${1/--/-}" in
pascal@14781 10 -s*) find ${3:-.} -exec fatattr {} \; > ${2:-$ATTRS} ;;
pascal@17549 11 -r*) sed -e 's/^\(.\{0,8\}\)/\1=/' -e ':a;s/^\([^ =]*\)\ /\1/;ta' \
pascal@17552 12 -e "s/^/fatattr +/;s|= | ${3:-.}/|" < ${2:-$ATTRS} | sh ;;
pascal@14781 13 -c*) cdfat ${2:-.} && $0 -s && find . | cpio -o -H newc ;;
pascal@14781 14 -[xe]*) cdfat ${2:-.} && cpio -idmu && $0 -r && rm -f $ATTRS ;;
pascal@14781 15 *) cat 1>&2 <<EOT
pascal@14781 16 Usage: $0 [--save|--restore] [datafile] [root]
pascal@14781 17 $0 [--create-cpio|--extract-cpio] [root]
pascal@14781 18 EOT
pascal@14781 19 esac
pascal@14781 20