Improve the info-files and register-shell triggers.
This avoids the need of having to create a new file in pkg metadata dir with a few lines and puts all them in the INSTALL/REMOVE scripts. --HG-- extra : convert_revision : 2dc1d3f6ddcc6aec7dadf14df475c32959df0aba
This commit is contained in:
parent
8a31007139
commit
76c23bbd96
6 changed files with 71 additions and 54 deletions
|
@ -115,7 +115,6 @@ xbps_write_metadata_pkg_real()
|
||||||
# Write the files.plist file.
|
# Write the files.plist file.
|
||||||
TMPFLIST=$(mktemp -t flist.XXXXXXXXXX) || exit 1
|
TMPFLIST=$(mktemp -t flist.XXXXXXXXXX) || exit 1
|
||||||
TMPFPLIST=$(mktemp -t fplist.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
|
# Find out if this package contains info files and compress
|
||||||
|
@ -245,18 +244,6 @@ xbps_write_metadata_pkg_real()
|
||||||
echo "</plist>" >> $TMPFPLIST
|
echo "</plist>" >> $TMPFPLIST
|
||||||
sed -i -e /^$/d $TMPFLIST
|
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.
|
# Write the props.plist file.
|
||||||
local TMPFPROPS=$(mktemp -t fprops.XXXXXXXXXX) || exit 1
|
local TMPFPROPS=$(mktemp -t fprops.XXXXXXXXXX) || exit 1
|
||||||
|
|
||||||
|
@ -345,19 +332,6 @@ _EOF
|
||||||
fi
|
fi
|
||||||
mv -f $TMPFPLIST $metadir/files.plist
|
mv -f $TMPFPLIST $metadir/files.plist
|
||||||
mv -f $TMPFPROPS $metadir/props.plist
|
mv -f $TMPFPROPS $metadir/props.plist
|
||||||
if [ -s $TMPINFOLIST ]; then
|
|
||||||
mv -f $TMPINFOLIST $metadir/info-files
|
|
||||||
else
|
|
||||||
rm -f $TMPINFOLIST
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Register the shells into /etc/shells if requested.
|
|
||||||
if [ -n "${register_shell}" ]; then
|
|
||||||
triggers="$triggers register-shell"
|
|
||||||
for f in ${register_shell}; do
|
|
||||||
echo $f >> $metadir/shells
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
$XBPS_REGPKGDB_CMD sanitize-plist $metadir/files.plist
|
$XBPS_REGPKGDB_CMD sanitize-plist $metadir/files.plist
|
||||||
$XBPS_REGPKGDB_CMD sanitize-plist $metadir/props.plist
|
$XBPS_REGPKGDB_CMD sanitize-plist $metadir/props.plist
|
||||||
|
|
|
@ -28,7 +28,8 @@ xbps_write_metadata_scripts_pkg()
|
||||||
local action="$1"
|
local action="$1"
|
||||||
local metadir="${DESTDIR}/var/db/xbps/metadata/$pkgname"
|
local metadir="${DESTDIR}/var/db/xbps/metadata/$pkgname"
|
||||||
local tmpf=$(mktemp -t xbps-install.XXXXXXXXXX) || exit 1
|
local tmpf=$(mktemp -t xbps-install.XXXXXXXXXX) || exit 1
|
||||||
local targets found
|
local fpattern="s|${DESTDIR}||g;s|^\./$||g;/^$/d"
|
||||||
|
local targets found info_files
|
||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
install) ;;
|
install) ;;
|
||||||
|
@ -60,6 +61,32 @@ VERSION="\$3"
|
||||||
|
|
||||||
_EOF
|
_EOF
|
||||||
|
|
||||||
|
#
|
||||||
|
# Handle GNU Info files.
|
||||||
|
#
|
||||||
|
if [ -d "${DESTDIR}/usr/share/info" ]; then
|
||||||
|
unset info_files
|
||||||
|
for f in $(find ${DESTDIR}/usr/share/info -type f); do
|
||||||
|
j=$(echo $f|sed -e "$fpattern")
|
||||||
|
[ "$j" = "" ] && continue
|
||||||
|
[ "$j" = "/usr/share/info/dir" ] && continue
|
||||||
|
if [ -z "$info_files" ]; then
|
||||||
|
info_files="$j"
|
||||||
|
else
|
||||||
|
info_files="$info_files $j"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -n "${info_files}" ]; then
|
||||||
|
for f in ${triggers}; do
|
||||||
|
[ "$f" = "info-files" ] && found=1
|
||||||
|
done
|
||||||
|
[ -z "$found" ] && triggers="$triggers info-files"
|
||||||
|
unset found
|
||||||
|
echo "export info_files=\"${info_files}\"" >> $tmpf
|
||||||
|
echo >> $tmpf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Handle OpenRC services.
|
# Handle OpenRC services.
|
||||||
#
|
#
|
||||||
|
@ -68,6 +95,19 @@ _EOF
|
||||||
echo >> $tmpf
|
echo >> $tmpf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# (Un)Register a shell in /etc/shells.
|
||||||
|
#
|
||||||
|
if [ -n "${register_shell}" ]; then
|
||||||
|
for f in ${triggers}; do
|
||||||
|
[ "$f" = "register-shell" ] && found=1
|
||||||
|
done
|
||||||
|
[ -z "$found" ] && triggers="$triggers register-shell"
|
||||||
|
unset found
|
||||||
|
echo "export register_shell=\"${register_shell}\"" >> $tmpf
|
||||||
|
echo >> $tmpf
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Handle SGML/XML catalog entries via xmlcatmgr.
|
# Handle SGML/XML catalog entries via xmlcatmgr.
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#
|
#
|
||||||
# This script registers all currently installed info files.
|
# This script registers all currently installed info files.
|
||||||
#
|
#
|
||||||
texinfo_files="info.info.gz info-stnd.info.gz texinfo.gz
|
texinfo_files="info.info.gz info-stnd.info.gz texinfo.gz"
|
||||||
texinfo-1.gz texinfo-2.gz texinfo-3.gz"
|
texinfo_files="${texinfo_files} texinfo-1.gz texinfo-2.gz texinfo-3.gz"
|
||||||
|
|
||||||
case "${ACTION}" in
|
case "${ACTION}" in
|
||||||
pre)
|
pre)
|
||||||
|
@ -20,6 +20,9 @@ post)
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
echo -n "Registering info file: ${file#.}... "
|
echo -n "Registering info file: ${file#.}... "
|
||||||
|
if [ "${file#.}" = "/usr/share/info/dir" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
install-info $file ./usr/share/info/dir 2> /dev/null
|
install-info $file ./usr/share/info/dir 2> /dev/null
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "done."
|
echo "done."
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Template file for 'xbps-base-files'
|
# Template file for 'xbps-base-files'
|
||||||
pkgname=xbps-base-files
|
pkgname=xbps-base-files
|
||||||
version=0.18
|
version=0.19
|
||||||
build_style=custom-install
|
build_style=custom-install
|
||||||
short_desc="xbps base system files"
|
short_desc="xbps base system files"
|
||||||
maintainer="Juan RP <xtraeme@gmail.com>"
|
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
# $2 = target [post-install/pre-remove]
|
# $2 = target [post-install/pre-remove]
|
||||||
# $3 = pkgname
|
# $3 = pkgname
|
||||||
#
|
#
|
||||||
xbps_metadir=var/db/xbps/metadata
|
|
||||||
finfometa=$xbps_metadir/$3/info-files
|
|
||||||
installinfo=usr/bin/install-info
|
installinfo=usr/bin/install-info
|
||||||
infodir=usr/share/info
|
infodir=usr/share/info
|
||||||
|
|
||||||
|
@ -16,28 +14,27 @@ targets)
|
||||||
echo "post-install pre-remove"
|
echo "post-install pre-remove"
|
||||||
;;
|
;;
|
||||||
run)
|
run)
|
||||||
[ ! -x $installinfo ] && exit 0
|
[ ! -x "$installinfo" ] && exit 0
|
||||||
|
|
||||||
if [ ! -r $finfometa ]; then
|
if [ -z "$info_files" ]; then
|
||||||
echo "$trigger: can't find info-files in metadata directory!"
|
echo "Trigger info-files: empty info_files."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat $finfometa | while read line; do
|
for f in ${info_files}; do
|
||||||
[ ! -f ./$line ] && continue
|
[ "$f" = "/usr/share/info/dir" ] && continue
|
||||||
[ "$line" = "/usr/share/info/dir" ] && continue
|
|
||||||
|
|
||||||
case "$2" in
|
case "$2" in
|
||||||
post-install)
|
post-install)
|
||||||
echo -n "Registering info file: $line... "
|
echo -n "Registering info file: $f... "
|
||||||
;;
|
;;
|
||||||
pre-remove)
|
pre-remove)
|
||||||
echo -n "Unregistering info file: $line... "
|
echo -n "Unregistering info file: $f... "
|
||||||
infoargs="--delete"
|
infoargs="--delete"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
$installinfo $infoargs ./$line $infodir/dir 2>/dev/null
|
$installinfo $infoargs ./$f $infodir/dir 2>/dev/null
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "done."
|
echo "done."
|
||||||
else
|
else
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
# $3 = pkgname
|
# $3 = pkgname
|
||||||
# $4 = version
|
# $4 = version
|
||||||
#
|
#
|
||||||
shells_file=var/db/xbps/metadata/$3/shells
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
targets)
|
targets)
|
||||||
|
@ -15,21 +14,25 @@ targets)
|
||||||
;;
|
;;
|
||||||
run)
|
run)
|
||||||
[ "$2" != "post-install" -a "$2" != "post-remove" ] && exit 1
|
[ "$2" != "post-install" -a "$2" != "post-remove" ] && exit 1
|
||||||
[ ! -f ${shells_file} ] && exit 1
|
|
||||||
|
if [ -z "$register_shell" ]; then
|
||||||
|
echo "Trigger register-shell: empty \$register_shell!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
case "$2" in
|
case "$2" in
|
||||||
post-install)
|
post-install)
|
||||||
if [ ! -f etc/shells ]; then
|
if [ ! -f etc/shells ]; then
|
||||||
cat ${shells_file} | while read line; do
|
for f in ${register_shell}; do
|
||||||
echo $line >> etc/shells
|
echo $f >> etc/shells
|
||||||
echo "Registered $line into /etc/shells."
|
echo "Registered $f into /etc/shells."
|
||||||
done
|
done
|
||||||
chmod 644 etc/shells
|
chmod 644 etc/shells
|
||||||
else
|
else
|
||||||
cat ${shells_file} | while read line; do
|
for f in ${register_shell}; do
|
||||||
if ! grep -q $line etc/shells; then
|
if ! grep -q $f etc/shells; then
|
||||||
echo $line >> etc/shells
|
echo $f >> etc/shells
|
||||||
echo -n "Registered $line into "
|
echo -n "Registered $f into "
|
||||||
echo "/etc/shells."
|
echo "/etc/shells."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -37,11 +40,11 @@ run)
|
||||||
;;
|
;;
|
||||||
post-remove)
|
post-remove)
|
||||||
if [ -f etc/shells ]; then
|
if [ -f etc/shells ]; then
|
||||||
cat ${shells_file} | while read line; do
|
for f in ${register_shell}; do
|
||||||
if grep -q $line etc/shells; then
|
if grep -q $f etc/shells; then
|
||||||
shell=$(echo $line|sed "s|\\/|\\\/|g")
|
shell=$(echo $f|sed "s|\\/|\\\/|g")
|
||||||
sed -i -e "/$shell/d" etc/shells
|
sed -i -e "/$shell/d" etc/shells
|
||||||
echo -n "Unregistered $line from "
|
echo -n "Unregistered $f from "
|
||||||
echo "/etc/shells."
|
echo "/etc/shells."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue