mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
Enable additional motd tips showing some internal ads (#4396)
* Enable additional motd tips showing some internal ads 33% probability of showing, just like for the armbian-config * Update quotes and add expiration date support * Change variable names * Add support to download quotes from our server * Fix curl parameters * Keep only weekly update
This commit is contained in:
3
packages/bsp/common/etc/cron.weekly/armbian-quotes
Executable file
3
packages/bsp/common/etc/cron.weekly/armbian-quotes
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
curl -s -o "/etc/update-motd.d/quotes.txt" "https://dl.armbian.com/quotes.txt"
|
||||||
@@ -19,8 +19,12 @@ for f in $MOTD_DISABLE; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
quotes="/etc/update-motd.d/quotes.txt"
|
quotes="/etc/update-motd.d/quotes.txt"
|
||||||
if [[ -f $quotes ]]; then
|
if [[ -f $quotes && $(( $RANDOM % 1 )) == 0 ]]; then
|
||||||
random_line=$(shuf -i 1-$(wc -l < $quotes) -n 1)
|
random_line=$(shuf -i 1-$(wc -l < $quotes) -n 1)
|
||||||
quote=$(sed -n -e "$random_line"p $quotes)
|
quote=$(sed -n -e "$random_line"p $quotes)
|
||||||
[[ -n $quote ]] && echo -e "\e[93mTip of the day:\e[39m $quote\n"
|
DUE_DATE=$(echo $quote | cut -d"|" -f1)
|
||||||
|
SELECTED_QUOTE=$(echo $quote | cut -d"|" -f2)
|
||||||
|
if [[ -n $SELECTED_QUOTE && $(date +'%Y-%m-%d') < $(date -d $DUE_DATE +"%Y-%m-%d") ]]; then
|
||||||
|
echo -e "\e[93mTip of the day:\e[39m $SELECTED_QUOTE\n"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user