freebsd-ports/sysutils/pcbsd-utils/pkg-install
2014-03-11 23:39:01 +00:00

46 lines
1.6 KiB
Bash

#!/bin/sh
# Script to install PBI repo on pkg add
PREFIX=${PKG_PREFIX-/usr/local}
if [ "$2" != "POST-INSTALL" ] ; then
exit 0
fi
# If this is during staging, we can skip for now
echo $PREFIX | grep -q '/stage/'
if [ $? -eq 0 ] ; then
exit 0
fi
# If this is a new install, add the PC-BSD master repo
ls /var/db/pbi/keys/* 2>/dev/null >/dev/null
if [ $? -ne 0 ] ; then
${PREFIX}/sbin/pbi_addrepo ${PREFIX}/share/pbi-manager/pcbsd.rpo
fi
# Copy over the wrapper files
if [ `uname -m` = "amd64" ] ; then
cp ${PREFIX}/share/pbi-manager/.pbiwrapper-i386 /usr/pbi/.pbiwrapper-i386
cp ${PREFIX}/share/pbi-manager/.pbiwrapper-amd64 /usr/pbi/.pbiwrapper-amd64
else
cp ${PREFIX}/share/pbi-manager/.pbiwrapper-i386 /usr/pbi/.pbiwrapper-i386
fi
# If on FreeBSD > 10, install the PBI mounting files
if [ -e "${PREFIX}/share/pbi-manager/.pbime" ] ; then
install -o root -g wheel -m 4751 ${PREFIX}/share/pbi-manager/.pbime /usr/pbi/.pbime
install -o root -g wheel -m 755 ${PREFIX}/share/pbi-manager/.pbimount /usr/pbi/.pbimount
install -o root -g wheel -m 755 ${PREFIX}/share/pbi-manager/.ldconfig /usr/pbi/.ldconfig
install -o root -g wheel -m 755 ${PREFIX}/share/pbi-manager/.pbisyscmd /usr/pbi/.pbisyscmd
install -o root -g wheel -m 755 ${PREFIX}/share/pbi-manager/.pbisyslisten /usr/pbi/.pbisyslisten
install -o root -g wheel -m 755 ${PREFIX}/share/pbi-manager/.pbifs /usr/pbi/.pbifs
fi
# Check if we have our warden.conf file
if [ ! -e "/usr/local/etc/warden.conf" ] ; then
cp /usr/local/etc/warden.conf.dist /usr/local/etc/warden.conf
chmod 644 /usr/local/etc/warden.conf
fi
exit 0