Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
54b8db6b
Commit
54b8db6b
authored
Sep 28, 2015
by
Kaarle Ritvanen
Committed by
Stéphane Graber
Sep 29, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxc-alpine: use getopt to parse options
Signed-off-by:
Kaarle Ritvanen
<
kaarle.ritvanen@datakunkku.fi
>
Acked-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
parent
8bdc1262
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
38 deletions
+13
-38
lxc-alpine.in
templates/lxc-alpine.in
+13
-38
No files found.
templates/lxc-alpine.in
View file @
54b8db6b
...
@@ -278,12 +278,6 @@ usage_err() {
...
@@ -278,12 +278,6 @@ usage_err() {
exit
1
exit
1
}
}
optarg_check
()
{
if
[
-z
"
$2
"
]
;
then
usage_err
"option '
$1
' requires an argument"
fi
}
default_path
=
@LXCPATH@
default_path
=
@LXCPATH@
release
=
release
=
arch
=
$(
uname
-m
)
arch
=
$(
uname
-m
)
...
@@ -294,58 +288,39 @@ if [ $(id -u) -ne 0 ]; then
...
@@ -294,58 +288,39 @@ if [ $(id -u) -ne 0 ]; then
exit
1
exit
1
fi
fi
options
=
$(
getopt
-o
hn:p:r:R:a:
-l
help
,name:,rootfs:,path:,repository:,release:,arch:
--
"
$@
"
)
[
$?
-eq
0
]
||
usage_err
eval set
--
"
$options
"
while
[
$#
-gt
0
]
;
do
while
[
$#
-gt
0
]
;
do
opt
=
"
$1
"
case
"
$1
"
in
shift
case
"
$opt
"
in
-h
|
--help
)
-h
|
--help
)
usage
usage
exit
0
exit
0
;;
;;
-n
|
--name
)
-n
|
--name
)
optarg_check
$opt
"
$1
"
name
=
$2
name
=
$1
shift
;;
;;
--rootfs
)
--rootfs
)
optarg_check
$opt
"
$1
"
rootfs
=
$2
rootfs
=
$1
shift
;;
;;
-p
|
--path
)
-p
|
--path
)
optarg_check
$opt
"
$1
"
path
=
$2
path
=
$1
shift
;;
;;
-r
|
--repository
)
-r
|
--repository
)
optarg_check
$opt
"
$1
"
repository
=
$2
repository
=
$1
shift
;;
;;
-R
|
--release
)
-R
|
--release
)
optarg_check
$opt
"
$1
"
release
=
$2
release
=
$1
shift
;;
;;
-a
|
--arch
)
-a
|
--arch
)
optarg_check
$opt
"
$1
"
arch
=
$2
arch
=
$1
shift
;;
;;
--
)
--
)
shift
break
;;
break
;;
--
*
=
*
)
# split --myopt=foo=bar into --myopt foo=bar
set
--
${
opt
%=*
}
${
opt
#*=
}
"
$@
"
;;
-?
)
usage_err
"unknown option '
$opt
'"
;;
-
*
)
# split opts -abc into -a -b -c
set
--
$(
echo
"
${
opt
#-
}
"
|
sed
's/\(.\)/ -\1/g'
)
"
$@
"
;;
esac
esac
shift
2
done
done
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment