#!/usr/bin/env bash function create_directories() { mkdir ${HOME}/mnt mkdir ${HOME}/mnt/music mkdir ${HOME}/mnt/photos mkdir ${HOME}/mnt/video mkdir ${HOME}/mnt/NAS } function install_automount() { echo -n "Username for NAS: " read NAS_USERNAME echo -n "Password for NAS: " read -s NAS_PASSWORD echo sed -e "s/\[\[USERNAME\]\]/${NAS_USERNAME}/" \ -e "s/\[\[PASSWORD\]\]/${NAS_PASSWORD}/" \ -e "s/\[\[UNAME\]\]/$(whoami)/" \ < "${DOTFILES}/NAS_mounts/auto_nas" \ | sudo tee "/etc/auto_nas_$(whoami)" >/dev/null sudo chmod 600 "/etc/auto_nas_$(whoami)" if ! grep "auto_nas_$(whoami)" < /etc/auto_master >/dev/null; then echo "/- auto_nas_$(whoami) -nosuid" \ | sudo tee -a /etc/auto_master fi } function install_fixer() { local plist=org.autonomous.fixmounts.plist sed -e "s/\[\[USERNAME\]\]/$(whoami)/" \ < "${DOTFILES}/NAS_mounts/fix_mounts.sh" \ > ${HOME}/bin/fix_mounts.sh chmod +x ${HOME}/bin/fix_mounts.sh sed -e "s/\[\[USERNAME\]\]/$(whoami)/" \ < "${DOTFILES}/NAS_mounts/${plist}" \ | sudo tee /Library/LaunchDaemons/${plist} \ >/dev/null sudo chmod 644 /Library/LaunchDaemons/${plist} sudo launchctl load /Library/LaunchDaemons/${plist} } export DOTFILES=/Users/thomas/dotfiles install_automount install_fixer