#!/bin/sh restore(){ cd "$CURDIR" rm -rf "$TMPDIR" } die(){ echo "ERROR: $1" restore exit 1 } CURDIR="$(pwd)/install" SOURCE_PACKAGES="base-files" # SOURCE_PACKAGES="lsb-release base-files belocs-locales-bin" for package in ${SOURCE_PACKAGES} ; do TMPDIR="$(mktemp -d)" case "$package" in "lsb-release") SOURCE_FILE="lsb_release" TARGET_FILES="${CURDIR}/usr/bin/lsb_release.ubuntu ${CURDIR}/usr/bin/lsb_release.lliurex" ;; "base-files") SOURCE_FILE="lsb-release" TARGET_FILES="${CURDIR}/etc/lsb-release.ubuntu" ;; "belocs-locales-bin") SOURCE_FILE="locale-gen.conf" TARGET_FILES="${CURDIR}/usr/share/lliurex-base-files/jumble/etc/belocs/locale-gen.conf" ;; esac cd ${TMPDIR} apt-get source $package || die "Unable to download source of $package: Please check your sources.list" if LSB_RELEASE_SCRIPT="$(find ./ -name "$SOURCE_FILE")" ; then if [ "$LSB_RELEASE_SCRIPT" -a -f "$LSB_RELEASE_SCRIPT" ] ; then for f in ${TARGET_FILES} ; do cat "$LSB_RELEASE_SCRIPT" > "$f" echo "$f updated" done restore fi else die "$SOURCE_FILE file/script not found in source package" fi done exit 0