#!/bin/bash
#This script updates sources.list with the correct mirror (either the one in the
#config file for normal mode, or the local one for release preparation mode).

. "`dirname $0`/bootscriptfunctions.sh"

if ! is_os_museum_vm
then
	exit 2
fi

if [ "$UID" != 0 ]
then
	exec sudo "$0" "$@"
fi

if release_prep_enabled
then
	mirror="file:///media/host_apt"
else
	mirror="`get_conf_value update mirror`"
fi

if [ x"$mirror" = x ]
then
	panic "mirror unset in launcher.conf"
fi

suite="`get_conf_value update suite`"
if [ x"$suite" = x ]
then
	panic "suite unset in launcher.conf"
fi

echo deb $mirror $suite main > /etc/apt/sources.list.d/os-museum.list
