add url check

This commit is contained in:
Maximilian Keßler 2023-10-19 13:50:47 +02:00
parent 9ff3fac39d
commit f9f5ce8180
Signed by: max
GPG key ID: BCC5A619923C0BA5

9
setup-key.sh Normal file → Executable file
View file

@ -28,6 +28,15 @@ if [ -e "${KEYFILE}" ]; then
exit 1 exit 1
fi fi
URL="https://git.abstractnonsen.se/${OWNER}/${REPOSITORY}"
if curl --output /dev/null --silent --head --fail "${URL}"; then
read -p -n 1 -r "Url ${URL} is not (publicly) accessible, are you sure you want to continue? [y/N] "
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
exit 1
fi
fi
mkdir -p "${KEY_DIR}" mkdir -p "${KEY_DIR}"
chmod 700 "${KEY_DIR}" chmod 700 "${KEY_DIR}"