From cf15eff4f4ad7b09168ffd6bbf3962018236f4bc Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Thu, 28 Nov 2019 09:27:22 +0100 Subject: [PATCH] server/gitea: update_gitea expanded arguments for readability --- roles/server/gitea/templates/update_gitea.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/server/gitea/templates/update_gitea.sh b/roles/server/gitea/templates/update_gitea.sh index 361d1d0..946e1a8 100644 --- a/roles/server/gitea/templates/update_gitea.sh +++ b/roles/server/gitea/templates/update_gitea.sh @@ -21,11 +21,11 @@ function as() { } if [ -f "$GITEA_BIN" ]; then - installed=$(cd "$GITEA_DIR" && as "$GITEA_BIN" --version | grep -Po "(?<=version )\d+(\.\d+)*(?= )"); + installed=$(cd "$GITEA_DIR" && as "$GITEA_BIN" --version | grep --only-matching --perl-regexp "(?<=version )\d+(\.\d+)*(?= )"); else installed=0; fi -version=$(curl -s https://blog.gitea.io/index.xml | grep -Po '.*' | grep -Po '\d+(\.\d+)+' | sort -rn | head -n 1); +version=$(curl --silent https://blog.gitea.io/index.xml | grep --only-matching --perl-regexp '.*' | grep --only-matching --perl-regexp '\d+(\.\d+)+' | sort --numeric-sort --reverse | head --lines=1); address="https://dl.gitea.io/gitea/$version"; binary="gitea-$version-linux-amd64"; signature="$binary.asc"; @@ -46,7 +46,7 @@ fi cd "$GITEA_DIR"; for a in "$binary" "$signature" "$checksum"; do - if ! wget --quiet -O "$a" "$address/$a"; then + if ! wget --quiet -output-document="$a" "$address/$a"; then error "Failed to download $a"; exit 1; fi @@ -56,7 +56,7 @@ if ! "$CHECKSUM_APP" --quiet --check "$checksum"; then error "Checksum not correct!"; exit 1; fi -if ! (gpg --status-fd 1 --verify "$signature" "$binary" 2>/dev/null | grep -P 'VALIDSIG .* '"$GPG_FINGERPRINT" > /dev/null); then +if ! (gpg --status-fd 1 --verify "$signature" "$binary" 2>/dev/null | grep --perl-regexp 'VALIDSIG .* '"$GPG_FINGERPRINT" > /dev/null); then error "Signature not valid!"; exit 1; fi @@ -65,7 +65,7 @@ rm "$checksum"; rm "$signature"; mv "$binary" "$GITEA_BIN"; -chmod 0754 "$GITEA_BIN"; +chmod u=rwx,g=rx,o=r "$GITEA_BIN"; chown root:"$GITEA_USER" "$GITEA_BIN" if [[ ! "$installed" = "0" ]]; then