diff options
author | nachoparker <nacho@ownyourbits.com> | 2017-08-31 09:45:56 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2017-09-02 00:32:16 +0300 |
commit | 009c82e6cfb82cc40c49a9e253fe41bbbf779b13 (patch) | |
tree | 8213b20f68cfbe2941013eef540ec95a379bfb02 /bin | |
parent | cfc759969a9f0afdde35689e7185d49533e6c78f (diff) |
shellcheck style fixesv0.24.12
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ncp-check-version | 8 | ||||
-rwxr-xr-x | bin/ncp-test-updates | 6 | ||||
-rwxr-xr-x | bin/ncp-update | 8 | ||||
-rwxr-xr-x | bin/nextcloudpi-config | 11 |
4 files changed, 17 insertions, 16 deletions
diff --git a/bin/ncp-check-version b/bin/ncp-check-version index 3cb25c18..5075edfb 100755 --- a/bin/ncp-check-version +++ b/bin/ncp-check-version @@ -8,11 +8,11 @@ ping -W 2 -w 1 -q github.com &>/dev/null || { echo "No internet connectivity"; git clone --depth 20 -q --bare https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-check-tmp || exit 1 -cd /tmp/ncp-check-tmp +cd /tmp/ncp-check-tmp || exit 1 VER=$( git describe --always --tags | grep -oP "v\d+\.\d+\.\d+" ) -grep -qP "v\d+\.\d+\.\d+" <<< $VER && { # check format - echo $VER > /var/run/.ncp-latest-version +grep -qP "v\d+\.\d+\.\d+" <<< "$VER" && { # check format + echo "$VER" > /var/run/.ncp-latest-version } -cd / +cd / || exit 1 rm -rf /tmp/ncp-check-tmp diff --git a/bin/ncp-test-updates b/bin/ncp-test-updates index b0f79ab1..1a362401 100755 --- a/bin/ncp-test-updates +++ b/bin/ncp-test-updates @@ -15,11 +15,11 @@ if test -f $VERFILE && grep -qP "v\d+\.\d+\.\d+" $VERFILE; then MIN=$( grep -oP "\d+\.\d+\.\d+" /usr/local/etc/ncp-version | cut -d. -f2 ) PAT=$( grep -oP "\d+\.\d+\.\d+" /usr/local/etc/ncp-version | cut -d. -f3 ) - if [ $MAJOR -gt $MAJ ]; then + if [ "$MAJOR" -gt "$MAJ" ]; then NEED_UPDATE=true - elif [ $MAJOR -eq $MAJ ] && [ $MINOR -gt $MIN ]; then + elif [ "$MAJOR" -eq "$MAJ" ] && [ "$MINOR" -gt "$MIN" ]; then NEED_UPDATE=true - elif [ $MAJOR -eq $MAJ ] && [ $MINOR -eq $MIN ] && [ $PATCH -gt $PAT ]; then + elif [ "$MAJOR" -eq "$MAJ" ] && [ "$MINOR" -eq "$MIN" ] && [ "$PATCH" -gt "$PAT" ]; then NEED_UPDATE=true fi fi diff --git a/bin/ncp-update b/bin/ncp-update index 32bcd2d8..615595f0 100755 --- a/bin/ncp-update +++ b/bin/ncp-update @@ -3,7 +3,7 @@ # update latest NextCloudPi code from github { - [ $(id -u) -ne 0 ] && { printf "Must be run as root. Try 'sudo $0'\n"; exit 1; } + [ "$(id -u)" -ne 0 ] && { printf "Must be run as root. Try 'sudo $0'\n"; exit 1; } ping -W 2 -w 1 -q github.com &>/dev/null || { echo "No internet connectivity"; exit 1; } echo -e "Downloading updates" rm -rf /tmp/ncp-update-tmp @@ -14,9 +14,9 @@ ./update.sh VER=$( git describe --always --tags | grep -oP "v\d+\.\d+\.\d+" ) - grep -qP "v\d+\.\d+\.\d+" <<< $VER && { # check format - echo $VER > /usr/local/etc/ncp-version - echo $VER > /var/run/.ncp-latest-version + grep -qP "v\d+\.\d+\.\d+" <<< "$VER" && { # check format + echo "$VER" > /usr/local/etc/ncp-version + echo "$VER" > /var/run/.ncp-latest-version } cd / diff --git a/bin/nextcloudpi-config b/bin/nextcloudpi-config index 598329e2..a21336a8 100755 --- a/bin/nextcloudpi-config +++ b/bin/nextcloudpi-config @@ -20,6 +20,7 @@ function nextcloud-config() local VERFILE=/var/run/.ncp-latest-version local BACKTITLE="NextCloudPi configuration ver. " local CONFDIR=/usr/local/etc/nextcloudpi-config.d/ + local DESC # save latest version if it has never done before test -f $VERFILE || ncp-check-version @@ -36,9 +37,9 @@ function nextcloud-config() # fill options local LIST=() for item in $CONFDIR/*.sh; do - local DESC=$( grep "DESCRIPTION=" $item | sed 's|^DESCRIPTION="||;s|"$||' ) - grep -q "^ACTIVE_=yes" $item && local ON="✓" || local ON=" " - LIST+=( "$ON $( basename $item .sh )" "$DESC" ) + DESC=$( grep "DESCRIPTION=" "$item" | sed 's|^DESCRIPTION="||;s|"$||' ) + grep -q "^ACTIVE_=yes" "$item" && local ON="✓" || local ON=" " + LIST+=( "$ON $( basename "$item" .sh )" "$DESC" ) done # launch the selection menu @@ -56,8 +57,8 @@ function nextcloud-config() script=$( sed 's=✓\| ==g' <<< "$script" ) # launch selected script - info_script $script.sh || continue; - configure_script $script.sh && { echo "Done. Press any key..."; read; } + info_script "$script".sh || continue; + configure_script "$script".sh && { echo "Done. Press any key..."; read -r; } done } |