Commit 12ad0f90 by Natanael Copa Committed by Stéphane Graber

lxc-setuid: use POSIX shell instead of bash

Avoid getop --longoptions. Signed-off-by: 's avatarNatanael Copa <ncopa@alpinelinux.org> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent f910f092
#!/bin/bash
#!/bin/sh
#
# lxc: linux Container library
......@@ -78,32 +78,40 @@ lxc_dropuid()
chmod 0755 @LXCPATH@
}
shortoptions='hd'
longoptions='help'
getopt=$(getopt -o $shortoptions --longoptions $longoptions -- "$@")
if [ $? != 0 ]; then
usage_err() {
[ -n "$1" ] && echo "$1" >&2
usage
exit 1
fi
}
eval set -- "$getopt"
optarg_check() {
if [ -z "$2" ]; then
usage_err "option '$1' requires an argument"
fi
}
while true; do
case "$1" in
while [ $# -gt 0 ]; do
opt="$1"
shift
case "$opt" in
-d)
LXC_DROP_CAPS="yes"
shift
;;
-h|--help)
help
exit 0
;;
--)
shift
break
;;
*)
-?)
usage_err "unknown option '$opt'"
;;
-*)
# split opts -abc into -a -b -c
set -- $(echo "${opt#-}" | sed 's/\(.\)/ -\1/g') "$@"
;;
*)
usage
exit 1
;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment