This commit is contained in:
Brian Zalewski 2024-05-06 04:18:02 +00:00
parent cdd1ac6090
commit dc3dce5402
5 changed files with 20 additions and 2 deletions

View file

@ -767,6 +767,20 @@ addFlathub() {
fi
}
installXcode() {
if [ -d /Applications ] && [ -d /System ]; then
if [ ! -d /Applications/Xcode.app ]; then
logg info 'Installing Xcode via mas - the installation will timeout after 40 minutes if Apple account is not signed into'
timeout 2400 mas install 497799835 || MAS_EXIT_CODE=$?
if [ -n "$MAS_EXIT_CODE" ]; then
logg error 'Failed to install Xcode'
fi
else
logg success 'Xcode is already installed'
fi
fi
}
setupLinuxHomebrewFonts() {
if [ ! -d /Applications ] && [ ! -d /System ]; then
logg info 'Tapping homebrew/linux-fonts' && brew tap homebrew/linux-fonts
@ -788,6 +802,7 @@ miscMacOs() {
# TODO - Add install on macOS for macports
if [ -n "$DEBUG" ] || [ -n "$DEBUG_MODE" ]; then
logg info 'The DEBUG or DEBUG_MODE environment variable is set so preliminary system tweaks will be run synchronously'
installXcode
addFlathub
allocateSwap
configureGPG
@ -812,6 +827,7 @@ if [ -n "$DEBUG" ] || [ -n "$DEBUG_MODE" ]; then
setupLinuxHomebrewFonts
miscMacOs
else
installXcode &
addFlathub &
allocateSwap &
configureGPG &

View file

@ -27,7 +27,9 @@ brew "gsed"
brew "gum"
brew "htmlq"
brew "jq"
brew "mas"
brew "moreutils"
brew "m4"
brew "node"
brew "openssh"
brew "pinentry-mac"

View file

@ -41,7 +41,7 @@ async function runScript(key, script) {
fs.writeFileSync(`${cacheDir}/${key}-glow`, (file.stdout ? `# ${file.stdout}\n\n` : '') + (brief.stdout ? `> ${brief.stdout}\n\n` : '') + '```sh\n' + templatedScript.stdout + "\n```")
fs.writeFileSync(`${cacheDir}/${key}`, templatedScript.stdout)
try {
runSilentCommand(`glow --width 80 "${cacheDir}/${key}-glow"`)
runSilentCommand(`glow --width 120 "${cacheDir}/${key}-glow"`)
// TODO: Set process.env.DEBUG || true here because the asynchronous method is not logging properly / running slow
if (process.env.DEBUG) {
return await runSilentCommand(`bash "${cacheDir}/${key}" || logg error 'Error occurred while processing script for ${key}'`)

View file

@ -12047,10 +12047,10 @@ softwarePackages:
_home: https://developer.apple.com/xcode/
_name: XCode
_post: sudo xcodebuild -license accept && sudo xcodebuild -runFirstLaunch
script:darwin: bash "$HOME/.local/bin/post-installx/post-xcode.sh"
mas: 497799835
xcodeinstall:
_bin: xcodeinstall
_deprecated: The preferred method is to use mas early in the installation since Xcode might be a dependency during the full install
_desc: "xcodeinstall is a tool available on GitHub at https://github.com/sebsto/xcodeinstall that simplifies the installation and management of Xcode on macOS systems. It allows users to easily download and \ninstall different versions of Xcode from the command line, which can be useful for developers who need to switch between Xcode versions for compatibility testing or other purposes. The tool provides a \nconvenient way to automate the process of managing Xcode installations on macOS systems. "
_github: https://github.com/sebsto/xcodeinstall
_name: Xcode Install