mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Removed short parameters and use Bash features to make code shorter. Thanks to @tianon.
Signed-off-by: Robin Schneider <ypid@riseup.net>
This commit is contained in:
parent
52e193bed7
commit
3f0fa1f643
1 changed files with 7 additions and 12 deletions
|
@ -27,8 +27,8 @@ while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-d|--dir) dir="$2" ; shift 2 ;;
|
-d|--dir) dir="$2" ; shift 2 ;;
|
||||||
-t|--tag) tag="$2" ; shift 2 ;;
|
-t|--tag) tag="$2" ; shift 2 ;;
|
||||||
-c|--compression) compression="$2" ; shift 2 ;;
|
--compression) compression="$2" ; shift 2 ;;
|
||||||
-C|--no-compression) compression="none" ; shift 1 ;;
|
--no-compression) compression="none" ; shift 1 ;;
|
||||||
-h|--help) usage ;;
|
-h|--help) usage ;;
|
||||||
--) shift ; break ;;
|
--) shift ; break ;;
|
||||||
esac
|
esac
|
||||||
|
@ -38,17 +38,12 @@ script="$1"
|
||||||
[ "$script" ] || usage
|
[ "$script" ] || usage
|
||||||
shift
|
shift
|
||||||
|
|
||||||
if [ "$compression" == "auto" ] || [ -z "$compression" ]
|
if [ "$compression" == 'auto' ] || [ -z "$compression" ]
|
||||||
then
|
then
|
||||||
compression="xz"
|
compression='xz'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$compression" == "none" ]
|
[ "$compression" == 'none' ] && compression=''
|
||||||
then
|
|
||||||
compression=""
|
|
||||||
else
|
|
||||||
compression=".${compression}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -x "$scriptDir/$script" ]; then
|
if [ ! -x "$scriptDir/$script" ]; then
|
||||||
echo >&2 "error: $script does not exist or is not executable"
|
echo >&2 "error: $script does not exist or is not executable"
|
||||||
|
@ -86,7 +81,7 @@ nameserver 8.8.8.8
|
||||||
nameserver 8.8.4.4
|
nameserver 8.8.4.4
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
tarFile="$dir/rootfs.tar${compression}"
|
tarFile="$dir/rootfs.tar${compression:+.$compression}"
|
||||||
touch "$tarFile"
|
touch "$tarFile"
|
||||||
|
|
||||||
(
|
(
|
||||||
|
@ -97,7 +92,7 @@ touch "$tarFile"
|
||||||
echo >&2 "+ cat > '$dir/Dockerfile'"
|
echo >&2 "+ cat > '$dir/Dockerfile'"
|
||||||
cat > "$dir/Dockerfile" <<EOF
|
cat > "$dir/Dockerfile" <<EOF
|
||||||
FROM scratch
|
FROM scratch
|
||||||
ADD $tarFile /
|
ADD $(basename "$tarFile") /
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# if our generated image has a decent shell, let's set a default command
|
# if our generated image has a decent shell, let's set a default command
|
||||||
|
|
Loading…
Add table
Reference in a new issue