[pacman-dev] [PATCH] bacman - regenerate package from system
Allan McRae
mcrae_allan at hotmail.com
Tue Jun 3 23:55:55 EDT 2008
Carlo Bersani wrote:
>
> Hello,
> I finally had a while to fix the permissions issue and to include fakeroot
> support.
Great, tested this with mlocate and the permissions get setup nicely. I
did notice one regression though.
>
> #
> +# Fakeroot
> +#
> +if [ -f /usr/bin/fakeroot -a $EUID -gt 0 ] ; then
> + echo "Entering fakeroot environment"
> + /usr/bin/fakeroot -u -- $progname $1
> + exit $?
> +fi
>
We should add a warning here if fakeroot is missing so the user knows
the permissions might be messy.
The positioning of this block also needs to be considered, e.g.:
> ./bacman
Entering fakeroot environment
This program recreates a package using pacman's db and system files
Usage: bacman <installed package name>
Example: bacman kernel26
> @@ -116,10 +125,9 @@
> case $current in
> %FILES%)
> ret=0
> - if [ -d "/$i" ]; then
> - mkdir "$i" || ret=$?
> - elif [ -f "/$i" ]; then
> - cp -dp "/$i" "$i" || ret=$?
> + if [ -e "/$i" ]; then
> + bsdtar -cnf - "/$i" 2> /dev/null | bsdtar -xpf -
> + ret=${PIPESTATUS[0]}
> else
> echo "/$i" is missing: this might result in a broken package
> fi
>
The ret catch from bsdtar is not working correctly. E.g. making the
sudo package where the user does not have permission to read
/etc/sudoers no longer has that error caught.
Instead of checking $PIPESTATUS, how about checking the actual file is
present:
if [ ! -e $work_dir/$i ]; then
ret=1
fi
Allan
More information about the pacman-dev
mailing list