Files
cloudron-box/scripts/checkInstall
T

51 lines
1.4 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" \
"${SOURCE_DIR}/src/scripts/reloadnginx.sh" \
"${SOURCE_DIR}/src/scripts/backup.sh" \
"${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 ""
echo "Defaults!${script} env_keep=HOME"
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-02-15 21:51:51 -08:00
if ! docker inspect girish/test:0.8 >/dev/null 2>/dev/null; then
echo "docker pull girish/test:0.8 for tests to run"
2015-01-07 22:31:17 -08:00
exit 1
fi
2015-02-15 21:51:51 -08:00
if ! docker inspect girish/redis:0.3 >/dev/null 2>/dev/null; then
echo "docker pull girish/redis:0.3 for tests to run"
exit 1
fi
if ! docker inspect girish/mysql:0.3 >/dev/null 2>/dev/null; then
echo "docker pull girish/mysql:0.3 for tests to run"
exit 1
fi
if ! docker inspect girish/postgresql:0.3 >/dev/null 2>/dev/null; then
echo "docker pull girish/postgresql:0.3 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