_global_units() {
    local unit=p11-kit-server.socket dir=/etc/systemd/user/sockets.target.wants

    case $1 in
        enable)
            mkdir -p $dir
            ln -sf /usr/lib/systemd/user/$unit $dir/$unit
            ;;
        disable)
            rm -f $dir/$unit
            rmdir -p --ignore-fail-on-non-empty $dir
            ;;
    esac
}

post_install() {
  # Enable socket by default
  _global_units enable
}

pre_remove() {
  _global_units disable
}