summaryrefslogtreecommitdiff
path: root/etc/mklocaluser.d/60-itzks-systems-roamingworkstation_disable-welcome-page
blob: 9a6bb0341243a7908e63be6920d4dbba6d1a1443 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
# Make Debian Edu's show-welcome-page think that the welcome page has already been shown.

set -e

HOMEDIR=/home/$USER

# Allow lookup script to be replaced using /etc/debian-edu/config
GETDEFAULTHOMEPAGE=$(/usr/share/debian-edu-config/tools/get-default-homepage || true)

if [ -e /etc/debian-edu/config ] ; then
    . /etc/debian-edu/config
fi

if [ "$GETDEFAULTHOMEPAGE" ] &&
    echo "$PROFILE" | egrep -q 'Main-Server|Workstation|Roaming-Workstation|LTSP-Server|Minimal' ; then
    for lang in $(echo $LANGCODE | tr : " "); do
	if wget -q -O /dev/null ${GETDEFAULTHOMEPAGE}index.html.$lang ; then
            welcomeurl="${GETDEFAULTHOMEPAGE}index.html.$lang"
	    break
	else
            welcomeurl=$GETDEFAULTHOMEPAGE || true
	fi
    done
else
    welcomeurl=http://www.skolelinux.org/
fi

if [ -z "$welcomeurl" ] || [ "about:blank" = "$welcomeurl" ]; then
    exit 0
fi

flagdir="$HOMEDIR/.debian-edu"
flagfile="$flagdir/welcome-page-shown"

if [ ! -f "$flagfile" ] ; then
    echo "$welcomeurl" > "$flagfile"
else
    oldwelcomeurl="$(cat $flagfile)"
    if [ "$welcomeurl" != "$oldwelcomeurl" ] ; then
	echo "$welcomeurl" > "$flagfile"
    fi
fi