diff --git a/.gitattributes b/.gitattributes index 486a2325..a647db34 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,3 @@ +*.sh -crlf + *.zip filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md index f30d716e..b26546c8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![Build Status](https://travis-ci.org/cyplo/dotfiles.svg?branch=master)](https://travis-ci.org/cyplo/dotfiles) +[![Build status](https://ci.appveyor.com/api/projects/status/s6i314lyti4o1ny1/branch/master?svg=true)](https://ci.appveyor.com/project/cyplo/dotfiles/branch/master) My common dotfiles for Linux, Mac and Cygwin diff --git a/common/configure_fresh_system b/common/configure_fresh_system index 39fd4f8d..c79dd2d1 100755 --- a/common/configure_fresh_system +++ b/common/configure_fresh_system @@ -1,9 +1,16 @@ #!/bin/bash +SUDO="" +if [[ -z $NOSUDO ]]; then + SUDO="sudo" +fi + +echo "using '$SUDO' as sudo" + set -e echo echo "configuring settings common among OSes" -sudo true +$SUDO true #zsh if [[ -z $DONT_CHANGE_SHELL ]]; then @@ -13,7 +20,11 @@ fi CURL="curl -sSf" -#submodules +if [[ -z $DIR ]]; then + echo "please set DIR" + exit 1 +fi + DIR=`realpath $DIR` echo "using $DIR as the top level directory" cd $DIR @@ -46,7 +57,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 @@ -62,36 +73,42 @@ mkdir -p ~/.fonts cp -rv "$DIR/fonts" ~/.fonts set +e fc-cache -rv -sudo fc-cache -rv +$SUDO fc-cache -rv set -e -#rust -echo "installing rust" -RUSTUP_TEMP="/tmp/blastoff.sh" -$CURL https://sh.rustup.rs > "$RUSTUP_TEMP" -chmod a+x "$RUSTUP_TEMP" -"$RUSTUP_TEMP" -y -rm -f "$RUSTUP_TEMP" -rustup update -rustup default stable -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib -cd "$DIR/../" -echo "getting rust sources..." -if [[ ! -d rust ]]; then - git clone https://github.com/rust-lang/rust.git --recursive -else - cd rust - git pull - git submodule update --init --recursive +if [[ -z $NORUST ]]; then + #rust + echo "installing rust" + RUSTUP_TEMP="/tmp/blastoff.sh" + $CURL https://sh.rustup.rs > "$RUSTUP_TEMP" + chmod a+x "$RUSTUP_TEMP" + "$RUSTUP_TEMP" -y + rm -f "$RUSTUP_TEMP" + rustup update + rustup default stable + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib + cd "$DIR/../" + echo "getting rust sources..." + if [[ ! -d rust ]]; then + git clone https://github.com/rust-lang/rust.git --recursive + else + cd rust + git pull + git submodule update --init --recursive + fi + cargo install -f rustfmt fi -cargo install -f rustfmt - -echo "\n" | vim +PluginInstall +qa - -cd "$DIR/.vim/bundle/YouCompleteMe/" -git submodule update --init --recursive -./install.py --racer-completer --clang-completer +if [[ -z $NOVIM ]]; then + echo "\n" | vim +PluginInstall +qa + cd "$DIR/.vim/bundle/YouCompleteMe/" + git submodule update --init --recursive + if [[ -z $NORUST ]]; then + ./install.py --racer-completer --clang-completer + else + ./install.py --clang-completer + fi +fi if [[ -z $NO_GO ]]; then export GOPATH="$HOME/go" @@ -102,12 +119,12 @@ if [[ -z $NO_GO ]]; then fi # 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` @@ -115,7 +132,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" diff --git a/windows_cygwin/build.bat b/windows_cygwin/build.bat old mode 100644 new mode 100755 index 94f1c10f..b199bca1 --- a/windows_cygwin/build.bat +++ b/windows_cygwin/build.bat @@ -1,5 +1,14 @@ -choco install -y firefox googlechrome wget -wget -c https://cygwin.com/setup-x86_64.exe -REM cygwin installation -setup-x86_64.exe -R "C:\cygwin64" -s http://cygwin.netbet.org/ -q -g -P curl,zsh,git,vim,wget,xz,tar,gawk,bzip2,subversion +@echo on +choco install -y firefox googlechrome wget notepadplusplus sublimetext3 +wget -c https://cygwin.com/setup-x86_64.exe +setup-x86_64.exe -R "C:\cygwin64" -s http://cygwin.netbet.org/ -q -g -P curl,zsh,git,vim,wget,xz,tar,gawk,bzip2,subversion,zlib,fontconfig,clang + +set script_path=%~dp0 +set repo_path=%script_path%\..\ +set bash=c:\cygwin64\bin\bash.exe --login -c + +for /f "delims=" %%A in ('%bash% "cd `cygpath $HOMEPATH`/dev/dotfiles && git rev-parse --abbrev-ref HEAD"') do set "branch=%%A" +%bash% 'echo "branch is $branch"' +%bash% "cp -vr `cygpath $HOMEPATH`/.ssh $HOME/" +%bash% "export OUTER_CLONE=`cygpath $repo_path` && $script_path/build_insider.sh" diff --git a/windows_cygwin/build_insider.sh b/windows_cygwin/build_insider.sh new file mode 100755 index 00000000..67e2ac84 --- /dev/null +++ b/windows_cygwin/build_insider.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +DOTFILES_PATH="$HOME/dev/dotfiles" +mkdir -pv $HOME/dev/ +rm -fr $DOTFILES_PATH + +git clone "$OUTER_CLONE" "$DOTFILES_PATH" +cd "$DOTFILES_PATH" +git remote set-url origin git@github.com:cyplo/dotfiles.git +git checkout $branch + +export NOSUDO=true +export DONT_CHANGE_SHELL=true +export NORUST=true +export NOVIM=true +export NO_GO=true +export DIR=$DOTFILES_PATH + +curl https://bootstrap.pypa.io/get-pip.py > /tmp/get-pip.py +python /tmp/get-pip.py + +$DIR/common/configure_fresh_system +