]> xenbits.xen.org Git - xenclient/toolstack.git/commitdiff
Discard script output by default.
authorChristian Limpach <Christian.Limpach@citrix.com>
Thu, 14 Jan 2010 05:27:33 +0000 (05:27 +0000)
committerChristian Limpach <Christian.Limpach@citrix.com>
Thu, 14 Jan 2010 05:27:33 +0000 (05:27 +0000)
scripts/sec-change-pass
scripts/sec-check-pass
scripts/sec-mount
scripts/sec-new-user
scripts/sec-umount

index 8cafb1b55e97d55a5858e143d893b6951bc781d7..d37c73a5b2fe77d9ee823d7312d5dea713e19247 100755 (executable)
@@ -4,6 +4,10 @@ user="$1"
 userpass="$2"
 serverpass="$3"
 
+exec 3>&2
+[ -z "$V" ] && exec >/dev/null 2>&1
+err () { echo >&3 "$@"; }
+
 LVPREFIX=s-
 LVSIZE=12M
 VGNAME=xenclient
@@ -23,14 +27,14 @@ SECDM="s-${user}"
 
 cryptsetup -q -d "${TKEY}" \
   luksKillSlot "/dev/${VGNAME}/${LVPREFIX}${user}" 0 || {
-    echo $0: cryptsetup luksKillSlot failed: $?
+    err $0: cryptsetup luksKillSlot failed: $?
     rm "${TKEY}" "${UKEY}"
     exit 2
   }                       
 
 cryptsetup -q -d "${TKEY}" -S 0 \
   luksAddKey "/dev/${VGNAME}/${LVPREFIX}${user}" "${UKEY}" || {
-    echo $0: cryptsetup luksAddKey failed: $?
+    err $0: cryptsetup luksAddKey failed: $?
     rm "${TKEY}" "${UKEY}"
     exit 3
   }
index d78123846d3d49cdfc527510ba7128939aa4f579..f61c9527cff9d4840e78f271595bde1a8552010b 100755 (executable)
@@ -3,6 +3,10 @@
 user="$1"
 userpass="$2"
 
+exec 3>&2
+[ -z "$V" ] && exec >/dev/null 2>&1
+err () { echo >&3 "$@"; }
+
 LVPREFIX=s-
 VGNAME=xenclient
 DEVKEY=/config/sec/device.key
@@ -15,7 +19,7 @@ UKEY="${RAMDIR}/s-${user}.key"
 
 cryptsetup -d "${UKEY}" -S 0 \
   luksCheckKey "/dev/${VGNAME}/${LVPREFIX}${user}" || {
-  echo $0: cryptsetup luksCheckKey failed: $?
+  err $0: cryptsetup luksCheckKey failed: $?
   rm "${UKEY}"
   exit 2
 }
index bc61b5e79c398dfae0d92e7f3ebe166d7dbc28be..cf0db7c27fda431acc8dd073cf6fcb0e5b865a2d 100755 (executable)
@@ -3,6 +3,10 @@
 user="$1"
 userpass="$2"
 
+exec 3>&2
+[ -z "$V" ] && exec >/dev/null 2>&1
+err () { echo >&3 "$@"; }
+
 LVPREFIX=s-
 VGNAME=xenclient
 DEVKEY=/config/sec/device.key
@@ -21,14 +25,14 @@ grep -q "${SECPATH}" /proc/mounts && \
 
 cryptsetup -d "${UKEY}" \
   luksOpen "/dev/${VGNAME}/${LVPREFIX}${user}" "${SECDM}" || {
-  echo $0: cryptsetup luksOpen failed: $?
+  err $0: cryptsetup luksOpen failed: $?
   rm "${UKEY}"
   exit 2
 }
 
 mkdir -p "${SECPATH}"
 mount "/dev/mapper/${SECDM}" "${SECPATH}" || {
-  echo $0: mount failed: $?
+  err $0: mount failed: $?
   cryptsetup luksClose "${SECDM}"
   rm "${UKEY}"
   exit 3
index 767317de138045dcfaa5b585df0affaea36ae044..1eec793ffcf397269720269fd1adc7d8a7188ba7 100755 (executable)
@@ -4,6 +4,10 @@ user="$1"
 userpass="$2"
 serverpass="$3"
 
+exec 3>&2
+[ -z "$V" ] && exec >/dev/null 2>&1
+err () { echo >&3 "$@"; }
+
 LVPREFIX=s-
 LVSIZE=12M
 VGNAME=xenclient
@@ -14,7 +18,7 @@ TKEY="${RAMDIR}/s-t-${user}.key"
 SECDM="s-${user}"
 
 lvcreate -L "${LVSIZE}" -n "${LVPREFIX}${user}" "${VGNAME}" || {
-  echo $0: lvcreate failed: $?
+  err $0: lvcreate failed: $?
   exit 2
 }
 
@@ -24,7 +28,7 @@ lvcreate -L "${LVSIZE}" -n "${LVPREFIX}${user}" "${VGNAME}" || {
 
 cryptsetup -q -S 0 \
   luksFormat "/dev/${VGNAME}/${LVPREFIX}${user}" "${UKEY}" || {
-  echo $0: cryptsetup luksFormat failed: $?
+  err $0: cryptsetup luksFormat failed: $?
   rm "${UKEY}"
   exit 3
 }
@@ -37,7 +41,7 @@ cryptsetup -q -S 0 \
  
   cryptsetup -q -S 1 -d "${UKEY}" \
     luksAddKey "/dev/${VGNAME}/${LVPREFIX}${user}" "${TKEY}" || {
-      echo $0: cryptsetup luksAddKey failed: $?
+      err $0: cryptsetup luksAddKey failed: $?
       rm "${TKEY}" "${UKEY}"
       exit 4
     }
@@ -47,20 +51,20 @@ cryptsetup -q -S 0 \
 
 cryptsetup -d "${UKEY}" \
   luksOpen "/dev/${VGNAME}/${LVPREFIX}${user}" "${SECDM}" || {
-  echo $0: cryptsetup luksOpen failed: $?
+  err $0: cryptsetup luksOpen failed: $?
   rm "${UKEY}"
   exit 5
 }
 
 mkfs.ext2 "/dev/mapper/${SECDM}" || {
-  echo $0: mkfs.ext2 failed: $?
+  err $0: mkfs.ext2 failed: $?
   cryptsetup luksClose "${SECDM}"
   rm "${UKEY}"
   exit 6
 }
 
 cryptsetup luksClose "${SECDM}" || {
-  echo $0: cryptsetup luksClose failed: $?
+  err $0: cryptsetup luksClose failed: $?
   rm "${UKEY}"
   exit 7
 }
index 62c4efe56547a6a74c972ddac7bd9df29bee1c65..d7df5b7bafc68a9ad4fdf053227776e82163b882 100755 (executable)
@@ -2,18 +2,22 @@
 
 user="$1"
 
+exec 3>&2
+[ -z "$V" ] && exec >/dev/null 2>&1
+err () { echo >&3 "$@"; }
+
 SECDIR=/config/sec
 SECDM="s-${user}"
 SECPATH="${SECDIR}/s-${user}"
 
 umount "${SECPATH}" || {
-  echo $0: umount failed: $?
+  err $0: umount failed: $?
   cryptsetup luksClose "${SECDM}"
   exit 2
 }
 
 cryptsetup luksClose "${SECDM}" || {
-  echo $0: cryptsetup luksClose failed: $?
+  err $0: cryptsetup luksClose failed: $?
   exit 3
 }