Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/modules/sugarlabs_activities/kspost.60.nochroot.aslo.sh
blob: c090aa481c5249b6fbef3a5dfd175662a93623ff (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
44
# Copyright (C) 2009 One Laptop Per Child
# Licensed under the terms of the GNU GPL v2 or later; see COPYING for details.

. $OOB__shlib

sugarver=$(read_config sugarlabs_activities sugar_version)
experimental=$(read_config sugarlabs_activities experimental)
activities=$(read_config sugarlabs_activities activities)
cache=$cachedir/activities
mkdir -p $cache

oIFS=$IFS
IFS=$'\n\t, '
for id in $activities; do
	qurl="http://activities.sugarlabs.org/services/update-aslo.php?id=$id"
	[ -n "$sugarver" ] && qurl="${qurl}&appVersion=${sugarver}"
	[ "$experimental" = "1" ] && qurl="${qurl}&experimental=1"

	qurlcache="${cache}/${id}"
	[ -n "$sugarver" ] && qurlcache="${qurlcache}-s${sugarver}"
	[ "$experimental" = "1" ] && qurlcache="${qurlcache}-experimental"
	qurlcache="${qurlcache}.url"

	if [ -n "$OOB__cacheonly" ]; then
		echo "Using cache for ${id}" >&2
		aurl=$(<$qurlcache)
	else
		echo "Examining $qurl ..." >&2
		aurl=$(wget --inet4-only -q -O- "$qurl" | grep updateLink | sed -e 's/[[:space:]]*<[^>]*>//g')
		if [ -z "$aurl" ]; then
			echo "ERROR: Could not find download URL for $id" >&2
			exit 1
		fi
		echo "${aurl}" > "${qurlcache}"
	fi

	if [ -z "$OOB__cacheonly" ]; then
		echo "Downloading from $aurl ..." >&2
		wget --no-verbose --inet4-only -P $cache -N "$aurl"
	fi
	install_sugar_bundle $cache/$(basename "$aurl")
done
IFS=$oIFS