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="$(cat "$dir/includelist.txt" | sed -e 's|\#.*||g' -e 's/[\#%&\`|*+=!@:;\t$^()?\[\]{}<>]/ /g')"; else ui_print "Processing exclude config from $dir..."; excludelist="$(cat "$dir/excludelist.txt" | sed -e 's|\#.*||g' -e 's/[\#%&\`|*+=!@:;\t$^()?\[\]{}<>]/ /g')"; 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"; }