mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-09 14:17:59 +00:00
lxc-setuid: use POSIX shell instead of bash
Avoid getop --longoptions. Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Acked-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
parent
f910f092e5
commit
12ad0f90c1
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# lxc: linux Container library
|
# lxc: linux Container library
|
||||||
@ -78,31 +78,39 @@ lxc_dropuid()
|
|||||||
chmod 0755 @LXCPATH@
|
chmod 0755 @LXCPATH@
|
||||||
}
|
}
|
||||||
|
|
||||||
shortoptions='hd'
|
usage_err() {
|
||||||
longoptions='help'
|
[ -n "$1" ] && echo "$1" >&2
|
||||||
|
|
||||||
getopt=$(getopt -o $shortoptions --longoptions $longoptions -- "$@")
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
optarg_check() {
|
||||||
|
if [ -z "$2" ]; then
|
||||||
|
usage_err "option '$1' requires an argument"
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
eval set -- "$getopt"
|
while [ $# -gt 0 ]; do
|
||||||
|
opt="$1"
|
||||||
while true; do
|
shift
|
||||||
case "$1" in
|
case "$opt" in
|
||||||
-d)
|
-d)
|
||||||
LXC_DROP_CAPS="yes"
|
LXC_DROP_CAPS="yes"
|
||||||
shift
|
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
-h|--help)
|
||||||
help
|
help
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
-?)
|
||||||
|
usage_err "unknown option '$opt'"
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
# split opts -abc into -a -b -c
|
||||||
|
set -- $(echo "${opt#-}" | sed 's/\(.\)/ -\1/g') "$@"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user