install (401B)
1 #!/bin/sh 2 3 set -e 4 5 for i 6 do 7 case "$i" in 8 -p) 9 proto=$2 10 shift 2 11 ;; 12 -*) 13 echo usage: install [-p proto] root >&2 14 exit 1 15 ;; 16 esac 17 done 18 19 root=${1?'root missed'} 20 21 while read type perm name 22 do 23 case $type in 24 d) 25 mkdir -p $root/$name 26 ;; 27 f) 28 cp $name $root/$name 29 ;; 30 *) 31 echo install: wrong entry type >&2 32 exit 1 33 ;; 34 esac 35 36 chmod $perm $root/$name 37 done < ${proto:-scripts/proto.all}