Skip to content

Commit c93cb02

Browse files
committed
Fix release dmg handling
1 parent 94dcbe6 commit c93cb02

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

etc/jhb.conf/release.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313

1414
### variables ##################################################################
1515

16-
RELEASE_ARCHIVE=${RELEASE_ARCHIVE:-$(basename "$VER_DIR")_$(uname -m)}.tar.xz
16+
RELEASE_ARCHIVE=${RELEASE_ARCHIVE:-$(basename "$VER_DIR")_$(uname -m).tar.xz}
1717

1818
RELEASE_URL=$(eval echo "${RELEASE_URL:-${RELEASE_URL_TEMPLATE:-\
1919
https://github.com/dehesselle/jhb/releases/download/\
2020
v$VERSION/$RELEASE_ARCHIVE}}")
2121

22+
RELEASE_OVERLAY=overlay
23+
2224
### functions ##################################################################
2325

2426
# Nothing here.

usr/bin/archive

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,13 @@ done
3434

3535
### variables ##################################################################
3636

37-
TAR_FILE=$RELEASE_ARCHIVE
38-
DMG_FILE=$(basename -s .tar.xz "$TAR_FILE").dmg
39-
40-
OVERLAY_NAME=overlay
37+
# Nothing here.
4138

4239
### functions ##################################################################
4340

4441
function create_tar
4542
{
46-
local file=$ARTIFACT_DIR/$TAR_FILE
43+
local file=$ARTIFACT_DIR/$RELEASE_ARCHIVE
4744

4845
echo_i "creating $file"
4946

@@ -56,7 +53,7 @@ function create_tar
5653

5754
function create_dmg
5855
{
59-
local file=$ARTIFACT_DIR/$DMG_FILE
56+
local file=$ARTIFACT_DIR/$RELEASE_ARCHIVE
6057

6158
( # create dmg
6259
local vol_name
@@ -78,14 +75,14 @@ function create_dmg
7875

7976
function mount_dmg
8077
{
81-
local file=$REP_DIR/$DMG_FILE
78+
local file=$REP_DIR/$RELEASE_ARCHIVE
8279
local mountpoint=$VER_DIR
8380

8481
if [ ! -d "$mountpoint" ]; then
8582
mkdir -p "$mountpoint"
8683
fi
8784

88-
echo_i "mounting dmg may take some time"
85+
echo_i "mounting $(basename "$file") may take some time"
8986
local device
9087
device=$(hdiutil attach -nomount "$file" | grep "^/dev/disk" |
9188
grep "Apple_HFS" | awk '{ print $1 }')
@@ -123,14 +120,17 @@ function download_dmg
123120
mkdir -p "$REP_DIR"
124121
fi
125122

126-
curl -o "$REP_DIR/$DMG_FILE" -L -C "$RELEASE_URL"
123+
local url
124+
url="$(dirname "$RELEASE_URL")/$RELEASE_ARCHIVE"
125+
126+
curl -o "$REP_DIR/$RELEASE_ARCHIVE" -L -C - "$url"
127127
}
128128

129129
function install_dmg
130130
{
131131
local overlay_size=${1:-1} # unit GiB, default 1
132132

133-
local file=$REP_DIR/$DMG_FILE
133+
local file=$REP_DIR/$RELEASE_ARCHIVE
134134

135135
# download and mount read-only disk image
136136
if [ -f "$file" ]; then
@@ -143,7 +143,7 @@ function install_dmg
143143
# create writable overlay
144144
local device
145145
device=$(hdiutil attach -nomount ram://$((overlay_size * 1024 * 2048)) | xargs)
146-
newfs_hfs -v "$OVERLAY_NAME" "$device" >/dev/null
146+
newfs_hfs -v "$RELEASE_OVERLAY" "$device" >/dev/null
147147
echo_i "$overlay_size GiB ram attached to $device"
148148
mount -o nobrowse,rw,union -t hfs "$device" "$VER_DIR"
149149
echo_i "$device union-mounted at $VER_DIR"

0 commit comments

Comments
 (0)