add setup script

This commit is contained in:
Jeffrey Paul 2018-08-13 04:05:49 -07:00 committed by GitHub
parent f32d49d29e
commit 78c1a2db4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 0 deletions

37
bin/setup Normal file
View File

@ -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