mkrootfs.sh.in: support arbitrary filenames

This commit is contained in:
Michael Aldridge 2017-08-29 22:42:40 -07:00
parent aa0920fb16
commit 9debeafbf6
1 changed files with 4 additions and 2 deletions

View File

@ -62,6 +62,7 @@ Options
-h Show this help
-r <repo> Set XBPS repository (may be set multiple times)
-x <num> Use <num> threads to compress the image (dynamic if unset)
-o <file> Filename to write the ROOTFS archive to
-V Show version
_EOF
}
@ -72,13 +73,14 @@ _EOF
# Boilerplate option parsing. This script supports the bare minimum
# needed to build an image.
while getopts "C:c:h:r:x:V" opt; do
while getopts "C:c:h:r:x:o:V" opt; do
case $opt in
C) XBPS_CONFFILE="-C $OPTARG";;
c) XBPS_CACHEDIR="--cachedir=$OPTARG";;
h) usage; exit 0;;
r) XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=$OPTARG";;
x) COMPRESSOR_THREADS="$OPTARG" ;;
o) FILENAME="$OPTARG" ;;
V) echo "$PROGNAME @@MKLIVE_VERSION@@"; exit 0;;
esac
done
@ -206,7 +208,7 @@ rm -rf "$ROOTFS/var/cache/*" 2>/dev/null
# Finally we can compress the tarball, the name will include the
# architecture and the date on which the tarball was built.
tarball=void-${XBPS_TARGET_ARCH}-ROOTFS-$(date '+%Y%m%d').tar.xz
tarball=${FILENAME-void-${XBPS_TARGET_ARCH}-ROOTFS-$(date '+%Y%m%d').tar.xz}
run_cmd "tar -cp --posix --xattrs -C $ROOTFS . | xz -T${COMPRESSOR_THREADS:-0} -9 > $tarball "
# Now that we have the tarball we don't need the rootfs anymore, so we