Files
cloudron-box/scripts/checkInstall
T

54 lines
1.6 KiB
Bash
Raw Normal View History

#!/bin/bash
2015-01-23 15:01:10 -08:00
set -eu
2015-01-21 14:32:45 -08:00
readonly SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# reset sudo timestamp to avoid wrong success
2015-01-22 23:01:49 -08:00
sudo -k || sudo --reset-timestamp
# checks if all scripts are sudo access
2015-01-21 14:32:45 -08:00
scripts=("${SOURCE_DIR}/src/scripts/rmappdir.sh" \
2015-03-25 19:36:44 -07:00
"${SOURCE_DIR}/src/scripts/createappdir.sh" \
2015-01-21 14:32:45 -08:00
"${SOURCE_DIR}/src/scripts/reloadnginx.sh" \
2015-03-26 00:24:38 -07:00
"${SOURCE_DIR}/src/scripts/backupbox.sh" \
2015-03-25 21:49:06 -07:00
"${SOURCE_DIR}/src/scripts/backupapp.sh" \
2015-03-26 10:40:47 -07:00
"${SOURCE_DIR}/src/scripts/restoreapp.sh" \
2015-01-21 14:32:45 -08:00
"${SOURCE_DIR}/src/scripts/reboot.sh" \
"${SOURCE_DIR}/src/scripts/reloadcollectd.sh")
for script in "${scripts[@]}"; do
if [[ $(sudo -n "${script}" --check 2>/dev/null) != "OK" ]]; then
echo ""
echo "${script} does not have sudo access."
echo "You have to add the lines below to /etc/sudoers.d/yellowtent."
echo ""
2015-03-29 21:10:09 -07:00
echo 'Defaults!${script} env_keep="HOME NODE_ENV"'
echo "${USER} ALL=(ALL) NOPASSWD: ${script}"
echo ""
2014-09-26 12:09:41 -07:00
exit 1
fi
done
2014-09-26 12:09:41 -07:00
2015-04-10 14:39:10 -07:00
if ! docker inspect girish/test:0.1.0 >/dev/null 2>/dev/null; then
echo "docker pull girish/test:0.1.0 for tests to run"
2015-01-07 22:31:17 -08:00
exit 1
fi
2015-04-10 15:15:27 -07:00
if ! docker inspect girish/redis:0.1.0 >/dev/null 2>/dev/null; then
echo "docker pull girish/redis:0.1.0 for tests to run"
2015-02-15 21:51:51 -08:00
exit 1
fi
2015-04-10 15:15:27 -07:00
if ! docker inspect girish/mysql:0.1.0 >/dev/null 2>/dev/null; then
echo "docker pull girish/mysql:0.1.0 for tests to run"
2015-02-15 21:51:51 -08:00
exit 1
fi
2015-04-10 15:15:27 -07:00
if ! docker inspect girish/postgresql:0.1.0 >/dev/null 2>/dev/null; then
echo "docker pull girish/postgresql:0.1.0 for tests to run"
2015-01-07 22:31:17 -08:00
exit 1
fi
2014-09-26 12:09:41 -07:00
exit 0