Accomadate empty easter egg list

This commit is contained in:
icenine451 2023-04-19 08:58:40 -04:00
parent f076b490de
commit d3f1fce7dc

View file

@ -1743,17 +1743,21 @@ easter_eggs() {
# USAGE: easter_eggs # USAGE: easter_eggs
current_day=$(date +"%0m%0d") # Read the current date in a format that can be calculated in ranges current_day=$(date +"%0m%0d") # Read the current date in a format that can be calculated in ranges
current_time=$(date +"%0H%0M") # Read the current time in a format that can be calculated in ranges current_time=$(date +"%0H%0M") # Read the current time in a format that can be calculated in ranges
while IFS="^" read -r start_date end_date start_time end_time splash_file # Read Easter Egg checklist file and separate values if [[ ! -z $(cat $easter_egg_checklist) ]]; then
do while IFS="^" read -r start_date end_date start_time end_time splash_file # Read Easter Egg checklist file and separate values
if [[ $current_day -ge "$start_date" && $current_day -le "$end_date" && $current_time -ge "$start_time" && $current_time -le "$end_time" ]]; then # If current line specified date/time matches current date/time, set $splash_file to be deployed do
new_splash_file="$splashscreen_dir/$splash_file" if [[ $current_day -ge "$start_date" && $current_day -le "$end_date" && $current_time -ge "$start_time" && $current_time -le "$end_time" ]]; then # If current line specified date/time matches current date/time, set $splash_file to be deployed
break new_splash_file="$splashscreen_dir/$splash_file"
else # When there are no matches, the default splash screen is set to deploy break
new_splash_file="$default_splash_file" else # When there are no matches, the default splash screen is set to deploy
fi new_splash_file="$default_splash_file"
done < $easter_egg_checklist fi
done < $easter_egg_checklist
else
new_splash_file="$default_splash_file"
fi
cp -fv "$new_splash_file" "$current_splash_file" # Deploy assigned splash screen cp -f "$new_splash_file" "$current_splash_file" # Deploy assigned splash screen
} }
tools_init() { tools_init() {