Merge remote-tracking branch 'origin/github/pr/145'
[grml-live.git] / etc / grml / fai / config / scripts / GRMLBASE / 47-update-wallpaper
1 #!/bin/sh
2 # Filename:      ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/47-update-wallpaper
3 # Purpose:       Update the grml wallpaper
4 # Authors:       grml-team (grml.org)
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2 or any later version.
7 ################################################################################
8
9 . "$GRML_LIVE_CONFIG"
10
11 FONTFILE=${FONTFILE:-/usr/share/grml-live/fonts/graphicoreBitmapFont0-Light.otf}
12 TITLE_FONTSIZE=${TITLE_FONTSIZE:-200}
13 VERSION_FONTSIZE=${VERSION_FONTSIZE:-100}
14 GRML_BG=${GRML_BG:-$target/usr/share/grml/desktop-bg.png}
15 GRML_WALLPAPER=${GRML_WALLPAPER:-$target/usr/share/grml/desktop.jpg}
16
17 if [ ! -x "$(which convert)" ]; then
18   echo "convert not installed, skipping wallpaper."
19   exit 0
20 fi
21
22 if [ ! -f "$GRML_BG" ]; then
23     echo "Could not find Grml background image, skipping wallpaper"
24     exit 0
25 fi
26
27 if [ ! -f "$FONTFILE" ]; then
28     echo "Could not find font $FONTFILE, skipping wallpaper"
29     exit 0
30 fi
31
32 echo "Creating standard wallpaper"
33
34 convert "$GRML_BG" -gravity center \
35     -fill white -font "$FONTFILE" \
36     -pointsize $TITLE_FONTSIZE \
37     -draw "text 0,0 \"$GRML_NAME\"" \
38     -pointsize $VERSION_FONTSIZE \
39     -draw "text 0,$((TITLE_FONTSIZE+50)) \"$VERSION\"" "$GRML_WALLPAPER"