46 lines
856 B
Bash
Executable File
46 lines
856 B
Bash
Executable File
#!/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
|
|
|
|
if [ "${TARGET}" = "post-install" ]; then
|
|
if [ "$UPDATE" = "yes" ]; then
|
|
# do nothing
|
|
exit 0
|
|
fi
|
|
echo "Enabled $PKGNAME virtual packages to $CONF_FILE."
|
|
echo "include(/etc/xbps/virtualpkg.d/$PKGNAME.conf)" >> ./$CONF_FILE
|
|
else
|
|
sed -i "/^include.*${PKGNAME}\.conf.*$/d" ./$CONF_FILE
|
|
echo "Disabled $PKGNAME virtual packages from $CONF_FILE."
|
|
fi
|
|
;;
|
|
*)
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|