Do some crazy stuff with OPTIND to unbreak getopts interoperation.
This commit is contained in:
parent
ca17d69e4a
commit
d731e62b04
@ -119,7 +119,7 @@ function do_the_brew() {
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
echo "Installing the following packages:"
|
echo "Installing the following packages:"
|
||||||
for package_name in "${install_items[@]}"; do echo $package_name; done;
|
for package_name in "${install_items[@]}"; do printf '\t%s\n' $package_name; done;
|
||||||
brew update
|
brew update
|
||||||
brew_install_items $install_items
|
brew_install_items $install_items
|
||||||
brew cleanup
|
brew cleanup
|
||||||
|
@ -228,10 +228,10 @@ function ss() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function git_config_string() {
|
function git_config_string() {
|
||||||
git config -f $1 --list | xargs -I kv sh -c "echo \\\"kv\\\"" | xargs | tr '\n' ' '
|
git config -f $1 --list | xargs -I kv printf '-c \"%s\" ' kv
|
||||||
}
|
}
|
||||||
|
|
||||||
function brew_for_multiple_user() {
|
function brew_for_multiple_users() {
|
||||||
sudo chgrp -R admin /usr/local
|
sudo chgrp -R admin /usr/local
|
||||||
sudo chmod -R g+w /usr/local
|
sudo chmod -R g+w /usr/local
|
||||||
sudo chgrp -R admin /Library/Caches/Homebrew
|
sudo chgrp -R admin /Library/Caches/Homebrew
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
function install_python_packages() {
|
function install_python_packages() {
|
||||||
|
easy_install pip
|
||||||
ESSENTIAL=(ipdb ipython virtualenv)
|
ESSENTIAL=(ipdb ipython virtualenv)
|
||||||
FOR_EDITOR=(jedi pyflakes)
|
FOR_EDITOR=(jedi pyflakes)
|
||||||
USEFUL=(
|
USEFUL=(
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
function vimstall() {
|
function vimstall() {
|
||||||
# This sucks, but BundleInstall fails otherwise.
|
|
||||||
sudo chmod -R 775 $(readlink -f ~/.vim)
|
|
||||||
vim +BundleInstall! +q +q
|
vim +BundleInstall! +q +q
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
function osx_config() {
|
||||||
|
|
||||||
# Ask for the administrator password upfront
|
# Ask for the administrator password upfront
|
||||||
sudo -v
|
sudo -v
|
||||||
|
|
||||||
@ -325,3 +324,4 @@ defaults write org.m0k.transmission DeleteOriginalTorrent -bool true
|
|||||||
defaults write org.m0k.transmission WarningDonate -bool false
|
defaults write org.m0k.transmission WarningDonate -bool false
|
||||||
# Hide the legal disclaimer
|
# Hide the legal disclaimer
|
||||||
defaults write org.m0k.transmission WarningLegal -bool false
|
defaults write org.m0k.transmission WarningLegal -bool false
|
||||||
|
}
|
||||||
|
9
setup.sh
9
setup.sh
@ -4,6 +4,7 @@ source dotfiles/lib/shellrc/functions.sh
|
|||||||
source dotfiles/lib/shellrc/brew.sh
|
source dotfiles/lib/shellrc/brew.sh
|
||||||
source dotfiles/lib/shellrc/python.sh
|
source dotfiles/lib/shellrc/python.sh
|
||||||
source dotfiles/lib/shellrc/vim.sh
|
source dotfiles/lib/shellrc/vim.sh
|
||||||
|
source resources/osx.sh
|
||||||
DOTFILES_DIRECTORY="$(dotfiles_abspath)/dotfiles"
|
DOTFILES_DIRECTORY="$(dotfiles_abspath)/dotfiles"
|
||||||
|
|
||||||
|
|
||||||
@ -74,6 +75,7 @@ function setup() {
|
|||||||
fi
|
fi
|
||||||
while getopts "acosbpev" OPTCHAR;
|
while getopts "acosbpev" OPTCHAR;
|
||||||
do
|
do
|
||||||
|
local real_opt_ind=$OPTIND
|
||||||
case $OPTCHAR in
|
case $OPTCHAR in
|
||||||
a)
|
a)
|
||||||
source resources/apt-get.sh
|
source resources/apt-get.sh
|
||||||
@ -90,7 +92,7 @@ function setup() {
|
|||||||
;;
|
;;
|
||||||
o)
|
o)
|
||||||
sudo -v
|
sudo -v
|
||||||
source resources/osx.sh
|
osx_config
|
||||||
;;
|
;;
|
||||||
s)
|
s)
|
||||||
symlink_dotfiles_prompt
|
symlink_dotfiles_prompt
|
||||||
@ -104,10 +106,11 @@ function setup() {
|
|||||||
install_python_packages $REPLY
|
install_python_packages $REPLY
|
||||||
;;
|
;;
|
||||||
e)
|
e)
|
||||||
case uname in
|
case $(uname) in
|
||||||
Darwin)
|
Darwin)
|
||||||
get_command_line_tools
|
get_command_line_tools
|
||||||
get_brew && do_the_brew -au
|
get_brew && do_the_brew -au
|
||||||
|
osx_config
|
||||||
;;
|
;;
|
||||||
Linux)
|
Linux)
|
||||||
apt-get
|
apt-get
|
||||||
@ -115,7 +118,6 @@ function setup() {
|
|||||||
esac
|
esac
|
||||||
install_python_packages -a
|
install_python_packages -a
|
||||||
symlink_dotfiles
|
symlink_dotfiles
|
||||||
source resources/osx.sh
|
|
||||||
vimstall
|
vimstall
|
||||||
;;
|
;;
|
||||||
v)
|
v)
|
||||||
@ -126,6 +128,7 @@ function setup() {
|
|||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
OPTIND=$real_opt_ind
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user