]> gitweb.factorcode.org Git - factor.git/commitdiff
build.sh: more variables are local
authorCat Stevens <catb0t@protonmail.ch>
Fri, 17 Aug 2018 23:56:31 +0000 (19:56 -0400)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 21 Aug 2018 18:36:29 +0000 (11:36 -0700)
build.sh

index 166a6d8d53b242ca6c0be39f80b9cf843d0e9844..b48cec41d0f55a1641aade57fa99e62b197e1644 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -27,7 +27,7 @@ test_program_installed() {
 
 # return 1 on found
 test_programs_installed() {
-    installed=0;
+    local installed=0;
     $ECHO -n "Checking for all($*)..."
     for i in "$@" ;
     do
@@ -54,7 +54,7 @@ exit_script() {
 }
 
 ensure_program_installed() {
-    installed=0;
+    local installed=0;
     $ECHO -n "Checking for any($*)..."
     for i in "$@" ;
     do
@@ -243,7 +243,7 @@ check_factor_exists() {
 find_os() {
     if [[ -n $OS ]] ; then return; fi
     $ECHO "Finding OS..."
-    uname_s=$(uname -s)
+    local uname_s=$(uname -s)
     check_ret uname
     case $uname_s in
         CYGWIN_NT-5.2-WOW64) OS=windows;;
@@ -550,7 +550,7 @@ check_url() {
             return 1
         fi
     elif [[ $DOWNLOADER_NAME == 'curl' ]]; then
-        code=$(curl -sL -w "%{http_code}\\n" "$1" -o /dev/null)
+        local code=$(curl -sL -w "%{http_code}\\n" "$1" -o /dev/null)
         if [[ $code -eq 200 ]]; then return 0; else return 1; fi
     else
         $ECHO "error: wget or curl required in check_url"
@@ -562,10 +562,10 @@ check_url() {
 # Otherwise, just use `master`
 set_boot_image_vars() {
     set_current_branch
-    url="http://downloads.factorcode.org/images/${CURRENT_BRANCH}/checksums.txt"
+    local url="http://downloads.factorcode.org/images/${CURRENT_BRANCH}/checksums.txt"
     check_url $url
     if [[ $? -eq 0 ]]; then
-        CHECKSUM_URL="http://downloads.factorcode.org/images/${CURRENT_BRANCH}/checksums.txt"
+        CHECKSUM_URL="$url"
         BOOT_IMAGE_URL="http://downloads.factorcode.org/images/${CURRENT_BRANCH}/${BOOT_IMAGE}"
     else
         CHECKSUM_URL="http://downloads.factorcode.org/images/master/checksums.txt"