Skip to content

Instantly share code, notes, and snippets.

@palemoky
Last active July 9, 2020 15:13
Show Gist options
  • Save palemoky/38c34aea090a46f74df7a0b8b673fb66 to your computer and use it in GitHub Desktop.
Save palemoky/38c34aea090a46f74df7a0b8b673fb66 to your computer and use it in GitHub Desktop.
Synology login page automatically replaces bing wallpaper
#!/bin/bash
# Author: Palemoky
# Fetch image
img=$(curl -s 'https://bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&pid=hp&FORM=BEHPTB&video=1')
img_path=$(jq .images[0].url <<< $img)
img_name=$(jq .images[0].urlbase <<< $img)
img_name=${img_name#*=}
filename=${img_name//\"/}.jpg
# Save image
curl -so /path/to/bing_wallpaper/$filename https://bing.com${img_path//\"/}
# Copy to directory
cp /path/to/bing_wallpaper/$filename /usr/syno/etc/login_background.jpg
cp /path/to/bing_wallpaper/$filename /usr/syno/etc/login_background_hd.jpg
# Extracting copyright
copyright=$(jq .images[0].copyright <<< $img)
copyright=${copyright//\"/}
title=${copyright#*(}
title=${title//)/}
msg=${copyright%% *}
# Edit configure
sed -i "/login_welcome_title/c login_welcome_title=\"$title\"" /etc/synoinfo.conf
sed -i "/login_welcome_msg/c login_welcome_msg=\"$msg\"" /etc/synoinfo.conf
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment