info-files (1031B)
1#!/bin/sh 2# 3# Registers or unregisters info files for a package. 4# 5# Arguments: $ACTION = [run/targets] 6# $TARGET = [post-install/pre-remove] 7# $PKGNAME 8# $VERSION 9# $UPDATE = [yes/no] 10# 11ACTION="$1" 12TARGET="$2" 13PKGNAME="$3" 14VERSION="$4" 15UPDATE="$5" 16 17installinfo=usr/bin/install-info 18infodir=usr/share/info 19 20case "$ACTION" in 21targets) 22 echo "post-install pre-remove" 23 ;; 24run) 25 [ ! -x "$installinfo" ] && exit 0 26 27 if [ -z "$info_files" ]; then 28 echo "Trigger info-files: empty info_files." 29 exit 1 30 fi 31 32 for f in ${info_files}; do 33 if [ "$f" = "/usr/share/info/dir" ]; then 34 continue 35 elif [ ! -f ".$f" ]; then 36 echo "WARNING: $f does not exist! skipping..." 37 continue 38 fi 39 40 case "$TARGET" in 41 post-install) 42 echo -n "Registering info file: $f... " 43 ;; 44 pre-remove) 45 echo -n "Unregistering info file: $f... " 46 infoargs="--delete" 47 ;; 48 esac 49 50 $installinfo $infoargs ./$f $infodir/dir 2>/dev/null 51 if [ $? -eq 0 ]; then 52 echo "done." 53 else 54 echo "failed!" 55 fi 56 done 57 ;; 58*) 59 exit 1 60 ;; 61esac 62 63exit 0