docker rootfs defaults
This commit is contained in:
parent
5f3d60ef0f
commit
93c3d1a67b
6498 changed files with 64929 additions and 14 deletions
69
make-rootfs.sh
Normal file
69
make-rootfs.sh
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
log() {
|
||||
printf '[make-rootfs] %s\n' "$*"
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage: ./make-rootfs.sh [--size <size>] [--base-rootfs <path>]
|
||||
|
||||
Builds rootfs-docker.ext4 using customize.sh. If --base-rootfs is omitted,
|
||||
the first existing file is used:
|
||||
./rootfs.ext4
|
||||
./ubuntu-noble-rootfs/rootfs.ext4
|
||||
./ubuntu-lts/rootfs.ext4
|
||||
EOF
|
||||
}
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
OUT_ROOTFS="$DIR/rootfs-docker.ext4"
|
||||
SIZE_SPEC="6G"
|
||||
BASE_ROOTFS=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--size)
|
||||
SIZE_SPEC="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
--base-rootfs)
|
||||
BASE_ROOTFS="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
log "unknown option: $1"
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -f "$OUT_ROOTFS" ]]; then
|
||||
log "already exists: $OUT_ROOTFS"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ -z "$BASE_ROOTFS" ]]; then
|
||||
if [[ -f "$DIR/rootfs.ext4" ]]; then
|
||||
BASE_ROOTFS="$DIR/rootfs.ext4"
|
||||
elif [[ -f "$DIR/ubuntu-noble-rootfs/rootfs.ext4" ]]; then
|
||||
BASE_ROOTFS="$DIR/ubuntu-noble-rootfs/rootfs.ext4"
|
||||
elif [[ -f "$DIR/ubuntu-lts/rootfs.ext4" ]]; then
|
||||
BASE_ROOTFS="$DIR/ubuntu-lts/rootfs.ext4"
|
||||
else
|
||||
log "no base rootfs found"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
log "building $OUT_ROOTFS from $BASE_ROOTFS"
|
||||
exec "$DIR/customize.sh" "$OUT_ROOTFS" \
|
||||
--size "$SIZE_SPEC" \
|
||||
--base-rootfs "$BASE_ROOTFS" \
|
||||
--docker
|
||||
Loading…
Add table
Add a link
Reference in a new issue