4 # Work out where the user's pc/, patch/ and txt/ directories live.
6 # If the user specified PATCHSCRIPTS in environment then use that (it's
7 # probably a relative path)
9 # If there is a directory ./patch-scripts then use that
14 if [ x$PATCHSCRIPTS_LIBDIR != x ]
16 P=$PATCHSCRIPTS_LIBDIR
17 elif [ -d ./patch-scripts ]
24 echo "could not locate your pc/ and patches/ directories"
41 if echo $1 | egrep '^[0-9]*$' > /dev/null
52 if grep "^$name$" "$DB.1" > /dev/null 2>&1
65 if grep "^$name$" "$DB" > /dev/null 2>&1
74 if [ -f /usr/bin/lsdiff ]; then
75 tmpfile=$(mktemp /tmp/p_XXXXXX) || exit 1
76 lsdiff --strip=1 $1 > $tmpfile
77 diff $2 $tmpfile > /dev/null
79 echo " $1 do not match with $2 "
80 echo " $2 will be changed to match $2"
81 # cat $tmpfile > $P/pc/$PATCH_NAME.pc
88 if patch -p1 --dry-run -i "$1" -f
98 if patch -R -p1 --dry-run -i $P/patches/"$1".patch -f
108 tmpfile=$(mktemp /tmp/p_XXXXXX)
110 sed -e "/^$name$/d" < "$DB" > $tmpfile
117 ret=$(echo $ret | sed -e 's/\.patch$//')
118 ret=$(echo $ret | sed -e 's/\.pc$//')
119 ret=$(echo $ret | sed -e 's/\.txt$//')
125 patch_name=$(top_patch)
126 if [ x$patch_name == x ]
130 patch_file=$P/patches/"$patch_name".patch
131 files=$(cat $P/pc/$patch_name.pc)
134 if [ $file -nt $patch_file ]
136 echo $file newer than $patch_file
148 echo "Error: Top patch is not up-to-date"
157 echo "Warning: Top patch is not up-to-date"
166 if [ -e $P/pc/$patch.pc ]
168 if grep "^"$file"$" $P/pc/$patch.pc > /dev/null
176 # copy_file_to_bup filename patchname
187 echo "Cannot install file $file in patch $patch: backup $bup exists"
192 cp -p $file "$file"~"$patch"
194 echo "file $file appears to be newly added"
196 if [ ! -L "$orig" ]; then
197 ln -s "$src_dir/$bup" $orig
201 install_file_in_patch()
206 copy_file_to_bup $file $patch
207 echo $file >> $P/pc/$patch.pc
208 # touch $P/txt/$patch.txt
215 echo "File $1 does not exist"
228 elif [ x"$x" = xEDESC ]
245 if [ x"$x" = xEDESC ]
252 if [ $did_stuff = 0 ]