This session was presented at MacTech 2014 in Los Angeles, California. Session description follows:
Git and GitHub have changed the way we can collaborate with others on code-based projects, but it can be intimidating at first. How does this all work? We will cover the basics of Git and how to escape some of its pitfalls, and we will review some of the tools and processes available to those wanting to start or contribute to an open-source project, which isn't Git-specific. Writing code is only part of it!
40. $
git:(master) >$
git:(master) ✗ >$
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
virtual
nothing added to commit but untracked files present (use "git add" to
track)
git status
cd munki-conditions
Submitting changes
cp /new/munki/condition/virtual .
46. git:(master) ✗ >$ git branch add-virtual
git:(master) ✗ >$ git checkout add-virtual
Switched to branch 'add-virtual'
git:(add-virtual) ✗ >$ git add virtual
git:(add-virtual) ✗ >$ git status
On branch add-virtual
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: virtual
git:(add-virtual) ✗ >$
Submitting changes
47. git:(master) ✗ >$ git branch add-virtual
git:(master) ✗ >$ git checkout add-virtual
Switched to branch 'add-virtual'
git:(add-virtual) ✗ >$ git add virtual
git:(add-virtual) ✗ >$ git status
On branch add-virtual
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: virtual
git:(add-virtual) ✗ >$ git commit
Submitting changes
48. # Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch add-virtual
# Changes to be committed:
# new file: virtual
#
Submitting changes
49. # Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch add-virtual
# Changes to be committed:
# new file: virtual
#
Adding new ‘virtual’ condition
Submitting changes
50. # Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch add-virtual
# Changes to be committed:
# new file: virtual
#
Adding new ‘virtual’ condition
- returns ‘physical’ on a physical Mac, ‘vmware’ on Fusion
Submitting changes
51. # Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch add-virtual
# Changes to be committed:
# new file: virtual
#
Adding new ‘virtual’ condition
- returns ‘physical’ on a physical Mac, ‘vmware’ on Fusion
:wq
Submitting changes
69. Pulling in changes
git:(master) >$ git log mactech/add-virtual
commit c633790b8405d30d2681ae6b912cf7d89dcad5bc
Author: MacTech 2014 <2014@mactech.com>
Date: Thu Oct 23 14:50:08 2014 -0400
Adding new 'virtual' condition
- returns 'physical' on a physical Mac, 'vmware' on Fusion
70. commit c633790b8405d30d2681ae6b912cf7d89dcad5bc
Author: MacTech 2014 <2014@mactech.com>
Date: Thu Oct 23 14:50:08 2014 -0400
Adding new 'virtual' condition
- returns 'physical' on a physical Mac, 'vmware' on Fusion
diff --git a/virtual b/virtual
new file mode 100755
index 0000000..7697495
--- /dev/null
+++ b/virtual
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
Pulling in changes
git:(master) >$ git log --patch mactech/add-virtual
71. index 0000000..7697495
--- /dev/null
+++ b/virtual
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# writes a condition: 'virtual', which can be:
+# - 'physical' if a physical machine
+# - 'vmware' if a VMware VM
+#
+# Designed to be analogous to the 'virtual' Facter fact. No
+# other virtualization platforms are supported currently.
+
+DEFAULTS=/usr/bin/defaults
+MUNKI_DIR=$("${DEFAULTS}" read /Library/Preferences/ManagedInstalls
ManagedInstallDir)
+COND_DOMAIN="${MUNKI_DIR}/ConditionalItems"
+KEY="virtual"
+
+VALUE="physical"
+if system_profiler SPHardwareDataType | grep Boot ROM | grep VMW; then
+ VALUE="vmware"
+fi
+
+"${DEFAULTS}" write "${COND_DOMAIN}" "${KEY}" "${VALUE}"
Pulling in changes