Implemented support for running triggers with binpkgs.
Also the following changes were made: * Added an info-files trigger, to (un)register info files. * xbps-base-dirs: it's responsible to install triggers on destdir. --HG-- extra : convert_revision : 8d707053616f38d2b5beef7cf28e1bc4a66812b8
This commit is contained in:
parent
37c27f7307
commit
53747489f0
@ -96,16 +96,18 @@ run_file()
|
||||
|
||||
set_defvars()
|
||||
{
|
||||
local i=
|
||||
local DDIRS i
|
||||
|
||||
: ${XBPS_TEMPLATESDIR:=$XBPS_DISTRIBUTIONDIR/templates}
|
||||
: ${XBPS_TRIGGERSDIR:=$XBPS_DISTRIBUTIONDIR/triggers}
|
||||
: ${XBPS_HELPERSDIR:=$XBPS_TEMPLATESDIR/helpers}
|
||||
: ${XBPS_DBDIR:=$XBPS_MASTERDIR/var/db/xbps}
|
||||
: ${XBPS_META_PATH:=$XBPS_DBDIR/}
|
||||
: ${XBPS_PKGMETADIR:=$XBPS_DBDIR/metadata}
|
||||
: ${XBPS_SHUTILSDIR:=$XBPS_DISTRIBUTIONDIR/shutils}
|
||||
|
||||
local DDIRS="XBPS_TEMPLATESDIR XBPS_HELPERSDIR XBPS_SHUTILSDIR"
|
||||
DDIRS="XBPS_TEMPLATESDIR XBPS_TRIGGERSDIR"
|
||||
DDIRS="$DDIRS XBPS_HELPERSDIR XBPS_SHUTILSDIR"
|
||||
for i in ${DDIRS}; do
|
||||
eval val="\$$i"
|
||||
[ ! -d "$val" ] && msg_error "cannot find $i, aborting."
|
||||
|
3
doc/TODO
3
doc/TODO
@ -4,8 +4,6 @@ xbps-src:
|
||||
Something like ${sourceforge} to pick up any specified mirror on the list.
|
||||
* Add support to run INSTALL/REMOVE scripts, so that the same actions are
|
||||
performed in source/bin packages. [STOPPED]
|
||||
* Use current postinstall_helpers to automatically add triggers, shared
|
||||
by src/bin packages. [IN PROGRESS]
|
||||
|
||||
Packages:
|
||||
* fix mpfr hardcoded rpath for gmp.
|
||||
@ -19,7 +17,6 @@ xbps-bin:
|
||||
* Add support to update packages.
|
||||
* While installing a package, check if version that is going to be
|
||||
installed is already installed.
|
||||
* (Un)register info files automatically. [IN PROGRESS]
|
||||
|
||||
xbps-repo:
|
||||
* Replace binpkg-genindex.sh with a target for xbps-repo to generate the
|
||||
|
@ -25,11 +25,9 @@
|
||||
|
||||
write_metadata_flist_header()
|
||||
{
|
||||
local file="$1"
|
||||
[ ! -f "$1" ] && return 1
|
||||
|
||||
[ -z "$file" ] && return 1
|
||||
|
||||
cat > $file <<_EOF
|
||||
cat > $1 <<_EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
@ -43,7 +41,7 @@ _EOF
|
||||
xbps_write_metadata_pkg()
|
||||
{
|
||||
local pkg="$1"
|
||||
local subpkg=
|
||||
local subpkg
|
||||
|
||||
for subpkg in ${subpackages}; do
|
||||
if [ "${pkg}" != "${sourcepkg}" ] && \
|
||||
@ -56,7 +54,8 @@ xbps_write_metadata_pkg()
|
||||
if [ ! -f $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template ]; then
|
||||
msg_error "Cannot find subpackage template!"
|
||||
fi
|
||||
unset run_depends conf_files keep_dirs noarch install_priority
|
||||
unset run_depends conf_files keep_dirs noarch install_priority \
|
||||
triggers
|
||||
. $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template
|
||||
pkgname=${sourcepkg}-${subpkg}
|
||||
set_tmpl_common_vars
|
||||
@ -83,7 +82,7 @@ xbps_write_metadata_pkg()
|
||||
xbps_write_metadata_pkg_real()
|
||||
{
|
||||
local metadir=${DESTDIR}/var/db/xbps/metadata/$pkgname
|
||||
local f i j arch prioinst TMPFLIST TMPFPLIST
|
||||
local f i j arch dirat lnkat newlnk prioinst TMPFLIST TMPFPLIST
|
||||
local fpattern="s|${DESTDIR}||g;s|^\./$||g;/^$/d"
|
||||
|
||||
if [ ! -d "${DESTDIR}" ]; then
|
||||
@ -106,7 +105,66 @@ xbps_write_metadata_pkg_real()
|
||||
# Write the files.plist file.
|
||||
TMPFLIST=$(mktemp -t flist.XXXXXXXXXX) || exit 1
|
||||
TMPFPLIST=$(mktemp -t fplist.XXXXXXXXXX) || exit 1
|
||||
TMPINFOLIST=$(mktemp -t infolist.XXXXXXXXXX) || exit 1
|
||||
|
||||
#
|
||||
# Find out if this package contains info files and compress
|
||||
# all them with gzip.
|
||||
#
|
||||
if [ -f "${DESTDIR}/usr/share/info/dir" ]; then
|
||||
if [ -f ${XBPS_MASTERDIR}/usr/share/info/dir ]; then
|
||||
rm -f ${DESTDIR}/usr/share/info/dir
|
||||
fi
|
||||
# Add info-files trigger.
|
||||
triggers="info-files $triggers"
|
||||
|
||||
for f in $(find -L ${DESTDIR}/usr/share/info -type f); do
|
||||
j=$(echo $f|sed -e "$fpattern")
|
||||
[ "$j" = "" ] && continue
|
||||
[ "$j" = "/usr/share/info/dir" ] && continue
|
||||
if $(echo $j|grep -q '.gz'); then
|
||||
continue
|
||||
fi
|
||||
if [ -h ${DESTDIR}/$j ]; then
|
||||
dirat=$(dirname $j)
|
||||
lnkat=$(readlink ${DESTDIR}/$j)
|
||||
newlnk=$(basename $j)
|
||||
rm -f ${DESTDIR}/$j
|
||||
cd ${DESTDIR}/$dirat
|
||||
ln -s ${lnkat}.gz ${newlnk}.gz
|
||||
continue
|
||||
fi
|
||||
echo "=> Compressing info file: $j..."
|
||||
gzip -q9 ${DESTDIR}/$j
|
||||
done
|
||||
fi
|
||||
|
||||
#
|
||||
# Find out if this package contains manual pages and
|
||||
# compress all them with gzip.
|
||||
#
|
||||
if [ -d "${DESTDIR}/usr/share/man" ]; then
|
||||
for f in $(find -L ${DESTDIR}/usr/share/man -type f); do
|
||||
j=$(echo $f|sed -e "$fpattern")
|
||||
[ "$j" = "" ] && continue
|
||||
if $(echo $j|grep -q '.gz'); then
|
||||
continue
|
||||
fi
|
||||
if [ -h ${DESTDIR}/$j ]; then
|
||||
dirat=$(dirname $j)
|
||||
lnkat=$(readlink ${DESTDIR}/$j)
|
||||
newlnk=$(basename $j)
|
||||
rm -f ${DESTDIR}/$j
|
||||
cd ${DESTDIR}/$dirat
|
||||
ln -s ${lnkat}.gz ${newlnk}.gz
|
||||
continue
|
||||
fi
|
||||
echo "=> Compressing manpage: $j..."
|
||||
gzip -q9 ${DESTDIR}/$j
|
||||
done
|
||||
fi
|
||||
|
||||
cd ${DESTDIR}
|
||||
msg_normal "Writing package metadata for $pkgname-$version..."
|
||||
|
||||
write_metadata_flist_header $TMPFPLIST
|
||||
@ -115,59 +173,73 @@ xbps_write_metadata_pkg_real()
|
||||
for f in $(find ${DESTDIR} -type l); do
|
||||
j=$(echo $f|sed -e "$fpattern")
|
||||
[ "$j" = "" ] && continue
|
||||
printf "$j\n" >> $TMPFLIST
|
||||
printf "<dict>\n" >> $TMPFPLIST
|
||||
printf "<key>file</key>\n" >> $TMPFPLIST
|
||||
printf "<string>$j</string>\n" >> $TMPFPLIST
|
||||
printf "<key>type</key>\n" >> $TMPFPLIST
|
||||
printf "<string>link</string>\n" >> $TMPFPLIST
|
||||
printf "</dict>\n" >> $TMPFPLIST
|
||||
echo "$j" >> $TMPFLIST
|
||||
echo "<dict>" >> $TMPFPLIST
|
||||
echo "<key>file</key>" >> $TMPFPLIST
|
||||
echo "<string>$j</string>" >> $TMPFPLIST
|
||||
echo "<key>type</key>" >> $TMPFPLIST
|
||||
echo "<string>link</string>" >> $TMPFPLIST
|
||||
echo "</dict>" >> $TMPFPLIST
|
||||
done
|
||||
|
||||
# Pass 2: add regular files.
|
||||
for f in $(find ${DESTDIR} -type f); do
|
||||
j=$(echo $f|sed -e "$fpattern")
|
||||
[ "$j" = "" ] && continue
|
||||
printf "$j\n" >> $TMPFLIST
|
||||
printf "<dict>\n" >> $TMPFPLIST
|
||||
printf "<key>file</key>\n" >> $TMPFPLIST
|
||||
printf "<string>$j</string>\n" >> $TMPFPLIST
|
||||
printf "<key>type</key>\n" >> $TMPFPLIST
|
||||
printf "<string>file</string>\n" >> $TMPFPLIST
|
||||
printf "<key>sha256</key>\n" >> $TMPFPLIST
|
||||
printf "<string>$(xbps-digest $f)</string>\n" >> $TMPFPLIST
|
||||
echo "$j" >> $TMPFLIST
|
||||
echo "<dict>" >> $TMPFPLIST
|
||||
echo "<key>file</key>" >> $TMPFPLIST
|
||||
echo "<string>$j</string>" >> $TMPFPLIST
|
||||
echo "<key>type</key>" >> $TMPFPLIST
|
||||
echo "<string>file</string>" >> $TMPFPLIST
|
||||
echo "<key>sha256</key>" >> $TMPFPLIST
|
||||
echo "<string>$(xbps-digest $f)</string>" >> $TMPFPLIST
|
||||
for i in ${conf_files}; do
|
||||
if [ "$j" = "$i" ]; then
|
||||
printf "<key>conf_file</key>\n" >> $TMPFPLIST
|
||||
printf "<true/>\n" >> $TMPFPLIST
|
||||
echo "<key>conf_file</key>" >> $TMPFPLIST
|
||||
echo "<true/>" >> $TMPFPLIST
|
||||
break
|
||||
fi
|
||||
done
|
||||
printf "</dict>\n" >> $TMPFPLIST
|
||||
echo "</dict>" >> $TMPFPLIST
|
||||
done
|
||||
|
||||
# Pass 3: add directories.
|
||||
for f in $(find ${DESTDIR} -type d|sort -ur); do
|
||||
j=$(echo $f|sed -e "$fpattern")
|
||||
[ "$j" = "" ] && continue
|
||||
printf "$j\n" >> $TMPFLIST
|
||||
printf "<dict>\n" >> $TMPFPLIST
|
||||
printf "<key>file</key>\n" >> $TMPFPLIST
|
||||
printf "<string>$j</string>\n" >> $TMPFPLIST
|
||||
printf "<key>type</key>\n" >> $TMPFPLIST
|
||||
printf "<string>dir</string>\n" >> $TMPFPLIST
|
||||
echo "$j" >> $TMPFLIST
|
||||
echo "<dict>" >> $TMPFPLIST
|
||||
echo "<key>file</key>" >> $TMPFPLIST
|
||||
echo "<string>$j</string>" >> $TMPFPLIST
|
||||
echo "<key>type</key>" >> $TMPFPLIST
|
||||
echo "<string>dir</string>" >> $TMPFPLIST
|
||||
for i in ${keep_dirs}; do
|
||||
if [ "$j" = "$i" ]; then
|
||||
printf "<key>keep</key>\n" >> $TMPFPLIST
|
||||
printf "<true/>\n" >> $TMPFPLIST
|
||||
echo "<key>keep</key>" >> $TMPFPLIST
|
||||
echo "<true/>" >> $TMPFPLIST
|
||||
break
|
||||
fi
|
||||
done
|
||||
printf "</dict>\n" >> $TMPFPLIST
|
||||
echo "</dict>" >> $TMPFPLIST
|
||||
done
|
||||
printf "</array>\n</dict>\n</plist>\n" >> $TMPFPLIST
|
||||
echo "</array>" >> $TMPFPLIST
|
||||
echo "</dict>" >> $TMPFPLIST
|
||||
echo "</plist>" >> $TMPFPLIST
|
||||
sed -i -e /^$/d $TMPFLIST
|
||||
|
||||
#
|
||||
# Find out if this package contains info files and write
|
||||
# a list will all them in a file.
|
||||
#
|
||||
if [ -d "${DESTDIR}/usr/share/info" ]; then
|
||||
for f in $(find ${DESTDIR}/usr/share/info -type f); do
|
||||
j=$(echo $f|sed -e "$fpattern")
|
||||
[ "$j" = "" ] && continue
|
||||
echo "$j" >> $TMPINFOLIST
|
||||
done
|
||||
fi
|
||||
|
||||
# Write the props.plist file.
|
||||
local TMPFPROPS=$(mktemp -t fprops.XXXXXXXXXX) || exit 1
|
||||
|
||||
@ -195,35 +267,36 @@ xbps_write_metadata_pkg_real()
|
||||
_EOF
|
||||
# Dependencies
|
||||
if [ -n "$run_depends" ]; then
|
||||
printf "<key>run_depends</key>\n" >> $TMPFPROPS
|
||||
printf "<array>\n" >> $TMPFPROPS
|
||||
echo "<key>run_depends</key>" >> $TMPFPROPS
|
||||
echo "<array>" >> $TMPFPROPS
|
||||
for f in ${run_depends}; do
|
||||
printf "<string>$f</string>\n" >> $TMPFPROPS
|
||||
echo "<string>$f</string>" >> $TMPFPROPS
|
||||
done
|
||||
printf "</array>\n" >> $TMPFPROPS
|
||||
echo "</array>" >> $TMPFPROPS
|
||||
fi
|
||||
|
||||
# Configuration files
|
||||
if [ -n "$conf_files" ]; then
|
||||
printf "<key>conf_files</key>\n" >> $TMPFPROPS
|
||||
printf "<array>\n" >> $TMPFPROPS
|
||||
echo "<key>conf_files</key>" >> $TMPFPROPS
|
||||
echo "<array>" >> $TMPFPROPS
|
||||
for f in ${conf_files}; do
|
||||
printf "<string>$f</string>\n" >> $TMPFPROPS
|
||||
echo "<string>$f</string>" >> $TMPFPROPS
|
||||
done
|
||||
printf "</array>\n" >> $TMPFPROPS
|
||||
echo "</array>" >> $TMPFPROPS
|
||||
fi
|
||||
# Keep directories while removing.
|
||||
if [ -n "$keep_dirs" ]; then
|
||||
printf "<key>keep_dirs</key>\n" >> $TMPFPROPS
|
||||
printf "<array>\n" >> $TMPFPROPS
|
||||
echo "<key>keep_dirs</key>" >> $TMPFPROPS
|
||||
echo "<array>" >> $TMPFPROPS
|
||||
for f in ${keep_dirs}; do
|
||||
printf "<string>$f</string>\n" >> $TMPFPROPS
|
||||
echo "<string>$f</string>" >> $TMPFPROPS
|
||||
done
|
||||
printf "</array>\n" >> $TMPFPROPS
|
||||
echo "</array>" >> $TMPFPROPS
|
||||
fi
|
||||
|
||||
# Terminate the property list file.
|
||||
printf "</dict>\n</plist>\n" >> $TMPFPROPS
|
||||
echo "</dict>" >> $TMPFPROPS
|
||||
echo "</plist>" >> $TMPFPROPS
|
||||
|
||||
if [ ! -d $metadir ]; then
|
||||
mkdir -p $metadir >/dev/null 2>&1
|
||||
@ -235,28 +308,131 @@ _EOF
|
||||
fi
|
||||
|
||||
# Write metadata files and cleanup.
|
||||
cp -f $TMPFLIST $metadir/flist
|
||||
cp -f $TMPFPLIST $metadir/files.plist
|
||||
cp -f $TMPFPROPS $metadir/props.plist
|
||||
if [ -s $TMPFLIST ]; then
|
||||
mv -f $TMPFLIST $metadir/flist
|
||||
else
|
||||
rm -f $TMPFLIST
|
||||
fi
|
||||
mv -f $TMPFPLIST $metadir/files.plist
|
||||
mv -f $TMPFPROPS $metadir/props.plist
|
||||
if [ -s $TMPINFOLIST ]; then
|
||||
mv -f $TMPINFOLIST $metadir/info-files
|
||||
else
|
||||
rm -f $TMPINFOLIST
|
||||
fi
|
||||
$XBPS_REGPKGDB_CMD sanitize-plist $metadir/files.plist
|
||||
$XBPS_REGPKGDB_CMD sanitize-plist $metadir/props.plist
|
||||
chmod 644 $metadir/*
|
||||
rm -f $TMPFLIST $TMPFPLIST $TMPFPROPS
|
||||
|
||||
if [ -f "$XBPS_TEMPLATESDIR/$pkgname/INSTALL" ]; then
|
||||
cp -f $XBPS_TEMPLATESDIR/$pkgname/INSTALL ${DESTDIR}
|
||||
chmod +x ${DESTDIR}/INSTALL
|
||||
fi
|
||||
if [ -f "$XBPS_TEMPLATESDIR/$pkgname/REMOVE" ]; then
|
||||
cp -f $XBPS_TEMPLATESDIR/$pkgname/REMOVE $metadir
|
||||
chmod +x $metadir/REMOVE
|
||||
#
|
||||
# Create the INSTALL/REMOVE scripts if package uses them
|
||||
# or uses any available trigger.
|
||||
#
|
||||
xbps_make_script install
|
||||
xbps_make_script remove
|
||||
}
|
||||
|
||||
xbps_make_script()
|
||||
{
|
||||
local action="$1"
|
||||
local metadir="${DESTDIR}/var/db/xbps/metadata/$pkgname"
|
||||
local tmpf=$(mktemp -t xbps-install.XXXXXXXXXX) || exit 1
|
||||
local triggerdir="./var/db/xbps/triggers"
|
||||
local targets found
|
||||
|
||||
case "$action" in
|
||||
install) ;;
|
||||
remove) ;;
|
||||
*) return 1;;
|
||||
esac
|
||||
|
||||
cd ${DESTDIR}
|
||||
cat >> $tmpf <<_EOF
|
||||
#!/bin/sh -e
|
||||
#
|
||||
# Generic INSTALL/REMOVE script.
|
||||
#
|
||||
# $1 = cwd
|
||||
# $2 = action
|
||||
# $3 = pkgname
|
||||
# $4 = version
|
||||
#
|
||||
# Note that paths must be relative to CWD, to avoid calling
|
||||
# host commands.
|
||||
#
|
||||
|
||||
export PATH="./bin:./sbin:./usr/bin:./usr/sbin"
|
||||
_EOF
|
||||
|
||||
if [ -n "$triggers" ]; then
|
||||
found=1
|
||||
echo "case \"\$2\" in" >> $tmpf
|
||||
echo "pre)" >> $tmpf
|
||||
for f in ${triggers}; do
|
||||
if [ ! -f $XBPS_TRIGGERSDIR/$f ]; then
|
||||
rm -f $tmpf
|
||||
msg_error "$pkgname: unknown trigger $f, aborting!"
|
||||
fi
|
||||
done
|
||||
for f in ${triggers}; do
|
||||
targets=$($XBPS_TRIGGERSDIR/$f targets)
|
||||
for j in ${targets}; do
|
||||
if ! $(echo $j|grep -q pre-${action}); then
|
||||
continue
|
||||
fi
|
||||
printf "\t$triggerdir/$f run $j $pkgname $version\n" >> $tmpf
|
||||
printf "\t[ \$? -ne 0 ] && exit \$?\n" >> $tmpf
|
||||
done
|
||||
done
|
||||
printf "\t;;\n" >> $tmpf
|
||||
echo "post)" >> $tmpf
|
||||
for f in ${triggers}; do
|
||||
targets=$($XBPS_TRIGGERSDIR/$f targets)
|
||||
for j in ${targets}; do
|
||||
if ! $(echo $j|grep -q post-${action}); then
|
||||
continue
|
||||
fi
|
||||
printf "\t$triggerdir/$f run $j $pkgname $version\n" >> $tmpf
|
||||
printf "\t[ \$? -ne 0 ] && exit \$?\n" >> $tmpf
|
||||
done
|
||||
done
|
||||
printf "\t;;\n" >> $tmpf
|
||||
echo "esac" >> $tmpf
|
||||
echo >> $tmpf
|
||||
fi
|
||||
|
||||
case "$action" in
|
||||
install)
|
||||
if [ -f "$XBPS_TEMPLATESDIR/$pkgname/INSTALL" ]; then
|
||||
found=1
|
||||
cat $XBPS_TEMPLATESDIR/$pkgname/INSTALL >> $tmpf
|
||||
fi
|
||||
echo "exit 0" >> $tmpf
|
||||
if [ -z "$found" ]; then
|
||||
rm -f $tmpf
|
||||
return 0
|
||||
fi
|
||||
mv $tmpf ${DESTDIR}/INSTALL && chmod 755 ${DESTDIR}/INSTALL
|
||||
;;
|
||||
remove)
|
||||
if [ -f "$XBPS_TEMPLATESDIR/$pkgname/REMOVE" ]; then
|
||||
found=1
|
||||
cat $XBPS_TEMPLATESDIR/$pkgname/REMOVE >> $tmpf
|
||||
fi
|
||||
echo "exit 0" >> $tmpf
|
||||
if [ -z "$found" ]; then
|
||||
rm -f $tmpf
|
||||
return 0
|
||||
fi
|
||||
mv $tmpf ${metadir}/REMOVE && chmod 755 ${metadir}/REMOVE
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
xbps_make_binpkg()
|
||||
{
|
||||
local pkg="$1"
|
||||
local subpkg=
|
||||
local subpkg
|
||||
|
||||
for subpkg in ${subpackages}; do
|
||||
if [ "$pkg" = "$pkgname-$subpkg" ]; then
|
||||
@ -280,10 +456,7 @@ xbps_make_binpkg()
|
||||
#
|
||||
xbps_make_binpkg_real()
|
||||
{
|
||||
local binpkg=
|
||||
local pkgdir=
|
||||
local arch=
|
||||
local use_sudo=
|
||||
local binpkg pkgdir arch use_sudo
|
||||
|
||||
if [ ! -d ${DESTDIR} ]; then
|
||||
echo "$pkgname: unexistent destdir... skipping!"
|
||||
|
@ -1,12 +1,7 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
|
||||
|
||||
# $1 = chrootdir
|
||||
# $2 = action
|
||||
# $3 = pkgname
|
||||
# $4 = version
|
||||
|
||||
#
|
||||
# This scripts creates the initramfs for the newly installed
|
||||
# kernel package.
|
||||
#
|
||||
case "$2" in
|
||||
pre)
|
||||
;;
|
||||
@ -39,5 +34,3 @@ post)
|
||||
${umntsys_cmd}
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
@ -1,11 +1,8 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
|
||||
|
||||
# $1 = chrootdir
|
||||
# $2 = action
|
||||
# $3 = pkgname
|
||||
# $4 = version
|
||||
#
|
||||
# This script creates default /etc/passwd and /etc/group
|
||||
# files if they are unexistent.
|
||||
#
|
||||
# Also shadow passwords are enabled.
|
||||
|
||||
create_passwd()
|
||||
{
|
||||
@ -66,6 +63,3 @@ post)
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
|
31
templates/texinfo/INSTALL
Normal file
31
templates/texinfo/INSTALL
Normal file
@ -0,0 +1,31 @@
|
||||
#
|
||||
# This script registers all currently installed info files.
|
||||
#
|
||||
texinfo_files="info.info.gz info-stnd.info.gz texinfo.gz
|
||||
texinfo-1.gz texinfo-2.gz texinfo-3.gz"
|
||||
|
||||
case "$2" in
|
||||
pre)
|
||||
;;
|
||||
post)
|
||||
for file in $(find ./usr/share/info -type f ! -name dir); do
|
||||
for i in ${texinfo_files}; do
|
||||
if [ "$(basename ${file#.})" = "${i}" ]; then
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -n "$found" ]; then
|
||||
unset found
|
||||
continue
|
||||
fi
|
||||
echo -n "Registering info file: ${file#.}... "
|
||||
install-info $file ./usr/share/info/dir 2> /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "done."
|
||||
else
|
||||
echo "failed!"
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
@ -1,11 +1,12 @@
|
||||
# Template file for 'xbps-base-dirs'
|
||||
pkgname=xbps-base-dirs
|
||||
version=0.2
|
||||
version=0.3
|
||||
build_style=custom-install
|
||||
short_desc="xbps base system directories"
|
||||
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||
long_desc="
|
||||
This package installs the base system directories."
|
||||
This package installs the base system directories as well
|
||||
as some required files for xbps."
|
||||
|
||||
base_chroot=yes
|
||||
noarch=yes
|
||||
@ -48,4 +49,9 @@ do_install()
|
||||
cd $DESTDIR && ln -s lib lib64
|
||||
cd $DESTDIR/usr && ln -s lib lib64
|
||||
fi
|
||||
|
||||
for f in info-files; do
|
||||
install -D -m 755 ${XBPS_TRIGGERSDIR}/$f \
|
||||
$DESTDIR/var/db/xbps/triggers/$f
|
||||
done
|
||||
}
|
||||
|
54
triggers/info-files
Executable file
54
triggers/info-files
Executable file
@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Registers or unregisters info files for a package.
|
||||
#
|
||||
# Arguments: $1 = action [run/targets]
|
||||
# $2 = target [post-install/pre-remove]
|
||||
# $3 = pkgname
|
||||
#
|
||||
trigger="info-files"
|
||||
|
||||
xbps_metadir="./var/db/xbps/metadata"
|
||||
finfometa="$xbps_metadir/$3/$trigger"
|
||||
installinfo="./usr/bin/install-info"
|
||||
infodir="./usr/share/info"
|
||||
|
||||
case "$1" in
|
||||
targets)
|
||||
echo "post-install pre-remove"
|
||||
;;
|
||||
run)
|
||||
[ ! -x $installinfo ] && exit 0
|
||||
|
||||
if [ ! -r $finfometa ]; then
|
||||
echo "$trigger: can't find info-files in metadata directory!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat $finfometa | while read line; do
|
||||
[ ! -f ./$line ] && continue
|
||||
|
||||
case "$2" in
|
||||
post-install)
|
||||
echo -n "Registering info file: $line... "
|
||||
;;
|
||||
pre-remove)
|
||||
echo -n "Unregistering info file: $line... "
|
||||
infoargs="--delete"
|
||||
;;
|
||||
esac
|
||||
|
||||
$installinfo $infoargs ./$line $infodir/dir 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "done."
|
||||
else
|
||||
echo "failed!"
|
||||
fi
|
||||
done
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user