Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Remove obsolete export during package name setup
#!/bin/bash set -e if [ "$(uname -s)" == "Darwin" ]; then PKG_SUFFIX="osx-$(sw_vers -productVersion)" elif [ "$(uname -s)" == "Linux" ]; then PKG_SUFFIX="ubuntu-"`uname -m` fi VERSION=${CIRCLE_SHA1:-unknown} if [[ -n $CIRCLE_TAG && $CIRCLE_TAG =~ ^v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then VERSION=${BASH_REMATCH[1]} fi export PACKAGE_TARBALL=${PACKAGES_DIR:?}/epoch-${VERSION}-${PKG_SUFFIX}.tar.gz echo "export PACKAGE_TARBALL=${PACKAGE_TARBALL}" >> $BASH_ENV
#!/bin/bash set -e if [ "$(uname -s)" == "Darwin" ]; then PKG_SUFFIX="osx-$(sw_vers -productVersion)" elif [ "$(uname -s)" == "Linux" ]; then PKG_SUFFIX="ubuntu-"`uname -m` fi VERSION=${CIRCLE_SHA1:-unknown} if [[ -n $CIRCLE_TAG && $CIRCLE_TAG =~ ^v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then VERSION=${BASH_REMATCH[1]} fi PACKAGE_TARBALL=${PACKAGES_DIR:?}/epoch-${VERSION}-${PKG_SUFFIX}.tar.gz echo "export PACKAGE_TARBALL=${PACKAGE_TARBALL}" >> $BASH_ENV
Change shim package script name to package_shim.sh
#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail set -x pushd cnb2cf go build -o build/cnb2cf ./cmd/cnb2cf/main.go popd # Cut off the rc part of the version, so that ultimate RC will have the correct version file version=$( cut -d '-' -f 1 version/version ) pushd repo mkdir .bin mv ../cnb2cf/build/cnb2cf .bin/cnb2cf ./scripts/package.sh -v "${version}" # TODO: Configure cnb2cf to output to desired dir mv "nodejs_buildpack-v${version}.zip" ../candidate/candidate.zip popd
#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail set -x pushd cnb2cf go build -o build/cnb2cf ./cmd/cnb2cf/main.go popd # Cut off the rc part of the version, so that ultimate RC will have the correct version file version=$( cut -d '-' -f 1 version/version ) pushd repo mkdir .bin mv ../cnb2cf/build/cnb2cf .bin/cnb2cf ./scripts/package_shim.sh -v "${version}" # TODO: Configure cnb2cf to output to desired dir mv "nodejs_buildpack-v${version}.zip" ../candidate/candidate.zip popd
Add new jobs for missing_newrelic_alerts
cd $WORKSPACE/configuration/util/jenkins/ pip install -r requirements-missingalerts.txt . util/jenkins/assume-role.sh # Assume the role assume-role ${ROLE_ARN} python missing_alerts_checker.py --new-relic-api-key ${NEW_RELIC_API_KEY}
#!/bin/bash cd $WORKSPACE/configuration/util/jenkins/ pip install -r check_celery_progress/requirements.txt . util/jenkins/assume-role.sh # Assume the role assume-role ${ROLE_ARN} python missing_alerts_checker.py --new-relic-api-key ${NEW_RELIC_API_KEY}
Stop running bin/ci on provision, add message
#!/bin/sh set -e cd /vagrant npm install gem install bundler rbenv rehash bundle install bin/ci
#!/bin/sh set -e cd /vagrant npm install gem install bundler rbenv rehash bundle install echo "" echo "" echo "Ready to go! Run the following to get started:" echo "" echo "$ vagrant ssh" echo "$ cd /vagrant" echo "$ grunt"
Index starts at 0 in bash too
#!/usr/bin/env bash set -euo pipefail readonly RAILS_VERSIONS=(41 42 50 51) readonly RUBY_VERSIONS=(2.3.8 2.3.8 2.5 2.5) readonly CURRENT_JOB_IDX=`expr ${BUILDKITE_PARALLEL_JOB} + 1` readonly RAILS_VERSION=${RAILS_VERSIONS[$CURRENT_JOB_IDX]} readonly RUBY_VERSION=${RUBY_VERSIONS[$CURRENT_JOB_IDX]} echo ":llama: Testing with :ruby: ${RUBY_VERSION} | :rails: ${RAILS_VERSION}" docker run -it --rm -v "$PWD":/usr/src -w /usr/src ruby:${RUBY_VERSION}-stretch sh -c "bundle check --path=vendor/bundle_${RAILS_VERSION} \ --gemfile Gemfile.rails${RAILS_VERSION} || bundle install --jobs=4 --retry=3 --gemfile Gemfile.rails${RAILS_VERSION} --path=vendor/bundle_${RAILS_VERSION} ; \ BUNDLE_GEMFILE=Gemfile.rails${RAILS_VERSION} bundle exec rake test:units"
#!/usr/bin/env bash set -euo pipefail readonly RAILS_VERSIONS=(41 42 50 51) readonly RUBY_VERSIONS=(2.3.8 2.3.8 2.5 2.5) readonly RAILS_VERSION=${RAILS_VERSIONS[$BUILDKITE_PARALLEL_JOB]} readonly RUBY_VERSION=${RUBY_VERSIONS[$BUILDKITE_PARALLEL_JOB]} echo -e "+++ :llama: Testing with :ruby: ${RUBY_VERSION} | :rails: ${RAILS_VERSION}" docker run -it --rm -v "$PWD":/usr/src -w /usr/src ruby:${RUBY_VERSION}-stretch sh -c "bundle check --path=vendor/bundle_${RAILS_VERSION} \ --gemfile Gemfile.rails${RAILS_VERSION} || bundle install --jobs=4 --retry=3 --gemfile Gemfile.rails${RAILS_VERSION} --path=vendor/bundle_${RAILS_VERSION} ; \ BUNDLE_GEMFILE=Gemfile.rails${RAILS_VERSION} bundle exec rake test:units"
Update scripts to latest version
#!/usr/bin/env sh test -e ~/.coursier/coursier || ( \ mkdir -p ~/.coursier && \ curl -Lso ~/.coursier/coursier https://git.io/vgvpD && \ chmod +x ~/.coursier/coursier \ ) ~/.coursier/coursier launch -q -P \ com.lihaoyi:ammonite_2.12.4:1.0.3 \ is.cir:ciris-core_2.12:0.5.0 \ is.cir:ciris-enumeratum_2.12:0.5.0 \ is.cir:ciris-generic_2.12:0.5.0 \ is.cir:ciris-refined_2.12:0.5.0 \ is.cir:ciris-spire_2.12:0.5.0 \ is.cir:ciris-squants_2.12:0.5.0 \ -- --predef-code "\ import ciris._,\ ciris.syntax._,\ ciris.enumeratum._,\ ciris.generic._,\ ciris.refined._,\ ciris.refined.syntax._,\ ciris.spire._,\ ciris.squants._\ " < /dev/tty
#!/usr/bin/env sh test -e ~/.coursier/coursier || ( \ mkdir -p ~/.coursier && \ curl -Lso ~/.coursier/coursier https://git.io/vgvpD && \ chmod +x ~/.coursier/coursier \ ) ~/.coursier/coursier launch -q -P \ com.lihaoyi:ammonite_2.12.4:1.0.3 \ is.cir:ciris-core_2.12:0.6.0 \ is.cir:ciris-enumeratum_2.12:0.6.0 \ is.cir:ciris-generic_2.12:0.6.0 \ is.cir:ciris-refined_2.12:0.6.0 \ is.cir:ciris-spire_2.12:0.6.0 \ is.cir:ciris-squants_2.12:0.6.0 \ -- --predef-code "\ import ciris._,\ ciris.syntax._,\ ciris.enumeratum._,\ ciris.generic._,\ ciris.refined._,\ ciris.refined.syntax._,\ ciris.spire._,\ ciris.squants._\ " < /dev/tty
Correct options passed to import
#!/usr/bin/env bash DBHOST='localhost' DBUSER='root' DBPASS='' DUMPLOC='/backups/mysql' GZIPPED=true MYISAM2INNODB=true cd $DUMPLOC databases=($(ls)) createmydb () { mysql -h$DBHOST -u$DBUSER -p$DBPASS -e "CREATE DATABASE IF NOT EXISTS $1" } 2innodb () { if $MYISAM2INNODB; then sed -i -r 's/MyISAM/InnoDB/g' "$1" fi } importdb () { if $GZIPPED; then gunzip < "$db" | mysql -h$DBHOST -u$DBUSER -p$DBPASS "$2" < "$3" else mysql -h$DBHOST -u$DBUSER -p$DBPASS "$2" < "$3" fi } for db in "${databases[@]}"; do filename="${db/.gz/}" dbname="${db/.sql/}" if [ "$dbname" == 'mysql' ]; then continue fi createmydb "$dbname" 2innodb "$filename" importdb "$db" "$dbname" "$filename" done
#!/usr/bin/env bash DBHOST='localhost' DBUSER='root' DBPASS='' DUMPLOC='/backups/mysql' GZIPPED=true MYISAM2INNODB=true cd $DUMPLOC databases=($(ls)) createmydb () { mysql -h$DBHOST -u$DBUSER -p$DBPASS -e "CREATE DATABASE IF NOT EXISTS $1" } 2innodb () { if $MYISAM2INNODB; then sed -i -r 's/MyISAM/InnoDB/g' "$1" fi } importdb () { if $GZIPPED; then gunzip < "$2" | mysql -h$DBHOST -u$DBUSER -p$DBPASS "$1" < "$2" else mysql -h$DBHOST -u$DBUSER -p$DBPASS "$1" < "$2" fi } for db in "${databases[@]}"; do filename="${db/.gz/}" dbname="${db/.sql/}" if [ "$dbname" == 'mysql' ]; then continue fi createmydb "$dbname" 2innodb "$filename" importdb "$dbname" "$filename" done
Make check schema check for relative URL markdowns
#!/usr/bin/env bash if ! git diff --exit-code HEAD -- ./build/vega-lite-schema.json then echo "vega-lite-schema.json is different from the committed one." exit 1 elif grep 'Generic.*Spec<' ./build/vega-lite-schema.json then echo "Generic*Spec in the schema have not been replaced." exit 1 elif grep 'UnitSpec<Encoding' ./build/vega-lite-schema.json then echo "UnitSpec<...> in the schema have not been replaced." exit 1 elif grep '<Field>' ./build/vega-lite-schema.json then echo "...<Field> in the schema have not been replaced." exit 1 else exit 0 fi
#!/usr/bin/env bash if ! git diff --exit-code HEAD -- ./build/vega-lite-schema.json then echo "vega-lite-schema.json is different from the committed one." exit 1 elif grep 'Generic.*Spec<' ./build/vega-lite-schema.json then echo "Generic*Spec in the schema have not been replaced." exit 1 elif grep 'UnitSpec<Encoding' ./build/vega-lite-schema.json then echo "UnitSpec<...> in the schema have not been replaced." exit 1 elif grep '<Field>' ./build/vega-lite-schema.json then echo "...<Field> in the schema have not been replaced." exit 1 elif grep -E "\]\([^/.]*\.html" ./build/vega-lite-schema.json then echo "Schema description contains relative URL." exit 1 else exit 0 fi
Add platform-specific ls color alias
alias h=history alias ll="ls -al" alias ...='cd ..' alias more='less' alias ls='ls -G' alias la='ls -al' alias lsd='ls -d */' # List only subdirectories alias sls='screen -ls' alias tls='tmux ls' ta() { tmux a -t "$@" ;} tn() { tmux new -s "$@" ;} sr() { screen -D -R "$@" ;} sd() { screen -d "$@" ;} # Git clone single gcs() { repo=$1 branch=$2 dest=$3 if [ "$#" -ne 3 ]; then echo "git clone a single branch" echo "Usage: gcs <repo> <branch> <destination>" return 1 fi git clone $1 --single-branch --branch $2 $3 }
PLATFORM=`uname` if [[ "$PLATFORM" == "Darwin" ]]; then alias ls='ls -Gh' elif [[ "$PLATFORM" == "Linux" ]]; then alias ls='ls --color=auto -h' fi alias h=history alias ll="ls -al" alias ...='cd ..' alias more='less' alias la='ls -al' alias lsd='ls -d */' # List only subdirectories alias sls='screen -ls' alias tls='tmux ls' ta() { tmux a -t "$@" ;} tn() { tmux new -s "$@" ;} sr() { screen -D -R "$@" ;} sd() { screen -d "$@" ;} # Git clone single gcs() { repo=$1 branch=$2 dest=$3 if [ "$#" -ne 3 ]; then echo "git clone a single branch" echo "Usage: gcs <repo> <branch> <destination>" return 1 fi git clone $1 --single-branch --branch $2 $3 }
Fix spelling error limux => linux
#!/usr/bin/env bash GOOS=linux GOARCH=amd64 go build -o bin/data-downloader-limux-amd64 main.go GOOS=windows GOARCH=amd64 go build -o bin/data-downloader-windows-amd64.exe main.go GOOS=darwin GOARCH=amd64 go build -o bin/data-downloader-darwin-amd64 main.go
#!/usr/bin/env bash GOOS=linux GOARCH=amd64 go build -o bin/data-downloader-linux-amd64 main.go GOOS=windows GOARCH=amd64 go build -o bin/data-downloader-windows-amd64.exe main.go GOOS=darwin GOARCH=amd64 go build -o bin/data-downloader-darwin-amd64 main.go
Build --pre wheels as well as released ones
#!/bin/bash set -e # psycopg2 won't build without this export PG_HOME=/usr/pgsql-9.5 export PATH=/usr/pgsql-9.5/bin:$PATH # Compile wheels for PYBIN in /opt/python/*/bin; do if [[ "$PYBIN" =~ cp26 ]]; then echo "Skipping 2.6 because it's horrible" elif [[ "$PYBIN" =~ cp33 ]]; then echo "Skipping 3.3 because we don't use it" elif [[ "$PYBIN" =~ cp34 ]]; then echo "Skipping 3.4 because we don't use it" else CFLAGS="-I/usr/local/ssl/include" LDFLAGS="-L/usr/local/ssl/lib" ${PYBIN}/pip wheel cryptography -w /io/wheelhouse/ -f /io/wheelhouse ${PYBIN}/pip wheel -r /io/dev-requirements.txt -w /io/wheelhouse/ -f /io/wheelhouse || true fi done # Bundle external shared libraries into the wheels for whl in /io/wheelhouse/*.whl; do if [[ "$whl" =~ none-any ]]; then echo "Skipping pure wheel $whl" elif [[ "$whl" =~ manylinux ]]; then echo "Skipping manylinux wheel $whl" else auditwheel repair $whl -w /io/wheelhouse/ || true fi done # Remove platform-specific wheels rm -f /io/wheelhouse/*-linux*.whl
#!/bin/bash set -e # psycopg2 won't build without this export PG_HOME=/usr/pgsql-9.5 export PATH=/usr/pgsql-9.5/bin:$PATH # Compile wheels for PYBIN in /opt/python/*/bin; do if [[ "$PYBIN" =~ cp26 ]]; then echo "Skipping 2.6 because it's horrible" elif [[ "$PYBIN" =~ cp33 ]]; then echo "Skipping 3.3 because we don't use it" elif [[ "$PYBIN" =~ cp34 ]]; then echo "Skipping 3.4 because we don't use it" else CFLAGS="-I/usr/local/ssl/include" LDFLAGS="-L/usr/local/ssl/lib" ${PYBIN}/pip wheel cryptography -w /io/wheelhouse/ -f /io/wheelhouse ${PYBIN}/pip wheel -r /io/dev-requirements.txt -w /io/wheelhouse/ -f /io/wheelhouse || true # Do another run allowing dev builds ${PYBIN}/pip wheel --pre -r /io/dev-requirements.txt -w /io/wheelhouse/ -f /io/wheelhouse || true fi done # Bundle external shared libraries into the wheels for whl in /io/wheelhouse/*.whl; do if [[ "$whl" =~ none-any ]]; then echo "Skipping pure wheel $whl" elif [[ "$whl" =~ manylinux ]]; then echo "Skipping manylinux wheel $whl" else auditwheel repair $whl -w /io/wheelhouse/ || true fi done # Remove platform-specific wheels rm -f /io/wheelhouse/*-linux*.whl
Remove the whole `build' forlder
#!/bin/sh # Cleans up the builds rm -rf build/debug rm -rf build/release rm -f src/components/compiler/lex.yy.c rm -f src/components/compiler/parser.tab.c rm -f src/components/vm/_generated_vm_opcodes.c rm -f src/components/objects/_generated_exceptions.inc rm -f src/components/objects/_generated_interfaces.inc rm -f include/saffire/compiler/lex.yy.h rm -f include/saffire/vm/_generated_vm_opcodes.h rm -f include/saffire/objects/_generated_exceptions.h rm -f include/saffire/objects/_generated_interfaces.h rm -f include/saffire/config.h rm -f include/saffire/gitversion.h rm -f include/saffire/compiler/parser.tab.h
#!/bin/sh # Cleans up the builds rm -rf build rm -f src/components/compiler/lex.yy.c rm -f src/components/compiler/parser.tab.c rm -f src/components/vm/_generated_vm_opcodes.c rm -f src/components/objects/_generated_exceptions.inc rm -f src/components/objects/_generated_interfaces.inc rm -f include/saffire/compiler/lex.yy.h rm -f include/saffire/vm/_generated_vm_opcodes.h rm -f include/saffire/objects/_generated_exceptions.h rm -f include/saffire/objects/_generated_interfaces.h rm -f include/saffire/config.h rm -f include/saffire/gitversion.h rm -f include/saffire/compiler/parser.tab.h
Add a note about building ace
#!/bin/bash # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. echo "Compiling and copying Ace Editor for Hue" rm -rf ../../desktop/core/src/desktop/static/desktop/js/ace/* || echo "Skipping removal of folder" node ./Makefile.dryice.js minimal --nc --s --target ../../desktop/core/src/desktop/static/desktop/js/ace/ mv ../../desktop/core/src/desktop/static/desktop/js/ace/src-noconflict/* ../../desktop/core/src/desktop/static/desktop/js/ace/ rmdir ../../desktop/core/src/desktop/static/desktop/js/ace/src-noconflict echo "Done!"
#!/bin/bash # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # First install Ace # # npm install # node ./Makefile.dryice.js # # https://github.com/ajaxorg/ace#building-ace echo "Compiling and copying Ace Editor for Hue" rm -rf ../../desktop/core/src/desktop/static/desktop/js/ace/* || echo "Skipping removal of folder" node ./Makefile.dryice.js minimal --nc --s --target ../../desktop/core/src/desktop/static/desktop/js/ace/ mv ../../desktop/core/src/desktop/static/desktop/js/ace/src-noconflict/* ../../desktop/core/src/desktop/static/desktop/js/ace/ rmdir ../../desktop/core/src/desktop/static/desktop/js/ace/src-noconflict echo "Done!"
Use npp and vsr weighting when computing summary data
#!/bin/bash set -e num_jobs=10 year0=2015 year1=2101 for_real=/bin/true for dname in /data/luh2_v2/LUH2_v2f_SSP[0-9]_*; do dd=$(basename $dname) full=${dd,,} scenario=${full#luh2_v2f_} for what in sr cs-sr ab cs-ab bii-ab bii-sr; do printf "%s %s %d:%d\n" "${what}" "${scenario}" "${year0}" "${year1}" done done | xargs -P 10 -n 1 -l1 ./ipbes-summarize.py summary
#!/bin/bash set -e num_jobs=10 year0=2015 year1=2101 for_real=/bin/true for dname in /data/luh2_v2/LUH2_v2f_SSP[0-9]_*; do dd=$(basename $dname) full=${dd,,} scenario=${full#luh2_v2f_} for what in sr cs-sr ab cs-ab bii-ab bii-sr; do if [[ ("$what" = "sr") || ("$what" = "cs-sr") || ( "$what" = "bii-sr") ]]; then printf "%s /out/luh2/vertebrate-richness.tif %s %s %d:%d\n" "--vsr" "${what}" "${scenario}" "${year0}" "${year1}" else printf "%s /out/luh2/npp.tif %s %s %d:%d\n" "--npp" "${what}" "${scenario}" "${year0}" "${year1}" fi done done | xargs -P 10 -n 1 -l1 ./ipbes-summarize.py summary
Replace notation with zsh scientific notation
# Tweaks from Github export RUBY_HEAP_MIN_SLOTS=1000000 export RUBY_HEAP_SLOTS_INCREMENT=1000000 export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 export RUBY_GC_MALLOC_LIMIT=100000000 export RUBY_HEAP_FREE_MIN=500000
# Tweaks from Github export RUBY_HEAP_MIN_SLOTS=$((1e6)) export RUBY_HEAP_SLOTS_INCREMENT=$((1e6)) export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 export RUBY_GC_MALLOC_LIMIT=$((1e8)) export RUBY_HEAP_FREE_MIN=$((5e5))
Increase default number of open files
export SP_HOME=~/Trabajo/SponsorPay/workspace export TI_HOME=~/Trabajo/TurboInternet/workspace export KAFKA_HOME=~/Applications/kafka
export SP_HOME=~/Trabajo/SponsorPay/workspace export TI_HOME=~/Trabajo/TurboInternet/workspace export KAFKA_HOME=~/Applications/kafka ulimit -n 1024
Add test for a broken stream via dbus
#!/bin/bash RADIO="http://playerservices.streamtheworld.com/pls/CBC_R1_EDM_H.pls" if [[ -z "$(pgrep vlc)" ]] ; then nohup cvlc $RADIO &>/dev/null & #cvlc $RADIO fi
#!/bin/bash RADIO="http://playerservices.streamtheworld.com/pls/CBC_R1_EDM_H.pls" if [[ -z "$(pgrep vlc)" ]] then nohup cvlc $RADIO --control dbus &>/dev/null & else p=$(pgrep vlc) DBUS_SESSION_BUS_ADDRESS=$(xargs -n 1 -0 < /proc/$p/environ | sed -n 's/^DBUS_SESSION_BUS_ADDRESS=\(.*\)/\1/p') p1=$(qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Position) sleep 30 p2=$(qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Position) if [[ $p1 -eq $p2 ]] then pkill vlc nohup cvlc $RADIO --control dbus &>/dev/null & fi fi
Add paths to old plugin directories.
# # Directory Navigation Functions # # # Varying Vagrant Vagrants # # VVV (www folder) vag() { cd $VAGRANT/www } # WordPress Default vvvd() { vag cd wordpress-default } # WordPress Trunk vvvt() { vag cd wordpress-trunk } # WordPress Dev vvvv() { vag cd wordpress-develop } # Plugins plugs() { vvvt cd wp-content/plugins } # Themes themes() { vvvt cd wp-content/themes }
# # Directory Navigation Functions # # # Varying Vagrant Vagrants # # VVV (www folder) vag() { cd $VAGRANT/www } # WordPress Default vvvd() { vag cd wordpress-default } # WordPress Trunk vvvt() { vag cd wordpress-trunk } # WordPress Dev vvvv() { vag cd wordpress-develop } # Themes themes() { vvvt cd wp-content/themes } # Plugins plugs() { vvvt cd wp-content/plugins } # # Old Structure # testPlugs() { cd $SITES/WP\ Plugins\ -\ Test/wp-content/plugins } finPlugs() { cd $SITES/WP\ Plugins\ -\ Final }
Remove rsync inplace which can trip up php apc
#!/bin/bash THIS=`basename $0` if [ $# -lt 2 ] then echo "Error: Usage $THIS <arg1> <arg2> <arg...> <source> <target>" exit 1 fi rsync --whole-file --executability --exclude="*.git" --exclude="etc/app/config.php" --exclude="*.swp" --exclude=".DS_Store" --exclude=".vagrant" --delete --verbose --inplace --cvs-exclude --checksum --recursive --human-readable $@
#!/bin/bash THIS=`basename $0` if [ $# -lt 2 ] then echo "Error: Usage $THIS <arg1> <arg2> <arg...> <source> <target>" exit 1 fi rsync --whole-file --executability --exclude="*.git" --exclude="etc/app/config.php" --exclude="*.swp" --exclude=".DS_Store" --exclude=".vagrant" --delete --verbose --cvs-exclude --checksum --recursive --human-readable $@
Add scripts for when publishing @openzeppelin/contracts directly
#!/usr/bin/env bash # cd to the root of the repo cd "$(git rev-parse --show-toplevel)" # avoids re-compilation during publishing of both packages if [[ ! -v ALREADY_COMPILED ]]; then npm run prepare fi cp README.md contracts/ mkdir contracts/build contracts/build/contracts cp -r build/contracts/*.json contracts/build/contracts
#!/usr/bin/env bash # cd to the root of the repo cd "$(git rev-parse --show-toplevel)" # avoids re-compilation during publishing of both packages if [[ ! -v ALREADY_COMPILED ]]; then npm run prepublish npm run prepare npm run prepack fi cp README.md contracts/ mkdir contracts/build contracts/build/contracts cp -r build/contracts/*.json contracts/build/contracts
Remove gradle build from rpm build script
#!/bin/sh gradle build cd packages/xroad-catalog-lister/redhat rpmbuild --define "_topdir `pwd`" -ba SPECS/xroad-catalog-lister.spec
#!/bin/sh cd packages/xroad-catalog-lister/redhat rpmbuild --define "_topdir `pwd`" -ba SPECS/xroad-catalog-lister.spec
Stop printing warnings about ADB version
# Copyright 2015 Google Inc. # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. UTIL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" if [ $PYADB ] && [ -a "$PYADB" ]; then echo "Python ADB detected, going to use that" ADB="python ${PYADB}" return fi if [ "$(which adb)" != "" ]; then ADB="$(which adb)" elif [ -d "$ANDROID_SDK_ROOT" ]; then ADB="${ANDROID_SDK_ROOT}/platform-tools/adb" else echo $ANDROID_SDK_ROOT echo "No ANDROID_SDK_ROOT set (check that android_setup.sh was properly sourced)" exit 1 fi if [ ! -x $ADB ]; then echo "The adb binary is not executable" exit 1 fi if [ $(uname) == "Linux" ]; then ADB_REQUIRED="1.0.32 or 1.0.35" elif [ $(uname) == "Darwin" ]; then ADB_REQUIRED="1.0.31 or 1.0.32" fi # get the version string as an array, use just the version numbers ADB_VERSION="$($ADB version)" ADB_VERSION=($ADB_VERSION) ADB_VERSION=${ADB_VERSION[4]} if [[ "$ADB_REQUIRED" != *"$ADB_VERSION"* ]]; then echo "WARNING: Your ADB version is out of date!" echo " Expected ADB Version: ${ADB_REQUIRED}" echo " Actual ADB Version: ${ADB_VERSION}" fi
# Copyright 2015 Google Inc. # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. UTIL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" if [ $PYADB ] && [ -a "$PYADB" ]; then echo "Python ADB detected, going to use that" ADB="python ${PYADB}" return fi if [ "$(which adb)" != "" ]; then ADB="$(which adb)" elif [ -d "$ANDROID_SDK_ROOT" ]; then ADB="${ANDROID_SDK_ROOT}/platform-tools/adb" else echo $ANDROID_SDK_ROOT echo "No ANDROID_SDK_ROOT set (check that android_setup.sh was properly sourced)" exit 1 fi if [ ! -x $ADB ]; then echo "The adb binary is not executable" exit 1 fi
Move environment as first parameter to allow passing arguments
#! /bin/bash DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ); FILE="$DIR/config/$2".env START=$DIR"/"$1 USAGE="Usage: ./start.sh <startscript> <config>" if [ ! -r $FILE ] ; then echo "config file not found" echo $USAGE exit 1 fi if [ ! -r $START ] ; then echo "start script not found" echo $USAGE exit 1 fi source $FILE exec node $START
#! /bin/bash DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ); FILE="$DIR/config/$1".env && shift START="$DIR/$1" && shift USAGE="Usage: ./start.sh <config> <startscript> [startscript_opts]..." if [ ! -r $FILE ] ; then echo "config file not found" echo $USAGE exit 1 fi if [ ! -r $START ] ; then echo "start script not found" echo $USAGE exit 1 fi source $FILE exec node $START $@
Make "-" an alias for "cd -" (cd back to previous directory)
alias pu='pushd' alias po='popd' alias sc='ruby script/console' alias sd='ruby script/server --debugger' alias ss='thin --stats "/thin/stats" start' alias mr='mate CHANGELOG app config db lib public script spec test' alias .='pwd' alias ...='cd ../..' alias _='sudo' alias ss='sudo su -' #alias g='grep -in' alias g='git' alias gst='git status' alias gl='git pull' alias gp='git push' alias gd='git diff | mate' alias gc='git commit -v' alias gca='git commit -v -a' alias gb='git branch' alias gba='git branch -a' alias history='fc -l 1' alias ls='ls -F' alias ll='ls -alr' alias l='ls' alias ll='ls -l' alias sl=ls # often screw this up alias sgem='sudo gem' alias rfind='find . -name *.rb | xargs grep -n' alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' alias et='mate . &' alias ett='mate app config lib db public spec test Rakefile Capfile Todo &' alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
alias pu='pushd' alias po='popd' alias sc='ruby script/console' alias sd='ruby script/server --debugger' alias ss='thin --stats "/thin/stats" start' alias mr='mate CHANGELOG app config db lib public script spec test' alias .='pwd' alias ...='cd ../..' alias -- -='cd -' alias _='sudo' alias ss='sudo su -' #alias g='grep -in' alias g='git' alias gst='git status' alias gl='git pull' alias gp='git push' alias gd='git diff | mate' alias gc='git commit -v' alias gca='git commit -v -a' alias gb='git branch' alias gba='git branch -a' alias history='fc -l 1' alias ls='ls -F' alias ll='ls -alr' alias l='ls' alias ll='ls -l' alias sl=ls # often screw this up alias sgem='sudo gem' alias rfind='find . -name *.rb | xargs grep -n' alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' alias et='mate . &' alias ett='mate app config lib db public spec test Rakefile Capfile Todo &' alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
Test *.aag too, by using *.aig as reference
#!/bin/bash set -e for aig in *.aig; do ../../yosys-abc -c "read -c $aig; write ${aig%.*}_ref.v" ../../yosys -p " read_verilog ${aig%.*}_ref.v prep design -stash gold read_aiger -clk_name clock $aig prep design -stash gate design -import gold -as gold design -import gate -as gate miter -equiv -flatten -make_assert -make_outputs gold gate miter sat -verify -prove-asserts -show-ports -seq 16 miter " done
#!/bin/bash set -e for aag in *.aag; do # Since ABC cannot read *.aag, read the *.aig instead # (which would have been created by the reference aig2aig utility) ../../yosys-abc -c "read -c ${aag%.*}.aig; write ${aag%.*}_ref.v" ../../yosys -p " read_verilog ${aag%.*}_ref.v prep design -stash gold read_aiger -clk_name clock $aag prep design -stash gate design -import gold -as gold design -import gate -as gate miter -equiv -flatten -make_assert -make_outputs gold gate miter sat -verify -prove-asserts -show-ports -seq 16 miter " done for aig in *.aig; do ../../yosys-abc -c "read -c $aig; write ${aig%.*}_ref.v" ../../yosys -p " read_verilog ${aig%.*}_ref.v prep design -stash gold read_aiger -clk_name clock $aig prep design -stash gate design -import gold -as gold design -import gate -as gate miter -equiv -flatten -make_assert -make_outputs gold gate miter sat -verify -prove-asserts -show-ports -seq 16 miter " done
Add Python lib/ to LDFLAGS in configure for MacOS build
#!/bin/sh gprefix=`which glibtoolize 2>&1 >/dev/null` if [ $? -eq 0 ]; then glibtoolize --force else libtoolize --force fi aclocal -I m4 autoheader automake --add-missing autoconf if [ -z "$NOCONFIGURE" ]; then ./configure "$@" fi
#!/bin/sh gprefix=`which glibtoolize 2>&1 >/dev/null` if [ $? -eq 0 ]; then glibtoolize --force else libtoolize --force fi aclocal -I m4 autoheader automake --add-missing autoconf if [ -z "$NOCONFIGURE" ]; then ./configure LDFLAGS="-L$(python-config --prefix)/lib/" "$@" fi
Add percona-toolkit to travis build
#!/bin/bash -e if [[ $DB == 'mysql' ]] then if [[ $DB_VERSION == '5.5' ]] then sudo service mysql start || true # Travis default installed version else sudo apt-get -y remove mysql-server sudo apt-get -y autoremove sudo apt-get -y install software-properties-common sudo add-apt-repository -y ppa:ondrej/mysql-5.6 sudo apt-get update yes Y | sudo apt-get -y install mysql-server fi elif [[ $DB == 'mariadb' ]] then sudo service mysql stop sudo apt-get install -y python-software-properties sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db sudo add-apt-repository "deb http://ftp.osuosl.org/pub/mariadb/repo/$DB_VERSION/ubuntu precise main" sudo apt-get update -qq yes Y | sudo apt-get install -y mariadb-server fi mysql -e 'create database if not exists test;'
#!/bin/bash -e # Add percona sudo apt-get install -y percona-toolkit # Add database if [[ $DB == 'mysql' ]] then if [[ $DB_VERSION == '5.5' ]] then sudo service mysql start || true # Travis default installed version else sudo apt-get -y remove mysql-server sudo apt-get -y autoremove sudo apt-get -y install software-properties-common sudo add-apt-repository -y ppa:ondrej/mysql-5.6 sudo apt-get update yes Y | sudo apt-get -y install mysql-server fi elif [[ $DB == 'mariadb' ]] then sudo service mysql stop sudo apt-get install -y python-software-properties sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db sudo add-apt-repository "deb http://ftp.osuosl.org/pub/mariadb/repo/$DB_VERSION/ubuntu precise main" sudo apt-get update -qq yes Y | sudo apt-get install -y mariadb-server fi mysql -e 'create database if not exists test;'
Add files to be merged to gh-pages.
#!/bin/bash set -e # Exit with nonzero exit code if anything fails # If we're on master, build for gh-pages & push to that branch if [ $TRAVIS_PULL_REQUEST = "false" -a $TRAVIS_BRANCH = $SOURCE_BRANCH ]; then mv dist/* . rmdir dist git add . --all git commit -m "Build for gh-pages: ${SHA}" git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH git merge -s recursive -X theirs TEMP_BRANCH -m "Merge into gh-pages: ${SHA}" || true git status --porcelain | awk '{if ($1=="DU") print $2}' | xargs git rm git commit -m "Merge into gh-pages: ${SHA}" ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key" ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv" ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR} ENCRYPTED_IV=${!ENCRYPTED_IV_VAR} openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in deploy_key.enc -out deploy_key -d chmod 600 deploy_key eval `ssh-agent -s` ssh-add deploy_key git push $SSH_REPO $TARGET_BRANCH git branch -D TEMP_BRANCH fi
#!/bin/bash set -e # Exit with nonzero exit code if anything fails # If we're on master, build for gh-pages & push to that branch if [ $TRAVIS_PULL_REQUEST = "false" -a $TRAVIS_BRANCH = $SOURCE_BRANCH ]; then mv dist/* . rmdir dist git add . --all git commit -m "Build for gh-pages: ${SHA}" git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH git merge -s recursive -X theirs TEMP_BRANCH -m "Merge into gh-pages: ${SHA}" || true git status --porcelain | awk '{if ($1=="DU") print $2}' | xargs git rm git add . git commit -m "Merge into gh-pages: ${SHA}" ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key" ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv" ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR} ENCRYPTED_IV=${!ENCRYPTED_IV_VAR} openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in deploy_key.enc -out deploy_key -d chmod 600 deploy_key eval `ssh-agent -s` ssh-add deploy_key git push $SSH_REPO $TARGET_BRANCH git branch -D TEMP_BRANCH fi
Check ip address format received from ifconfig.com, code cleanup
#!/bin/sh GLOBAL_IP_FILE=$1 while [ 1 ]; do IP1=$(cat $GLOBAL_IP_FILE) # while [ -z "$IP1" ]; do # IP1="$(curl -s ifconfig.co)"; # sleep 10; # done; # echo "IP1 = $IP1" # sleep 60; IP2=""; while [ -z "$IP2" ]; do IP2="$(curl -s ifconfig.co)"; sleep 10; done; # echo "IP2 = $IP2" # if [ -n "$IP1" ] && [ -n "$IP2" ]; then if [ "$IP1" != "$IP2" ]; then echo -e "Subject: IP alert: \n\n raspberry new ip: $IP2 " | ssmtp youraddress@gmail.com; fi # fi echo "$IP2" >$GLOBAL_IP_FILE exit 0 #if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then done #EOF
#!/bin/sh GLOBAL_IP_FILE=$1 while [ 1 ]; do IP1=$(cat $GLOBAL_IP_FILE) IP2=""; while [ 1 ]; do IP2="$(curl -s ifconfig.co)"; if [[ $IP2 =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then break; else sleep 10; fi done; if [ "$IP1" != "$IP2" ]; then echo -e "Subject: IP alert: \n\n raspberry new ip: $IP2 " | ssmtp youraddress@gmail.com; fi echo "$IP2" >$GLOBAL_IP_FILE exit 0 # Remove this line if you want script to run forever done #EOF
Fix script to create and publish release
#!/usr/bin/env bash # Remove the "v" prefix from deb-package name VERSION=$(echo ${CI_BRANCH} | tr -d 'v') PKG_NAME="kandalf_${VERSION}_amd64.deb" # Install FPM gem install fpm # Download the tool "github-release" go get github.com/aktau/github-release # Change the app version sed -i -e "s/%app.version%/${VERSION}/g" src/main.go # Build the binary make bootstrap make deb # Upload package to release assets github-release upload \ --user hellofresh \ --repo kandalf \ --tag ${CI_BRANCH} \ --name ${PKG_NAME} \ --file build/out/${PKG_NAME}
#!/usr/bin/env bash # Remove the "v" prefix from deb-package name VERSION=$(echo ${CI_BRANCH} | tr -d 'v') PKG_NAME="kandalf_${VERSION}_amd64.deb" # Install FPM gem install fpm # Download the tool "github-release" go get github.com/aktau/github-release # Change the app version sed -i -e "s/%app.version%/${VERSION}/g" main.go # Build the binary make bootstrap make deb # Upload package to release assets github-release upload \ --user hellofresh \ --repo kandalf \ --tag ${CI_BRANCH} \ --name ${PKG_NAME} \ --file build/out/${PKG_NAME}
Upgrade Java 8 version in CI image
#!/bin/bash set -e case "$1" in java8) echo "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u292b10.tar.gz" ;; java11) echo "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.11%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.11_9.tar.gz" ;; java16) echo "https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16.0.1%2B9/OpenJDK16U-jdk_x64_linux_hotspot_16.0.1_9.tar.gz" ;; *) echo $"Unknown java version" exit 1 esac
#!/bin/bash set -e case "$1" in java8) echo "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz" ;; java11) echo "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.11%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.11_9.tar.gz" ;; java16) echo "https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16.0.1%2B9/OpenJDK16U-jdk_x64_linux_hotspot_16.0.1_9.tar.gz" ;; *) echo $"Unknown java version" exit 1 esac
Update the params for safepbnf to be reasonable for life boards.
#!/bin/bash for min in 5 10 30 60 80 do for nblocks in 3 5 10 15 20 do for (( threads=1; threads <= 10; threads++ )) do ./scripts/run_grids.sh safepbnf \ -m $min \ -t $threads \ -n $nblocks \ $@ done done done
#!/bin/bash for min in 5 10 30 60 80 #for min in 10 30 60 80 do # for nblocks in 3 5 10 15 20 for nblocks in 10 15 20 do for (( threads=1; threads <= 10; threads++ )) do ./scripts/run_grids.sh safepbnf \ -m $min \ -t $threads \ -n $nblocks \ $@ done done done
Add support for different disk bus
#!/bin/sh . /etc/sysconfig/heat-params DOCKER_DEV=/dev/disk/by-id/virtio-${DOCKER_VOLUME:0:20} attempts=60 while [[ ! -b $DOCKER_DEV && $attempts != 0 ]]; do echo "waiting for disk $DOCKER_DEV" sleep 0.5 udevadm trigger let attempts-- done if ! [ -b $DOCKER_DEV ]; then echo "ERROR: device $DOCKER_DEV does not exist" >&2 exit 1 fi pvcreate $DOCKER_DEV vgcreate docker $DOCKER_DEV cat > /etc/sysconfig/docker-storage-setup <<EOF VG=docker EOF
#!/bin/sh . /etc/sysconfig/heat-params attempts=60 while [ ${attempts} -gt 0 ]; do device_name=$(ls /dev/disk/by-id | grep ${DOCKER_VOLUME:0:20}$) if [ -n "${device_name}" ]; then break fi echo "waiting for disk device" sleep 0.5 udevadm trigger let attempts-- done if [ -z "${device_name}" ]; then echo "ERROR: disk device does not exist" >&2 exit 1 fi device_path=/dev/disk/by-id/${device_name} pvcreate ${device_path} vgcreate docker ${device_path} cat > /etc/sysconfig/docker-storage-setup << EOF VG=docker EOF
Change the path suitable raspbian
#!/bin/bash GPIO=`ls /var/www/html/shome/gpio/` while true; do sleep 1 for TMP4324 in $GPIO do echo ${GPIO} > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio${GPIO}/direction head -1 /var/www/html/shome/gpio/${GPIO} > /sys/class/gpio/gpio${GPIO}/value done done
#!/bin/bash GPIO=`ls /var/www/gpio/` while true; do sleep 1 for TMP4324 in $GPIO do echo ${GPIO} > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio${GPIO}/direction head -1 /var/www/html/shome/gpio/${GPIO} > /sys/class/gpio/gpio${GPIO}/value done done
Increase wait for end2end server
TEST="$1" if [ "$TEST" = "unit" ]; then echo Run unit and integration tests npm run test:unit UNIT=$? npm run test:integration:headless INT=$? exit $(($UNIT + $INT)) fi echo Run end2end tests: "$TEST" echo Start end2end server npm run test:end2end:server& echo Wait for server # give the server time to start sleep 30 echo 30 sleep 30 echo 60 sleep 30 echo 90 sleep 30 echo 120 echo Start end2end test runner chimp --ddp=http://localhost:3100 --mocha --path=tests/end2end --browser=phantomjs -- $TEST
TEST="$1" if [ "$TEST" = "unit" ]; then echo Run unit and integration tests npm run test:unit UNIT=$? npm run test:integration:headless INT=$? exit $(($UNIT + $INT)) fi echo Run end2end tests: "$TEST" echo Start end2end server npm run test:end2end:server& echo Wait for server # give the server time to start sleep 180 echo 180 sleep 60 echo 240 sleep 60 echo 300 sleep 60 echo 360 echo Start end2end test runner chimp --ddp=http://localhost:3100 --mocha --path=tests/end2end --browser=phantomjs -- $TEST
Clear EXIT trap after end (just in case)
#!/bin/bash exec 6>&1 exec 7>&2 source /srv/provision/provision-helpers.sh function provisioner_begin() { VVV_PROVISIONER_RUNNING="${1:-${FUNCNAME[1]}}" log_to_file "provisioner-${VVV_PROVISIONER_RUNNING}" touch "/vagrant/failed_provisioners/provisioner-${VVV_PROVISIONER_RUNNING}" echo -e "------------------------------------------------------------------------------------" vvv_success " ▷ Running the '${VVV_PROVISIONER_RUNNING}' provisioner..." echo -e "------------------------------------------------------------------------------------" start_seconds="$(date +%s)" trap "provisioner_end" EXIT } function provisioner_end() { PROVISION_SUCCESS="$?" end_seconds="$(date +%s)" local elapsed="$(( end_seconds - start_seconds ))" if [[ $PROVISION_SUCCESS -eq "0" ]]; then echo -e "------------------------------------------------------------------------------------" vvv_success " ✔ The '${VVV_PROVISIONER_RUNNING}' provisioner completed in ${elapsed} seconds." echo -e "------------------------------------------------------------------------------------" rm -f "/vagrant/failed_provisioners/provisioner-${VVV_PROVISIONER_RUNNING}" else echo -e "------------------------------------------------------------------------------------" vvv_error " ! The '${VVV_PROVISIONER_RUNNING}' provisioner ran into problems, check the full log for more details! It completed in ${elapsed} seconds." echo -e "------------------------------------------------------------------------------------" fi echo "" } if [[ ! -z $VVV_LOG ]]; then provisioner_begin "${VVV_LOG}" fi
#!/bin/bash exec 6>&1 exec 7>&2 source /srv/provision/provision-helpers.sh function provisioner_begin() { VVV_PROVISIONER_RUNNING="${1:-${FUNCNAME[1]}}" log_to_file "provisioner-${VVV_PROVISIONER_RUNNING}" touch "/vagrant/failed_provisioners/provisioner-${VVV_PROVISIONER_RUNNING}" echo -e "------------------------------------------------------------------------------------" vvv_success " ▷ Running the '${VVV_PROVISIONER_RUNNING}' provisioner..." echo -e "------------------------------------------------------------------------------------" start_seconds="$(date +%s)" trap "provisioner_end" EXIT } function provisioner_end() { PROVISION_SUCCESS="$?" end_seconds="$(date +%s)" local elapsed="$(( end_seconds - start_seconds ))" if [[ $PROVISION_SUCCESS -eq "0" ]]; then echo -e "------------------------------------------------------------------------------------" vvv_success " ✔ The '${VVV_PROVISIONER_RUNNING}' provisioner completed in ${elapsed} seconds." echo -e "------------------------------------------------------------------------------------" rm -f "/vagrant/failed_provisioners/provisioner-${VVV_PROVISIONER_RUNNING}" else echo -e "------------------------------------------------------------------------------------" vvv_error " ! The '${VVV_PROVISIONER_RUNNING}' provisioner ran into problems, check the full log for more details! It completed in ${elapsed} seconds." echo -e "------------------------------------------------------------------------------------" fi echo "" trap - EXIT } if [[ ! -z $VVV_LOG ]]; then provisioner_begin "${VVV_LOG}" fi
Update scaffolding-go17 dependency to go17
pkg_name=scaffolding-go17 pkg_description="Scaffolding for Go 1.7 Applications" pkg_origin=core pkg_maintainer="The Habitat Maintainers <humans@habitat.sh>" pkg_version="0.1.0" pkg_license=('Apache-2.0') pkg_source=nosuchfile.tar.gz pkg_upstream_url="https://github.com/habitat-sh/core-plans" pkg_deps=( ${pkg_deps[@]} core/go core/git core/gcc core/make ) do_install() { install -D -m 0644 "$PLAN_CONTEXT/lib/scaffolding.sh" "$pkg_prefix/lib/scaffolding.sh" } # Turn the remaining default phases into no-ops do_prepare() { return 0 } do_download() { return 0 } do_build() { return 0 } do_verify() { return 0 } do_unpack() { return 0 }
pkg_name=scaffolding-go17 pkg_description="Scaffolding for Go 1.7 Applications" pkg_origin=core pkg_maintainer="The Habitat Maintainers <humans@habitat.sh>" pkg_version="0.1.0" pkg_license=('Apache-2.0') pkg_source=nosuchfile.tar.gz pkg_upstream_url="https://github.com/habitat-sh/core-plans" pkg_deps=( ${pkg_deps[@]} core/go17 core/git core/gcc core/make ) do_install() { install -D -m 0644 "$PLAN_CONTEXT/lib/scaffolding.sh" "$pkg_prefix/lib/scaffolding.sh" } # Turn the remaining default phases into no-ops do_prepare() { return 0 } do_download() { return 0 } do_build() { return 0 } do_verify() { return 0 } do_unpack() { return 0 }
Fix typos and use meaningful variable names in install_udpates.sh
#!/bin/bash set -e -u #Date of the schema file that was used to build the initial db schema_date="2013-04-06" if [ "$#" -lt 5 ] ; then exit 1 fi function get_update_files { ls -1 "$1" } files=(`get_update_files "$4"`) status_file="$5""/.last_db_update" if [[ -f $status_file ]] ; then last_update=(`cat $status_file`) if [[ "$last_update" > "$schema_date" ]] ; then schema_date="$last_update" fi fi for file in "${files[@]}" do if [[ "$file" > "$schema_date" ]] ; then echo 'Imported '$file'' mysql -u "$1" -p"$2" "$3" < "$4"/"$file" else echo 'Skipped '$file'' fi done echo `ls -1 "$4" | tail -1` > $status_file #Update the .last_update file
#!/bin/bash set -e -u #Date of the schema file that was used to build the initial db schema_date="2013-04-06" if [ "$#" -lt 5 ] ; then exit 1 fi function get_update_files { ls -1 "$1" } mysql_user="$1" mysql_password="$2" mysql_db="$3" update_dir="$4" status_file="$5""/.last_db_update" files=(`get_update_files "$update_dir"`) if [[ -f $status_file ]] ; then last_update=`cat "$status_file" ` if [[ "$last_update" > "$schema_date" ]] ; then schema_date="$last_update" fi fi for file in "${files[@]}" do if [[ "$file" > "$schema_date" ]] ; then echo 'Imported '$file'' mysql -u "$mysql_user" -p"$mysql_password" "$mysql_db" < "$update_dir"/"$file" else echo 'Skipped '$file'' fi done echo `ls -1 "$4" | tail -1` > "$status_file" #Update the .last_update file
Upgrade valgrind for Fedora 22.
#!/bin/bash # # Trigger vars and find information # # $Id$ # ###################################################################### ###################################################################### # # Set variables whose change should not trigger a rebuild or will # by value change trigger a rebuild, as change of this file will not # trigger a rebuild. # E.g: version, builds, deps, auxdata, paths, builds of other packages # ###################################################################### setValgrindTriggerVars() { case `uname` in Darwin) if ! test -d /usr/include/mach; then techo "WARNING: [$FUNCNAME] Install command line tools per "'http://sourceforge.net/p/bilder/wiki/Preparing\%20a\%20Darwin\%20machine\%20for\%20Bilder'"/." fi VALGRIND_BLDRVERSION_STD=3.10.1 VALGRIND_BLDRVERSION_EXP=3.10.1 case `uname -r` in # Mavericks or later OSX 10.9 # 1[3-9]*) VALGRIND_BUILDS=${VALGRIND_BUILDS:-"ser"};; 1[3-9]*) VALGRIND_BUILDS=${VALGRIND_BUILDS:-"NONE"};; esac ;; Linux) VALGRIND_BLDRVERSION_STD=3.10.1 VALGRIND_BLDRVERSION_EXP=3.10.1 VALGRIND_BUILDS=${VALGRIND_BUILDS:-"ser"} ;; esac VALGRIND_DEPS= } setValgrindTriggerVars ###################################################################### # # Find valgrind # ###################################################################### findValgrind() { addtopathvar PATH $CONTRIB_DIR/valgrind/bin }
#!/bin/bash # # Trigger vars and find information # # $Id$ # ###################################################################### ###################################################################### # # Set variables whose change should not trigger a rebuild or will # by value change trigger a rebuild, as change of this file will not # trigger a rebuild. # E.g: version, builds, deps, auxdata, paths, builds of other packages # ###################################################################### setValgrindTriggerVars() { VALGRIND_BLDRVERSION_STD=3.10.1 VALGRIND_BLDRVERSION_EXP=3.11.0 case `uname` in Darwin) case `uname -r` in # Mavericks or later OSX 10.9 does not build 3.10.1 1[3-9]*) if $BUILD_EXPERIMENTAL; then VALGRIND_BUILDS=${VALGRIND_BUILDS:-"ser"} else VALGRIND_BUILDS=${VALGRIND_BUILDS:-"NONE"} fi ;; *) VALGRIND_BUILDS=${VALGRIND_BUILDS:-"ser"};; esac ;; Linux) VALGRIND_BUILDS=${VALGRIND_BUILDS:-"ser"} ;; esac VALGRIND_DEPS= } setValgrindTriggerVars ###################################################################### # # Find valgrind # ###################################################################### findValgrind() { addtopathvar PATH $CONTRIB_DIR/valgrind/bin }
Disable host key checking in fio script
#!/bin/bash oc get nodes --no-headers | cut -f1 -d" " | while read i; do ssh -n "$i" 'sync ; echo 3 > /proc/sys/vm/drop_caches'; done
#!/bin/bash oc get nodes --no-headers | cut -f1 -d" " | while read i; do ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -n "$i" 'sync ; echo 3 > /proc/sys/vm/drop_caches'; done
Copy lattice.tgz directly to repo for Vagrantfile compatibility
#!/bin/bash set -x -e export LATTICE_DIR=$PWD/lattice export AWS_SSH_PRIVATE_KEY_PATH=$PWD/vagrant.pem export VAGRANT_TMP_DIR=$PWD/vagrant-tmp mkdir -p $VAGRANT_TMP_DIR cat <<< "$AWS_SSH_PRIVATE_KEY" > "$AWS_SSH_PRIVATE_KEY_PATH" curl -LO https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.deb dpkg -i vagrant_1.7.4_x86_64.deb while ! vagrant plugin install vagrant-aws; do sleep 5 done vagrant box add lattice/ubuntu-trusty-64 --provider=aws cp lattice-tar-build/lattice-*.tgz $VAGRANT_TMP_DIR/lattice.tgz cp lattice/Vagrantfile $VAGRANT_TMP_DIR/ pushd $VAGRANT_TMP_DIR vagrant up --provider=aws export $(vagrant ssh -c "grep SYSTEM_DOMAIN /var/lattice/setup/lattice-environment" | egrep -o '(SYSTEM_DOMAIN=.+\.io)') popd sleep 60 echo $SYSTEM_DOMAIN > system_domain
#!/bin/bash set -x -e export LATTICE_DIR=$PWD/lattice export AWS_SSH_PRIVATE_KEY_PATH=$PWD/vagrant.pem cat <<< "$AWS_SSH_PRIVATE_KEY" > "$AWS_SSH_PRIVATE_KEY_PATH" curl -LO https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.deb dpkg -i vagrant_1.7.4_x86_64.deb while ! vagrant plugin install vagrant-aws; do sleep 5 done vagrant box add lattice/ubuntu-trusty-64 --provider=aws cp lattice-tar-build/lattice-*.tgz $LATTICE_DIR/lattice.tgz pushd $LATTICE_DIR vagrant up --provider=aws export $(vagrant ssh -c "grep SYSTEM_DOMAIN /var/lattice/setup/lattice-environment" | egrep -o '(SYSTEM_DOMAIN=.+\.io)') popd sleep 60 echo $SYSTEM_DOMAIN > system_domain
Use wget rather than curl
#!/usr/bin/env bash set -e # CircleCI doesn't give CIRCLE_PR_NUMBER in the environment for non-forked PRs. Wonderful. # In this case, we just need to do some ~shell magic~ to strip it out of the PULL_REQUEST URL. echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV source $BASH_ENV if [[ -z "${CIRCLE_PR_NUMBER}" ]] then echo "Can't figure out what the PR number is! Assuming merge target is develop." # It probably hasn't had a PR opened yet. Since all PRs land on develop, we # can probably assume it's based on it and will be merged into it. GITBASE="develop" else # Get the reference, using the GitHub API GITBASE=`curl -q https://api.github.com/repos/matrix-org/synapse/pulls/${CIRCLE_PR_NUMBER} | jq -r '.base.ref'` fi # Show what we are before git show -s # Set up username so it can do a merge git config --global user.email bot@matrix.org git config --global user.name "A robot" # Fetch and merge. If it doesn't work, it will raise due to set -e. git fetch -u origin $GITBASE git merge --no-edit origin/$GITBASE # Show what we are after. git show -s
#!/usr/bin/env bash set -e # CircleCI doesn't give CIRCLE_PR_NUMBER in the environment for non-forked PRs. Wonderful. # In this case, we just need to do some ~shell magic~ to strip it out of the PULL_REQUEST URL. echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV source $BASH_ENV if [[ -z "${CIRCLE_PR_NUMBER}" ]] then echo "Can't figure out what the PR number is! Assuming merge target is develop." # It probably hasn't had a PR opened yet. Since all PRs land on develop, we # can probably assume it's based on it and will be merged into it. GITBASE="develop" else # Get the reference, using the GitHub API GITBASE=`wget -O- https://api.github.com/repos/matrix-org/synapse/pulls/${CIRCLE_PR_NUMBER} | jq -r '.base.ref'` fi # Show what we are before git show -s # Set up username so it can do a merge git config --global user.email bot@matrix.org git config --global user.name "A robot" # Fetch and merge. If it doesn't work, it will raise due to set -e. git fetch -u origin $GITBASE git merge --no-edit origin/$GITBASE # Show what we are after. git show -s
Fix appcast push for release on snapshot
#!/bin/bash set -e BRANCH=$1 COMPOUND_VERSION=$2 IS_SNAPSHOT=$3 if [ "${IS_SNAPSHOT}" = true ] ; then cp ./build/Release/appcast_snapshot.xml . else cp ./build/Release/appcast.xml . fi echo "### Commiting and pushing appcast" git commit -S -am "Bump appcast to ${COMPOUND_VERSION}" git push origin HEAD:"${BRANCH}" if [ "${IS_SNAPSHOT}" = false ] ; then git reset --hard @ git checkout develop git merge master cp appcast.xml appcast_snapshot.xml git commit appcast_snapshot.xml -m "Update appcast_snapshot with version ${COMPOUND_VERSION}" git push origin HEAD:develop fi
#!/bin/bash set -e BRANCH=$1 COMPOUND_VERSION=$2 IS_SNAPSHOT=$3 if [ "${IS_SNAPSHOT}" = true ] ; then cp ./build/Release/appcast_snapshot.xml . else cp ./build/Release/appcast.xml . fi echo "### Commiting and pushing appcast" git commit -S -am "Bump appcast to ${COMPOUND_VERSION}" git push origin HEAD:"${BRANCH}" if [ "${IS_SNAPSHOT}" = false ] ; then git reset --hard @ git checkout -b for_appcast origin/develop git merge --ff-only for_build cp appcast.xml appcast_snapshot.xml git commit appcast_snapshot.xml -m "Update appcast_snapshot with version ${COMPOUND_VERSION}" git push origin HEAD:develop fi
Allow for custom PHPUNIT flags
#!/usr/bin/env sh # # Small script to run a jenkins post-commit build ## set +x # Assert assumption that we're running from the project root directory # This works for all of my projects, but someone else may want to modify this if [[ ! -d "test" ]]; then echo >&2 'Could not find "test" directory. Refusing to run' exit 1 fi echo " $(git show --name-status) " set -x # PHPUnit doesn't have a --no-colors option # For jenkins, check out https://wiki.jenkins-ci.org/display/JENKINS/AnsiColor+Plugin phpunit \ --log-junit build/reports/phpunit.xml \ test/
#!/usr/bin/env sh # # Small script to run a jenkins post-commit build ## set +x # Set our default phpunit flags PHPUNIT_FLAGS="--log-junit build/reports/phpunit.xml $PHPUNIT_FLAGS" # Assert assumption that we're running from the project root directory # This works for all of my projects, but someone else may want to modify this if [[ ! -d "test" ]]; then echo >&2 'Could not find "test" directory. Refusing to run' exit 1 fi echo " $(git show --name-status) " set -x # PHPUnit doesn't have a --no-colors option # For jenkins, check out https://wiki.jenkins-ci.org/display/JENKINS/AnsiColor+Plugin phpunit \ $PHPUNIT_FLAGS \ test/
Change installation dir on the target node.
NAME=gridengine SCRIPTS_DIR=/home/ubuntu/scripts6 #elasticluster start $NAME for host in `elasticluster list-nodes gridengine | grep " -" | cut -d'-' -f2`; do echo "installing packages on $host" elasticluster sftp $NAME -n $host << EOF mkdir -p $SCRIPTS_DIR put install_packages.sh $SCRIPTS_DIR EOF elasticluster ssh $NAME -n $host << EOF2 source $SCRIPTS_DIR/install_packages.sh EOF2 done
NAME=gridengine SCRIPTS_DIR=/home/ubuntu/scripts elasticluster start $NAME for host in `elasticluster list-nodes gridengine | grep " -" | cut -d'-' -f2`; do echo "installing packages on $host" elasticluster sftp $NAME -n $host << EOF mkdir -p $SCRIPTS_DIR put install_packages.sh $SCRIPTS_DIR EOF elasticluster ssh $NAME -n $host << EOF2 source $SCRIPTS_DIR/install_packages.sh EOF2 done
Fix path typo per @nalinik 's suggestion
# set up script on NERSC Cori machine module load python/3.5-anaconda if [[ ! -d $HOME/.conda ]]; then mkdir $HOME/.conda fi conda create -n wrapped_ibench -c intel -y python=3.6 hugetlbfs scipy source $HOME/.conda/envs/ibench/bin/activate wrapped_ibench cd ../../ python setup.py install
# set up script on NERSC Cori machine module load python/3.5-anaconda if [[ ! -d $HOME/.conda ]]; then mkdir $HOME/.conda fi conda create -n wrapped_ibench -c intel -y python=3.6 hugetlbfs scipy source $HOME/.conda/envs/wrapped_ibench/bin/activate wrapped_ibench cd ../../ python setup.py install
Use only one php version
#!/usr/bin/env bash set -xe if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then if ([ "$TRAVIS_BRANCH" == "master" ]) ; then composer install -o -q -n docker login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} -e ${DOCKER_EMAIL} LATEST="paymaxi/webhooks:latest" docker build -f etc/docker/php/Dockerfile.prod -t ${LATEST} . docker push ${LATEST} fi if ([ ! -z "$TRAVIS_TAG" ]); then TAGGED="paymaxi/webhooks:${TRAVIS_TAG}" docker build -f etc/docker/php/Dockerfile.prod -t ${TAGGED} . docker push ${TAGGED} fi fi
#!/usr/bin/env bash set -xe if ( ["$TRAVIS_PULL_REQUEST" == "false"] && ["$TRAVIS_PHP_VERSION" == "7.0"] ); then if ([ "$TRAVIS_BRANCH" == "master" ]) ; then composer install -o -q -n docker login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} -e ${DOCKER_EMAIL} LATEST="paymaxi/webhooks:latest" docker build -f etc/docker/php/Dockerfile.prod -t ${LATEST} . docker push ${LATEST} fi if ([ ! -z "$TRAVIS_TAG" ]); then TAGGED="paymaxi/webhooks:${TRAVIS_TAG}" docker build -f etc/docker/php/Dockerfile.prod -t ${TAGGED} . docker push ${TAGGED} fi fi
Remove thinkbig user as part of cleanup script
#!/bin/bash echo "Uninstalling all components that were installed from the RPM and setup-wizard" echo "Uninstalling thinkbig applications with RPM uninstall" /opt/thinkbig/remove-thinkbig-datalake-accelerator.sh rm -rf /opt/thinkbig mysql -e "drop database thinkbig;" mysql -e "show databases;" echo "Uninstalling NiFi" service nifi stop chkconfig nifi off rm -rf /opt/nifi rm -rf /var/log/nifi rm -f /etc/init.d/nifi userdel nifi echo "Uninstalling ActiveMQ" service activemq stop rm -f /etc/init.d/activemq rm -f /etc/default/activemq rm -rf /opt/activemq userdel activemq echo "Uninstalling elasticsearch" rpm -e elasticsearch rm -rf /var/lib/elasticsearch/ echo "Uninstalling /opt/java" rm -rf /opt/java echo "Uninstall complete. You should now be able to re-install the RPM and run the setup wizard to get a clean install"
#!/bin/bash echo "Uninstalling all components that were installed from the RPM and setup-wizard" echo "Uninstalling thinkbig applications with RPM uninstall" /opt/thinkbig/remove-thinkbig-datalake-accelerator.sh rm -rf /opt/thinkbig mysql -e "drop database thinkbig;" mysql -e "show databases;" userdel thinkbig echo "Uninstalling NiFi" service nifi stop chkconfig nifi off rm -rf /opt/nifi rm -rf /var/log/nifi rm -f /etc/init.d/nifi userdel nifi echo "Uninstalling ActiveMQ" service activemq stop rm -f /etc/init.d/activemq rm -f /etc/default/activemq rm -rf /opt/activemq userdel activemq echo "Uninstalling elasticsearch" rpm -e elasticsearch rm -rf /var/lib/elasticsearch/ echo "Uninstalling /opt/java" rm -rf /opt/java echo "Uninstall complete. You should now be able to re-install the RPM and run the setup wizard to get a clean install"
Fix version number in package
#!/bin/bash mkdir -p build cd build echo "Run cmake..." HDF5_ROOT=$HDF5_ROOT \ cmake ../code \ -DLibRDKafka_ROOT_DIR=$LibRDKafka_ROOT_DIR echo "Build project" make echo "Run tests" ./unitTests ../code/data/ --gtest_output=xml:test_results.xml echo "Create docs" make doc echo "Create package" make package cd .. echo "Create RPM" rm -rf package/* mkdir -p package/{BUILD,RPMS,SOURCES,SPECS,SRPMS} cp build/isis_nexus_streamer-1.0.0.tar.gz package/SOURCES/ cp code/isis_nexus_streamer.spec package/SPECS/ rpmbuild \ --define "_topdir $(pwd)/package" \ --define "_version 1.0.0" \ --define "_release $BUILD_NUMBER" \ -bb package/SPECS/isis_nexus_streamer.spec
#!/bin/bash mkdir -p build cd build echo "Run cmake..." HDF5_ROOT=$HDF5_ROOT \ cmake ../code \ -DLibRDKafka_ROOT_DIR=$LibRDKafka_ROOT_DIR echo "Build project" make echo "Run tests" ./unitTests ../code/data/ --gtest_output=xml:test_results.xml echo "Create docs" make doc echo "Create package" make package cd .. echo "Create RPM" rm -rf package/* mkdir -p package/{BUILD,RPMS,SOURCES,SPECS,SRPMS} cp build/isis_nexus_streamer-0.1.0.tar.gz package/SOURCES/ cp code/isis_nexus_streamer.spec package/SPECS/ rpmbuild \ --define "_topdir $(pwd)/package" \ --define "_version 0.1.0" \ --define "_release $BUILD_NUMBER" \ -bb package/SPECS/isis_nexus_streamer.spec
Build tests with gcc -std=c99 -fsanitize=address
#!/bin/bash gcc -Wall -O0 -g3 -I./include src/cuckoo_filter.c tests/cuckootest.c -o test gcc -Wall -O0 -g3 -I./include src/cuckoo_filter.c tests/cuckootest2.c -o test2
#!/bin/bash gcc -Wall -std=c99 -fsanitize=address -O2 -g3 -I./include src/cuckoo_filter.c tests/cuckootest.c -o test gcc -Wall -std=c99 -fsanitize=address -O2 -g3 -I./include src/cuckoo_filter.c tests/cuckootest2.c -o test2
Create atom config dir if necessary
#!/bin/bash # Setup Atom editor set -euf -o pipefail AtomHome="${1}/.atom/" AtomPackages="packages.txt" if [ -d "${AtomHome}" ]; then cp ./config.cson ${AtomHome} cp ./keymap.cson ${AtomHome} cp ./styles.less ${AtomHome} fi while read -r pkg; do apm install ${pkg} done <${AtomPackages}
#!/bin/bash # Setup Atom editor set -euf -o pipefail AtomHome="/home/${1}/.atom/" AtomPackages="packages.txt" if [ ! -d "${AtomHome}" ]; then mkdir ${AtomHome} chmod 0750 ${1} ${AtomHome} chown ${1}:${1} ${AtomHome} fi cp ./config.cson ${AtomHome} cp ./keymap.cson ${AtomHome} cp ./styles.less ${AtomHome} while read -r pkg; do apm install ${pkg} done <${AtomPackages}
Fix incorrect -L where -I is needed
sed -i.bak 's^TABIX_LIB_DIR)$^TABIX_LIB_DIR) -L$(PREFIX)/lib^' src/Makefile sed -i.bak 's^TABIX_INCLUDE_DIR)$^TABIX_INCLUDE_DIR) -L$(PREFIX)/include^' src/Makefile sed -r -i.bak "s^tabix: (.*)^tabix: \1\n\tsed -i.bak 's@CFLAGS =@CFLAGS = -I$\(PREFIX\)/include@' tabix*/Makefile^" redist/Makefile echo "LISTING include" ls $PREFIX/include echo "LISTING lib" ls $PREFIX/lib make BIN_DIR=$PREFIX/bin
sed -i.bak 's^TABIX_LIB_DIR)$^TABIX_LIB_DIR) -L$(PREFIX)/lib^' src/Makefile sed -i.bak 's^TABIX_INCLUDE_DIR)$^TABIX_INCLUDE_DIR) -I$(PREFIX)/include^' src/Makefile sed -r -i.bak "s^tabix: (.*)^tabix: \1\n\tsed -i.bak 's@CFLAGS =@CFLAGS = -I$\(PREFIX\)/include@' tabix*/Makefile^" redist/Makefile make BIN_DIR=$PREFIX/bin
Make bison script backwards compatible with 2.x
#!/bin/sh BISON="$1" OUTPUT="$2" INPUT="$3" if test "x$BISON" = x -o "x$OUTPUT" = x -o "x$INPUT" = x; then echo "usage: $0 <bison> <output> <input>" exit 1 fi ############################################################################# ## bison ############################################################################# ${BISON} -d -ra --warnings="deprecated,other,error=conflicts-sr,error=conflicts-rr" -o ${OUTPUT} ${INPUT} ############################################################################# ## sanity checks ############################################################################# PREFIX=`echo ${OUTPUT} | sed -e 's:\.cpp$::'` test -f ${PREFIX}.hpp || exit 1 test -f ${PREFIX}.cpp || exit 1 cp ${PREFIX}.hpp ${PREFIX}.h
#!/bin/sh BISON="$1" OUTPUT="$2" INPUT="$3" if test "x$BISON" = x -o "x$OUTPUT" = x -o "x$INPUT" = x; then echo "usage: $0 <bison> <output> <input>" exit 1 fi BISON_MAJOR_VER=`${BISON} --version |grep bison|sed -e "s;.* ;;" -e "s;\..*;;"` if test "${BISON_MAJOR_VER}" -ge "3"; then BISON_OPTS="--warnings=deprecated,other,error=conflicts-sr,error=conflicts-rr" fi ############################################################################# ## bison ############################################################################# ${BISON} -d -ra ${BISON_OPTS} -o ${OUTPUT} ${INPUT} ############################################################################# ## sanity checks ############################################################################# PREFIX=`echo ${OUTPUT} | sed -e 's:\.cpp$::'` test -f ${PREFIX}.hpp || exit 1 test -f ${PREFIX}.cpp || exit 1 cp ${PREFIX}.hpp ${PREFIX}.h
Use new homebrew version format.
#!/bin/sh -e brew update brew install homebrew/versions/llvm38 if [[ "$CXX" == "clang++" ]]; then brew unlink gcc export CXX=$(which clang++-3.8) elif [[ "$CXX" == "g++" ]]; then export CXX=$(which g++) else exit 1 fi SL=/System/Library PL=com.apple.ReportCrash launchctl unload -w ${SL}/LaunchAgents/${PL}.plist sudo launchctl unload -w ${SL}/LaunchDaemons/${PL}.Root.plist
#!/bin/sh -e brew update brew install llvm@3.8 if [[ "$CXX" == "clang++" ]]; then brew unlink gcc export CXX=$(which clang++-3.8) elif [[ "$CXX" == "g++" ]]; then export CXX=$(which g++) else exit 1 fi SL=/System/Library PL=com.apple.ReportCrash launchctl unload -w ${SL}/LaunchAgents/${PL}.plist sudo launchctl unload -w ${SL}/LaunchDaemons/${PL}.Root.plist
Update zsh to use vim style line editing
# Initialize completion autoload -Uz compinit && compinit # Set automatic cd (typing directory name with no 'cd') setopt autocd # Nicer history export HISTSIZE=16384 export HISTFILE="$HOME/.zsh_history" export SAVEHIST=$HISTSIZE # Use vim as the editor export EDITOR=vim # Use emacs mode in vim bindkey -e # Use incremental search bindkey "^R" history-incremental-search-backward
# Initialize completion autoload -Uz compinit && compinit # Set automatic cd (typing directory name with no 'cd') setopt autocd # Nicer history export HISTSIZE=16384 export HISTFILE="$HOME/.zsh_history" export SAVEHIST=$HISTSIZE # Use vim as the editor export EDITOR=vim # Use vim style line editing in zsh bindkey -v # Use incremental search bindkey "^R" history-incremental-search-backward
Fix the typo in the last committed tag
#!/bin/bash # # Build a snap using a docker container. set -ev # Check if the latest tag is in the beta channel. tmp_dir="$(mktemp -d)" source="$(cat snapcraft.yaml | grep source: | head -n 1 | awk '{printf $2}')" git clone "${source}" "${tmp_dir}" last_committed_tag="$(git -C "${tmp_dir}" describe --tags --abbrev=0)" docker run -v $(pwd):$(pwd) snapcore/snapcraft sh -c "apt update && apt install -y snapcraft && cd $(pwd) && ((snapcraft status ipfs || echo "none") > status)" last_released_tag="$(cat status | grep beta | awk '{print $2}')" if [ "${last_committed_tag}" != "${last_released_tag}" ]; then # Build using the latest tag. sed -i "s/source-tag:.*$/source-tag: '"$last_committed_tag"'/g" snapcraft.yaml sed -i "s/version:.*$/version: '"$last_commited_tag"'/g" snapcraft.yaml fi docker run -v "$(pwd)":/cwd snapcore/snapcraft sh -c "cd /cwd && ./scripts/snap.sh"
#!/bin/bash # # Build a snap using a docker container. set -ev # Check if the latest tag is in the beta channel. tmp_dir="$(mktemp -d)" source="$(cat snapcraft.yaml | grep source: | head -n 1 | awk '{printf $2}')" git clone "${source}" "${tmp_dir}" last_committed_tag="$(git -C "${tmp_dir}" describe --tags --abbrev=0)" docker run -v $(pwd):$(pwd) snapcore/snapcraft sh -c "apt update && apt install -y snapcraft && cd $(pwd) && ((snapcraft status ipfs || echo "none") > status)" last_released_tag="$(cat status | grep beta | awk '{print $2}')" if [ "${last_committed_tag}" != "${last_released_tag}" ]; then # Build using the latest tag. sed -i "s/source-tag:.*$/source-tag: '"$last_committed_tag"'/g" snapcraft.yaml sed -i "s/version:.*$/version: '"$last_committed_tag"'/g" snapcraft.yaml fi docker run -v "$(pwd)":/cwd snapcore/snapcraft sh -c "cd /cwd && ./scripts/snap.sh"
Change to two == in bash script
#!/bin/bash -eux GROUP=plextmp mkdir -p /config/logs/supervisor chown -R plex: /config touch /supervisord.log touch /supervisord.pid chown plex: /supervisord.log /supervisord.pid TARGET_GID=$(stat -c "%g" /data) EXISTS=$(cat /etc/group | grep ${TARGET_GID} | wc -l) # Create new group using target GID and add plex user if [ $EXISTS = "0" ]; then groupadd --gid ${TARGET_GID} ${GROUP} else # GID exists, find group name and add GROUP=$(getent group $TARGET_GID | cut -d: -f1) usermod -a -G ${GROUP} plex fi usermod -a -G ${GROUP} plex # Will change all files in directory to be readable by group if [ "${CHANGE_DIR_RIGHTS}" = true ]; then chgrp -R ${GROUP} /data chmod -R g+rX /data fi # Current defaults to run as root while testing. if [ "${RUN_AS_ROOT}" = true ]; then /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf else su plex -c "/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf" fi
#!/bin/bash -eux GROUP=plextmp mkdir -p /config/logs/supervisor chown -R plex: /config touch /supervisord.log touch /supervisord.pid chown plex: /supervisord.log /supervisord.pid TARGET_GID=$(stat -c "%g" /data) EXISTS=$(cat /etc/group | grep ${TARGET_GID} | wc -l) # Create new group using target GID and add plex user if [ $EXISTS == "0" ]; then groupadd --gid ${TARGET_GID} ${GROUP} else # GID exists, find group name and add GROUP=$(getent group $TARGET_GID | cut -d: -f1) usermod -a -G ${GROUP} plex fi usermod -a -G ${GROUP} plex # Will change all files in directory to be readable by group if [ "${CHANGE_DIR_RIGHTS}" == true ]; then chgrp -R ${GROUP} /data chmod -R g+rX /data fi # Current defaults to run as root while testing. if [ "${RUN_AS_ROOT}" == true ]; then /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf else su plex -c "/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf" fi
Add git mf == merge --ff-only
#!/usr/bin/env bash git config --global merge.commit no git config --global merge.ff yes git config --global push.default simple git config --global pull.rebase true git config --global log.decorate true git config --global gitsh.defaultCommand "!clear && logs && !echo && st" git config --global format.pretty format:"%h %C(yellow)%ci%C(reset) %C(green)%an%C(reset) |%C(yellow)%C(bold)%d%C(reset) %s" git config --global alias.aa 'add .' git config --global alias.ap 'add -p' git config --global alias.cgrep '!f() { git log --format=%H --grep=$1; }; f' git config --global alias.cm 'commit -m' git config --global alias.co checkout git config --global alias.cshow '!f() { git show `git cgrep $1`; }; f' git config --global alias.dc 'diff --cached' git config --global alias.dh 'diff head' git config --global alias.logs 'log -n 20' git config --global alias.lp 'log -p' git config --global alias.ls 'log --stat' git config --global alias.pr 'pull --rebase' git config --global alias.rc 'rebase --continue' git config --global alias.spsp 'stash && pull && stash pop' git config --global alias.st status
#!/usr/bin/env bash git config --global merge.commit no git config --global merge.ff yes git config --global push.default simple git config --global pull.rebase true git config --global log.decorate true git config --global gitsh.defaultCommand "!clear && logs && !echo && st" git config --global format.pretty format:"%h %C(yellow)%ci%C(reset) %C(green)%an%C(reset) |%C(yellow)%C(bold)%d%C(reset) %s" git config --global alias.aa 'add .' git config --global alias.ap 'add -p' git config --global alias.cgrep '!f() { git log --format=%H --grep=$1; }; f' git config --global alias.cm 'commit -m' git config --global alias.co checkout git config --global alias.cshow '!f() { git show `git cgrep $1`; }; f' git config --global alias.dc 'diff --cached' git config --global alias.dh 'diff head' git config --global alias.logs 'log -n 20' git config --global alias.lp 'log -p' git config --global alias.ls 'log --stat' git config --global alias.mf 'merge --ff-only' git config --global alias.pr 'pull --rebase' git config --global alias.rc 'rebase --continue' git config --global alias.spsp 'stash && pull && stash pop' git config --global alias.st status
Add About/contact us links to footer
# S3 bucket and credentials for uploading files export AWS_ACCESS_KEY_ID=AKIAIU6OWKO72U5V3TUA export AWS_SECRET_ACCESS_KEY=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 export S3_BUCKET=democracylab-marlok # Password for account used to send email export EMAIL_HOST_PASSWORD=betterDemocracyViaTechnology # Url prefix to generate links on the back-end export PROTOCOL_DOMAIN=http://127.0.0.1:8000 # Email of the admin account, used to export ADMIN_EMAIL=marlonakeating+1111@gmail.com # Secret key used to encrypt session tokens export DJANGO_SECRET_KEY="d!01@gn+%1ql1n(*)8xo+nx$$&n@mg$0_)9g+!(t-2vncaq!j8" # Whether to show django debug info page on errors export DJANGO_DEBUG=True # Configure footer links export FOOTER_LINKS='[{"u":"http://www.democracylab.org","n":"Home"},{"u":"/about","n":"About"},{"u":"/blog","n":"Blog"}]'
# S3 bucket and credentials for uploading files export AWS_ACCESS_KEY_ID=AKIAIU6OWKO72U5V3TUA export AWS_SECRET_ACCESS_KEY=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 export S3_BUCKET=democracylab-marlok # Password for account used to send email export EMAIL_HOST_PASSWORD=betterDemocracyViaTechnology # Url prefix to generate links on the back-end export PROTOCOL_DOMAIN=http://127.0.0.1:8000 # Email of the admin account, used to export ADMIN_EMAIL=marlonakeating+1111@gmail.com # Secret key used to encrypt session tokens export DJANGO_SECRET_KEY="d!01@gn+%1ql1n(*)8xo+nx$$&n@mg$0_)9g+!(t-2vncaq!j8" # Whether to show django debug info page on errors export DJANGO_DEBUG=True # Configure footer links export FOOTER_LINKS='[{"u":"http://www.democracylab.org","n":"About"},{"u":"mailto:hello@democracylab.org","n":"Contact Us"}]'
Add chrome to the ui vagrant machine
#!/usr/bin/env bash # Install NVM for simple node.js version management wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash # This enables NVM without a logout/login export NVM_DIR="/home/vagrant/.nvm" # shellcheck source=/dev/null [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm # Install Node, Ember CLI, and Phantom for UI development nvm install 8.11.2 nvm alias default 8.11.2 npm install -g ember-cli # Install Yarn for front-end dependency management curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.7.0 export PATH="$HOME/.yarn/bin:\$PATH"
#!/usr/bin/env bash # Install NVM for simple node.js version management wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash # This enables NVM without a logout/login export NVM_DIR="/home/vagrant/.nvm" # shellcheck source=/dev/null [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm # Install Node, Ember CLI, and Phantom for UI development nvm install 8.11.2 nvm alias default 8.11.2 npm install -g ember-cli # Install Yarn for front-end dependency management curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.7.0 # Install Chrome for running tests (in headless mode) wget -qO- - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - sudo sh -c 'echo "deb https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' sudo apt-get update sudo apt-get install -y google-chrome-stable
Use a nicer API endpoint for GitHub pubkeys
#!/bin/bash # # Author: Lorenz Leutgeb <lorenz.leutgeb@cod.uno> # # Usage: ./authorize.sh <user-name> # Script to add the public key of a GitHub user to the # list of authorized keys for git on this server DEFAULT_CONFIG_FILE=config.rc # $CONFIG_FILE should point at the config file created by setup.sh if [ -z $CONFIG_FILE ]; then CONFIG_FILE=$DEFAULT_CONFIG_FILE fi eval $(cat config.rc) # User needs a name if [ -z $1 ]; then echo "User must have a non-empty name" exit 1 fi USER_NAME=$1 curl "https://api.github.com/users/$USER_NAME/keys" | grep key | tr -d '"' | cut -d' ' -f6- \ | while read key do echo "environment=\"GITHUB_USERNAME=$USER_NAME\" $key" | tee -a $GIT_HOME/.ssh/authorized_keys done
#!/bin/bash # # Author: Lorenz Leutgeb <lorenz.leutgeb@cod.uno> # # Usage: ./authorize.sh <user-name> # Script to add the public key of a GitHub user to the # list of authorized keys for git on this server DEFAULT_CONFIG_FILE=config.rc # $CONFIG_FILE should point at the config file created by setup.sh if [ -z $CONFIG_FILE ]; then CONFIG_FILE=$DEFAULT_CONFIG_FILE fi eval $(cat config.rc) # User needs a name if [ -z $1 ]; then echo "User must have a non-empty name" exit 1 fi USER_NAME=$1 curl "https://github.com/${USER_NAME}.keys" | while read key do echo "environment=\"GITHUB_USERNAME=$USER_NAME\" $key" | tee -a $GIT_HOME/.ssh/authorized_keys done
Allow building from either base checkout or a git worktree
#!/usr/bin/env sh set -e # We neet a local copy of the libtexpdf library to compile. If this was # downloaded as a src distibution package this will exist already, but if not # and we are part of a git repository that the user has not fully initialized, # go ahead and do the step of fetching the the submodule so the compile process # can run. if [ ! -f "libtexpdf/configure.ac" ] && [ -d ".git" ]; then git submodule update --init --recursive --remote fi autoreconf --install # See discussion in https://github.com/simoncozens/sile/issues/82 # http://blog.gaku.net/autoconf/ case `uname` in Darwin*) glibtoolize ;; *) libtoolize ;; esac aclocal automake --force-missing --add-missing autoreconf (cd libtexpdf; autoreconf -I m4) sed -i -e 's/rm -f core/rm -f/' configure
#!/usr/bin/env sh set -e # We neet a local copy of the libtexpdf library to compile. If this was # downloaded as a src distibution package this will exist already, but if not # and we are part of a git repository that the user has not fully initialized, # go ahead and do the step of fetching the the submodule so the compile process # can run. if [ ! -f "libtexpdf/configure.ac" ] && [ -e ".git" ]; then git submodule update --init --recursive --remote fi autoreconf --install # See discussion in https://github.com/simoncozens/sile/issues/82 # http://blog.gaku.net/autoconf/ case `uname` in Darwin*) glibtoolize ;; *) libtoolize ;; esac aclocal automake --force-missing --add-missing autoreconf (cd libtexpdf; autoreconf -I m4) sed -i -e 's/rm -f core/rm -f/' configure
Add 'fancy_echo' function to make script more independent.
#!/bin/sh ################################################################################ # symlink_dotfiles.sh # # This script backs up any old dotfiles on the system, and symlinks the new ones # to their proper place in the home folder. ################################################################################ set -e # Terminate script if anything exits with a non-zero value set -u # Prevent unset variables ################################################################################ # Set some variables ################################################################################ DOTFILES=$HOME/dotfiles OLD_DOTFILES_BACKUP=$HOME/old_dotfiles_backup files="gemrc gitignore gitconfig tmux.conf railsrc vimrc zshrc" ################################################################################ # Back up old dotfiles if needed ################################################################################ if [ -d $DOTFILES ]; then fancy_echo "Backing up old dotfiles to $HOME/old_dotfiles_backup..." rm -rf $OLD_DOTFILES_BACKUP cp -R $DOTFILES $OLD_DOTFILES_BACKUP fi ################################################################################ # Symklink new dotfiles to $HOME ################################################################################ fancy_echo "Creating symlinks..." for file in $files; do fancy_echo "-> Linking $DOTFILES/$file to $HOME/.$file..." ln -nfs "$DOTFILES/$file" "$HOME/.$file" done
#!/bin/bash ################################################################################ # symlink_dotfiles.sh # # This script backs up any old dotfiles on the system, and symlinks the new ones # to their proper place in the home folder. ################################################################################ set -e # Terminate script if anything exits with a non-zero value set -u # Prevent unset variables fancy_echo() { local fmt="$1"; shift # shellcheck disable=SC2059 printf "\n$fmt\n" "$@" } ################################################################################ # Set some variables ################################################################################ DOTFILES=$HOME/dotfiles OLD_DOTFILES_BACKUP=$HOME/old_dotfiles_backup files="gemrc gitignore gitconfig tmux.conf railsrc vimrc zshrc" ################################################################################ # Back up old dotfiles if needed ################################################################################ if [ -d $DOTFILES ]; then fancy_echo "Backing up old dotfiles to $HOME/old_dotfiles_backup..." rm -rf $OLD_DOTFILES_BACKUP cp -R $DOTFILES $OLD_DOTFILES_BACKUP fi ################################################################################ # Symklink new dotfiles to $HOME ################################################################################ fancy_echo "Creating symlinks..." for file in $files; do fancy_echo "-> Linking $DOTFILES/$file to $HOME/.$file..." ln -nfs "$DOTFILES/$file" "$HOME/.$file" done
Use bash instead of sh - pushd etc are bash only
#!/bin/sh waitUrl="`pwd`/ui/waiting-room.html"; # Ensure dependencies are installed. echo "* Checking dependencies..." hash tsc 2>/dev/null if [ $? -ne 0 ]; then echo "Please install the typescript compiler with ('sudo npm install -g typescript') before continuing." exit fi hash multirust 2>/dev/null if [ $? -ne 0 ]; then echo "Please install multirust with ('./install-multirust') before continuing." exit fi pushd . # Try using the typescript compiler (tsc) to compile UI echo "* Compiling Editor..." cd ui tsc if [ $? -ne 0 ]; then echo "Failed to compile editor, bailing." popd exit fi popd # If we aren't restarting, open the editor in the user's preferred browser if [[ "x$1" != "x--restart" ]]; then echo "* Opening $waitUrl" if [[ "$OSTYPE" == "darwin"* ]]; then open "$waitUrl" & else xdg-open "$waitUrl" & fi fi pushd . # Ensure rustc is updated echo "* Updating rust if necessary..." cd runtime multirust override nightly-2015-08-10 # Compile runtime server echo "* Compiling server... (This takes a while)" rustFlags="--release" if [[ "x$1" != "x--debug" ]]; then rustFlags="" fi RUST_BACKTRACE=1 cargo run --bin=server $rustFlags popd
#!/bin/bash waitUrl="`pwd`/ui/waiting-room.html"; # Ensure dependencies are installed. echo "* Checking dependencies..." hash tsc 2>/dev/null if [ $? -ne 0 ]; then echo "Please install the typescript compiler with ('sudo npm install -g typescript') before continuing." exit fi hash multirust 2>/dev/null if [ $? -ne 0 ]; then echo "Please install multirust with ('./install-multirust') before continuing." exit fi pushd . # Try using the typescript compiler (tsc) to compile UI echo "* Compiling Editor..." cd ui tsc if [ $? -ne 0 ]; then echo "Failed to compile editor, bailing." popd exit fi popd # If we aren't restarting, open the editor in the user's preferred browser if [[ "x$1" != "x--restart" ]]; then echo "* Opening $waitUrl" if [[ "$OSTYPE" == "darwin"* ]]; then open "$waitUrl" & else xdg-open "$waitUrl" & fi fi pushd . # Ensure rustc is updated echo "* Updating rust if necessary..." cd runtime multirust override nightly-2015-08-10 # Compile runtime server echo "* Compiling server... (This takes a while)" rustFlags="--release" if [[ "x$1" != "x--debug" ]]; then rustFlags="" fi RUST_BACKTRACE=1 cargo run --bin=server $rustFlags popd
Add single bash alias for docker system prune
alias dps="docker ps -a --format 'table {{.ID}} | {{.Status}} | {{.Names}}'" ## Make permanent tee -a .bashrc <<EOF alias dps="docker ps -a --format 'table {{.ID}}\t{{.Status}}\t{{.Names}}'" EOF
alias dps="docker ps -a --format 'table {{.ID}} | {{.Status}} | {{.Names}}'" alias dsp="docker system prune" ## Make permanent tee -a .bashrc <<EOF alias dps="docker ps -a --format 'table {{.ID}}\t{{.Status}}\t{{.Names}}'" alias dsp="docker system prune" EOF
Include explicit region in aws commands
#! /bin/bash VERSION=$1 PROFILE=$2 # Create new Elastic Beanstalk version EB_BUCKET=cml-ls-hubot DOCKERRUN_FILE=$VERSION-Dockerrun.aws.json sed "s/<TAG>/$VERSION/" < Dockerrun.aws.json.template > $DOCKERRUN_FILE aws s3 cp $DOCKERRUN_FILE s3://$EB_BUCKET/$DOCKERRUN_FILE $( if [ -n "${PROFILE}" ]; then echo "--profile $PROFILE"; fi ) aws elasticbeanstalk create-application-version --application-name ls-hubot \ --version-label $VERSION --source-bundle S3Bucket=$EB_BUCKET,S3Key=$DOCKERRUN_FILE $( if [ -n "${PROFILE}" ]; then echo "--profile $PROFILE"; fi ) # Update Elastic Beanstalk environment to new version aws elasticbeanstalk update-environment --environment-name ls-hubot-env \ --version-label $VERSION $( if [ -n "${PROFILE}" ]; then echo "--profile $PROFILE"; fi )
#! /bin/bash VERSION=$1 PROFILE=$2 # Create new Elastic Beanstalk version EB_BUCKET=cml-ls-hubot DOCKERRUN_FILE=$VERSION-Dockerrun.aws.json sed "s/<TAG>/$VERSION/" < Dockerrun.aws.json.template > $DOCKERRUN_FILE aws s3 cp $DOCKERRUN_FILE s3://$EB_BUCKET/$DOCKERRUN_FILE $( if [ -n "${PROFILE}" ]; then echo "--profile $PROFILE"; fi ) aws elasticbeanstalk create-application-version \ --application-name ls-hubot \ --region $AWS_REGION --version-label $VERSION \ --source-bundle S3Bucket=$EB_BUCKET,S3Key=$DOCKERRUN_FILE \ $( if [ -n "${PROFILE}" ]; then echo "--profile $PROFILE"; fi ) # Update Elastic Beanstalk environment to new version aws elasticbeanstalk update-environment --environment-name ls-hubot-env \ --version-label $VERSION \ --region $AWS_REGION $( if [ -n "${PROFILE}" ]; then echo "--profile $PROFILE"; fi )
Add check for recent deployment commits to tagging script
#!/usr/bin/env bash set -euo pipefail if [[ -z "$( git config user.signingkey )" ]]; then echo "$0: GPG signing key required." >&2 exit 2 fi repo_dir="$( cd $( dirname $0 )/.. && pwd )" deploy_dir="$( git config deploy.dir )" cd "$deploy_dir" deploy_commit_date="$( git show -s --format=%ci | awk '{print $1;}' )" deploy_commit_id="$( git rev-parse --short HEAD )" tag="deploy/$deploy_commit_date/$deploy_commit_id" cd "$repo_dir" git tag -s "$tag" -m "deployed" && git push --tags
#!/usr/bin/env bash set -euo pipefail # Check for GPG signing key if [[ -z "$( git config user.signingkey )" ]]; then printf "\n$0: GPG signing key required. See https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work\n" >&2 exit 2 fi # Check for deploy directory if [[ -z "$( git config deploy.dir )" ]]; then printf "\n$0: No deploy repository found. Set a deploy repo with:\n\n git config deploy.dir <FULL PATH TO DEPLOY REPO DIR>\n\n" >&2 exit 2 fi repo_dir="$( cd $( dirname $0 )/.. && pwd )" cd "$( git config deploy.dir )" # Check for deploy directory commit in past 2 hours if [[ -z "$( git log --since="2 hours ago" )" ]]; then printf "\nWARNING: The most recent deploy commit is:\n\n" printf "$( git log -1 )\n\n" printf "This isn't very recent. You may need to pull the most recent changes.\n\n" read -p "Continue anyway? (y/N) " -n 1 -r if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo exit 1 fi fi # Build the deployment tag deploy_commit_date="$( git show -s --format=%ci | awk '{print $1;}' )" deploy_commit_id="$( git rev-parse --short HEAD )" tag="deploy/$deploy_commit_date/$deploy_commit_id" # Tag the latest code repo commit with it & push tags cd "$repo_dir" git tag -s "$tag" -m "deployed" && git push --tags printf "Applied new tag: $tag"
Use `subtitle` option for notification
#!/bin/bash BREW=$(which brew) TERMINAL_NOTIFIER=$(which terminal-notifier) $BREW update > /dev/null 2>&1 outdated=$($BREW outdated --quiet) pinned=$($BREW list --pinned) updatable=$(comm -1 -3 <(echo "$pinned") <(echo "$outdated")) if [ -n "$updatable" ] && [ -e "$TERMINAL_NOTIFIER" ]; then message="The following formulae are outdated: $updatable" $TERMINAL_NOTIFIER -sender com.apple.Terminal \ -title "Homebrew Updates Available" -message "$message" fi
#!/bin/bash BREW=$(which brew) TERMINAL_NOTIFIER=$(which terminal-notifier) $BREW update > /dev/null 2>&1 outdated=$($BREW outdated --quiet) pinned=$($BREW list --pinned) updatable=$(comm -1 -3 <(echo "$pinned") <(echo "$outdated")) if [ -n "$updatable" ] && [ -e "$TERMINAL_NOTIFIER" ]; then $TERMINAL_NOTIFIER -sender com.apple.Terminal \ -title "Homebrew Updates Available" \ -subtitle "The following formulae are outdated:" \ -message "$updatable" fi
Send the buildkite agent log to cloudwatch
#!/bin/bash -eu sudo yum install -y awslogs mkdir -p /var/awslogs/state cat << EOF | sudo tee /etc/awslogs/awslogs.conf [general] state_file = /var/awslogs/state/agent-state [/var/log/messages] file = /var/log/messages log_group_name = /var/log/messages log_stream_name = {instance_id} datetime_format = %b %d %H:%M:%S EOF sudo chkconfig awslogs on
#!/bin/bash -eu sudo yum install -y awslogs mkdir -p /var/awslogs/state cat << EOF | sudo tee /etc/awslogs/awslogs.conf [general] state_file = /var/awslogs/state/agent-state [/var/log/messages] file = /var/log/messages log_group_name = /var/log/messages log_stream_name = {instance_id} datetime_format = %b %d %H:%M:%S [/var/log/buildkite-agent.log] file = /var/log/buildkite-agent.log log_group_name = /var/log/buildkite-agent.log log_stream_name = {instance_id} datetime_format = %Y-%m-%d %H:%M:%S EOF sudo chkconfig awslogs on
Add umount in add-ec2-disk script
#!/bin/sh -xe PARTITION="xvdb" MOUNTPOINT="/mnt" if grep $PARTITION /proc/partitions; then sudo mkfs.ext4 -F /dev/$PARTITION [ -d $MOUNTPOINT ] || sudo mkdir $MOUNTPOINT sudo mount -o noatime,nodiratime,barrier=0 /dev/$PARTITION $MOUNTPOINT sudo mkdir -m 1777 $MOUNTPOINT/tmp sudo sh -c "echo \"export TMPDIR=$MOUNTPOINT/tmp\" >> /etc/profile" . /etc/profile echo "Done Setting Up Data Disk." sudo mount -o remount,noatime,nodiratime,barrier=0 /dev/xvda1 / echo "Remounted / with noatime,nodiratime,barrier=0" else echo "Data Partition Not Found!" exit 1 fi
#!/bin/sh -xe PARTITION="xvdb" MOUNTPOINT="/mnt" if grep $PARTITION /proc/partitions; then sudo umount $MOUNTPOINT || /bin/true sudo mkfs.ext4 -F /dev/$PARTITION [ -d $MOUNTPOINT ] || sudo mkdir $MOUNTPOINT sudo mount -o noatime,nodiratime,barrier=0 /dev/$PARTITION $MOUNTPOINT sudo mkdir -m 1777 $MOUNTPOINT/tmp sudo sh -c "echo \"export TMPDIR=$MOUNTPOINT/tmp\" >> /etc/profile" . /etc/profile echo "Done Setting Up Data Disk." sudo mount -o remount,noatime,nodiratime,barrier=0 /dev/xvda1 / echo "Remounted / with noatime,nodiratime,barrier=0" else echo "Data Partition Not Found!" exit 1 fi
Hide the `Terminal` line marks
#!/usr/bin/env bash cd "$(dirname "${BASH_SOURCE[0]}")" \ && . "../../utils.sh" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - print_in_purple "\n Terminal\n\n" execute "defaults write com.apple.terminal FocusFollowsMouse -string true" \ "Make the focus automatically follow the mouse" execute "defaults write com.apple.terminal SecureKeyboardEntry -bool true" \ "Enable 'Secure Keyboard Entry'" execute "defaults write com.apple.terminal StringEncodings -array 4" \ "Only use UTF-8" execute "./set_terminal_theme.applescript" \ "Set custom terminal theme"
#!/usr/bin/env bash cd "$(dirname "${BASH_SOURCE[0]}")" \ && . "../../utils.sh" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - print_in_purple "\n Terminal\n\n" execute "defaults write com.apple.terminal FocusFollowsMouse -string true" \ "Make the focus automatically follow the mouse" execute "defaults write com.apple.terminal SecureKeyboardEntry -bool true" \ "Enable 'Secure Keyboard Entry'" execute "defaults write com.apple.Terminal ShowLineMarks -int 0" \ "Hide line marks" execute "defaults write com.apple.terminal StringEncodings -array 4" \ "Only use UTF-8" execute "./set_terminal_theme.applescript" \ "Set custom terminal theme"
Update index location for Google Cloud Debugger
#!/usr/bin/env bash set -e -o pipefail source $(dirname "$0")/common.sh cd cloud-debug-java chmod +x build.sh ./build.sh VERSION=$(git describe --tags) VERSION=${VERSION##v} INDEX_PATH="/google-stackdriver-debugger/index.yml" UPLOAD_PATH="/google-stackdriver-debugger/$PLATFORM/x86_64/google-stackdriver-debugger-$VERSION.tar.gz" transfer_to_s3 "cdbg_java_agent_gce.tar.gz" $UPLOAD_PATH update_index $INDEX_PATH $VERSION $UPLOAD_PATH invalidate_cache $INDEX_PATH $UPLOAD_PATH
#!/usr/bin/env bash set -e -o pipefail source $(dirname "$0")/common.sh cd cloud-debug-java chmod +x build.sh ./build.sh VERSION=$(git describe --tags) VERSION=${VERSION##v} INDEX_PATH="/google-stackdriver-debugger/$PLATFORM/x86_64/index.yml" UPLOAD_PATH="/google-stackdriver-debugger/$PLATFORM/x86_64/google-stackdriver-debugger-$VERSION.tar.gz" transfer_to_s3 "cdbg_java_agent_gce.tar.gz" $UPLOAD_PATH update_index $INDEX_PATH $VERSION $UPLOAD_PATH invalidate_cache $INDEX_PATH $UPLOAD_PATH
Add git pull to the scripts
#!/bin/bash # clean the evn source ./setenv.sh cd $CRAZY_MONKEY_HOME && /bin/bash ./reset_vpn.sh # Git update and build #echo "[Crazy Monkey] Update the crazy monkey code..." #cd $CRAZY_MONKEY_HOME && git pull echo "[Crazy Monkey] Build the project..." cd $CRAZY_MONKEY_HOME && $ANT_HOME/bin/ant # Clean the env cd $CRAZY_MONKEY_HOME && /bin/bash ./stop.sh # Run the vpn client cd $VPN_CLINET_HOME && ./autorun MAC_ADDRESS=`/sbin/ifconfig $NETWORK_INTERFACE | grep HWaddr | awk '{print $5}'` # Run the testing $JAVA_HOME/bin/java -jar $CRAZY_MONKEY_HOME/crazy-monkey-0.1.jar $MAC_ADDRESS $EMULATOR_TYPE
#!/bin/bash # clean the evn source ./setenv.sh cd $CRAZY_MONKEY_HOME && /bin/bash ./reset_vpn.sh # Git update and build echo "[Crazy Monkey] Update the crazy monkey code..." cd $CRAZY_MONKEY_HOME && git pull echo "[Crazy Monkey] Build the project..." cd $CRAZY_MONKEY_HOME && $ANT_HOME/bin/ant # Clean the env cd $CRAZY_MONKEY_HOME && /bin/bash ./stop.sh # Run the vpn client cd $VPN_CLINET_HOME && ./autorun MAC_ADDRESS=`/sbin/ifconfig $NETWORK_INTERFACE | grep HWaddr | awk '{print $5}'` # Run the testing $JAVA_HOME/bin/java -jar $CRAZY_MONKEY_HOME/crazy-monkey-0.1.jar $MAC_ADDRESS $EMULATOR_TYPE
Fix location of iTunes directory
#!/bin/sh cd '/Volumes/Media/Music/iTunes/iTunes Music/Morning Automation/Morning Automation' long_speach () { TIME=`date +%H:%M` DATE=`date +'%A %B %d, %Y'` echo "Good morning, time to wake up! It's $TIME on $DATE." > script.txt echo >> script.txt echo "Your custom weather forecast for Lafayette Colorado." >> script.txt echo >> script.txt sh ~/Develop/pmade/rc/macosx/scripts/weather/weather.sh >> script.txt echo >> script.txt #echo "Shanna, if you can hear me, Peter wanted me to tell you that he loves you." >> script.txt } short_speach () { TIME=`date +%H:%M` echo "The time is now $TIME" > script.txt } if [ x$1 = xtime ]; then short_speach else long_speach fi say -f script.txt -o 'Morning Time.aiff' osascript ~/Develop/pmade/rc/macosx/scripts/iTunes/mobile-speakers.applescript cat <<EOF | osascript tell application "iTunes" set the_volume to (get sound volume) repeat while the_volume > 0 set i to the_volume - 5 if i < 0 then set i to 0 set sound volume to i set the_volume to i delay 1 end repeat stop set sound volume to 70 play playlist "Morning Energy" end tell EOF
#!/bin/sh cd '/Volumes/Media/iTunes/Music/Morning Automation/Morning Automation' long_speach () { TIME=`date +%H:%M` DATE=`date +'%A %B %d, %Y'` echo "Good morning, time to wake up! It's $TIME on $DATE." > script.txt echo >> script.txt echo "Your custom weather forecast for Lafayette Colorado." >> script.txt echo >> script.txt sh ~/Develop/pmade/rc/macosx/scripts/weather/weather.sh >> script.txt echo >> script.txt #echo "Shanna, if you can hear me, Peter wanted me to tell you that he loves you." >> script.txt } short_speach () { TIME=`date +%H:%M` echo "The time is now $TIME" > script.txt } if [ x$1 = xtime ]; then short_speach else long_speach fi say -f script.txt -o 'Morning Time.aiff' osascript ~/Develop/pmade/rc/macosx/scripts/iTunes/mobile-speakers.applescript cat <<EOF | osascript tell application "iTunes" set the_volume to (get sound volume) repeat while the_volume > 0 set i to the_volume - 5 if i < 0 then set i to 0 set sound volume to i set the_volume to i delay 1 end repeat stop set sound volume to 70 play playlist "Morning Energy" end tell EOF
Remove corporate proxy specific steps from namespace creation.
#!/usr/bin/env bash ########################################################################### #Script Name : create-minikube-example.sh #Description : Creates and runs new minikube instance using preproxy #Args : Not supported #Bash Version : GNU bash, version 3.x.XX ########################################################################### set -o errexit set -eo pipefail set -o nounset #set -o xtrace RED='\033[0;31m' NC='\033[0m' # No Color echo -e "Creating minikube cluster locally ${RED}(takes up to 10 minutes)${NC}" minikube delete || echo "Ignoring delete for non existed minikube cluster" minikube --vm-driver virtualbox --memory 8192 --cpus 4 start --insecure-registry=registry-all.docker.ing.net hostIp=$(minikube ssh "route -n | grep ^0.0.0.0 | awk '{ print \$2 }'") #Removes last \r symbol hostIp=${hostIp%?} dockerVars="--insecure-registry=registry-all.docker.ing.net --docker-env http_proxy=${hostIp}:3128 --docker-env https_proxy=${hostIp}:3128" minikube stop minikube --vm-driver virtualbox --memory 8192 --cpus 4 start --insecure-registry=registry-all.docker.ing.net ${dockerVars} kubectl api-resources
#!/usr/bin/env bash ########################################################################### #Script Name : create-minikube-example.sh #Description : Creates and runs new minikube instance using preproxy #Args : Not supported #Bash Version : GNU bash, version 3.x.XX ########################################################################### set -o errexit set -eo pipefail set -o nounset #set -o xtrace RED='\033[0;31m' NC='\033[0m' # No Color echo -e "Creating minikube cluster locally ${RED}(takes up to 10 minutes)${NC}" minikube delete || echo "Ignoring delete for non existed minikube cluster" minikube --vm-driver virtualbox --memory 8192 --cpus 4 start kubectl api-resources
Handle case when running on linux for getting dircolors
# set default umask umask 002 # load (optional) percol if exists percol; then function percol_select_history() { local tac exists gtac && tac="gtac" || { exists tac && tac="tac" || { tac="tail -r" } } BUFFER=$(fc -l -n 1 | eval $tac | percol --query "$LBUFFER") CURSOR=$#BUFFER # move cursor zle -R -c # refresh } zle -N percol_select_history bindkey '^R' percol_select_history fi if exists fuck; then eval $(thefuck --alias) fi if exists fasd; then eval $(fasd --init auto) fi [[ -s $HOME/dot-files-forest/LS_COLORS/LS_COLORS ]] && eval $(dircolors -b $HOME/dot-files-forest/LS_COLORS/LS_COLORS)
# set default umask umask 002 # load (optional) percol if exists percol; then function percol_select_history() { local tac exists gtac && tac="gtac" || { exists tac && tac="tac" || { tac="tail -r" } } BUFFER=$(fc -l -n 1 | eval $tac | percol --query "$LBUFFER") CURSOR=$#BUFFER # move cursor zle -R -c # refresh } zle -N percol_select_history bindkey '^R' percol_select_history fi if exists fuck; then eval $(thefuck --alias) fi if exists fasd; then eval $(fasd --init auto) fi if [[ "$OS_IS_LINUX" = true ]]; then alias gdircolors=dircolrs fi [[ -s $HOME/dot-files-forest/LS_COLORS/LS_COLORS ]] && eval $(gdircolors -b $HOME/dot-files-forest/LS_COLORS/LS_COLORS)
Use "${TMP:?}" to ensure this never expands to /* .
#!/usr/bin/env bash setup() { export TMP="$BATS_TEST_DIRNAME/tmp" export NAGIOS_PLUGINS_DIRECTORY="$TMP/../.." export PATH="$NAGIOS_PLUGINS_DIRECTORY:$TMP/stub:$PATH" NAGIOS_BASH_SCRIPTS=$(find "$NAGIOS_PLUGINS_DIRECTORY" -maxdepth 1 -type f -name '*.sh' -print) export NAGIOS_BASH_SCRIPTS OS="$(uname)" export $OS } teardown() { [[ -d "$TMP" ]] && rm -rf "$TMP"/* } # http://www.nherson.com/blog/2014/01/13/stubbing-system-executables-with-bats stub() { exit_code=$3 [[ -z $exit_code ]] && exit_code=0 mkdir -p "$BATS_TEST_DIRNAME/tmp/stub" cat <<STUB > "$BATS_TEST_DIRNAME/tmp/stub/$1" #!/usr/bin/env bash echo '$2' exit $exit_code STUB chmod +x "$BATS_TEST_DIRNAME/tmp/stub/$1" }
#!/usr/bin/env bash setup() { export TMP="$BATS_TEST_DIRNAME/tmp" export NAGIOS_PLUGINS_DIRECTORY="$TMP/../.." export PATH="$NAGIOS_PLUGINS_DIRECTORY:$TMP/stub:$PATH" NAGIOS_BASH_SCRIPTS=$(find "$NAGIOS_PLUGINS_DIRECTORY" -maxdepth 1 -type f -name '*.sh' -print) export NAGIOS_BASH_SCRIPTS OS="$(uname)" export $OS } teardown() { [[ -d "$TMP" ]] && rm -rf "${TMP:?}"/* } # http://www.nherson.com/blog/2014/01/13/stubbing-system-executables-with-bats stub() { exit_code=$3 [[ -z $exit_code ]] && exit_code=0 mkdir -p "$BATS_TEST_DIRNAME/tmp/stub" cat <<STUB > "$BATS_TEST_DIRNAME/tmp/stub/$1" #!/usr/bin/env bash echo '$2' exit $exit_code STUB chmod +x "$BATS_TEST_DIRNAME/tmp/stub/$1" }
Check permissions on private keys after updating repo
check () { git fetch changes=$(git diff) if [ "$changes" != "" ]; then echo 'YOU HAVE UNCOMMITTED CHANGES'; exit fi changes=$(git ls-files --others --exclude-standard) if [ "$changes" != "" ]; then echo 'YOU HAVE UNCOMMITTED FILES'; exit fi changes=$(git diff HEAD..FETCH_HEAD) if [ "$changes" != "" ] ; then git pull --quiet echo 'Dotfiles updated' fi } # Check if there are updates to this dotfiles repo cd ~/.dotfiles check # Check if there are updates to ssh if [ -d ~/.ssh/.git ]; then cd ~/.ssh check fi
check () { git fetch changes=$(git diff) if [ "$changes" != "" ]; then echo 'YOU HAVE UNCOMMITTED CHANGES'; exit fi changes=$(git ls-files --others --exclude-standard) if [ "$changes" != "" ]; then echo 'YOU HAVE UNCOMMITTED FILES'; exit fi changes=$(git diff HEAD..FETCH_HEAD) if [ "$changes" != "" ] ; then git pull --quiet ~/.dotfiles/scripts/chmod-private-keys.sh echo 'Dotfiles updated' fi } # Check if there are updates to this dotfiles repo cd ~/.dotfiles check # Check if there are updates to ssh if [ -d ~/.ssh/.git ]; then cd ~/.ssh check fi
Update 1.3.3 to be "1.3", "1", and "latest" (whoops)
#!/bin/bash set -e declare -A aliases aliases=( [1.3.2]='1.3 1 latest' [1.2.2]='1.2' ) cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" versions=( */ ) versions=( "${versions[@]%/}" ) url='git://github.com/docker-library/golang' echo '# maintainer: InfoSiftr <github@infosiftr.com> (@infosiftr)' echo '# maintainer: Johan Euphrosine <proppy@google.com> (@proppy)' for version in "${versions[@]}"; do commit="$(git log -1 --format='format:%H' "$version")" #fullVersion="$(grep -m1 'ENV GOLANG_VERSION ' "$version/Dockerfile" | cut -d' ' -f3)" versionAliases=( $version ${aliases[$version]} ) echo for va in "${versionAliases[@]}"; do echo "$va: ${url}@${commit} $version" done for variant in onbuild cross; do commit="$(git log -1 --format='format:%H' "$version/$variant")" echo for va in "${versionAliases[@]}"; do if [ "$va" = 'latest' ]; then va="$variant" else va="$va-$variant" fi echo "$va: ${url}@${commit} $version/$variant" done done done
#!/bin/bash set -e declare -A aliases aliases=( [1.3.3]='1.3 1 latest' [1.2.2]='1.2' ) cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" versions=( */ ) versions=( "${versions[@]%/}" ) url='git://github.com/docker-library/golang' echo '# maintainer: InfoSiftr <github@infosiftr.com> (@infosiftr)' echo '# maintainer: Johan Euphrosine <proppy@google.com> (@proppy)' for version in "${versions[@]}"; do commit="$(git log -1 --format='format:%H' "$version")" #fullVersion="$(grep -m1 'ENV GOLANG_VERSION ' "$version/Dockerfile" | cut -d' ' -f3)" versionAliases=( $version ${aliases[$version]} ) echo for va in "${versionAliases[@]}"; do echo "$va: ${url}@${commit} $version" done for variant in onbuild cross; do commit="$(git log -1 --format='format:%H' "$version/$variant")" echo for va in "${versionAliases[@]}"; do if [ "$va" = 'latest' ]; then va="$variant" else va="$va-$variant" fi echo "$va: ${url}@${commit} $version/$variant" done done done
Change chmod 777 of /tmp to fix permission
#!/bin/bash -e VERSION=5.6.23 # Preconfiguration setup sudo apt-get install -y cmake libncurses5-dev sudo groupadd mysql sudo useradd -g mysql mysql # Install MySQL 5.6 sudo wget http://downloads.mysql.com/archives/get/file/mysql-$VERSION.tar.gz sudo tar xzf mysql-$VERSION.tar.gz && sudo rm -f mysql-$VERSION.tar.gz cd mysql-$VERSION sudo cmake . sudo make && sudo make install # Postinstallation setup cd /usr/local/mysql sudo chown -R mysql . sudo chgrp -R mysql . sudo scripts/mysql_install_db --user=mysql sudo chown -R root . sudo chown -R mysql data sudo cp support-files/mysql.server /etc/init.d/mysql echo 'export PATH=$PATH:/usr/local/mysql/bin' >> $HOME/.bashrc
#!/bin/bash -e VERSION=5.6.23 # Preconfiguration setup sudo apt-get install -y cmake libncurses5-dev sudo groupadd mysql sudo useradd -g mysql mysql sudo chmod 0777 /tmp # Install MySQL 5.6 sudo wget http://downloads.mysql.com/archives/get/file/mysql-$VERSION.tar.gz sudo tar xzf mysql-$VERSION.tar.gz && sudo rm -f mysql-$VERSION.tar.gz cd mysql-$VERSION sudo cmake . sudo make && sudo make install # Postinstallation setup cd /usr/local/mysql sudo chown -R mysql . sudo chgrp -R mysql . sudo scripts/mysql_install_db --user=mysql sudo chown -R root . sudo chown -R mysql data sudo cp support-files/mysql.server /etc/init.d/mysql echo 'export PATH=$PATH:/usr/local/mysql/bin' >> $HOME/.bashrc
Use new config update option for aimctl
#!/bin/sh set -e set -x PREFIX=/usr/local AIMDIR=/usr/local/etc/aim AIMLOCALDIR=/usr/local/etc/aim-local AIMCONF=${AIMDIR}/aim.conf AIMLOCALCONF=${AIMLOCALDIR}/aim-local.conf AIMCTL=/usr/bin/aimctl AIMAID=/usr/bin/aim-aid mkdir -p "${AIMDIR}" cat <<EOF > "${AIMCONF}" [aim] aim_store = k8s [aim_k8s] k8s_config_path = /usr/local/etc/kubeconfig k8s_namespace = kube-system [apic] # Hostname:port list of APIC controllers apic_hosts = ${APIC_HOSTS} # Username for the APIC controller apic_username = ${APIC_USERNAME} # Password for the APIC controller apic_password = ${APIC_PASSWORD} # Whether use SSl for connecting to the APIC controller or not apic_use_ssl = True scope_names = False verify_ssl_certificate = False apic_model = apicapi.db.noop_manager EOF ${AIMCTL} -c "${AIMCONF}" -c "${AIMLOCALCONF}" config replace echo Starting Aid exec ${AIMAID} --config-dir "${AIMDIR}" --config-dir "${AIMLOCALDIR}"
#!/bin/sh set -e set -x PREFIX=/usr/local AIMDIR=/usr/local/etc/aim AIMLOCALDIR=/usr/local/etc/aim-local AIMCONF=${AIMDIR}/aim.conf AIMLOCALCONF=${AIMLOCALDIR}/aim-local.conf AIMCTL=/usr/bin/aimctl AIMAID=/usr/bin/aim-aid mkdir -p "${AIMDIR}" cat <<EOF > "${AIMCONF}" [aim] aim_store = k8s [aim_k8s] k8s_config_path = /usr/local/etc/kubeconfig k8s_namespace = kube-system [apic] # Hostname:port list of APIC controllers apic_hosts = ${APIC_HOSTS} # Username for the APIC controller apic_username = ${APIC_USERNAME} # Password for the APIC controller apic_password = ${APIC_PASSWORD} # Whether use SSl for connecting to the APIC controller or not apic_use_ssl = True scope_names = False verify_ssl_certificate = False apic_model = apicapi.db.noop_manager EOF ${AIMCTL} -c "${AIMCONF}" -c "${AIMLOCALCONF}" config update echo Starting Aid exec ${AIMAID} --config-dir "${AIMDIR}" --config-dir "${AIMLOCALDIR}"
Remove `DOCKER_MACHINE_CREATE` variable for readability
#!/bin/bash -e DOCKER_MACHINE_DRIVER=${DOCKER_MACHINE_DRIVER:-"--driver virtualbox"} DOCKER_MACHINE_CREATE="docker-machine create ${DOCKER_MACHINE_DRIVER}" ## I am using curl to create tokens as I find it the easiest, otherwise ## one needs to either download or compile a `docker-swarm` binary or ## have a Docker daemon running DOCKER_SWARM_CREATE=${DOCKER_SWARM_CREATE:-"curl -XPOST https://discovery-stage.hub.docker.com/v1/clusters"} swarm_flags="--swarm --swarm-discovery=token://$(${DOCKER_SWARM_CREATE})" for i in $(seq 3) ; do if [ ${i} = 1 ] ; then ## The first machine shall be the Swarm master $DOCKER_MACHINE_CREATE \ ${swarm_flags} \ --swarm-master \ "weave-${i}" else ## The rest of machines are Swarm slaves $DOCKER_MACHINE_CREATE \ ${swarm_flags} \ "weave-${i}" fi done
#!/bin/bash -e DOCKER_MACHINE_DRIVER=${DOCKER_MACHINE_DRIVER:-"--driver virtualbox"} ## I am using curl to create tokens as I find it the easiest, otherwise ## one needs to either download or compile a `docker-swarm` binary or ## have a Docker daemon running DOCKER_SWARM_CREATE=${DOCKER_SWARM_CREATE:-"curl -XPOST https://discovery-stage.hub.docker.com/v1/clusters"} swarm_flags="--swarm --swarm-discovery=token://$(${DOCKER_SWARM_CREATE})" for i in $(seq 3) ; do if [ ${i} = 1 ] ; then ## The first machine shall be the Swarm master docker-machine create \ ${DOCKER_MACHINE_DRIVER} \ ${swarm_flags} \ --swarm-master \ "weave-${i}" else ## The rest of machines are Swarm slaves docker-machine create \ ${DOCKER_MACHINE_DRIVER} \ ${swarm_flags} \ "weave-${i}" fi done
Exclude .tox from paths scanned for urlopen
#!/bin/sh BASEDIR=${1-"."} URLLIB_USERS=$(find "$BASEDIR" -name '*.py' -exec grep -H urlopen \{\} \;) URLLIB_USERS=$(echo "$URLLIB_USERS" | sed '/\(\n\|lib\/ansible\/module_utils\/urls.py\|lib\/ansible\/compat\/six\/_six.py\)/d') if test -n "$URLLIB_USERS" ; then printf "$URLLIB_USERS" exit 1 else exit 0 fi
#!/bin/sh BASEDIR=${1-"."} URLLIB_USERS=$(find "$BASEDIR" -name '*.py' -exec grep -H urlopen \{\} \;) URLLIB_USERS=$(echo "$URLLIB_USERS" | sed '/\(\n\|lib\/ansible\/module_utils\/urls.py\|lib\/ansible\/compat\/six\/_six.py\|.tox\)/d') if test -n "$URLLIB_USERS" ; then printf "$URLLIB_USERS" exit 1 else exit 0 fi
Update randoop version to 2.1.4
#!/bin/bash # This script downloads Randoop. CWD="$( cd "$(dirname "$(readlink "$0" || printf %s "$0")")" pwd -P )" rm -f "$CWD/randoop.jar" wget "https://github.com/mernst/randoop/releases/download/v1.3.6/randoop-1.3.6.jar" -O "$CWD/randoop.jar" chmod +x "$CWD/randoop.jar" echo "1.3.6" > "$CWD/VERSION"
#!/bin/bash # This script downloads Randoop. VERSION=2.1.4 CWD="$( cd "$(dirname "$(readlink "$0" || printf %s "$0")")" pwd -P )" rm -f "$CWD/randoop.jar" wget "https://github.com/mernst/randoop/releases/download/v$VERSION/randoop-$VERSION.jar" -O "$CWD/randoop.jar" chmod +x "$CWD/randoop.jar" echo "$VERSION" > "$CWD/VERSION"
Use flaky to manage tests that need to be rerun
#!/bin/bash set -e cd testmodel/webapp/selenium nosetests --verbose
#!/bin/bash set -e cd testmodel/webapp/selenium nosetests --verbose --with-flaky
Add go aliases for cross compiling
export GOPATH=$HOME/golang mkdir -p "$GOPATH" ,path-add ~/golang/bin # Generally I prob won't use <= 1.7 now, but I'll keep this just in case. export GO15VENDOREXPERIMENT=1
export GOPATH=$HOME/golang mkdir -p "$GOPATH" ,path-add ~/golang/bin # Generally I prob won't use <= 1.7 now, but I'll keep this just in case. export GO15VENDOREXPERIMENT=1 alias golinux="GOOS=linux GOARCH=amd64 go" alias godarwin="GOOS=darwin GOARCH=amd64 go"
Add new dataset to track_meta
#!/bin/bash set -e if [ -d input ] then exit 0 fi # Setup Datsets mkdir -p input DATASETS=("ryanholbrook/stanford-cars-for-learn" "ryanholbrook/cv-course-models" "ryanholbrook/computer-vision-resources") for dataset in "${DATASETS[@]}" do name=`echo $dataset | cut -d '/' -f 2` dest="input/$name" mkdir -p $dest kaggle d download -p $dest --unzip $dataset done
#!/bin/bash set -e if [ -d input ] then exit 0 fi # Setup Datsets mkdir -p input DATASETS=("ryanholbrook/car-or-truck" "ryanholbrook/cv-course-models" "ryanholbrook/computer-vision-resources") for dataset in "${DATASETS[@]}" do name=`echo $dataset | cut -d '/' -f 2` dest="input/$name" mkdir -p $dest kaggle d download -p $dest --unzip $dataset done
Allow script to copy test-data into live local server for manual testing
#!/bin/bash set -e readonly MY_DIR="$( cd "$( dirname "${0}" )" && pwd )" # You cannot docker cp to a tmpfs, so tar-piping instead... readonly CONTAINER=test-web-saver readonly SRC_PATH=${MY_DIR}/../test/data/cyber-dojo readonly DEST_PATH=/cyber-dojo cd ${SRC_PATH} \ && tar -cv . \ | docker exec -i ${CONTAINER} tar x -C ${DEST_PATH}
#!/bin/bash set -e readonly MY_DIR="$( cd "$( dirname "${0}" )" && pwd )" # You cannot docker cp to a tmpfs, so tar-piping instead... readonly CONTAINER=${1:-test-web-saver} readonly SRC_PATH=${MY_DIR}/../test/data/cyber-dojo readonly DEST_PATH=/cyber-dojo cd ${SRC_PATH} \ && tar -cv . \ | docker exec -i ${CONTAINER} tar x -C ${DEST_PATH}
Remove unneeded compile flags from imagequant
#!/bin/bash set -e export OPTIMIZE="-Os" export LDFLAGS="${OPTIMIZE}" export CFLAGS="${OPTIMIZE}" export CPPFLAGS="${OPTIMIZE}" echo "=============================================" echo "Compiling libimagequant" echo "=============================================" ( emcc \ --bind \ ${OPTIMIZE} \ --closure 1 \ -s ALLOW_MEMORY_GROWTH=1 \ -s MODULARIZE=1 \ -s 'EXPORT_NAME="imagequant"' \ -I node_modules/libimagequant \ --std=c99 \ -c \ node_modules/libimagequant/{libimagequant,pam,mediancut,blur,mempool,kmeans,nearest}.c ) echo "=============================================" echo "Compiling wasm module" echo "=============================================" ( emcc \ --bind \ ${OPTIMIZE} \ --closure 1 \ -s ALLOW_MEMORY_GROWTH=1 \ -s MODULARIZE=1 \ -s 'EXPORT_NAME="imagequant"' \ -I node_modules/libimagequant \ -o ./imagequant.js \ --std=c++11 *.o \ -x c++ \ imagequant.cpp ) echo "=============================================" echo "Compiling wasm module done" echo "=============================================" echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo "Did you update your docker image?" echo "Run \`docker pull trzeci/emscripten\`" echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
#!/bin/bash set -e export OPTIMIZE="-Os" export LDFLAGS="${OPTIMIZE}" export CFLAGS="${OPTIMIZE}" export CPPFLAGS="${OPTIMIZE}" echo "=============================================" echo "Compiling libimagequant" echo "=============================================" ( emcc \ ${OPTIMIZE} \ -I node_modules/libimagequant \ --std=c99 \ -c \ node_modules/libimagequant/{libimagequant,pam,mediancut,blur,mempool,kmeans,nearest}.c ) echo "=============================================" echo "Compiling wasm module" echo "=============================================" ( emcc \ --bind \ ${OPTIMIZE} \ --closure 1 \ -s ALLOW_MEMORY_GROWTH=1 \ -s MODULARIZE=1 \ -s 'EXPORT_NAME="imagequant"' \ -I node_modules/libimagequant \ -o ./imagequant.js \ --std=c++11 *.o \ -x c++ \ imagequant.cpp ) echo "=============================================" echo "Compiling wasm module done" echo "=============================================" echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo "Did you update your docker image?" echo "Run \`docker pull trzeci/emscripten\`" echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
Fix symfony command completion 'permission denied'
# symfony basic command completion _symfony_get_command_list () { ./symfony | sed "1,/Available tasks/d" | awk 'BEGIN { cat=null; } /^[A-Za-z]+$/ { cat = $1; } /^ :[a-z]+/ { print cat $1; }' } _symfony () { if [ -f symfony ]; then compadd `_symfony_get_command_list` fi } compdef _symfony symfony
# symfony basic command completion _symfony_get_command_list () { php symfony | sed "1,/Available tasks/d" | awk 'BEGIN { cat=null; } /^[A-Za-z]+$/ { cat = $1; } /^ :[a-z]+/ { print cat $1; }' } _symfony () { if [ -f symfony ]; then compadd `_symfony_get_command_list` fi } compdef _symfony symfony
Improve the docker script a bit
BRANCH=$1 J_FLAG=$2 BUILD_SCRIPT=/usr/bin/build-clazy.sh if [ -z "$1" ] then BRANCH="master" fi docker run -i -t iamsergio/clazy-ubuntu-14.04 sh $BUILD_SCRIPT $BRANCH $J_FLAG && \ docker run -i -t iamsergio/clazy-ubuntu-15.10 sh $BUILD_SCRIPT $BRANCH $J_FLAG && \ docker run -i -t iamsergio/clazy-ubuntu-16.04 sh $BUILD_SCRIPT $BRANCH $J_FLAG && \ docker run -i -t iamsergio/clazy-opensuse-tumbleweed sh $BUILD_SCRIPT $BRANCH $J_FLAG && \ docker run -i -t iamsergio/clazy-archlinux sh $BUILD_SCRIPT $BRANCH $J_FLAG
BRANCH=$1 J_FLAG=$2 BUILD_SCRIPT=/usr/bin/build-clazy.sh if [ -z "$1" ] then BRANCH="master" fi function run_test { echo "Testing $1..." docker run -i -t iamsergio/clazy-$1 sh $BUILD_SCRIPT $BRANCH $J_FLAG &> clazy-$1.log } run_test ubuntu-14.04 run_test ubuntu-15.10 run_test ubuntu-16.04 run_test pensuse-tumbleweed run_test archlinux
Optimize the script so not as many password prompts
ssh -t root@$1 'apt-get update && \ apt-get upgrade -y && \ apt-get install -y -q curl git htop vim && \ adduser deployer --gecos "" && \ adduser deployer sudo' ssh -t deployer@$1 'ssh-keygen' scp ~/.ssh/id_rsa.pub deployer@$1:"~/.ssh/authorized_keys"
ssh -t root@$1 'apt-get update && \ apt-get upgrade -y && \ apt-get install -y -q curl git htop vim && \ adduser deployer --gecos "" && \ adduser deployer sudo && \ mkdir /home/deployer/.ssh && \ cp /root/.ssh/authorized_keys /home/deployer/.ssh/ && \ chown -R deployer:deployer /home/deployer/.ssh && \ chmod 600 /home/deployer/.ssh/authorized_keys && \ chmod 700 /home/deployer/.ssh'
Add _smugmug_cache to things that get purged on RESET
#!/bin/bash # Only deploy if not PR if [ $TRAVIS_PULL_REQUEST = "false" ] then # cleanup rm -rf gh-pages git clone -b gh-pages https://${GH_TOKEN}@github.com/newtheatre/history-project.git gh-pages if [ $RESET = "true" ] then rm -rf gh-pages/* fi # copy generated HTML site to built branch cp -R _site/* gh-pages # commit and push generated content to built branch # since repository was cloned in write mode with token auth - we can push there cd gh-pages git config user.email "webmaster@newtheatre.org.uk" git config user.name "ntbot" git add -A . git commit -a -m "Travis Build $TRAVIS_BUILD_NUMBER" git push --quiet origin gh-pages > /dev/null 2>&1 # Hiding all the output from git push command, to prevent token leak. fi
#!/bin/bash # Only deploy if not PR if [ $TRAVIS_PULL_REQUEST = "false" ] then # cleanup rm -rf gh-pages git clone -b gh-pages https://${GH_TOKEN}@github.com/newtheatre/history-project.git gh-pages if [ $RESET = "true" ] then rm -rf gh-pages/* rm -rf _smugmug_cache fi # copy generated HTML site to built branch cp -R _site/* gh-pages # commit and push generated content to built branch # since repository was cloned in write mode with token auth - we can push there cd gh-pages git config user.email "webmaster@newtheatre.org.uk" git config user.name "ntbot" git add -A . git commit -a -m "Travis Build $TRAVIS_BUILD_NUMBER" git push --quiet origin gh-pages > /dev/null 2>&1 # Hiding all the output from git push command, to prevent token leak. fi
Use the default device instead the running one
#!/bin/sh # use PulseAudio to easly set the volume up/down/mute if [ $# -ne 1 ]; then echo 'Usage: mute|-x[%|dB]|+x[%|dB]' exit 0 fi device=$(pactl list short sinks | grep "RUNNING" | cut -f 1) if [ "$1" = "mute" ]; then pactl set-sink-mute "${device}" toggle else pactl set-sink-volume "${device}" -- "$1" fi
#!/bin/sh # use PulseAudio to easly set the volume up/down/mute if [ $# -ne 1 ]; then echo 'Usage: mute|-x[%|dB]|+x[%|dB]' exit 0 fi device=$(pactl info | grep 'Default Sink' | cut -f 3 -d ' ') if [ "$1" = "mute" ]; then pactl set-sink-mute "${device}" toggle else pactl set-sink-volume "${device}" -- "$1" fi
Improve wget with -c and fixed year range.
#!/bin/bash baseurl=http://www.itk.org/pipermail/insight-users/ months=( January February March April May June July August September October November December ) startyear=1999 endyear=2013 year=$startyear while [[ $year -le $endyear ]] do echo "$year" ((year=year+1)) for month in "${months[@]}" do filename=$baseurl$year'-'$month'.txt.gz' echo "$filename" wget "${filename}" done done
#!/bin/bash baseurl=http://www.itk.org/pipermail/insight-users/ months=( January February March April May June July August September October November December ) startyear=2000 endyear=2014 year=$startyear while [[ $year -le $endyear ]] do echo "$year" ((year=year+1)) for month in "${months[@]}" do filename=$baseurl$year'-'$month'.txt.gz' echo "$filename" wget -c "${filename}" done done
Format development logs using `jq`
#!/bin/sh if [[ -f ./zoomhub.pid ]] ; then kill $(cat zoomhub.pid) fi # # See: http://apple.stackexchange.com/questions/3271/how-to-get-rid-of-firewall-accept-incoming-connections-dialog/121010 # # Find app binary: # zoomhub=$(find .stack-work/dist -type f -name zoomhub | tr -d '\n') # # Self-sign app to avoid constant Mac OS X firewall warnings: # sudo codesign --force --sign - "$zoomhub" BASE_URI='http://localhost:8000' \ HASHIDS_SALT='DEVELOPMENT-ONLY' \ PGUSER=$(whoami) \ PGDATABASE='zoomhub_development' \ stack exec zoomhub & echo $! > zoomhub.pid
#!/bin/sh if [[ -f ./zoomhub.pid ]] ; then kill $(cat zoomhub.pid) fi # # See: http://apple.stackexchange.com/questions/3271/how-to-get-rid-of-firewall-accept-incoming-connections-dialog/121010 # # Find app binary: # zoomhub=$(find .stack-work/dist -type f -name zoomhub | tr -d '\n') # # Self-sign app to avoid constant Mac OS X firewall warnings: # sudo codesign --force --sign - "$zoomhub" BASE_URI='http://localhost:8000' \ HASHIDS_SALT='DEVELOPMENT-ONLY' \ PGUSER=$(whoami) \ PGDATABASE='zoomhub_development' \ stack exec zoomhub | jq & echo $! > zoomhub.pid
Improve zsh alias loading for puppet
[[ -x ~/src/puppet/ext/envpuppet ]] && alias puppet="~/src/puppet/ext/envpuppet puppet" [[ -x ~/src/puppet/ext/envpuppet ]] && alias facter="~/src/puppet/ext/envpuppet facter" #[[ -x ~/src/puppet/ext/envpuppet ]] && alias mco="~/src/puppet/ext/envpuppet /Users/zach/src/marionette-collective/mco" [[ -x ~/src/puppet/ext/envpuppet ]] &&alias puppet-module="~/src/puppet/ext/envpuppet ~/src/puppet-module-tool/bin/puppet-module" alias mco="RUBYLIB=~/src/mcollective/lib ~/src/mcollective/bin/mco"
if [ -x ~/src/puppet/ext/envpuppet ]; then if [ -d ~/src/puppet ]; then alias puppet="~/src/puppet/ext/envpuppet puppet" alias puppet-module="~/src/puppet/ext/envpuppet ~/src/puppet-module-tool/bin/puppet-module" fi if [ -d ~/src/facter ]; then alias facter="~/src/puppet/ext/envpuppet facter" fi if [ -d ~/src/mcollective ]; then alias mco="~/src/puppet/ext/envpuppet /Users/zach/src/marionette-collective/mco" alias mco="RUBYLIB=~/src/mcollective/lib ~/src/mcollective/bin/mco" fi fi
Change sourcing scripts to mimic Bash more closely
#!/bin/bash if [ -f /etc/profile ]; then source /etc/profile > /dev/null fi if [ -f ~/.bash_profile ]; then source ~/.bash_profile > /dev/null fi if [ -f ~/.bash_login ]; then source ~/.bash_login > /dev/null fi if [ -f ~/.profile ]; then source ~/.profile > /dev/null fi
#!/bin/bash if [ -f /etc/profile ]; then source /etc/profile > /dev/null fi if [ -f ~/.bash_profile ]; then source ~/.bash_profile > /dev/null elif [ -f ~/.bash_login ]; then source ~/.bash_login > /dev/null elif [ -f ~/.profile ]; then source ~/.profile > /dev/null fi
Update output info on install dependencies script
#!/usr/bin/env bash # # Install required dependencies # sdkmanager can be found in $ANDROID_HOME/tools/bin/sdkmanager # # Accept licences # src http://vgaidarji.me/blog/2017/05/31/automatically-accept-android-sdkmanager-licenses/ /usr/bin/expect -c ' set timeout -1; spawn '"${ANDROID_HOME}"'/tools/bin/sdkmanager --licenses; expect { "y/N" { exp_send "y\r" ; exp_continue } eof } ' for I in "platforms;android-25" \ "platforms;android-23" \ "platforms;android-21" \ "build-tools;25.0.6" \ "extras;google;m2repository" \ "extras;android;m2repository" \ "extras;google;google_play_services"; do echo "Trying to update with tools/bin/sdkmanager: " $I sdkmanager $I done sdkmanager --update
#!/usr/bin/env bash # # Install required dependencies # sdkmanager can be found in $ANDROID_HOME/tools/bin/sdkmanager # # Accept licences # src http://vgaidarji.me/blog/2017/05/31/automatically-accept-android-sdkmanager-licenses/ /usr/bin/expect -c ' set timeout -1; spawn '"${ANDROID_HOME}"'/tools/bin/sdkmanager --licenses; expect { "y/N" { exp_send "y\r" ; exp_continue } eof } ' echo "--------------------------------------------------------" echo "Trying to update dependencies with tools/bin/sdkmanager: " echo "--------------------------------------------------------" for I in "platforms;android-26" \ "platforms;android-25" \ "platforms;android-23" \ "platforms;android-21" \ "build-tools;26.0.1" \ "tools" \ "platform-tools" \ "extras;google;m2repository" \ "extras;android;m2repository" \ "extras;google;google_play_services" \ "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"\ "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2"; do echo "-> " $I sdkmanager $I done sdkmanager --update echo "--------------------------------------------------------"
Build futures-nightly on travis if building with nightly
#!/bin/sh set -x set -e if [ "$GTK" = latest -o "$GTK" = "3.18" ]; then BUNDLE="gtk-3.18.1-2" FEATURES=gtk_3_18,futures-stable fi if [ -n "$BUNDLE" ]; then WD="$PWD" cd "$HOME" curl -LO "https://github.com/gkoz/gtk-bootstrap/releases/download/$BUNDLE/deps.txz" tar xf deps.txz cd "$WD" export PKG_CONFIG_PATH="$HOME/local/lib/pkgconfig" fi cargo build --features "$FEATURES" --jobs 1 "$@"
#!/bin/sh set -x set -e if [ "$GTK" = latest -o "$GTK" = "3.18" ]; then BUNDLE="gtk-3.18.1-2" if [ "$TRAVIS_RUST_VERSION" = "nightly" ]; then FEATURES=gtk_3_18,futures-nightly else FEATURES=gtk_3_18,futures-stable fi fi if [ -n "$BUNDLE" ]; then WD="$PWD" cd "$HOME" curl -LO "https://github.com/gkoz/gtk-bootstrap/releases/download/$BUNDLE/deps.txz" tar xf deps.txz cd "$WD" export PKG_CONFIG_PATH="$HOME/local/lib/pkgconfig" fi cargo build --features "$FEATURES" --jobs 1 "$@"