Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update allsky.sh: use check_settings_link #2713

Merged
merged 1 commit into from
May 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 2 additions & 25 deletions allsky.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,32 +172,9 @@ else
fi

# Make sure the settings file is linked to the camera-specific file.
if ! SETTINGS_LINK="$( get_links "${SETTINGS_FILE}" )" ; then
MSG="The settings file (${SETTINGS_FILE}) is not linked to"
MSG="${MSG} a camera-specific file; any setting changes you make will not"
MSG="${MSG} be saved if you switch cameras."
MSG="${MSG}\nERROR: ${SETTINGS_LINK}."
# TODO: Tell them how to fix it.
if ! MSG="$( check_settings_link "${SETTINGS_FILE}" )" ; then
"${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${MSG}"
echo "ERROR: Settings file (${SETTINGS_FILE}) not linked to camera-specific file." >&2
else
# Make sure it's linked to the correct file.
SETTINGS_LINK="$( basename "${SETTINGS_LINK}" )"
FILE="${SETTINGS_FILE%.*}"
EXT="${SETTINGS_FILE##*.}"
CORRECT_NAME="$( basename "${FILE}_${CAMERA_TYPE}_${CAMERA_MODEL}.${EXT}" )"
if [[ ${SETTINGS_LINK} != "${CORRECT_NAME}" ]]; then
MSG="The settings file (${SETTINGS_FILE}) is not properly linked to"
MSG="${MSG} its camera-specific file; any setting changes you make will not"
MSG="${MSG} be saved if you switch cameras."
MSG="${MSG}\nIt is linked to:"
MSG="${MSG}\n ${SETTINGS_LINK}"
MSG="${MSG}\nbut should be linked to"
MSG="${MSG}\n ${CORRECT_NAME}"
# TODO: Tell them how to fix it.
"${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${MSG}"
echo "ERROR: Settings file (${SETTINGS_FILE}) incorrectly linked to ${SETTINGS_LINK}." >&2
fi
echo "ERROR: Settings file (${SETTINGS_FILE}) not linked correctly." >&2
fi

# Make directories that need to exist.
Expand Down