|
2 | 2 | # postrm for ceralive-modem-support. |
3 | 3 | # |
4 | 4 | # On PURGE, retire the runtime state this package's helper creates but does not own as |
5 | | -# packaged files: the ACTIVE fcc-unlock symlinks it wrote into ModemManager's multiarch |
6 | | -# directory. Those are symlinks into /usr/share/ModemManager/fcc-unlock.d, so removing |
| 5 | +# packaged files: the ACTIVE fcc-unlock symlinks it wrote into ModemManager's admin |
| 6 | +# directory. Those are symlinks into /usr/share/ModemManager/fcc-unlock.available.d, so removing |
7 | 7 | # them removes nothing of ModemManager's own — but leaving them behind would let a purged |
8 | 8 | # package keep a radio's FCC-unlock script active, which is exactly the state todo 33 |
9 | 9 | # forbids by default. |
|
12 | 12 | # is left strictly alone: it is not ours. |
13 | 13 | set -e |
14 | 14 |
|
15 | | -AVAILABLE_DIR=/usr/share/ModemManager/fcc-unlock.d |
| 15 | +AVAILABLE_DIR=/usr/share/ModemManager/fcc-unlock.available.d |
| 16 | +ACTIVE_DIR=/etc/ModemManager/fcc-unlock.d |
16 | 17 |
|
17 | 18 | purge_active_fcc_symlinks() { |
18 | | - for dir in /usr/lib/*/ModemManager/fcc-unlock.d; do |
19 | | - [ -d "$dir" ] || continue |
20 | | - for link in "$dir"/*; do |
21 | | - [ -L "$link" ] || continue |
22 | | - target="$(readlink -f "$link" 2>/dev/null || true)" |
23 | | - case "$target" in |
24 | | - "$AVAILABLE_DIR"/*) |
25 | | - rm -f "$link" |
26 | | - echo "ceralive-modem-support: purge removed active FCC-unlock symlink $link" |
27 | | - ;; |
28 | | - esac |
29 | | - done |
30 | | - rmdir "$dir" 2>/dev/null || true |
| 19 | + [ -d "$ACTIVE_DIR" ] || return 0 |
| 20 | + for link in "$ACTIVE_DIR"/*; do |
| 21 | + [ -L "$link" ] || continue |
| 22 | + target="$(readlink -f "$link" 2>/dev/null || true)" |
| 23 | + case "$target" in |
| 24 | + "$AVAILABLE_DIR"/*) |
| 25 | + rm -f "$link" |
| 26 | + echo "ceralive-modem-support: purge removed active FCC-unlock symlink $link" |
| 27 | + ;; |
| 28 | + esac |
31 | 29 | done |
| 30 | + rmdir "$ACTIVE_DIR" 2>/dev/null || true |
32 | 31 | } |
33 | 32 |
|
34 | 33 | case "$1" in |
|
0 commit comments