[PS: it's easier to read if you don't use HTML or special formatting...]
Mike Branco wrote:
> Running dachstein RC2 floppy version:
> I'm try to add an uninstall option into lrpkg.
Apkg already has this :)
> I've added this code to /lib/POSIXness/POSIXness.linuxrouter in the
> lrpkg() function.
> #########
> uninstall () {
> f="$1"
> FN_LIST="$(cat $lrpkgpath/$f.list)"
> for FN in $FN_LIST; do
> rm /$FN
> done
> }
> #########
rm /$FN leads to a few problems:
* If the file doesn't exist, an error is created...
* If the file is actually a directory, an error is created...
Probably better is:
rm -rf /$FN
...remember this is dangerous, since -rf makes the delete 1) recursive,
and 2) forced.
If no file exists, it is silent (and returns success). If the file is a
directory, it'll delete it and everything underneath it.
> this in the case function,
>
> #########
> -u ) uninstall "$2" "$3" ;;
> #########
> and this in the usage function:
>
> #########
> eecho " -u: uninstall Uninstall package. (explude
> .lrp)"
> #########
> Is this messy/incorrect/etc? I have very little exp. coding shell
> scripts,
> that's why i'm asking, although it seems to work ok.
>
> Also, what can I add to this to update the /var/lib/lrpkg/packages
> file
> to remove the named package from the list?
# Remove package from packages list:
PKGD=/var/lib/lrpkg
mv $PKGD/packages $PKGD/pkg.old
grep -v $PKGD/pkg.old > $PKGD/packages
_______________________________________________
Leaf-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user