File: postrm

package info (click to toggle)
smartlist 3.15-25
  • links: PTS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 2,192 kB
  • ctags: 1,837
  • sloc: ansic: 9,239; sh: 4,947; makefile: 145
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