File: postrm

package info (click to toggle)
smartlist 3.15-28
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,308 kB
  • sloc: ansic: 9,238; sh: 4,901; makefile: 118
file content (24 lines) | stat: -rw-r--r-- 794 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
set -e
if [ "$1" = "purge" ]; then
  echo "Directory /var/list not removed, as it may contain user data."
  echo "Trying to remove list aliases from /etc/aliases..."
  if ! grep -q "^# ---SmartList End" /etc/aliases; then
    echo "Warning: \`# ---SmartList End' line not found in /etc/aliases."
    echo "You will have to remove list alias by hand."
    echo "Sorry."
    echo ""
  else
    OLDALIASES=/etc/aliases.`date +%Y-%m-%d.%H:%M:%S`
    cp -p /etc/aliases $OLDALIASES
    cat $OLDALIASES | sed -e '/^# ---SmartList Begin/,/^# ---SmartList End/d' > /etc/aliases
    echo "Done. Backup copy of your old /etc/aliases in $OLDALIASES"
    echo ""
    set +e
    newaliases
    set -e
  fi
  # Remove generated files
  rm -f /var/list/.etc/rc.init
  rm -f /var/list/.etc/reject
fi