The new style (json-rpc) hooks are great. However when using them in snapd we noticed the following problem. When shipping a hook in /etc/apt/apt.conf.d/20snapd.conf like:
```
AptCli::Hooks::Install { "[ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt || true"; };
```
this works fine.
However when the snapd package is removed apt fails with:
```
...
Purging configuration files for snapd (1337.2.32.8) ...
Final directory cleanup
Discarding preserved snap namespaces
Removing extra snap-confine apparmor rules
Removing snapd cache
Removing snapd state
E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt || true: Connection reset by peer
E: Could not read message separator line after handshake from [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt || true: Connection reset by peer
quiet: end of output.
```
I.e. if the hook is not there apt still expectes a handshake.
The new style (json-rpc) hooks are great. However when using them in snapd we noticed the following problem. When shipping a hook in /etc/apt/ apt.conf. d/20snapd. conf like: :Hooks: :Install { "[ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt || true"; };
```
AptCli:
```
this works fine.
However when the snapd package is removed apt fails with:
```
...
Purging configuration files for snapd (1337.2.32.8) ...
Final directory cleanup
Discarding preserved snap namespaces
Removing extra snap-confine apparmor rules
Removing snapd cache
Removing snapd state
E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt || true: Connection reset by peer
E: Could not read message separator line after handshake from [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt || true: Connection reset by peer
quiet: end of output.
```
I.e. if the hook is not there apt still expectes a handshake.