postrm is in di-netboot-assistant 0.51.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | #!/bin/sh
# postrm script for di-netboot-assistant
set -eu
DL_CACHE=/var/cache/di-netboot-assistant/
STATUS_LIB=/var/lib/di-netboot-assistant
TFTP_ROOT=/var/lib/tftpboot
N_A_DIR=d-i/n-a
if [ -e /etc/di-netboot-assistant/di-netboot-assistant.conf ] ; then
. /etc/di-netboot-assistant/di-netboot-assistant.conf
fi
if [ -f $STATUS_LIB/.old-conf-for-purge ]; then
. $STATUS_LIB/.old-conf-for-purge
fi
#This function should be kept in sync with function "uninstall_repo" in di-netboot-assistant
uninstall_repo() {
dist_conf="$1" # Repository's .conf file
local s metadatabasename tarfile expand_dir dist_dir
metadatabasename="$(echo $dist_conf | sed -e 's/\.conf$//' )"
#remove di-netboot-assistant < 0.37 cached files.
tarfile="$(grep -E "^[[:blank:]]*dl_file=" "$dist_conf" | sed -e 's/^[[:blank:]]*dl_file=//')"
if [ "$(echo $tarfile | sed -n -e 's/^\(.\).*/\1/p')" = "/" ]; then
[ -f "$tarfile" ] && rm "$tarfile"
fi
expand_dir="$(grep -E "^[[:blank:]]*expand_dir=" "$dist_conf" | sed -e 's/^[[:blank:]]*expand_dir=//')"
[ "$expand_dir" != "/" -a -d "$expand_dir" ] && rm -Rf "$expand_dir"
dist_dir="$(echo "$expand_dir" | sed -e 's,/[^/]\+$,,')"
rmdir --ignore-fail-on-non-empty "$dist_dir"
s="$metadatabasename.pxelinux.menu.fragment"
[ -f "$s" ] && rm "$s"
s="$metadatabasename.pxelinux.menu.serial-9600.fragment"
[ -f "$s" ] && rm "$s"
s="$metadatabasename.elilo.conf.fragment"
[ -f "$s" ] && rm "$s"
rm "$dist_conf"
}
#This function should be kept in sync with function "url2filename" in di-netboot-assistant
url2filename() {
sed -e 's#//\+#/#g' -e 's#[^[:alnum:]@+_~\.-]#_#g'
}
#This function should be kept in sync with function "remove_repocache" in di-netboot-assistant
remove_repocache() {
local metadatafile="$1" # repository to uncache
local base file
base=$(echo $metadatafile | sed -e 's/~~.*$//' )
for file in $(sed -n -e 's/^[[:blank:]]*dl_file=[[:blank:]]*//p' $metadatafile); do
rm $rm_verbosity ${base}_"$(echo $file| url2filename)"
done
#Purge remaing files (MD5SUMs...) if there are no more cached
#distribution from the same repository.
if [ ! "$(ls -1 ${base}~~*.meta | grep -v "$metadatafile")" ]; then
rm $rm_verbosity ${base}_*
fi
[ -f $metadatafile ] && rm $metadatafile
}
remove_pre037_md5sums() {
#remove di-netboot-assistant < 0.37 checksum files.
find "$DL_CACHE" -type f ! -name '*_MD5SUMS' \
| grep -q "" \
|| find "$DL_CACHE" -type f -name '*_MD5SUMS' \
| xargs -r rm
}
case "$1" in
purge)
if [ -d $STATUS_LIB ]; then
for x in $( find $STATUS_LIB -type f -name '*.conf' ) ; do
uninstall_repo "$x"
done
if [ -d "$DL_CACHE" ]; then
for metadatafile in $(find $DL_CACHE -name "*~~*--*.meta"); do
remove_repocache "$metadatafile"
done
remove_pre037_md5sums
fi
for x in pxelinux.0 elilo.conf elilo.efi README.txt \
pxelinux.cfg/default pxelinux.cfg/default.mig-bak \
pxelinux.cfg/menu.c32 pxelinux.cfg/vesamenu.c32 \
; do
f="$TFTP_ROOT/$N_A_DIR/$x"
if [ -f "$f" -o -L "$f" ]; then
rm "$f" || true
fi
done
for x in $N_A_DIR/pxelinux.cfg $N_A_DIR ; do
f="$TFTP_ROOT/$x"
[ -d "$f" ] && rmdir --ignore-fail-on-non-empty "$f" || true
done
if [ -f $STATUS_LIB/.old-conf-for-purge ]; then
rm $STATUS_LIB/.old-conf-for-purge || true
fi
rmdir --ignore-fail-on-non-empty $STATUS_LIB
fi
;;
remove)
if [ -f /etc/di-netboot-assistant/di-netboot-assistant.conf ]; then
[ ! -d $STATUS_LIB ] && mkdir $STATUS_LIB
sed -e "1s/^/#BACKUP, to purge our TFT stuff when purged\n/" \
< /etc/di-netboot-assistant/di-netboot-assistant.conf \
> $STATUS_LIB/.old-conf-for-purge
fi
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
# Automatically added by dh_installdeb/11ubuntu1
dpkg-maintscript-helper rm_conffile /etc/di-netboot-assistant/elilo.HEAD 0.50\~ -- "$@"
# End automatically added section
exit 0
|