diff --git a/.gitignore b/.gitignore index 31c5787..28d2432 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,360 @@ -.DS_Store -BaseSystem.img -BaseSystem.dmg +# Ignore all user generated images +*.img +*.dmg +*.qcow2 BaseSystem.chunklist + +# Do not ignore ESP.qcow2 +!ESP.qcow2 + +# Ignore user generated template template.xml + +# Ingore system version fire version -data/ \ No newline at end of file + +# Ignore future use data folder +data/ + + +# Created by https://www.gitignore.io/api/vim,code,linux,macos,emacs,windows,eclipse,sublimetext,intellij+all +# Edit at https://www.gitignore.io/?templates=vim,code,linux,macos,emacs,windows,eclipse,sublimetext,intellij+all + +### Code ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +### Eclipse ### +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +### Eclipse Patch ### +# Eclipse Core +.project + +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# Annotation Processing +.apt_generated + +.sts4-cache/ + +### Emacs ### +# -*- mode: gitignore; -*- +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile + +# directory configuration +.dir-locals.el + +# network security +/network-security.data + + +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Linux ### + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### SublimeText ### +# Cache files for Sublime Text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache + +# Workspace files are user-specific +*.sublime-workspace + +# Project files should be checked into the repository, unless a significant +# proportion of contributors will probably not be using Sublime Text +# *.sublime-project + +# SFTP configuration file +sftp-config.json + +# Package control specific files +Package Control.last-run +Package Control.ca-list +Package Control.ca-bundle +Package Control.system-ca-bundle +Package Control.cache/ +Package Control.ca-certs/ +Package Control.merged-ca-bundle +Package Control.user-ca-bundle +oscrypto-ca-bundle.crt +bh_unicode_properties.cache + +# Sublime-github package stores a github token in this file +# https://packagecontrol.io/packages/sublime-github +GitHub.sublime-settings + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist + +# Auto-generated tag files +tags + +# Persistent undo +[._]*.un~ + +# Coc configuration directory +.vim + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# End of https://www.gitignore.io/api/vim,code,linux,macos,emacs,windows,eclipse,sublimetext,intellij+all diff --git a/make.sh b/make.sh index e6aa123..8fd8099 100755 --- a/make.sh +++ b/make.sh @@ -7,7 +7,6 @@ VMDIR=$PWD QEMU_HOME="$HOME/.config/libvirt/qemu" BOXES_HOME="$HOME/.local/share/gnome-boxes/images" MACHINE="$(qemu-system-x86_64 --machine help | grep q35 | cut -d" " -f1 | grep -Eoe ".*-[0-9.]+" | sort -rV | head -1)" -DATA="data" OUT="template.xml" DOMAIN_NAME=macOS-Simple-KVM DEFAULT_STORAGE=60G @@ -38,12 +37,12 @@ generate(){ ## TODO do some input validation - if [[ -e $DATA/version ]]; then - NAME="$NAME $(cat $DATA/version)" + if [[ -e version ]]; then + NAME="$NAME $(cat version)" fi UUID=$( cat /proc/sys/kernel/random/uuid ) - sed -e "s|BOXESHOME|$BOXES_HOME|g" -e "s|MACOSNAME|$NAME|g" -e "s|BOXESHOME|$BOXES_HOME|g" -e "s|QEMUHOME|$QEMU_HOME|g" -e "s|UUID|$UUID|g" -e "s|MACHINE|$MACHINE|g" -e "s|MACHINE|$MACHINE|g" tools/template.xml.in > $DATA/$OUT - echo "$OUT has been generated in $VMDIR$/$DATA" + sed -e "s|BOXESHOME|$BOXES_HOME|g" -e "s|MACOSNAME|$NAME|g" -e "s|BOXESHOME|$BOXES_HOME|g" -e "s|QEMUHOME|$QEMU_HOME|g" -e "s|UUID|$UUID|g" -e "s|MACHINE|$MACHINE|g" -e "s|MACHINE|$MACHINE|g" tools/template.xml.in > $OUT + echo "$OUT has been generated in $VMDIR" } install(){ @@ -52,13 +51,13 @@ install(){ mkdir -p $QEMU_HOME/firmware read -p "How much storage? [$DEFAULT_STORAGE]: " STORAGE - ## Use default 30G storage if no storage provided + ## Use default 60G storage if no storage provided if [[ -z $STORAGE ]]; then STORAGE=$DEFAULT_STORAGE; fi ## TODO do some input validation echo Creating system disk $BOXES_HOME/macOS.qcow2 of size $STORAGE - qemu-img create -f qcow2 $BOXES_HOME/macOS.qcow2 $SIZE + qemu-img create -f qcow2 $BOXES_HOME/macOS.qcow2 $STORAGE echo Coping BaseSystem.img and ESP.qcow2 in $BOXES_HOME cp -Zfu BaseSystem.img $BOXES_HOME cp -Zfu ESP.qcow2 $BOXES_HOME @@ -67,10 +66,16 @@ install(){ echo Coping OVMF_CODE.fd in $QEMU_HOME/nvram/ cp -Zfu firmware/OVMF_VARS-1024x768.fd $QEMU_HOME/nvram/ echo Copy $OUT to $QEMU_HOME - cp -Zfu $DATA/$OUT $QEMU_HOME/$DOMAIN_NAME.xml + cp -Zfu $OUT $QEMU_HOME/$DOMAIN_NAME.xml virsh -c qemu:///session define $QEMU_HOME/$DOMAIN_NAME.xml } +if [[ ! -e BaseSystem.img ]]; then + echo "Can't find base image, please run ./jumpstart.sh to download it." + echo + exit 1 +fi + generate argument="$1"