From b436b4a6423e914a58c873869dba64f66d3676a7 Mon Sep 17 00:00:00 2001 From: teldra Date: Wed, 9 Feb 2022 10:13:59 +0100 Subject: [PATCH] progress --- etc/functions | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/etc/functions b/etc/functions index d085b24..b74bd35 100644 --- a/etc/functions +++ b/etc/functions @@ -121,21 +121,28 @@ yesno() { readin() { WHICH="$1" - header "$WHICH" local -a choice for i in $(find ./etc/${WHICH}/ -type f | sort); do choice+=("$(basename $i)") done if [ "${#choice[@]}" -gt "1" ]; then + header "$WHICH" multiplechoice "${choice[@]}" elif [ "${#choice[@]}" -eq "1" ]; then output=${choice[0]} fi if ! [ "${#choice[@]}" -eq "0" ]; then - . ./etc/${WHICH}/$output - packages - reset packages - cp ./etc/${WHICH}/$output $tmp_target + if [ -s ./etc/${WHICH}/$output ]; then + if grep -q "packages()" ./etc/${WHICH}/$output; then + . ./etc/${WHICH}/$output + packages + reset packages + fi + + if grep -q "config()" ./etc/${WHICH}/$output; then + cp ./etc/${WHICH}/$output $tmp_target + fi + fi fi }