2022-10-23 14:44:50 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd $(dirname $0)/..
|
|
|
|
|
|
|
|
source tools/env.sh
|
|
|
|
|
|
|
|
cd ports
|
|
|
|
|
2022-10-30 17:19:12 +00:00
|
|
|
export DESTDIR=${DESTDIR:-"$LUNA_ROOT/initrd"}
|
2022-10-23 14:44:50 +00:00
|
|
|
export listdir=$PWD
|
|
|
|
|
|
|
|
if [ -z $1 ]
|
|
|
|
then
|
|
|
|
echo "Usage: remove-port.sh <port-name>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d $1 ]
|
|
|
|
then
|
|
|
|
pkgscript=$1/package.sh
|
|
|
|
elif [ -f $1 ]
|
|
|
|
then
|
|
|
|
pkgscript=$1
|
|
|
|
else
|
|
|
|
echo "Unrecognized argument: $1"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
export portdir=$(realpath $(dirname $pkgscript))
|
|
|
|
export workdir=$portdir/workdir
|
|
|
|
mkdir -p $workdir
|
|
|
|
|
|
|
|
source $pkgscript
|
|
|
|
|
|
|
|
echo "Removing $pkgname version $pkgver..."
|
|
|
|
|
|
|
|
cd $installdir
|
2022-10-23 18:03:29 +00:00
|
|
|
port_uninstall | filter-lines $pkgname "uninstall"
|
2022-10-23 14:44:50 +00:00
|
|
|
|
|
|
|
rm -rf $workdir
|
2022-10-26 20:00:31 +00:00
|
|
|
cat $listdir/ports.list | grep -v $pkgname | tee $listdir/ports.list >/dev/null
|
2022-10-23 14:44:50 +00:00
|
|
|
|
|
|
|
echo "Success! Removed port: $pkgname version $pkgver."
|