From 67f97309f6cda007db509d0d69a7e2531eaf7e72 Mon Sep 17 00:00:00 2001 From: iliyan ivanov Date: Tue, 6 Aug 2019 20:40:48 +0300 Subject: [PATCH] fix helper script --- .helpers/gen_empty_sections.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.helpers/gen_empty_sections.sh b/.helpers/gen_empty_sections.sh index fc546d1..4b00ab8 100755 --- a/.helpers/gen_empty_sections.sh +++ b/.helpers/gen_empty_sections.sh @@ -2,16 +2,21 @@ set -e +defaultsdir="$(cd "$(dirname "$0")" && pwd)/../.defaults" + # get sections -sections=$(curl -L https://raw.githubusercontent.com/go-gitea/gitea/master/custom/conf/app.ini.sample 2>/dev/null | grep '^\[.*\]' | tr '\n' ' '|tr -d '[' | tr -d ']' ) +sections=$( +curl -L https://raw.githubusercontent.com/go-gitea/gitea/master/custom/conf/app.ini.sample 2>/dev/null \ + | grep '^\[.*\]' | tr '\n' ' '|tr -d '[' | tr -d ']' +) for x in $sections; do # to upper and remove dot y=$(echo -n "$x" | tr '[:lower:]' '[:upper:]' | tr '.' '_' | tr '-' '_' ) # skip existing files - [ -f "$PWD/$x.sh" ] && continue + [ -f "$defaultsdir/$x.sh" ] && continue # generate empty section file - cat>"$PWD/$x.sh" << EOB + cat>"$defaultsdir/$x.sh" << EOB # $x [ -z "\${A_DEFAULT_SETTINGS_${y}}" ] \\ && A_DEFAULT_SETTINGS_${y}=\$(cat << EOF