[pacman-dev] bacman

Allan McRae mcrae_allan at hotmail.com
Fri May 30 00:15:43 EDT 2008


carlocci wrote:
> <snip>
> #
> # File copying
> #
> echo Copying package files...
>
> cat "$pkg_dir"/files |
> while read i; do
>     if [ -z "$i" ] ; then
>         continue
>     fi
>
>     if [[ "$i" =~ %[A-Z]*% ]] ; then
>         current=$i
>         continue
>     fi
>
>     case $current in
>         %FILES%)
>         if [ -d "/$i" ]; then
>             mkdir "$i"
>         elif [ -f "/$i" ]; then
>             install -D "/$i" "$i"
>         else
>             echo "/$i" is missing: this might result in a broken package
>         fi
>         ;;
>     esac
>     pkg_size=$(du -sb | awk '{print $1}')
> done
>
> echo Adding install commands and changelogs, if any...
> if [ -f "$pkg_dir/install" ] ; then
>     cp "$pkg_dir/install" "$work_dir/.INSTALL"
> fi
> if  [ -f $pkg_dir/changelog ] ; then
>     cp "$pkg_dir/changelog" "$work_dir/.CHANGELOG"
> fi
>
> <snip>

The setting of the pkg_size variable needs to be outside that 
loop/subshell pipe (it currently does not work).

Another point, the whole file copying bit should probably be inside a 
fakeroot and using "cp -pd" in order to get file permissions right.  
Probably want to check directory permissions too.  Will still have 
problems with files that can't be read by a user by the error messages 
makes it obvious what happened.  Maybe should catch that error too...

Allan




More information about the pacman-dev mailing list