introduce NOSUDO in configure scripts

This commit is contained in:
Cyryl Płotnicki-Chudyk 2016-07-30 21:39:07 +02:00
parent e4ecedd64f
commit ca11a4a09c
2 changed files with 13 additions and 8 deletions

View file

@ -1,9 +1,14 @@
#!/bin/bash
SUDO=""
if [[ -z $NOSUDO ]]; then
SUDO=sudo
fi
set -e
echo
echo "configuring settings common among OSes"
sudo true
$SUDO true
#zsh
if [[ -z $DONT_CHANGE_SHELL ]]; then
@ -50,7 +55,7 @@ source ~/.setenv
# symlink 'nodejs' as node on some systems
# will replace symlink if it exists, but won't replace regular file
if [[ ! -f /usr/bin/node ]]; then
sudo ln -vfs /usr/bin/nodejs /usr/bin/node
$SUDO ln -vfs /usr/bin/nodejs /usr/bin/node
fi
# tools
@ -66,7 +71,7 @@ mkdir -p ~/.fonts
cp -rv "$DIR/fonts" ~/.fonts
set +e
fc-cache -rv
sudo fc-cache -rv
$SUDO fc-cache -rv
set -e
#rust
@ -105,12 +110,12 @@ mkdir -p "$GOPATH"
go get -u github.com/exercism/cli/exercism
# talks: reveal-md
sudo npm install -g reveal-md
sudo npm install -g diff-so-fancy
$SUDO npm install -g reveal-md
$SUDO npm install -g diff-so-fancy
# vdir syncer
echo "installing vdirsyncer"
sudo pip install vdirsyncer
$SUDO pip install vdirsyncer
if [[ -z $USER ]]; then
USER=`whoami`
@ -118,7 +123,7 @@ fi
# normalize npm permissions
mkdir -p $HOME/.npm
sudo chown $USER $HOME/.npm -R
$SUDO chown $USER $HOME/.npm -R
echo
echo "now go ahead and restart"

View file

@ -7,5 +7,5 @@ c:\cygwin64\bin\bash.exe --login -c "cp -vr `cygpath $HOMEPATH`/.ssh $HOME/"
c:\cygwin64\bin\bash.exe --login -c "mkdir -pv $HOME/dev/"
c:\cygwin64\bin\bash.exe --login -c "git clone git@github.com:cyplo/dotfiles.git dev/dotfiles"
c:\cygwin64\bin\bash.exe --login -c "export DIR=$HOME/dev/dotfiles && bash $DIR/common/configure_fresh_system"
c:\cygwin64\bin\bash.exe --login -c "export DIR=$HOME/dev/dotfiles && export NOSUDO=true && export DONT_CHANGE_SHELL=true && bash $DIR/common/configure_fresh_system"