Ema has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316529

Change subject: Fix bashisms
......................................................................

Fix bashisms

This commit fixes a few possible bashisms reported by checkbashisms. In
most situations we were relying on bash-specific behavior, in others on
dash-specific ones.

When in doubt, switch back the script to using bash explicitly.

Bug: T95064
Change-Id: Ifc841a52be47ca33ca8737a383ac6f7e2ed718c4
---
M files/mariadb/eventlogging_sync.init
M modules/admin/files/home/otto/.liquidprompt/test.sh
M modules/apache/files/apache-status
M modules/mirrors/files/check_apt_mirror
M modules/mysql/templates/mysql.init.erb
M modules/puppetmaster/files/motd/99-obsolete
M modules/quarry/files/celeryd
M modules/shinken/files/init
8 files changed, 10 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/29/316529/1

diff --git a/files/mariadb/eventlogging_sync.init 
b/files/mariadb/eventlogging_sync.init
index 86b152f..437a0a4 100644
--- a/files/mariadb/eventlogging_sync.init
+++ b/files/mariadb/eventlogging_sync.init
@@ -49,7 +49,7 @@
     if is_running; then
         echo -n "Stopping $name.."
         kill `get_pid`
-        for i in {1..10}
+        for i in $(seq 1 10)
         do
             if ! is_running; then
                 break
diff --git a/modules/admin/files/home/otto/.liquidprompt/test.sh 
b/modules/admin/files/home/otto/.liquidprompt/test.sh
index 1e8ed86..9fc77df 100755
--- a/modules/admin/files/home/otto/.liquidprompt/test.sh
+++ b/modules/admin/files/home/otto/.liquidprompt/test.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 
 print_ok()
diff --git a/modules/apache/files/apache-status 
b/modules/apache/files/apache-status
index 492e4e6..3d6e87a 100755
--- a/modules/apache/files/apache-status
+++ b/modules/apache/files/apache-status
@@ -3,4 +3,4 @@
 RESET="$(/usr/bin/tput sgr0)"
 file="/tmp/apache_status.$(/bin/hostname).$(/bin/date +%s).txt"
 /usr/bin/links -dump http://127.0.0.1/server-status -width 80 | tee "$file"
-echo "\nOutput saved to ${WHITE}${file}${RESET}."
+printf "\nOutput saved to ${WHITE}${file}${RESET}.\n"
diff --git a/modules/mirrors/files/check_apt_mirror 
b/modules/mirrors/files/check_apt_mirror
index 48634d3..b17ba20 100755
--- a/modules/mirrors/files/check_apt_mirror
+++ b/modules/mirrors/files/check_apt_mirror
@@ -9,8 +9,8 @@
        exit 1
 fi
 
-HOSTNAME=$(hostname -f)
-STAMP=${TO}/project/trace/${HOSTNAME}
+FQDN=$(hostname -f)
+STAMP=${TO}/project/trace/${FQDN}
 WARN=6
 CRITICAL=12
 
diff --git a/modules/mysql/templates/mysql.init.erb 
b/modules/mysql/templates/mysql.init.erb
index 8aef417..d1cfba9 100755
--- a/modules/mysql/templates/mysql.init.erb
+++ b/modules/mysql/templates/mysql.init.erb
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
 # This file is public domain and comes with NO WARRANTY of any kind
 
diff --git a/modules/puppetmaster/files/motd/99-obsolete 
b/modules/puppetmaster/files/motd/99-obsolete
index 2188783..e3ff246 100755
--- a/modules/puppetmaster/files/motd/99-obsolete
+++ b/modules/puppetmaster/files/motd/99-obsolete
@@ -1,8 +1,8 @@
 #!/bin/sh
 
 echo
-echo "\033[1;31m"
+printf "\033[1;31m\n"
 echo "This system is no longer an active puppetmaster."
 echo "Everything you did here should now be done on puppetmaster1001."
-echo "\033[0m"
+printf "\033[0m\n"
 echo
diff --git a/modules/quarry/files/celeryd b/modules/quarry/files/celeryd
index 0fe704f..b1b8c0b 100644
--- a/modules/quarry/files/celeryd
+++ b/modules/quarry/files/celeryd
@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/bin/bash -e
 # ============================================
 #  celeryd - Starts the Celery worker daemon.
 # ============================================
diff --git a/modules/shinken/files/init b/modules/shinken/files/init
index f8effea..5e88474 100755
--- a/modules/shinken/files/init
+++ b/modules/shinken/files/init
@@ -325,7 +325,7 @@
     }
     if [ ! -z "$pid" ]; then
         kill "$pid"
-        sleep 0.5
+        /bin/sleep 0.5
         ## TODO: instead of 'sleep 1': wait up to when pid file is removed 
(with timeout)?
         for i in 1 2 3
         do

-- 
To view, visit https://gerrit.wikimedia.org/r/316529
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc841a52be47ca33ca8737a383ac6f7e2ed718c4
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ema <e...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to