Working on cleanup
This commit is contained in:
parent
5749a9fc07
commit
ee2a05a99a
@ -1,49 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function create_directories()
|
||||
function main()
|
||||
{
|
||||
mkdir ${HOME}/mnt
|
||||
mkdir ${HOME}/mnt/music
|
||||
mkdir ${HOME}/mnt/photos
|
||||
mkdir ${HOME}/mnt/video
|
||||
mkdir ${HOME}/mnt/NAS
|
||||
}
|
||||
if [ ! -d "${HOME}/mnt" ]; then
|
||||
mkdir "${HOME}/mnt"
|
||||
mkdir "${HOME}/mnt/music"
|
||||
mkdir "${HOME}/mnt/photos"
|
||||
mkdir "${HOME}/mnt/video"
|
||||
mkdir "${HOME}/mnt/NAS"
|
||||
fi
|
||||
|
||||
function install_automount()
|
||||
{
|
||||
|
||||
local auto_file="auto_nas_$(whoami)"
|
||||
|
||||
# Make a file with settings for the NAS mounts
|
||||
if [ ! -f "/etc/${auto_file}" ]; then
|
||||
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
|
||||
| sudo tee "/etc/${auto_file}" \
|
||||
> /dev/null
|
||||
|
||||
# The file contains a password, so make sure noone can read it
|
||||
sudo chmod 600 "/etc/${auto_file}"
|
||||
fi
|
||||
|
||||
# Add reference to the new file to /etc/auto_master
|
||||
if ! grep "${auto_file}" < /etc/auto_master >/dev/null; then
|
||||
echo "/- ${auto_file} -nosuid" \
|
||||
| sudo tee -a /etc/auto_master \
|
||||
> /dev/null
|
||||
fi
|
||||
|
||||
|
||||
# Install automount fixing script
|
||||
# Automount is wonky under OSX and will mount directories as the
|
||||
# first user who wants to use them.
|
||||
# In many cases, this is root, and then noone else can access it.
|
||||
# The following lines installs a script found at
|
||||
# https://github.com/scotartt/shell_scripts
|
||||
# which fixes this by remounting all mountpoints that have the wrong
|
||||
# owner every 15 seconds.
|
||||
|
||||
local script="${HOME}/bin/fix_mounts.sh"
|
||||
|
||||
local plist="org.autonomous.fixmounts.plist"
|
||||
local plistloc="/Library/LaunchDaemons/${plist}"
|
||||
|
||||
# Copy and set up mount-fixing script
|
||||
if [ ! -f "${script}" ]; then
|
||||
sed -e "s/\[\[USERNAME\]\]/$(whoami)/" \
|
||||
< "${DOTFILES}/NAS_mounts/fix_mounts.sh" \
|
||||
> "${script}"
|
||||
chmod +x "${script}"
|
||||
fi
|
||||
|
||||
# Install a launchd service to run it every 15 seconds
|
||||
if [ ! -f "${plistloc}" ]; then
|
||||
sed -e "s/\[\[USERNAME\]\]/$(whoami)/" \
|
||||
< "${DOTFILES}/NAS_mounts/${plist}" \
|
||||
| sudo tee "${plistloc}" \
|
||||
> /dev/null
|
||||
|
||||
sudo chmod 644 "${plistloc}"
|
||||
|
||||
sudo launchctl load "${plistloc}"
|
||||
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
|
||||
main "$@"
|
||||
|
43
install.sh
43
install.sh
@ -15,29 +15,19 @@ function install_homebrew()
|
||||
|
||||
}
|
||||
|
||||
function brew()
|
||||
{
|
||||
/usr/local/bin/brew install $@
|
||||
}
|
||||
function cask()
|
||||
{
|
||||
/usr/local/bin/brew cask install $@
|
||||
}
|
||||
|
||||
function install_casks()
|
||||
{
|
||||
cask google-chrome
|
||||
cask docker
|
||||
cask caskroom/drivers/logitech-options
|
||||
brew cask install google-chrome
|
||||
brew cask install docker
|
||||
brew cask install caskroom/drivers/logitech-options
|
||||
}
|
||||
|
||||
function install_brews()
|
||||
{
|
||||
#/usr/local/bin/brew update
|
||||
brew tmux
|
||||
brew git
|
||||
brew arp-scan
|
||||
brew neovim
|
||||
brew install tmux
|
||||
brew install arp-scan
|
||||
brew install neovim
|
||||
}
|
||||
|
||||
|
||||
@ -48,20 +38,11 @@ function setup_kitty()
|
||||
ln -s ${DOTFILES}/kitty.conf ${HOME}/Library/Preferences/kitty/kitty.conf
|
||||
}
|
||||
|
||||
function setup_ssh()
|
||||
{
|
||||
# copy private key to .ssh
|
||||
# cp ${KEYFILE} ~/.ssh/thomas_rsa
|
||||
# chmod 400 ~/.ssh/thomas_rsa
|
||||
# ssh-add -K ~/.ssh/thomas_rsa
|
||||
ln -s ${DOTFILES}/ssh_config ${HOME}/.ssh/config
|
||||
}
|
||||
|
||||
export DOTFILES=/Users/thomas/dotfiles
|
||||
#install_brews
|
||||
#install_casks
|
||||
#setup_fish
|
||||
#setup_ssh
|
||||
#setup_wm
|
||||
#setup_kitty
|
||||
setup_home
|
||||
|
||||
#ssh/setup.sh
|
||||
#git/setup.sh
|
||||
NAS_mounts/setup.sh
|
||||
#fish/setup.sh
|
||||
wm/setup.sh
|
||||
|
13
ssh/setup.sh
Executable file
13
ssh/setup.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function setup_ssh()
|
||||
{
|
||||
# copy private key to .ssh
|
||||
# cp ${KEYFILE} ~/.ssh/thomas_rsa
|
||||
# chmod 400 ~/.ssh/thomas_rsa
|
||||
# ssh-add -K ~/.ssh/thomas_rsa
|
||||
ln -s ${DOTFILES}/ssh/ssh_config ${HOME}/.ssh/config
|
||||
}
|
||||
|
||||
export DOTFILES=/Users/thomas/dotfiles
|
||||
setup_ssh
|
26
wm/setup.sh
Normal file → Executable file
26
wm/setup.sh
Normal file → Executable file
@ -1,16 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function setup_wm()
|
||||
function main()
|
||||
{
|
||||
brew crisidev/homebrew-chunkwm/chunkwm
|
||||
brew koekeishiya/formulae/khd
|
||||
# Install chunkwm and khd
|
||||
if ! brew list | grep chunkwm >/dev/null; then
|
||||
brew install crisidev/homebrew-chunkwm/chunkwm
|
||||
brew install koekeishiya/formulae/khd
|
||||
fi
|
||||
|
||||
# Link configuration files
|
||||
if [ ! -e "${HOME}/.chunkwmrc" ]; then
|
||||
rm -f "${HOME}/.chunkwmrc"
|
||||
rm -f "${HOME}/.khdrc"
|
||||
ln -s ${DOTFILES}/wm/khdrc ${HOME}/.khdrc
|
||||
ln -s ${DOTFILES}/wm/chunkwmrc ${HOME}/.chunkwmrc
|
||||
if ! /usr/local/bin/brew services list | grep chunkwm >/dev/null; then
|
||||
/usr/local/bin/brew services start khd
|
||||
/usr/local/bin/brew services start chunkwm
|
||||
fi
|
||||
|
||||
# Start services
|
||||
if ! brew services list | grep chunkwm >/dev/null; then
|
||||
brew services start khd
|
||||
brew services start chunkwm
|
||||
fi
|
||||
}
|
||||
|
||||
export DOTFILES=/Users/thomas/dotfiles
|
||||
setup_wm
|
||||
main
|
||||
|
Loading…
x
Reference in New Issue
Block a user