MinMicroG/conf/config.txt
FriendlyNeighborhoodShane 98d7881631 Run shellcheck on confs
2020-07-08 13:48:32 +05:30

67 lines
2.6 KiB
Plaintext

user_conf() {
for dir in "$(dirname "$0")" "$(dirname "$zipfile")" "$moddir" "/data/adb"; do
[ -f "$dir/includelist.txt" ] || [ -f "$dir/excludelist.txt" ] && {
ui_print " ";
if [ -f "$dir/includelist.txt" ]; then
ui_print "Processing include config from $dir...";
includelist="$(sed -e 's|\#.*||g' -e 's|[^a-zA-Z0-9.-]| |g' "$dir/includelist.txt")";
else
ui_print "Processing exclude config from $dir...";
excludelist="$(sed -e 's|\#.*||g' -e 's|[^a-zA-Z0-9.-]| |g' "$dir/excludelist.txt")";
fi;
break;
}
done;
[ "$includelist" ] && {
new_stuff="";
new_stuff_arch="";
new_stuff_sdk="";
new_stuff_arch_sdk="";
for include in $includelist; do
log "Including keyword $include";
new_stuff="$new_stuff $(echo "$stuff" | grep -oi "[ ]*[^ ]*$include[^ ]*[ ]*")";
new_stuff_arch="$new_stuff_arch $(echo "$stuff_arch" | grep -oi "[ ]*[^ ]*$include[^ ]*[ ]*")";
new_stuff_sdk="$new_stuff_sdk $(echo "$stuff_sdk" | grep -oi "[ ]*[^ ]*$include[^ ]*[ ]*")";
new_stuff_arch_sdk="$new_stuff_arch_sdk $(echo "$stuff_arch_sdk" | grep -oi "[ ]*[^ ]*$include[^ ]*[ ]*")";
done;
stuff="$new_stuff";
stuff_arch="$new_stuff_arch";
stuff_sdk="$new_stuff_sdk";
stuff_arch_sdk="$new_stuff_arch_sdk";
}
[ "$excludelist" ] && {
new_stuff="$stuff";
new_stuff_arch="$stuff_arch";
new_stuff_sdk="$stuff_sdk";
new_stuff_arch_sdk="$stuff_arch_sdk";
for exclude in $excludelist; do
log "Including keyword $include";
new_stuff="$(echo "$new_stuff" | sed "s|[ ]*[^ ]*$exclude[^ ]*[ ]*| |ig")";
new_stuff_arch="$(echo "$new_stuff_arch" | sed "s|[ ]*[^ ]*$exclude[^ ]*[ ]*| |ig")";
new_stuff_sdk="$(echo "$new_stuff_sdk" | sed "s|[ ]*[^ ]*$exclude[^ ]*[ ]*| |ig")";
new_stuff_arch_sdk="$(echo "$new_stuff_arch_sdk" | sed "s|[ ]*[^ ]*$exclude[^ ]*[ ]*| |ig")";
done;
stuff="$new_stuff";
stuff_arch="$new_stuff_arch";
stuff_sdk="$new_stuff_sdk";
stuff_arch_sdk="$new_stuff_arch_sdk";
}
[ "$includelist" ] || [ "$excludelist" ] && {
stuff="$(echo "$stuff" | sed 's| |\n|g' | tr -s '\n' | sort -u | sed 's|^| |g')
";
stuff_arch="$(echo "$stuff_arch" | sed 's| |\n|g' | tr -s '\n' | sort -u | sed 's|^| |g')
";
stuff_sdk="$(echo "$stuff_sdk" | sed 's| |\n|g' | tr -s '\n' | sort -u | sed 's|^| |g')
";
stuff_arch_sdk="$(echo "$stuff_arch_sdk" | sed 's| |\n|g' | tr -s '\n' | sort -u | sed 's|^| |g')
";
}
[ "$stuff" ] || [ "$stuff_arch" ] || [ "$stuff_sdk" ] || [ "$stuff_arch_sdk" ] || abort "Nothing left to install after config";
}