Fix options parsing for backup script

Fixes: PROD-27148 (PROD:27148)

Change-Id: Ie6d7d514f3cb3b2e49c60b861682b60f50a31956
diff --git a/xtrabackup/files/innobackupex-client-runner.sh b/xtrabackup/files/innobackupex-client-runner.sh
index ec628bb..fb20ac4 100644
--- a/xtrabackup/files/innobackupex-client-runner.sh
+++ b/xtrabackup/files/innobackupex-client-runner.sh
@@ -1,6 +1,6 @@
 {%- from "xtrabackup/map.jinja" import client with context %}
 {%- from "xtrabackup/map.jinja" import server with context %}
-#!/bin/sh
+#!/bin/sh -eo pipefile
 #
 # Script to create full and incremental backups (for all databases on server) using innobackupex from Percona.
 # http://www.percona.com/doc/percona-xtrabackup/innobackupex/innobackupex_script.html
@@ -9,20 +9,37 @@
 # FULLBACKUPLIFE variable will define your full backups schedule.
 
 SKIPCLEANUP=false
-while getopts ":skip-cleanup" opt; do
-  case $opt in
-    skip-cleanup)
-      echo "Cleanup will be skipped" >&2
-      SKIPCLEANUP=true
-      ;;
-    force-full)
-      echo "Full backup will be force triggered"
-      FORCEFULL=true
-      ;;
-    \?)
-      echo "Invalid option: -$OPTARG" >&2
-      ;;
-  esac
+FORCEFULL=false
+
+usage () {
+  echo ""
+  echo "USAGE: "
+  echo "  innobackupex-runner.sh [-s -f -h]"
+  echo "     -s makes the script to skip the cleanup"
+  echo "     -f forces the script to run the full backup instead of an incremental one"
+  echo "     -h shows this help"
+}
+
+while getopts ":sfh" opt; do
+    case $opt in
+        s)
+            echo "Cleanup will be skipped" >&2
+            SKIPCLEANUP=true
+        ;;
+        f)
+            echo "Full backup will be force triggered"
+            FORCEFULL=true
+        ;;
+        h)
+            usage
+            exit 0
+        ;;
+        \?)
+            echo "Invalid option: -$OPTARG" >&2
+            usage
+            exit 1
+        ;;
+    esac
 done
 USEROPTIONS="--user={{ client.database.user }} --password={{ client.database.password }}{%- if client.database.host is defined %} --host {{ client.database.host }} --port {{ client.database.get('port', '3306') }}{%- else %} --socket=/var/run/mysqld/mysqld.sock{%- endif %}"
 #TMPFILE="/var/log/backups/innobackupex-runner.$$.tmp"