From 25962beb02633b22f0dfa2bc9df467f559ba613e Mon Sep 17 00:00:00 2001 From: Martin Winkler Date: Thu, 21 Apr 2022 23:22:21 +0200 Subject: [PATCH] sequencer - don't create any config if only profiles should be listed --- sequencer/sequencer.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sequencer/sequencer.sh b/sequencer/sequencer.sh index 1dbfdfd..b124335 100755 --- a/sequencer/sequencer.sh +++ b/sequencer/sequencer.sh @@ -487,7 +487,7 @@ listProfiles() { return 1 fi [[ "$1" == "-q" ]] && return 0 - for file in $(ls "$SEQ_CONFIG_HOME"); do + for file in $(ls "$SEQ_CONFIG_HOME" 2>/dev/null); do [[ ${file%.*} =~ ^${1:-".*"} ]] && profiles+=(${file%.*}) done printf '%s\n' "${profiles[*]}" @@ -538,10 +538,10 @@ initSeqConfig() { local configDir="$(dirname $configLoc)" local configTemplate="$2" - # Create config subdir in users home - if [ ! -e "$configDir/" ] ; then - echoseq -n " [I] Creating $(realpath $configDir)..." - exe install -m 700 -d "$configDir" && echoseq "Ok" || echoseq "Nok" + # Don't create anything if only profiles should be listed + if [ -n "${SEQ_PROFILE_LIST}" ] ; then + SEQ_CONFIG_HOME="$configDir" + return 0 fi SEQ_CONFIG_HOME="$configDir" @@ -565,6 +565,12 @@ initSeqConfig() { ;; esac fi + + # Create config subdir in users home + if [ ! -e "$configDir/" ] ; then + echoseq -n " [I] Creating $(realpath $configDir)..." + exe install -m 700 -d "$configDir" && echoseq "Ok" || echoseq "Nok" + fi # Config does not exist, check for template if [ -s "$configTemplate" ] ; then