Working on cleanup
This commit is contained in:
parent
5749a9fc07
commit
ee2a05a99a
@ -1,49 +1,78 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
function create_directories()
|
function main()
|
||||||
{
|
{
|
||||||
mkdir ${HOME}/mnt
|
if [ ! -d "${HOME}/mnt" ]; then
|
||||||
mkdir ${HOME}/mnt/music
|
mkdir "${HOME}/mnt"
|
||||||
mkdir ${HOME}/mnt/photos
|
mkdir "${HOME}/mnt/music"
|
||||||
mkdir ${HOME}/mnt/video
|
mkdir "${HOME}/mnt/photos"
|
||||||
mkdir ${HOME}/mnt/NAS
|
mkdir "${HOME}/mnt/video"
|
||||||
}
|
mkdir "${HOME}/mnt/NAS"
|
||||||
|
fi
|
||||||
|
|
||||||
function install_automount()
|
|
||||||
{
|
local auto_file="auto_nas_$(whoami)"
|
||||||
echo -n "Username for NAS: "
|
|
||||||
read NAS_USERNAME
|
# Make a file with settings for the NAS mounts
|
||||||
echo -n "Password for NAS: "
|
if [ ! -f "/etc/${auto_file}" ]; then
|
||||||
read -s NAS_PASSWORD
|
echo -n "Username for NAS: "
|
||||||
echo
|
read NAS_USERNAME
|
||||||
sed -e "s/\[\[USERNAME\]\]/${NAS_USERNAME}/" \
|
echo -n "Password for NAS: "
|
||||||
-e "s/\[\[PASSWORD\]\]/${NAS_PASSWORD}/" \
|
read -s NAS_PASSWORD
|
||||||
-e "s/\[\[UNAME\]\]/$(whoami)/" \
|
echo
|
||||||
< "${DOTFILES}/NAS_mounts/auto_nas" \
|
|
||||||
| sudo tee "/etc/auto_nas_$(whoami)" >/dev/null
|
sed -e "s/\[\[USERNAME\]\]/${NAS_USERNAME}/" \
|
||||||
sudo chmod 600 "/etc/auto_nas_$(whoami)"
|
-e "s/\[\[PASSWORD\]\]/${NAS_PASSWORD}/" \
|
||||||
if ! grep "auto_nas_$(whoami)" < /etc/auto_master >/dev/null; then
|
-e "s/\[\[UNAME\]\]/$(whoami)/" \
|
||||||
echo "/- auto_nas_$(whoami) -nosuid" \
|
< "${DOTFILES}/NAS_mounts/auto_nas" \
|
||||||
| 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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_fixer()
|
main "$@"
|
||||||
{
|
|
||||||
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
|
|
||||||
|
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()
|
function install_casks()
|
||||||
{
|
{
|
||||||
cask google-chrome
|
brew cask install google-chrome
|
||||||
cask docker
|
brew cask install docker
|
||||||
cask caskroom/drivers/logitech-options
|
brew cask install caskroom/drivers/logitech-options
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_brews()
|
function install_brews()
|
||||||
{
|
{
|
||||||
#/usr/local/bin/brew update
|
#/usr/local/bin/brew update
|
||||||
brew tmux
|
brew install tmux
|
||||||
brew git
|
brew install arp-scan
|
||||||
brew arp-scan
|
brew install neovim
|
||||||
brew neovim
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -48,20 +38,11 @@ function setup_kitty()
|
|||||||
ln -s ${DOTFILES}/kitty.conf ${HOME}/Library/Preferences/kitty/kitty.conf
|
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
|
export DOTFILES=/Users/thomas/dotfiles
|
||||||
#install_brews
|
|
||||||
#install_casks
|
#ssh/setup.sh
|
||||||
#setup_fish
|
#git/setup.sh
|
||||||
#setup_ssh
|
NAS_mounts/setup.sh
|
||||||
#setup_wm
|
#fish/setup.sh
|
||||||
#setup_kitty
|
wm/setup.sh
|
||||||
setup_home
|
|
||||||
|
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
|
30
wm/setup.sh
Normal file → Executable file
30
wm/setup.sh
Normal file → Executable file
@ -1,16 +1,26 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
function setup_wm()
|
function main()
|
||||||
{
|
{
|
||||||
brew crisidev/homebrew-chunkwm/chunkwm
|
# Install chunkwm and khd
|
||||||
brew koekeishiya/formulae/khd
|
if ! brew list | grep chunkwm >/dev/null; then
|
||||||
ln -s ${DOTFILES}/wm/khdrc ${HOME}/.khdrc
|
brew install crisidev/homebrew-chunkwm/chunkwm
|
||||||
ln -s ${DOTFILES}/wm/chunkwmrc ${HOME}/.chunkwmrc
|
brew install koekeishiya/formulae/khd
|
||||||
if ! /usr/local/bin/brew services list | grep chunkwm >/dev/null; then
|
fi
|
||||||
/usr/local/bin/brew services start khd
|
|
||||||
/usr/local/bin/brew services start chunkwm
|
# 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
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start services
|
||||||
|
if ! brew services list | grep chunkwm >/dev/null; then
|
||||||
|
brew services start khd
|
||||||
|
brew services start chunkwm
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
export DOTFILES=/Users/thomas/dotfiles
|
main
|
||||||
setup_wm
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user