diff --git a/snap/hooks/install b/snap/hooks/install index a34ad7ccf47ddabe49cea626f42d79fa45f55a44..3af19fc155238c18d920fe49909dff289d98511a 100755 --- a/snap/hooks/install +++ b/snap/hooks/install @@ -3,5 +3,5 @@ OPENFORTIVPN_TEMPLATE="${SNAP}/share/openfortivpn/config.template" OPENFORTIVPN_CONFIG="${SNAP_COMMON}/config" -sed -e '3,$ s/^/# /' "$OPENFORTIVPN_TEMPLATE" > "$OPENFORTIVPN_CONFIG" +sed -e '/^#/n;/^\s*$/n;s/^/# /' "$OPENFORTIVPN_TEMPLATE" > "$OPENFORTIVPN_CONFIG" chmod 600 "$OPENFORTIVPN_CONFIG" diff --git a/snap/hooks/post-refresh b/snap/hooks/post-refresh index 69a00fa39dcea766479faac00b7b6c8802cb2d45..dbf01907c356185263cec2aadbf064a14f1edce5 100755 --- a/snap/hooks/post-refresh +++ b/snap/hooks/post-refresh @@ -6,6 +6,6 @@ OPENFORTIVPN_CONFIG="${SNAP_COMMON}/config" if [ -f "$OPENFORTIVPN_CONFIG" ]; then echo "Existing configuration file will not be overwritten" else - sed -e '3,$ s/^/# /' "$OPENFORTIVPN_TEMPLATE" > "$OPENFORTIVPN_CONFIG" + sed -e '/^#/n;/^\s*$/n;s/^/# /' "$OPENFORTIVPN_TEMPLATE" > "$OPENFORTIVPN_CONFIG" chmod 600 "$OPENFORTIVPN_CONFIG" fi