Signed-off-by: Robin Schneider <ypid@riseup.net>
| ... | ... |
@@ -27,8 +27,8 @@ while true; do |
| 27 | 27 |
case "$1" in |
| 28 | 28 |
-d|--dir) dir="$2" ; shift 2 ;; |
| 29 | 29 |
-t|--tag) tag="$2" ; shift 2 ;; |
| 30 |
- -c|--compression) compression="$2" ; shift 2 ;; |
|
| 31 |
- -C|--no-compression) compression="none" ; shift 1 ;; |
|
| 30 |
+ --compression) compression="$2" ; shift 2 ;; |
|
| 31 |
+ --no-compression) compression="none" ; shift 1 ;; |
|
| 32 | 32 |
-h|--help) usage ;; |
| 33 | 33 |
--) shift ; break ;; |
| 34 | 34 |
esac |
| ... | ... |
@@ -38,17 +38,12 @@ script="$1" |
| 38 | 38 |
[ "$script" ] || usage |
| 39 | 39 |
shift |
| 40 | 40 |
|
| 41 |
-if [ "$compression" == "auto" ] || [ -z "$compression" ] |
|
| 41 |
+if [ "$compression" == 'auto' ] || [ -z "$compression" ] |
|
| 42 | 42 |
then |
| 43 |
- compression="xz" |
|
| 43 |
+ compression='xz' |
|
| 44 | 44 |
fi |
| 45 | 45 |
|
| 46 |
-if [ "$compression" == "none" ] |
|
| 47 |
-then |
|
| 48 |
- compression="" |
|
| 49 |
-else |
|
| 50 |
- compression=".${compression}"
|
|
| 51 |
-fi |
|
| 46 |
+[ "$compression" == 'none' ] && compression='' |
|
| 52 | 47 |
|
| 53 | 48 |
if [ ! -x "$scriptDir/$script" ]; then |
| 54 | 49 |
echo >&2 "error: $script does not exist or is not executable" |
| ... | ... |
@@ -86,7 +81,7 @@ nameserver 8.8.8.8 |
| 86 | 86 |
nameserver 8.8.4.4 |
| 87 | 87 |
EOF |
| 88 | 88 |
|
| 89 |
-tarFile="$dir/rootfs.tar${compression}"
|
|
| 89 |
+tarFile="$dir/rootfs.tar${compression:+.$compression}"
|
|
| 90 | 90 |
touch "$tarFile" |
| 91 | 91 |
|
| 92 | 92 |
( |
| ... | ... |
@@ -97,7 +92,7 @@ touch "$tarFile" |
| 97 | 97 |
echo >&2 "+ cat > '$dir/Dockerfile'" |
| 98 | 98 |
cat > "$dir/Dockerfile" <<EOF |
| 99 | 99 |
FROM scratch |
| 100 |
-ADD $tarFile / |
|
| 100 |
+ADD $(basename "$tarFile") / |
|
| 101 | 101 |
EOF |
| 102 | 102 |
|
| 103 | 103 |
# if our generated image has a decent shell, let's set a default command |