X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=fai%2Fconfig%2Ffiles%2Fetc%2Fapt%2Fsources.list%2Fpreinst;fp=fai%2Fconfig%2Ffiles%2Fetc%2Fapt%2Fsources.list%2Fpreinst;h=e9f06236a122570bd92fae9321d1707209be4b13;hb=056eb4e90e13b2d8f7cbb8c3b875f35bf0fa207e;hp=0000000000000000000000000000000000000000;hpb=a6f3eaed0a1eebb5c58853fb9faa8bfbec404de3;p=automated-distro-installer diff --git a/fai/config/files/etc/apt/sources.list/preinst b/fai/config/files/etc/apt/sources.list/preinst new file mode 100755 index 0000000..e9f0623 --- /dev/null +++ b/fai/config/files/etc/apt/sources.list/preinst @@ -0,0 +1,17 @@ +#! /bin/bash + +# replace {release} in a sources.list template with the value of $release + + +# $1 is the class name used +# $2 is the path to the file copied + +# check if a variable of the form {varname} was used at all +grep -q '{' $2 || exit 0 + +if [ -z "$release" ]; then + echo "\$release is undefined. No substitution performed in $2." + exit 0 +fi + +sed -i -e "s/{release}/$release/g" $2