Fix a few memory leaks at exit time.
[tinc] / .github / workflows / deb / debian / preinst
1 #!/bin/sh
2
3 NETSFILE="/etc/tinc/nets.boot"
4 SYSTEM="/lib/systemd/system"
5 WANTS="/etc/systemd/system/multi-user.target.wants"
6
7 set -e
8
9 case "$1" in
10         upgrade)
11                 if dpkg --compare-versions "$2" '<<' "1.1~pre11-1"; then
12                         if [ -f "$NETSFILE" ]; then
13                                 echo -n "Creating systemd service instances from nets.boot:"
14                                 mkdir -p "$WANTS"
15                                 egrep '^[ ]*[a-zA-Z0-9_-]+' $NETSFILE | while read net args; do
16                                         echo -n " $net"
17                                         ln -s "$SYSTEM/tinc@.service" "$WANTS/tinc@$net.service" 2>/dev/null || true
18                                 done
19                                 echo "."
20                         fi
21                 fi
22         ;;
23
24         *)
25         ;;
26 esac
27
28 #DEBHELPER#