Drop usage of $UID in scripts; Do not use a negative exit value in shellscripts
authorMichael Prokop <mika@grml.org>
Thu, 29 Oct 2009 12:14:12 +0000 (13:14 +0100)
committerMichael Prokop <mika@grml.org>
Thu, 29 Oct 2009 12:14:12 +0000 (13:14 +0100)
debian/changelog
usr_bin/caps-ctrl
usr_bin/grml-lang
usr_bin/say
usr_sbin/grml-setservices
usr_sbin/grml-tpm
usr_sbin/ndiswrapper.sh
usr_sbin/prepare_ramdisk.sh
usr_sbin/prepare_tmpfs.sh

index 93c1ec8..9460639 100644 (file)
@@ -1,3 +1,10 @@
+grml-scripts (1.1.29) unstable; urgency=low
+
+  * Drop usage of $UID in scripts.
+  * Do not use a negative exit value in shellscripts.
+
+ -- Michael Prokop <mika@grml.org>  Thu, 29 Oct 2009 13:13:41 +0100
+
 grml-scripts (1.1.28) unstable; urgency=low
 
   [ Ulrich Dangel ]
index b0d8f64..8096e42 100755 (executable)
@@ -15,9 +15,9 @@ emulate zsh
 autoload -U colors ; colors
 
 if [[ -z $DISPLAY  ]] ; then # test if X is not running when calling us
-         if [[ $UID != 0 ]] ; then # test if user root did invoke this command
+         if [ $(id -u) != 0 ] ; then # test if user root did invoke this command
             eerror "As of Linux 2.6.15 you need root permissions for changing"
-           eerror "the keyboard on console using loadkeys for security reasons."
+            eerror "the keyboard on console using loadkeys for security reasons."
             eerror "Run this program with root permissions. Exiting." ; eend 1
             exit 1
          fi
index 3376d4c..ee8bcd3 100755 (executable)
@@ -26,7 +26,7 @@ setvalue(){
 
 if [ $# -lt "1" ] ; then
    usage
-   exit -1
+   exit 1
 fi
 
 [ -d /etc/sysconfig ] || sudo mkdir /etc/sysconfig
index 4d18e44..0f3bf16 100755 (executable)
@@ -8,7 +8,7 @@
 
 if [ $# -eq 0 ] ; then
   echo "Usage: $0 <text_to_say>"
-  exit -1
+  exit 1
 fi
 
 if [ -x /usr/bin/flite ] ; then
index 633ea9b..1d8e146 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Filename:      grml-setservices
 # Purpose:       interface for basic configuration of system startup
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
@@ -21,7 +21,7 @@ bailout(){
   exit 0
 }
 
-trap bailout SIGHUP SIGINT SIGQUIT SIGTERM
+trap bailout HUP INT QUIT TERM
 
 is_value_set(){
  [ -n "$1" ] || return 2
index 17000ef..07e2093 100755 (executable)
@@ -8,7 +8,7 @@
 
 . /etc/grml/lsb-functions
 
-if [ $UID != 0 ] ; then
+if [ $(id -u) != 0 ] ; then
    eerror Error: become root before starting $0 >& 2 ; eend 1
    exit 100
 fi
index 38e03d1..f0531af 100755 (executable)
@@ -10,7 +10,7 @@ PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin"
 export PATH
 
 # Get root
-if [ $UID != 0 ] ; then
+if [ $(id -u) != 0 ] ; then
    echo Error: become root before starting $0 >& 2
    exit 100
 fi
index 7e94187..e7018fb 100755 (executable)
@@ -6,7 +6,7 @@
 # License:       This file is licensed under the GPL v2.
 ################################################################################
 
-if [ $UID != 0 ]; then
+if [ $(id -u) != 0 ] ; then
   echo "Error: $0 requires root permissions. Exiting."
   exit 1
 fi
index 3208fcc..229fa79 100755 (executable)
@@ -6,7 +6,7 @@
 # License:       This file is licensed under the GPL v2.
 ################################################################################
 
-if [ $UID != 0 ]; then
+if [ $(id -u) != 0 ] ; then
   echo "Error: $0 requires root permissions. Exiting."
   exit 1
 fi