瀏覽代碼

mkrootfs.sh.in: support arbitrary filenames

Michael Aldridge 7 年之前
父節點
當前提交
9debeafbf6
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      mkrootfs.sh.in

+ 4 - 2
mkrootfs.sh.in

@@ -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