From 78c1a2db4f1c5cc8437c5b23d43ab410921036ba Mon Sep 17 00:00:00 2001 From: Jeffrey Paul Date: Mon, 13 Aug 2018 04:05:49 -0700 Subject: [PATCH] add setup script --- bin/setup | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 bin/setup diff --git a/bin/setup b/bin/setup new file mode 100644 index 0000000..5ca8f9c --- /dev/null +++ b/bin/setup @@ -0,0 +1,37 @@ +#!/bin/bash + +function do_osx_setup { + cc + + if [[ ! -d "$HOME/tmp" ]]; then + mkdir "$HOME/tmp" + fi + + if [[ ! -d "$HOME/tmp/osximage" ]]; then + git clone https://github.com/sneak/osximage.git "$HOME/tmp/osximage.tmp" && \ + mv "$HOME/tmp/osximage.tmp" "$HOME/tmp/osximage" + fi + + if [[ -d "$HOME/tmp/osximage" ]]; then + cd "$HOME/tmp/osximage/custompkg/root/etc/skel" + if [[ ! -d /etc/skel ]]; then + sudo rsync -avP ./ /etc/skel/ + fi + if [[ -d /etc/skel ]]; then + rsync -avP /etc/skel/ "$HOME" + fi + fi + + for FN in $HOME/Library/user-setup/*.sh ; do + echo "new-user-setup: starting $(basename $FN)..." + bash "$FN" 2>&1 | tee -a $HOME/Library/Logs/user-setup.log + rm "$FN" + echo "new-user-setup: removed $(basename $FN)..." + done +} + +if [[ "$(uname)" = "Darwin" ]]; then + if [[ ! -e "$HOME/Library/profile.d" ]]; then + do_osx_setup + fi +fi