2011-12-15 14:28:16 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Enables or disables a virtual package to xbps.conf.
|
|
|
|
#
|
|
|
|
# Arguments: $ACTION = [run/targets]
|
|
|
|
# $TARGET = [post-install/pre-remove]
|
|
|
|
# $PKGNAME
|
|
|
|
# $VERSION
|
|
|
|
# $UPDATE = [yes/no]
|
|
|
|
#
|
|
|
|
ACTION="$1"
|
|
|
|
TARGET="$2"
|
|
|
|
PKGNAME="$3"
|
|
|
|
VERSION="$4"
|
|
|
|
UPDATE="$5"
|
|
|
|
CONF_FILE="$6"
|
|
|
|
|
|
|
|
export PATH="$PATH:/usr/local/bin"
|
|
|
|
|
|
|
|
case "$ACTION" in
|
|
|
|
targets)
|
|
|
|
echo "post-install post-remove"
|
|
|
|
;;
|
|
|
|
run)
|
|
|
|
[ -z "$CONF_FILE" ] && CONF_FILE=etc/xbps/xbps.conf
|
|
|
|
[ ! -w $CONF_FILE ] && exit 0
|
|
|
|
|
2011-12-16 10:34:46 +01:00
|
|
|
if [ "${TARGET}" = "post-install" ]; then
|
|
|
|
if [ "$UPDATE" = "yes" ]; then
|
|
|
|
# do nothing
|
|
|
|
exit 0
|
|
|
|
fi
|
2011-12-15 14:28:16 +01:00
|
|
|
echo "Enabled $PKGNAME virtual packages to $CONF_FILE."
|
2011-12-16 10:34:46 +01:00
|
|
|
echo "include(/etc/xbps/virtualpkg.d/$PKGNAME.conf)" >> ./$CONF_FILE
|
2011-12-15 14:28:16 +01:00
|
|
|
else
|
2011-12-16 10:34:46 +01:00
|
|
|
sed -i "/^include.*${PKGNAME}\.conf.*$/d" ./$CONF_FILE
|
2011-12-15 14:28:16 +01:00
|
|
|
echo "Disabled $PKGNAME virtual packages from $CONF_FILE."
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|