parent
9357e9dd66
commit
27b5a7e2d0
1 changed files with 25 additions and 5 deletions
|
@ -22,6 +22,9 @@
|
|||
# <script-opts> Arguments to pass to the script.
|
||||
#
|
||||
# Options and Environment Variables:
|
||||
# -b --branch ALPINE_BRANCH Alpine branch to install; used only when
|
||||
# --repositories-file is not specified. Default is v3.8.
|
||||
#
|
||||
# -f --image-format IMAGE_FORMAT Format of the disk image (see qemu-img --help).
|
||||
#
|
||||
# -s --image-size IMAGE_SIZE Size of the disk image to create in bytes or with suffix
|
||||
|
@ -40,12 +43,18 @@
|
|||
# Default is /etc/apk/keys. If does not exist, keys for
|
||||
# x86_64 embedded in this script will be used.
|
||||
#
|
||||
# -m --mirror-uri ALPINE_MIRROR URI of the Aports mirror to fetch packages; used only
|
||||
# when --repositories-file is not specified. Default is
|
||||
# https://nl.alpinelinux.org/alpine.
|
||||
#
|
||||
# -C --no-cleanup (CLEANUP) Don't umount and disconnect image when done.
|
||||
#
|
||||
# -p --packages PACKAGES Additional packages to install into the image.
|
||||
#
|
||||
# -r --repositories-file REPOS_FILE Path of repositories file to copy into the image.
|
||||
# Default is /etc/apk/repositories.
|
||||
# -r --repositories-file REPOS_FILE Path of repositories file to copy into the rootfs.
|
||||
# Default is /etc/apk/repositories. If does not exist,
|
||||
# repositories file with Alpine's main and community
|
||||
# repositories on --mirror-uri is created.
|
||||
#
|
||||
# --rootfs ROOTFS Filesystem to create on the image. Default is ext4.
|
||||
#
|
||||
|
@ -289,19 +298,21 @@ wgets() (
|
|||
|
||||
#============================= M a i n ==============================#
|
||||
|
||||
opts=$(getopt -n $PROGNAME -o cCf:hi:k:p:r:s:v \
|
||||
-l image-format:,image-size:,initfs-features:,kernel-flavor:,keys-dir:,no-cleanup,packages:,repositories-file:,rootfs:,script-chroot,help,version \
|
||||
opts=$(getopt -n $PROGNAME -o b:cCf:hi:k:p:r:s:v \
|
||||
-l branch:,image-format:,image-size:,initfs-features:,kernel-flavor:,keys-dir:,mirror-uri:,no-cleanup,packages:,repositories-file:,rootfs:,script-chroot,help,version \
|
||||
-- "$@") || help 1 >&2
|
||||
|
||||
eval set -- "$opts"
|
||||
while [ $# -gt 0 ]; do
|
||||
n=2
|
||||
case "$1" in
|
||||
-b | --branch) ALPINE_BRANCH="$2";;
|
||||
-f | --image-format) IMAGE_FORMAT="$2";;
|
||||
-s | --image-size) IMAGE_SIZE="$2";;
|
||||
-i | --initfs-features) INITFS_FEATURES="${INITFS_FEATURES:-} $2";;
|
||||
-k | --kernel-flavor) KERNEL_FLAVOR="$2";;
|
||||
--keys-dir) KEYS_DIR="$(realpath "$2")";;
|
||||
-m | --mirror-uri) ALPINE_MIRROR="$2";;
|
||||
-C | --no-cleanup) CLEANUP='no'; n=1;;
|
||||
-p | --packages) PACKAGES="${PACKAGES:-} $2";;
|
||||
-r | --repositories-file) REPOS_FILE="$(realpath "$2")";;
|
||||
|
@ -314,6 +325,8 @@ while [ $# -gt 0 ]; do
|
|||
shift $n
|
||||
done
|
||||
|
||||
: ${ALPINE_BRANCH:="v3.8"}
|
||||
: ${ALPINE_MIRROR:="https://nl.alpinelinux.org/alpine"}
|
||||
: ${CLEANUP:="yes"}
|
||||
: ${IMAGE_FORMAT:=}
|
||||
: ${IMAGE_SIZE:="2G"}
|
||||
|
@ -393,7 +406,14 @@ einfo 'Installing base system'
|
|||
cd "$mount_dir"
|
||||
|
||||
mkdir -p etc/apk/keys
|
||||
install -m 644 "$REPOS_FILE" etc/apk/repositories
|
||||
if [ -f "$REPOS_FILE" ]; then
|
||||
install -m 644 "$REPOS_FILE" etc/apk/repositories
|
||||
else
|
||||
cat > etc/apk/repositories <<-EOF
|
||||
$ALPINE_MIRROR/$ALPINE_BRANCH/main
|
||||
$ALPINE_MIRROR/$ALPINE_BRANCH/community
|
||||
EOF
|
||||
fi
|
||||
if [ -d "$KEYS_DIR" ]; then
|
||||
cp "$KEYS_DIR"/* etc/apk/keys/
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue