目录

群晖-NAS把微软bing的背景图自动更换为群晖DSM7.X登录界面和DSM欢迎信息的教程

【群晖 NAS】把微软bing的背景图自动更换为群晖DSM7.X登录界面和DSM欢迎信息的教程

https://i-blog.csdnimg.cn/direct/8a83d89b0abf4cdea914a4b6159820b0.png

https://i-blog.csdnimg.cn/direct/275507999234499ab75e9511b115156f.png

https://i-blog.csdnimg.cn/direct/a04664c0c4ec4dd885b797eb08f9ede1.png

https://i-blog.csdnimg.cn/direct/496ac0360eef40caa858e4bdde0af32e.png

https://i-blog.csdnimg.cn/direct/0e4cfcd4a57543c7a943de79470cdebf.png

#如需收集每日美图去掉下面注释设置保存文件夹路径,在FileStation里面右键文件夹属性可以看到路径
#savepath="/volume2/download/BingWallpaper"
#下载Bing图片
pic=$(wget -t 5 --no-check-certificate -qO- "https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1")
echo $pic|grep -q enddate||exit
link=$(echo https://www.bing.com$(echo $pic|sed 's/.\+"url"[:" ]\+//g'|sed 's/".\+//g'))
date=$(echo $pic|sed 's/.\+enddate[": ]\+//g'|grep -Eo 2[0-9]{7}|head -1)
tmpfile=/tmp/$date"_bing.jpg"
wget -t 5 --no-check-certificate $link -qO $tmpfile
[ -s $tmpfile ]||exit
rm -rf /usr/syno/etc/login_background*.jpg
cp -f $tmpfile /usr/syno/etc/login_background.jpg &>/dev/null
cp -f $tmpfile /usr/syno/etc/login_background_hd.jpg &>/dev/null
cp -f $tmpfile /usr/syno/synoman/webman/resources/images/1x/default_login_background/dsm7_01.jpg &>/dev/null
cp -f $tmpfile /usr/syno/synoman/webman/resources/images/2x/default_login_background/dsm7_01.jpg &>/dev/null
title=$(echo $pic|sed 's/.\+"title":"//g'|sed 's/".\+//g')
copyright=$(echo $pic|sed 's/.\+"copyright[:" ]\+//g'|sed 's/".\+//g')
word=$(echo $copyright|sed 's/(.\+//g')
if [ ! -n "$title" ];then
cninfo=$(echo $copyright|sed 's/,/"/g'|sed 's/,/"/g'|sed 's/(/"/g'|sed 's/ //g'|sed 's/\//_/g'|sed 's/)//g')
title=$(echo $cninfo|cut -d'"' -f1)
word=$(echo $cninfo|cut -d'"' -f2)
fi
#将图片应用于登陆界面
sed -i s/login_background_customize=.*//g /etc/synoinfo.conf
echo "login_background_customize=\"yes\"">>/etc/synoinfo.conf
sed -i s/login_welcome_title=.*//g /etc/synoinfo.conf
echo "login_welcome_title=\"$title\"">>/etc/synoinfo.conf
sed -i s/login_welcome_msg=.*//g /etc/synoinfo.conf
echo "login_welcome_msg=\"$word\"">>/etc/synoinfo.conf
#将图片保存到指定路径
if (echo $savepath|grep -q '/') then
cp -f $tmpfile "$savepath/$date@$title-$word.jpg"
fi
#清除临时文件
rm -rf /tmp/*_bing.jpg

https://i-blog.csdnimg.cn/direct/487ddb0c02e643b28ee487ce04fff8f2.png

https://i-blog.csdnimg.cn/direct/f7c7dd59ba7249ea97f87c42f414a1c8.png

https://i-blog.csdnimg.cn/direct/37a1f2570b0445d4b55803fd35352623.png

https://i-blog.csdnimg.cn/direct/b6ea4d86478a44ed8831fb068a672c4a.png

https://i-blog.csdnimg.cn/direct/c19fcc107dde4c8595a6abf369d32df1.png

https://i-blog.csdnimg.cn/direct/0b92fd5c39ed4741ac4d53c6f772d60a.png