check-install: print all sudo instructions at once
This commit is contained in:
+14
-15
@@ -27,32 +27,31 @@ scripts=("${SOURCE_DIR}/src/scripts/clearvolume.sh" \
|
||||
"${SOURCE_DIR}/src/scripts/hdparm.sh" \
|
||||
"${SOURCE_DIR}/src/scripts/configurelogrotate.sh")
|
||||
|
||||
declare -a missing_scripts=()
|
||||
for script in "${scripts[@]}"; do
|
||||
if [[ $(sudo -n "${script}" --check 2>/dev/null) != "OK" ]]; then
|
||||
echo ""
|
||||
echo "${script} does not have sudo access. Try 'sudo -n ${script} --check'"
|
||||
echo "You have to add the lines below to /etc/sudoers.d/yellowtent"
|
||||
echo ""
|
||||
echo "Defaults!${script} env_keep=\"HOME BOX_ENV\""
|
||||
echo "${USER} ALL=(ALL) NOPASSWD: ${script}"
|
||||
echo ""
|
||||
exit 1
|
||||
missing_scripts+=("${script}")
|
||||
fi
|
||||
done
|
||||
|
||||
# image_missing=""
|
||||
if [[ ${#missing_scripts[@]} -gt 0 ]]; then
|
||||
echo "The following script(s) have no sudo access: ${missing_scripts[*]} . Try 'sudo -n ${script[0]} --check'"
|
||||
echo -e "\nYou have to add the lines below to /etc/sudoers.d/yellowtent\n\n"
|
||||
|
||||
for missing_script in "${missing_scripts[@]}"; do
|
||||
echo "Defaults!${missing_script} env_keep=\"HOME BOX_ENV\""
|
||||
echo "${USER} ALL=(ALL) NOPASSWD: ${missing_script}"
|
||||
echo ""
|
||||
done
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
images=$(node -e "let i = require('${SOURCE_DIR}/src/infra_version.js'); console.log(Object.keys(i.images).map(function (x) { return i.images[x].tag; }).join('\n'));"; echo $TEST_IMAGE)
|
||||
|
||||
for image in ${images}; do
|
||||
if ! docker inspect "${image}" >/dev/null 2>/dev/null; then
|
||||
# echo "docker pull ${image}"
|
||||
docker pull ${image%@sha256:*}
|
||||
# image_missing="true"
|
||||
fi
|
||||
done
|
||||
|
||||
# if [[ "${image_missing}" == "true" ]]; then
|
||||
# echo "Pull above images before running tests"
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
Reference in New Issue
Block a user