diff --git a/setup/start/sudoers b/setup/start/sudoers index f88936a05..d8b6c9a50 100644 --- a/setup/start/sudoers +++ b/setup/start/sudoers @@ -4,9 +4,6 @@ Defaults !syslog Defaults!/home/yellowtent/box/src/scripts/rmvolume.sh env_keep="HOME BOX_ENV" yellowtent ALL=(root) NOPASSWD: /home/yellowtent/box/src/scripts/rmvolume.sh -Defaults!/home/yellowtent/box/src/scripts/rmredis.sh env_keep="HOME BOX_ENV" -yellowtent ALL=(root) NOPASSWD: /home/yellowtent/box/src/scripts/rmredis.sh - Defaults!/home/yellowtent/box/src/scripts/rmaddon.sh env_keep="HOME BOX_ENV" yellowtent ALL=(root) NOPASSWD: /home/yellowtent/box/src/scripts/rmaddon.sh diff --git a/src/addons.js b/src/addons.js index 4ffda1225..1923b1b38 100644 --- a/src/addons.js +++ b/src/addons.js @@ -47,7 +47,7 @@ var accesscontrol = require('./accesscontrol.js'), util = require('util'); var NOOP = function (app, options, callback) { return callback(); }; -const RMREDIS_CMD = path.join(__dirname, 'scripts/rmredis.sh'); +const RMADDON_CMD = path.join(__dirname, 'scripts/rmaddon.sh'); // setup can be called multiple times for the same app (configure crash restart) and existing data must not be lost // teardown is destructive. app data stored with the addon is lost @@ -1116,7 +1116,7 @@ function teardownRedis(app, options, callback) { container.remove(removeOptions, function (error) { if (error && error.statusCode !== 404) return callback(new Error('Error removing container:' + error)); - shell.sudo('removeVolume', [ RMREDIS_CMD, app.id ], function (error) { + shell.sudo('removeVolume', [ RMADDON_CMD, 'redis', app.id ], function (error) { if (error) return callback(new Error('Error removing redis data:' + error)); rimraf(path.join(paths.LOG_DIR, `redis-${app.id}`), function (error) { diff --git a/src/scripts/rmaddon.sh b/src/scripts/rmaddon.sh index f500e3143..090976115 100755 --- a/src/scripts/rmaddon.sh +++ b/src/scripts/rmaddon.sh @@ -25,9 +25,9 @@ if [[ "${addon}" != "postgresql" && "${addon}" != "mysql" && "${addon}" != "mong fi if [[ "${BOX_ENV}" == "cloudron" ]]; then - readonly addon_dir="${HOME}/platformdata/${addon}" + readonly addon_dir="${HOME}/platformdata/${addon}/${appid}" else - readonly addon_dir="${HOME}/.cloudron_test/platformdata/${addon}" + readonly addon_dir="${HOME}/.cloudron_test/platformdata/${addon}/${appid}" fi rm -rf "${addon_dir}" diff --git a/src/scripts/rmredis.sh b/src/scripts/rmredis.sh deleted file mode 100755 index f6509bf63..000000000 --- a/src/scripts/rmredis.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -set -eu -o pipefail - -if [[ ${EUID} -ne 0 ]]; then - echo "This script should be run as root." > /dev/stderr - exit 1 -fi - -if [[ $# -eq 0 ]]; then - echo "No arguments supplied" - exit 1 -fi - -if [[ "$1" == "--check" ]]; then - echo "OK" - exit 0 -fi - -# this script is called from redis addon as well! - -appid="$1" - -if [[ "${BOX_ENV}" == "cloudron" ]]; then - readonly redis_dir="${HOME}/platformdata/redis/${appid}" -else - readonly redis_dir="${HOME}/.cloudron_test/platformdata/redis/${appid}" -fi - -rm -rf "${redis_dir}" - diff --git a/src/test/checkInstall b/src/test/checkInstall index f03df8c43..abb38a7fb 100755 --- a/src/test/checkInstall +++ b/src/test/checkInstall @@ -10,7 +10,6 @@ sudo -k || sudo --reset-timestamp # checks if all scripts are sudo access scripts=("${SOURCE_DIR}/src/scripts/rmvolume.sh" \ - "${SOURCE_DIR}/src/scripts/rmredis.sh" \ "${SOURCE_DIR}/src/scripts/rmaddon.sh" \ "${SOURCE_DIR}/src/scripts/reloadnginx.sh" \ "${SOURCE_DIR}/src/scripts/reboot.sh" \