Skip to content

Commit c970a41

Browse files
committed
fix: jre build setup permissions
1 parent 0f65410 commit c970a41

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

.github/workflows/main-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,9 @@ jobs:
504504
with:
505505
path: |
506506
src-tauri/resources/build-jre
507-
key: ${{ runner.os }}-${{ matrix.target }}-jre-build-v2-${{ hashFiles('src-tauri/scripts/setup-build-jre.sh') }}
507+
key: ${{ runner.os }}-${{ matrix.target }}-jre-v3-${{ hashFiles('src-tauri/scripts/setup-build-jre.sh') }}
508508
restore-keys: |
509-
${{ runner.os }}-${{ matrix.target }}-jre-build-v2-
509+
${{ runner.os }}-${{ matrix.target }}-jre-v3-
510510
511511
- name: Install frontend dependencies
512512
run: pnpm install --frozen-lockfile

src-tauri/scripts/setup-build-jre.sh

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,8 @@ download_jre() {
177177
# Clean up archive
178178
rm "$ARCHIVE_FILE"
179179

180-
find "$EXTRACT_DIR" -type f -exec chmod u+r {} \; 2>/dev/null || true
181-
find "$EXTRACT_DIR" -type f -exec chmod a+r {} \; 2>/dev/null || true
182-
find "$EXTRACT_DIR" -type d -exec chmod u+rx {} \; 2>/dev/null || true
183-
find "$EXTRACT_DIR" -type d -exec chmod a+rx {} \; 2>/dev/null || true
180+
find "$EXTRACT_DIR" -type f -exec chmod 644 {} \; 2>/dev/null || true
181+
find "$EXTRACT_DIR" -type d -exec chmod 755 {} \; 2>/dev/null || true
184182

185183
print_success "JRE extracted successfully" >&2
186184
echo "$EXTRACT_DIR"
@@ -238,11 +236,8 @@ create_minimal_jre() {
238236
--output "$OUTPUT_DIR" 2>&1 | grep -v "Warning" || [ ${PIPESTATUS[0]} -eq 0 ]; then
239237

240238
if [ -d "$OUTPUT_DIR" ]; then
241-
# Set permissions explicitly on all files and directories
242-
find "$OUTPUT_DIR" -type f -exec chmod u+r {} \; 2>/dev/null || true
243-
find "$OUTPUT_DIR" -type f -exec chmod a+r {} \; 2>/dev/null || true
244-
find "$OUTPUT_DIR" -type d -exec chmod u+rx {} \; 2>/dev/null || true
245-
find "$OUTPUT_DIR" -type d -exec chmod a+rx {} \; 2>/dev/null || true
239+
find "$OUTPUT_DIR" -type f -exec chmod 644 {} \; 2>/dev/null || true
240+
find "$OUTPUT_DIR" -type d -exec chmod 755 {} \; 2>/dev/null || true
246241

247242
local SIZE=$(du -sh "$OUTPUT_DIR" | cut -f1)
248243
print_success "Minimal JRE created successfully (Size: $SIZE)" >&2
@@ -263,11 +258,8 @@ copy_full_jre() {
263258

264259
cp -r "$SOURCE_JRE" "$OUTPUT_DIR"
265260

266-
# Fix permissions after copying - set explicitly on all files and directories
267-
find "$OUTPUT_DIR" -type f -exec chmod u+r {} \; 2>/dev/null || true
268-
find "$OUTPUT_DIR" -type f -exec chmod a+r {} \; 2>/dev/null || true
269-
find "$OUTPUT_DIR" -type d -exec chmod u+rx {} \; 2>/dev/null || true
270-
find "$OUTPUT_DIR" -type d -exec chmod a+rx {} \; 2>/dev/null || true
261+
find "$OUTPUT_DIR" -type f -exec chmod 644 {} \; 2>/dev/null || true
262+
find "$OUTPUT_DIR" -type d -exec chmod 755 {} \; 2>/dev/null || true
271263

272264
local SIZE=$(du -sh "$OUTPUT_DIR" | cut -f1)
273265
print_success "Full JRE copied successfully (Size: $SIZE)" >&2
@@ -279,11 +271,8 @@ set_java_permissions() {
279271

280272
print_info "Setting permissions on JRE files..." >&2
281273

282-
# First, ensure all files and directories are readable
283-
find "$JRE_PATH" -type f -exec chmod u+r {} \; 2>/dev/null || true
284-
find "$JRE_PATH" -type f -exec chmod a+r {} \; 2>/dev/null || true
285-
find "$JRE_PATH" -type d -exec chmod u+rx {} \; 2>/dev/null || true
286-
find "$JRE_PATH" -type d -exec chmod a+rx {} \; 2>/dev/null || true
274+
find "$JRE_PATH" -type f -exec chmod 644 {} \; 2>/dev/null || true
275+
find "$JRE_PATH" -type d -exec chmod 755 {} \; 2>/dev/null || true
287276

288277
# Try multiple possible locations for Java binary
289278
local POSSIBLE_PATHS=(
@@ -293,10 +282,9 @@ set_java_permissions() {
293282

294283
for path in "${POSSIBLE_PATHS[@]}"; do
295284
if [ -f "$path" ]; then
296-
chmod +x "$path"
285+
chmod 755 "$path"
297286
print_success "Set executable permission for: $path" >&2
298-
# Also set permissions for other binaries in the bin directory
299-
chmod +x "$(dirname "$path")"/* 2>/dev/null || true
287+
find "$(dirname "$path")" -type f -exec chmod 755 {} \; 2>/dev/null || true
300288
return 0
301289
fi
302290
done

0 commit comments

Comments
 (0)