Skip to content

Commit

Permalink
Remove dependency on Packages payload. Default hostname to existing. …
Browse files Browse the repository at this point in the history
…Fix auto-login hash generation. Add log headings.
  • Loading branch information
nbartzokas committed Dec 21, 2016
1 parent 5ac4d1e commit fb8ef7d
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 22 deletions.
70 changes: 51 additions & 19 deletions MacProvisioner.pkgproj
Original file line number Diff line number Diff line change
Expand Up @@ -370,24 +370,7 @@
<array>
<dict>
<key>CHILDREN</key>
<array>
<dict>
<key>CHILDREN</key>
<array/>
<key>GID</key>
<integer>0</integer>
<key>PATH</key>
<string>1280x720.jpg</string>
<key>PATH_TYPE</key>
<integer>1</integer>
<key>PERMISSIONS</key>
<integer>420</integer>
<key>TYPE</key>
<integer>3</integer>
<key>UID</key>
<integer>0</integer>
</dict>
</array>
<array/>
<key>GID</key>
<integer>0</integer>
<key>PATH</key>
Expand Down Expand Up @@ -444,7 +427,56 @@
<integer>1</integer>
</dict>
<key>RESOURCES</key>
<array/>
<array>
<dict>
<key>CHILDREN</key>
<array/>
<key>GID</key>
<integer>0</integer>
<key>PATH</key>
<string>1280x720.jpg</string>
<key>PATH_TYPE</key>
<integer>1</integer>
<key>PERMISSIONS</key>
<integer>420</integer>
<key>TYPE</key>
<integer>3</integer>
<key>UID</key>
<integer>0</integer>
</dict>
<dict>
<key>CHILDREN</key>
<array/>
<key>GID</key>
<integer>0</integer>
<key>PATH</key>
<string>install_runasroot</string>
<key>PATH_TYPE</key>
<integer>1</integer>
<key>PERMISSIONS</key>
<integer>493</integer>
<key>TYPE</key>
<integer>3</integer>
<key>UID</key>
<integer>0</integer>
</dict>
<dict>
<key>CHILDREN</key>
<array/>
<key>GID</key>
<integer>0</integer>
<key>PATH</key>
<string>install_runasuser</string>
<key>PATH_TYPE</key>
<integer>1</integer>
<key>PERMISSIONS</key>
<integer>493</integer>
<key>TYPE</key>
<integer>3</integer>
<key>UID</key>
<integer>0</integer>
</dict>
</array>
</dict>
<key>PACKAGE_SETTINGS</key>
<dict>
Expand Down
2 changes: 1 addition & 1 deletion install
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Prompt for ...
HOSTNAME="$(osascript -e 'Tell application "System Events" to display dialog "Enter the desired Hostname:" default answer "LAB-'$(uuidgen)'"' -e 'text returned of result' 2>/dev/null)"
HOSTNAME="$(osascript -e 'Tell application "System Events" to display dialog "Enter the desired Hostname:" default answer "'$(hostname)'"' -e 'text returned of result' 2>/dev/null)"
USERNAME="$(osascript -e 'Tell application "System Events" to display dialog "Enter the default Username:" default answer "'$(whoami)'"' -e 'text returned of result' 2>/dev/null)"
PASSWORD="$(osascript -e 'Tell application "System Events" to display dialog "Enter the default Password:" default answer ""' -e 'text returned of result' 2>/dev/null)"

Expand Down
5 changes: 4 additions & 1 deletion install_runasroot
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ HOSTNAME="$1"
USERNAME="$2"
PASSWORD="$3"

echo "####################"
echo "# install_runasroot"

# Begin sudo for rest of script
#https://gist.github.com/cowboy/3118588
sudo -v
Expand Down Expand Up @@ -62,7 +65,7 @@ echo "Setup auto login."
# http://osxnotes.net/passwords.html
# http://www.brock-family.org/gavin/perl/kcpassword.html
sudo defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser $USERNAME
sudo ruby -e"password=\"${PASSWORD}\".bytes; key=[125,137,82,35,210,188,221,234,163,185,31]; num=12*(1+password.size/12); out=Array.new(num); (0..num-1).each { |i| i<password.size ? out[i]=password[i]^key[i%key.size] : out[i]=key[i%key.size] }; IO.write(\"/etc/kcpassword\",out.pack(\"C*\"));"
sudo ruby -e"password=\"${PASSWORD}\".bytes; key=[125,137,82,35,210,188,221,234,163,185,31]; num=12*(1+password.size/12); out=Array.new(num); out.fill(0); (0..password.size).each { |i| out[i]=password[i]^key[i%key.size]; }; out[password.size]=key[password.size%key.size]; IO.write(\"/etc/kcpassword\",out.pack(\"C*\"));"
sudo chmod 0600 /etc/kcpassword

echo "Disable the 'This Application Unexpectedly Quit' and the subsequent bug report"
Expand Down
6 changes: 5 additions & 1 deletion install_runasuser
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ HOSTNAME="$1"
USERNAME="$2"
PASSWORD="$3"

echo "####################"
echo "# install_runasuser"

echo "Set wallpaper"
#https://github.com/pipwerks/OS-X-Wallpaper-Changer
cp ./1280x720.jpg ~/Pictures/1280x720.jpg
osascript \
-e 'tell application "System Events"' \
-e ' set theDesktops to a reference to every desktop' \
-e ' repeat with aDesktop in theDesktops' \
-e ' set the picture of aDesktop to "/Users/Shared/lab_1280x720.jpg"' \
-e ' set the picture of aDesktop to "~/Pictures/1280x720.jpg"' \
-e ' end repeat' \
-e 'end tell'
# # http://osxdaily.com/2015/08/28/set-wallpaper-command-line-macosx/
Expand Down

0 comments on commit fb8ef7d

Please sign in to comment.