WizardKit/setup/macos/live-macos-startup
2Shirt 0aefdf3f1a
Add support to build live macOS Catalina images
* Had to drop iTerm due to a library incompatibilty
2021-04-01 22:54:36 -06:00

36 lines
847 B
Bash
Executable file

#!/bin/bash
#
## Init macOS env
# Update PATH
for p in /usr/local/{,opt/{e2fsprogs,ruby,util-linux}/}{bin,sbin}; do
PATH="${p}:${PATH}"
done
# Create and mount RAMDisk
if ! [[ -d /Volumes/RAM_Disk ]]; then
echo "Creating RAM Disk..."
RAM_DEV="$(hdiutil attach -nomount ram://524288)"
diskutil quiet erasevolume HFS+ RAM_Disk ${RAM_DEV}
diskutil unmount ${RAM_DEV}
mkdir /Volumes/RAM_Disk
mount -t hfs -o owners ${RAM_DEV} /Volumes/RAM_Disk
fi
cd /Volumes/RAM_Disk
# Stay awake
echo "Getting caffeinated..."
caffeinate -id &
# Set time
if ! [[ -e /Volumes/RAM_Disk/.time_set ]]; then
echo "Updating clock..."
if ! sntp -Ss us.pool.ntp.org >/dev/null 2>&1; then
# Assuming we're running under an older version of macOS
sntp -s us.pool.ntp.org >/dev/null 2>&1
fi
touch /Volumes/RAM_Disk/.time_set
fi
# Run cmd
"$1"