void-packages/srcpkgs/xbps-triggers/files/virtualpkg

39 lines
645 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
sed -i "/^include.*\/etc\/xbps\/virtualpkg.d\/.*/d" ./$CONF_FILE
for f in etc/xbps/virtualpkg.d/*.conf; do
echo "include(/$f)" >> ./$CONF_FILE
done
;;
*)
exit 1
;;
esac
exit 0