Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix classic snap #80

Merged
merged 3 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions make-classic.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
#!/bin/sh

sed -i 's/base: core22/base: core20/g' snap/snapcraft.yaml
sed-i marked this conversation as resolved.
Show resolved Hide resolved
sed -i 's/confinement: strict/confinement: classic/g' snap/snapcraft.yaml
sed -i 's/CRAFT_PART_INSTALL/SNAPCRAFT_PART_INSTALL/g' snap/snapcraft.yaml
sed -i '/libbpfcc/d' snap/snapcraft.yaml
sed -i '/bpfcc-tools/d' snap/snapcraft.yaml
yq -i 'del(.apps.grafana-agent.plugs) | del(.plugs)' snap/snapcraft.yaml
cat << "EOF" > snap/local/agent-wrapper
#!/bin/sh

exec "${SNAP}/agent" -config.expand-env -config.file "/etc/grafana-agent.yaml"
EOF
sed -i 's/agent-wrapper.strict/agent-wrapper.classic/g' snap/snapcraft.yaml
12 changes: 12 additions & 0 deletions snap/local/agent-wrapper.classic
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

if [ "$(snapctl get reporting-enabled)" = "0" ]
then
echo "Launched with reporting disabled" | systemd-cat
REPORTING_ARG="-disable-reporting"
else
echo "Launched with reporting enabled" | systemd-cat
REPORTING_ARG=""
fi

exec "${SNAP}/agent" -config.expand-env -config.file "/etc/grafana-agent.yaml" "${REPORTING_ARG}"
File renamed without changes.
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ parts:
source: ./snap/local
source-type: local
override-build: |
cp agent-wrapper $CRAFT_PART_INSTALL/
cp agent-wrapper.strict $CRAFT_PART_INSTALL/agent-wrapper
grafana-agent:
plugin: go
source: https://github.com/grafana/agent
Expand Down
Loading