From e86f1f01e1ba1715d8f1f99f6b04bd7b1bcf3606 Mon Sep 17 00:00:00 2001 From: Max Asnaashari Date: Fri, 22 Sep 2023 15:27:57 +0000 Subject: [PATCH] snapcraft/hooks: Revert content interface Signed-off-by: Max Asnaashari --- snapcraft.yaml | 5 --- snapcraft/hooks/connect-plug-ceph-conf | 37 --------------------- snapcraft/hooks/disconnect-plug-ceph-conf | 40 ----------------------- 3 files changed, 82 deletions(-) delete mode 100755 snapcraft/hooks/connect-plug-ceph-conf delete mode 100755 snapcraft/hooks/disconnect-plug-ceph-conf diff --git a/snapcraft.yaml b/snapcraft.yaml index c98e88e0e..5943a8616 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -59,11 +59,6 @@ source-code: https://github.com/canonical/lxd website: https://ubuntu.com/lxd confinement: strict -plugs: - ceph-conf: - interface: content - target: "$SNAP_DATA/microceph" - apps: # Main commands activate: diff --git a/snapcraft/hooks/connect-plug-ceph-conf b/snapcraft/hooks/connect-plug-ceph-conf deleted file mode 100755 index edd8ab8cf..000000000 --- a/snapcraft/hooks/connect-plug-ceph-conf +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -set -eu - -# Re-exec outside of apparmor confinement -if [ -d /sys/kernel/security/apparmor ] && [ "$(cat /proc/self/attr/current)" != "unconfined" ]; then - exec aa-exec -p unconfined -- "$0" "$@" -fi - -# Utility functions -get_bool() { - value=$(echo "${1:-}" | tr '[:upper:]' '[:lower:]') - - # See if it's true - for yes in "true" "1" "yes" "on"; do - if [ "${value}" = "${yes}" ]; then - echo "true" - return - fi - done - - # See if it's false - for no in "false" "0" "no" "off"; do - if [ "${value}" = "${no}" ]; then - echo "false" - return - fi - done - - # Invalid value (or not set) - return -} - -ceph_builtin=$(get_bool "$(snapctl get ceph.builtin)") - -if ! [ "${ceph_builtin:-"false"}" = "true" ]; then - ln -snf ${SNAP_DATA}/microceph/conf/ /etc/ceph -fi diff --git a/snapcraft/hooks/disconnect-plug-ceph-conf b/snapcraft/hooks/disconnect-plug-ceph-conf deleted file mode 100755 index 6df9ed9bf..000000000 --- a/snapcraft/hooks/disconnect-plug-ceph-conf +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -set -eu - -# Re-exec outside of apparmor confinement -if [ -d /sys/kernel/security/apparmor ] && [ "$(cat /proc/self/attr/current)" != "unconfined" ]; then - exec aa-exec -p unconfined -- "$0" "$@" -fi - -# Utility functions -get_bool() { - value=$(echo "${1:-}" | tr '[:upper:]' '[:lower:]') - - # See if it's true - for yes in "true" "1" "yes" "on"; do - if [ "${value}" = "${yes}" ]; then - echo "true" - return - fi - done - - # See if it's false - for no in "false" "0" "no" "off"; do - if [ "${value}" = "${no}" ]; then - echo "false" - return - fi - done - - # Invalid value (or not set) - return -} - -ceph_builtin=$(get_bool "$(snapctl get ceph.builtin)") - -if [ "${ceph_builtin:-"false"}" = "true" ]; then - mkdir -p "${SNAP_COMMON}/ceph" - ln -snf "${SNAP_COMMON}/ceph" /etc/ceph -else - ln -snf /var/lib/snapd/hostfs/etc/ceph /etc/ceph -fi