mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-02-14 17:49:53 +00:00
add macos bootable installer
This commit is contained in:
51
macos/macos.bash
Normal file
51
macos/macos.bash
Normal file
@@ -0,0 +1,51 @@
|
||||
# title: macOS
|
||||
# homepage: https://bootableinstaller.com/macos/
|
||||
# tagline: Bootable macOS Installer
|
||||
# description: |
|
||||
# Downloads the official OS X / macOS dmg from Apple to create bootable installers - works from macOS, Linux, or even Windows (through VirtualBox).
|
||||
# examples: |
|
||||
#
|
||||
# Use with Balena Etcher to burn ISO to USB, or boot with VirtualBox.
|
||||
#
|
||||
# ```txt
|
||||
# el-capitan.iso
|
||||
# ```
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
if [ -z "${WEBI_PKG_URL:-}" ]; then
|
||||
# dmg
|
||||
release_tab="${WEBI_HOST}/api/releases/macos@${WEBI_VERSION:-}.csv?os=$(uname -s)&arch=$(uname -m)&limit=1"
|
||||
echo $release_tab
|
||||
WEBI_CSV=$(curl -fsSL "$release_tab" -H "User-Agent: $(uname -a)")
|
||||
echo $WEBI_CSV
|
||||
WEBI_CHANNEL=$(echo $WEBI_CSV | cut -d ',' -f 3)
|
||||
echo $WEBI_CHANNEL
|
||||
if [ "error" == "$WEBI_CHANNEL" ]; then
|
||||
echo "could not find release for macOS v${WEBI_VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
WEBI_VERSION=$(echo $WEBI_CSV | cut -d ',' -f 1)
|
||||
WEBI_PKG_URL=$(echo $WEBI_CSV | cut -d ',' -f 9)
|
||||
fi
|
||||
|
||||
mkdir -p ~/Downloads
|
||||
pushd ~/Downloads 2>&1 >/dev/null
|
||||
|
||||
wget -c "$WEBI_PKG_URL"
|
||||
|
||||
if [ "Darwin" == "$(uname -s)" ]; then
|
||||
curl -fsSL 'https://gist.githubusercontent.com/solderjs/8c36d132250163011c83bad8284975ee/raw/5a291955813743c20c12ca2d35c7b1bb34f8aecc/create-bootable-installer-for-os-x-el-capitan.sh' -o create-bootable-installer-for-os-x-el-capitan.sh
|
||||
bash create-bootable-installer-for-os-x-el-capitan.sh
|
||||
else
|
||||
curl -fsSL 'https://gist.githubusercontent.com/solderjs/9834a45a6c21a41e8882698a00b55787/raw/c43061cd0c53ec675996f5cb66c7077e666aabd4/install-mac-tools.sh' -o install-mac-tools.sh
|
||||
bash install-mac-tools.sh
|
||||
|
||||
curl -fsSL 'https://gist.github.com/solderjs/04fd06560a8465a695337eb502f5b0e9/raw/0a06fb4dce91399d374d9a12958dabb48a9bd42a/empty.7400m.img.bz2' -o empty.7400m.img.bz2
|
||||
|
||||
curl -fsSL 'https://gist.githubusercontent.com/solderjs/9834a45a6c21a41e8882698a00b55787/raw/c43061cd0c53ec675996f5cb66c7077e666aabd4/linux-create-bootable-macos-recovery-image.sh' -o linux-create-bootable-macos-recovery-image.sh
|
||||
bash linux-create-bootable-macos-recovery-image.sh
|
||||
fi
|
||||
|
||||
popd 2>&1 >/dev/null
|
||||
90
macos/releases.js
Normal file
90
macos/releases.js
Normal file
@@ -0,0 +1,90 @@
|
||||
'use strict';
|
||||
|
||||
var oses = [
|
||||
{
|
||||
name: 'macOS Sierra',
|
||||
version: '10.12.6',
|
||||
date: '2018-09-26',
|
||||
channel: 'beta',
|
||||
url: 'https://support.apple.com/en-us/HT208202'
|
||||
},
|
||||
{
|
||||
name: 'OS X El Capitan',
|
||||
version: '10.11.6',
|
||||
date: '2018-07-09',
|
||||
lts: true,
|
||||
channel: 'stable',
|
||||
url: 'https://support.apple.com/en-us/HT206886'
|
||||
},
|
||||
{
|
||||
name: 'OS X Yosemite',
|
||||
version: '10.10.5',
|
||||
date: '2017-07-19',
|
||||
channel: 'beta',
|
||||
url: 'https://support.apple.com/en-us/HT210717'
|
||||
}
|
||||
];
|
||||
|
||||
var headers = {
|
||||
Connection: 'keep-alive',
|
||||
'Cache-Control': 'max-age=0',
|
||||
'Upgrade-Insecure-Requests': '1',
|
||||
'User-Agent':
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36',
|
||||
'Sec-Fetch-Dest': 'document',
|
||||
Accept:
|
||||
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
|
||||
'Sec-Fetch-Site': 'none',
|
||||
'Sec-Fetch-Mode': 'navigate',
|
||||
'Sec-Fetch-User': '?1',
|
||||
'Accept-Language': 'en-US,en;q=0.9,sq;q=0.8'
|
||||
};
|
||||
|
||||
module.exports = function (request) {
|
||||
var all = { download: '', releases: [] };
|
||||
|
||||
return Promise.all(
|
||||
oses.map(function (os) {
|
||||
return request({
|
||||
method: 'GET',
|
||||
url: os.url,
|
||||
headers: headers
|
||||
}).then(function (resp) {
|
||||
var m = resp.body.match(/(http[^>]+Install[^>]+.dmg)/);
|
||||
var download = m && m[1];
|
||||
['macos', 'linux'].forEach(function (osname) {
|
||||
all.releases.push({
|
||||
version: os.version,
|
||||
lts: os.lts || false,
|
||||
channel: os.channel || 'beta',
|
||||
date: os.date,
|
||||
os: osname,
|
||||
arch: 'amd64',
|
||||
ext: 'dmg',
|
||||
hash: '-',
|
||||
download: download
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
).then(function () {
|
||||
all.releases.sort(function (a, b) {
|
||||
if ('10.11.6' === a.version) {
|
||||
return -1;
|
||||
}
|
||||
if (a.date > a.date) {
|
||||
return 1;
|
||||
}
|
||||
if (a.date < a.date) {
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
console.log(JSON.stringify(all, null, 2));
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user