#!/bin/sh set -e echo "Setting up click packages" click_uri=http://archive-team.internal/click_packages click_list=$click_uri/click_list click_db=/usr/share/click/preinstalled click_db_custom=/custom/click mkdir -p -m 755 "$click_db" chown clickpkg:clickpkg "$click_db" # some of these get installed to /custom/click mkdir -p -m 755 "$click_db_custom" chown clickpkg:clickpkg "$click_db_custom" # move default configuration aside to stop click being clever about symlink # layering mv /etc/click/databases /etc/click/databases.tmp tmpdir="$(mktemp -d)" cleanup () { rm -rf "$tmpdir" mv /etc/click/databases.tmp /etc/click/databases } trap cleanup EXIT CLICKARCH=$(dpkg --print-architecture) wget --no-verbose -O "$tmpdir/click_list" "$click_list" for package in $(cat "$tmpdir/click_list") do if echo $package | egrep -q "_$CLICKARCH.click|_all.click|_unknown.click"; then echo "Setting up $package" wget --no-verbose -O "$tmpdir/$package" "$click_uri/$package" # FIXME: first attempt, a hard-coded list of the packages that go to # the custom tarball case $package in com.ubuntu.developer.webapps.webapp-amazon_*|\ com.ubuntu.developer.webapps.webapp-ebay_*|\ com.ubuntu.developer.webapps.webapp-facebook_*|\ com.ubuntu.developer.webapps.webapp-gmail_*|\ com.ubuntu.developer.webapps.webapp-twitter_*|\ com.ubuntu.dropping-letters_*|\ com.ubuntu.filemanager_*|\ com.ubuntu.reminders_*|\ com.ubuntu.sudoku_*|\ com.ubuntu.terminal_*) roots="$click_db $click_db_custom" ;; *) roots="$click_db" ;; esac for root in $roots; do click install --force-missing-framework --root="$root" --all-users \ "$tmpdir/$package" done fi done