-
Notifications
You must be signed in to change notification settings - Fork 1
123 lines (106 loc) · 4.78 KB
/
build_full_iso.yml
File metadata and controls
123 lines (106 loc) · 4.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: MacOS ISO Builder For OpenCore (Below 11)
on:
workflow_dispatch:
jobs:
build_iso:
runs-on: macos-latest
strategy:
fail-fast: true
max-parallel: 1
matrix:
include:
- macos_version: "17G66"
macos_name: "high-sierra"
macos_version_number: "10.13"
catalog: "publicrelease"
image_size: "5500m"
- macos_version: "18F2059"
macos_name: "mojave"
macos_version_number: "10.14"
catalog: "publicrelease"
image_size: "6400m"
- macos_version: "19D2064"
macos_name: "catalina"
macos_version_number: "10.15"
catalog: "publicrelease"
image_size: "8200m"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: |
brew install wget sshpass p7zip
- name: Clone gibMacOS
run: |
git clone https://github.com/corpnewt/gibMacOS.git gibMacOS
chmod +x gibMacOS/gibMacOS.command
- name: Download macOS components
working-directory: gibMacOS
run: |
python3 gibMacOS.py --catalog "${{ matrix.catalog }}" \
--version "${{ matrix.macos_version_number }}" \
-b "${{ matrix.macos_version }}"
- name: Determine download directory
id: find_dir
run: |
DIR=$(find "${GITHUB_WORKSPACE}/gibMacOS/macOS Downloads" -type d -name "*${{ matrix.macos_version }}*" | head -n1)
if [ -z "$DIR" ]; then echo "Error: download dir not found"; exit 1; fi
echo "DOWNLOAD_DIR=$DIR" >> $GITHUB_ENV
- name: Prepare installer app
run: |
wget https://raw.githubusercontent.com/oneclickvirt/macos/main/BuildmacOSInstallApp.py -O BuildmacOSInstallApp.py
chmod +x BuildmacOSInstallApp.py
python3 BuildmacOSInstallApp.py "$DOWNLOAD_DIR" installer_app
APP=$(find installer_app -maxdepth 2 -type d -name "Install*.app" | head -n1)
if [ -z "$APP" ]; then echo "Error: built installer.app not found"; exit 1; fi
INSTALLER_APP="$PWD/$APP"
echo "INSTALLER_APP=$INSTALLER_APP" >> $GITHUB_ENV
- name: Create sparse image
run: |
hdiutil create -size "${{ matrix.image_size }}" -layout GPTSPUD -fs HFS+J -type SPARSE \
-volname "Install_${{ matrix.macos_name }}" \
-o temp_install.sparseimage
- name: Attach sparse image
id: attach
run: |
OUTPUT=$(hdiutil attach temp_install.sparseimage -nobrowse -noverify -noautoopen)
EFI_LINE=$(echo "$OUTPUT" | grep -i "EFI ")
INSTALL_LINE=$(echo "$OUTPUT" | grep -i "Install_${{ matrix.macos_name }}")
EFI_DEV=$(echo "$EFI_LINE" | awk '{print $1}')
EFI_MNT=$(echo "$EFI_LINE" | awk '{print $3}')
INST_DEV=$(echo "$INSTALL_LINE" | awk '{print $1}')
INST_MNT=$(echo "$INSTALL_LINE" | awk '{print $3}')
echo "EFI_DEV=$EFI_DEV" >> $GITHUB_ENV
echo "EFI_MNT=$EFI_MNT" >> $GITHUB_ENV
echo "INST_DEV=$INST_DEV" >> $GITHUB_ENV
echo "INST_MNT=$INST_MNT" >> $GITHUB_ENV
- name: Run createinstallmedia
run: |
echo "Using installer at $INSTALLER_APP"
sudo "$INSTALLER_APP/Contents/Resources/createinstallmedia" \
--volume "$INST_MNT" --nointeraction
- name: Inject OpenCore EFI
run: |
diskutil mount "$EFI_DEV"
EFI_MNT_POINT=$(mount | grep "$EFI_DEV" | awk '{print $3}')
sudo cp -R EFI/* "$EFI_MNT_POINT/"
diskutil unmount "$EFI_MNT_POINT" || true
- name: Detach sparse image
run: |
hdiutil detach "$EFI_DEV" || true
hdiutil detach "$INST_DEV" || true
- name: Create hybrid ISO
run: |
mkdir -p output
sleep 20
hdiutil convert temp_install.sparseimage -format UDTO -o output/${{ matrix.macos_name }}.cdr
mv output/${{ matrix.macos_name }}.cdr output/${{ matrix.macos_name }}.iso
- name: Compress ISO with 7z (max compression)
run: |
7z a -t7z -m0=lzma2 -mx=9 -mmt=on -ms=on -md=256m output/${{ matrix.macos_name }}.iso.7z output/${{ matrix.macos_name }}.iso
rm output/${{ matrix.macos_name }}.iso
- name: Upload compressed archive via SCP
run: |
sshpass -p "${{ secrets.PASSWORD }}" ssh -o StrictHostKeyChecking=no root@${{ secrets.IP }} "mkdir -p /root/macos"
sshpass -p "${{ secrets.PASSWORD }}" scp -o StrictHostKeyChecking=no output/${{ matrix.macos_name }}.iso.7z root@${{ secrets.IP }}:/root/macos/
sshpass -p "${{ secrets.PASSWORD }}" ssh -o StrictHostKeyChecking=no root@${{ secrets.IP }} "ls -lah /root/macos/"