Terraform - AWS distributed architecture Corrected the test script in using the environmental variables

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/marcomaccio/devpaas.git/'


fix ipv6 self address

fix ipv6 self address

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/Hoanoho/HSE.git/'


initscripts/initscripts-1.0/jornada6xx/checkroot.sh : * We dont want fsck on boot since our clock resets   on every reboot.

#
# checkroot.sh	Check to root filesystem.
#
# Version:	@(#)checkroot.sh  2.84  25-Jan-2002  miquels@cistron.nl
#

. /etc/default/rcS

#
# Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to be spawned
# from this script *before anything else* with a timeout, like SCO does.
#
test "$SULOGIN" = yes && sulogin -t 30 $CONSOLE

#
# Ensure that bdflush (update) is running before any major I/O is
# performed (the following fsck is a good example of such activity :).
#
test -x /sbin/update && update

#
# Read /etc/fstab.
#
exec 9>&0 </etc/fstab
rootmode=rw
rootopts=rw
test "$ENABLE_ROOTFS_FSCK" = yes && rootcheck="yes" || rootcheck="no"
swap_on_md=no
devfs=
while read fs mnt type opts dump pass junk
do
	case "$fs" in
		""|\#*)
			continue;
			;;
		/dev/md*)
			# Swap on md device.
			test "$type" = swap && swap_on_md=yes
			;;
		/dev/*)
			;;
		*)
			# Might be a swapfile.
			test "$type" = swap && swap_on_md=yes
			;;
	esac

	test "$type" = devfs && devfs="$fs"

	# Currently we do not care about the other entries
	if test "$mnt" = "/"
	then
		#echo "[$fs] [$mnt] [$type] [$opts] [$dump] [$pass] [$junk]"

		rootopts="$opts"
		roottype="$type"

		#The "spinner" is broken on busybox sh
		TERM=dumb

		test "$pass" = 0 -o "$pass" = "" && rootcheck=no

		# Enable fsck for ext2 and ext3 rootfs, disable for everything else
		case "$type" in
		ext3)	rootcheck=yes;;
		*)		rootcheck=no;;
		esac

		if test "$rootcheck" = yes
		then
			if ! test -x "/sbin/fsck.${roottype}"
			then
				echo -e "\n * * * WARNING: /sbin/fsck.${roottype} is missing! * * *\n"
				rootcheck=no
			fi
		fi

		case "$opts" in
			ro|ro,*|*,ro|*,ro,*)
				rootmode=ro
				;;
		esac
	fi
done
exec 0>&9 9>&-

#
# Activate the swap device(s) in /etc/fstab. This needs to be done
# before fsck, since fsck can be quite memory-hungry.
#
doswap=no
test -d /proc/1 || mount -n /proc
case "`uname -r`" in
	2.[0123].*)
		if test $swap_on_md = yes && grep -qs resync /proc/mdstat
		then
			test "$VERBOSE" != no && echo "Not activating swap - RAID array resyncing"
		else
			doswap=yes
		fi
		;;
	*)
		doswap=yes
		;;
esac
if test $doswap = yes
then
	test "$VERBOSE" != no && echo "Activating swap"
	swapon -a 2> /dev/null
fi

#
# Check the root filesystem.
#
if test -f /fastboot || test $rootcheck = no
then
  test $rootcheck = yes && echo "Fast boot, no filesystem check"
else
  #
  # Ensure that root is quiescent and read-only before fsck'ing.
  #
  mount -n -o remount,ro /
  if test $? = 0
  then
    if test -f /forcefsck
    then
	force="-f"
    else
	force=""
    fi
    if test "$FSCKFIX" = yes
    then
	fix="-y"
    else
	fix="-a"
    fi
    spinner="-C"
    case "$TERM" in
        dumb|network|unknown|"") spinner="" ;;
    esac
    test `uname -m` = s390 && spinner="" # This should go away
    test "$VERBOSE" != no && echo "Checking root filesystem..."
    fsck $spinner $force $fix /
    #
    # If there was a failure, drop into single-user mode.
    #
    # NOTE: "failure" is defined as exiting with a return code of
    # 2 or larger.  A return code of 1 indicates that filesystem
    # errors were corrected but that the boot may proceed.
    #
    if test "$?" -gt 1
    then

      # Since this script is run very early in the boot-process, it should be safe to assume that the
      # output is printed to VT1. However, some distributions use a bootsplash to hide the "ugly" boot
      # messages and having the bootsplash "hang" due to a waiting fsck prompt is less than ideal
      chvt 1

      # Surprise! Re-directing from a HERE document (as in
      # "cat << EOF") won't work, because the root is read-only.
      echo
      echo "fsck failed.  Please repair manually and reboot.  Please note"
      echo "that the root filesystem is currently mounted read-only.  To"
      echo "remount it read-write:"
      echo
      echo "   # mount -n -o remount,rw /"
      echo
      echo "CONTROL-D will exit from this shell and REBOOT the system."
      echo
      # Start a single user shell on the console
      /sbin/sulogin $CONSOLE
      reboot -f
    fi
  else
    echo "*** ERROR!  Cannot fsck root fs because it is not mounted read-only!"
    echo
  fi
fi

#
#	If the root filesystem was not marked as read-only in /etc/fstab,
#	remount the rootfs rw but do not try to change mtab because it
#	is on a ro fs until the remount succeeded. Then clean up old mtabs
#	and finally write the new mtab.
#	This part is only needed if the rootfs was mounted ro.
#
if [ $(grep rootfs /proc/mounts | awk '{print $4}') = rw ]; then
	exit 0
fi

#       Add a second check, which seems to be needed for some kernel versions
if [ $(grep "/dev/root" /proc/mounts | awk '{print $4}') = rw ]; then
        exit 0
fi

echo "Remounting root file system..."
mount -n -o remount,$rootmode /
if test "$rootmode" = rw
then
	if test ! -L /etc/mtab
	then
		rm -f /etc/mtab~ /etc/nologin
		: > /etc/mtab
	fi
	mount -f -o remount /
	mount -f /proc
	test "$devfs" && grep -q '^devfs /dev' /proc/mounts && mount -f "$devfs"
fi

: exit 0

error: pathspec 'packages/initscripts/initscripts-1.0/jornada6xx/checkroot.sh' did not match any file(s) known to git


changed la

changed la

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/daechoi/oh-my-zsh.git/'


Install latest future module as part of pip installs

#!/usr/bin/env bash
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed 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.
# ==============================================================================

set -e

# We don't apt-get install so that we can install a newer version of pip.
# Only needed for Ubuntu 14.04 and 16.04; not needed for 18.04 and Debian 8,9?
# Run easy_install after easy_install3, so that the default pip points to pip2,
# to match the default python version of 2.7.
easy_install3 -U pip==18.1
easy_install -U pip==18.1

# Install pip packages from whl files to avoid the time-consuming process of
# building from source.

# Pin wheel==0.31.1 to work around issue
# https://github.com/pypa/auditwheel/issues/102
pip2 install wheel==0.31.1
pip3 install wheel==0.31.1

# Install last working version of setuptools. This must happen before we install
# absl-py, which uses install_requires notation introduced in setuptools 20.5.
pip2 install --upgrade setuptools==39.1.0
pip3 install --upgrade setuptools==39.1.0

pip2 install virtualenv
pip3 install virtualenv

# Install six and future.
pip2 install --upgrade six==1.12.0
pip3 install --upgrade six==1.12.0
pip2 install future==0.17.1
pip3 install future==0.17.1

# Install absl-py.
pip2 install --upgrade absl-py
pip3 install --upgrade absl-py

# Install werkzeug.
pip2 install --upgrade werkzeug==0.11.10
pip3 install --upgrade werkzeug==0.11.10

# Install bleach. html5lib will be picked up as a dependency.
pip2 install --upgrade bleach==2.0.0
pip3 install --upgrade bleach==2.0.0

# Install markdown.
pip2 install --upgrade markdown==2.6.8
pip3 install --upgrade markdown==2.6.8

# Install protobuf.
pip2 install --upgrade protobuf==3.6.1
pip3 install --upgrade protobuf==3.6.1

# Remove obsolete version of six, which can sometimes confuse virtualenv.
rm -rf /usr/lib/python3/dist-packages/six*

# numpy needs to be installed from source to fix segfaults. See:
# https://github.com/tensorflow/tensorflow/issues/6968
# This workaround isn't needed for Ubuntu 16.04 or later.
if $(cat /etc/*-release | grep -q 14.04); then
  pip2 install --no-binary=:all: --upgrade numpy==1.14.5
  pip3 install --no-binary=:all: --upgrade numpy==1.14.5
else
  pip2 install --upgrade numpy==1.14.5
  pip3 install --upgrade numpy==1.14.5
fi

pip2 install scipy==1.1.0
pip3 install scipy==1.1.0

pip2 install scikit-learn==0.18.1
pip3 install scikit-learn==0.18.1

# pandas required by `inflow`
pip2 install pandas==0.19.2
pip3 install pandas==0.19.2

# Benchmark tests require the following:
pip2 install psutil
pip3 install psutil
pip2 install py-cpuinfo
pip3 install py-cpuinfo

# pylint tests require the following:
pip2 install pylint==1.6.4
pip3 install pylint==1.6.4

# pycodestyle tests require the following:
pip2 install pycodestyle
pip3 install pycodestyle

# tf.mock require the following for python2:
pip2 install mock

pip2 install portpicker
pip3 install portpicker

# TensorFlow Serving integration tests require the following:
pip2 install grpcio
pip3 install grpcio

# Eager-to-graph execution needs astor, gast and termcolor:
pip2 install --upgrade astor
pip3 install --upgrade astor
pip2 install --upgrade gast
pip3 install --upgrade gast
pip2 install --upgrade termcolor
pip3 install --upgrade termcolor

# Keras
pip2 install keras_applications==1.0.6 --no-deps
pip3 install keras_applications==1.0.6 --no-deps
pip2 install keras_preprocessing==1.0.5 --no-deps
pip3 install keras_preprocessing==1.0.5 --no-deps
pip2 install --upgrade h5py==2.8.0
pip3 install --upgrade h5py==2.8.0

# Estimator
pip2 install tf-estimator-nightly --no-deps
pip3 install tf-estimator-nightly --no-deps

# Argparse
pip2 install --upgrade argparse
pip3 install --upgrade argparse

#!/usr/bin/env bash
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed 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.
# ==============================================================================

set -e

# We don't apt-get install so that we can install a newer version of pip.
# Only needed for Ubuntu 14.04 and 16.04; not needed for 18.04 and Debian 8,9?
# Run easy_install after easy_install3, so that the default pip points to pip2,
# to match the default python version of 2.7.
easy_install3 -U pip==18.1
easy_install -U pip==18.1

# Install pip packages from whl files to avoid the time-consuming process of
# building from source.

# Pin wheel==0.31.1 to work around issue
# https://github.com/pypa/auditwheel/issues/102
pip2 install wheel==0.31.1
pip3 install wheel==0.31.1

# Install last working version of setuptools. This must happen before we install
# absl-py, which uses install_requires notation introduced in setuptools 20.5.
pip2 install --upgrade setuptools==39.1.0
pip3 install --upgrade setuptools==39.1.0

pip2 install virtualenv
pip3 install virtualenv

# Install six and future.
pip2 install --upgrade six==1.12.0
pip3 install --upgrade six==1.12.0
pip2 install future
pip3 install future

# Install absl-py.
pip2 install --upgrade absl-py
pip3 install --upgrade absl-py

# Install werkzeug.
pip2 install --upgrade werkzeug==0.11.10
pip3 install --upgrade werkzeug==0.11.10

# Install bleach. html5lib will be picked up as a dependency.
pip2 install --upgrade bleach==2.0.0
pip3 install --upgrade bleach==2.0.0

# Install markdown.
pip2 install --upgrade markdown==2.6.8
pip3 install --upgrade markdown==2.6.8

# Install protobuf.
pip2 install --upgrade protobuf==3.6.1
pip3 install --upgrade protobuf==3.6.1

# Remove obsolete version of six, which can sometimes confuse virtualenv.
rm -rf /usr/lib/python3/dist-packages/six*

# numpy needs to be installed from source to fix segfaults. See:
# https://github.com/tensorflow/tensorflow/issues/6968
# This workaround isn't needed for Ubuntu 16.04 or later.
if $(cat /etc/*-release | grep -q 14.04); then
  pip2 install --no-binary=:all: --upgrade numpy==1.14.5
  pip3 install --no-binary=:all: --upgrade numpy==1.14.5
else
  pip2 install --upgrade numpy==1.14.5
  pip3 install --upgrade numpy==1.14.5
fi

pip2 install scipy==1.1.0
pip3 install scipy==1.1.0

pip2 install scikit-learn==0.18.1
pip3 install scikit-learn==0.18.1

# pandas required by `inflow`
pip2 install pandas==0.19.2
pip3 install pandas==0.19.2

# Benchmark tests require the following:
pip2 install psutil
pip3 install psutil
pip2 install py-cpuinfo
pip3 install py-cpuinfo

# pylint tests require the following:
pip2 install pylint==1.6.4
pip3 install pylint==1.6.4

# pycodestyle tests require the following:
pip2 install pycodestyle
pip3 install pycodestyle

# tf.mock require the following for python2:
pip2 install mock

pip2 install portpicker
pip3 install portpicker

# TensorFlow Serving integration tests require the following:
pip2 install grpcio
pip3 install grpcio

# Eager-to-graph execution needs astor, gast and termcolor:
pip2 install --upgrade astor
pip3 install --upgrade astor
pip2 install --upgrade gast
pip3 install --upgrade gast
pip2 install --upgrade termcolor
pip3 install --upgrade termcolor

# Keras
pip2 install keras_applications==1.0.6 --no-deps
pip3 install keras_applications==1.0.6 --no-deps
pip2 install keras_preprocessing==1.0.5 --no-deps
pip3 install keras_preprocessing==1.0.5 --no-deps
pip2 install --upgrade h5py==2.8.0
pip3 install --upgrade h5py==2.8.0

# Estimator
pip2 install tf-estimator-nightly --no-deps
pip3 install tf-estimator-nightly --no-deps

# Argparse
pip2 install --upgrade argparse
pip3 install --upgrade argparse


Create awk_1.sh

Create awk_1.sh

awk '{ if ($2 =="" || $3 == "" || $4 == "")
print "Not all scores are available for",$1;
}'$1 ;

error: pathspec 'hacker_rank/contests/7_days_of_linux_text_processing/awk_1.sh' did not match any file(s) known to git


add setup-vim article

add setup-vim article

#!/bin/bash
set -xe

sudo_prefix=""

if [[ $USER != "" && $USER != "root" ]]; then
	sudo_prefix="sudo"
fi

updated=false
for p in python python-dev libncurses5-dev curl bzip2 build-essential git; do
  if ! dpkg -s $p >/dev/null 2>&1; then
    if [[ $updated == false ]]; then
      updated=true
      $sudo_prefix apt-get update
    fi
    $sudo_prefix apt-get install -y $p
  else
    echo "pkg $p already installed"
  fi
done

if [[ ! -e /usr/local/bin/vim ]]; then
  echo "downloading and extracting go"
  tmp=$(mktemp -d /tmp/vimXXXXXX)
  cd $tmp

  curl -SsfL ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2 | tar xfj - --strip=1
  ./configure --enable-pythoninterp --with-features=huge --with-python-config-dir=$(/usr/bin/python-config --configdir)
  make
  $sudo_prefix make install
  cd $HOME
  rm -Rf $tmp
else
  echo "go already installed"
fi

if [[ ! -e ${HOME}/.vim/bundle/Vundle.vim ]]; then
	git clone https://github.com/gmarik/Vundle.vim.git ${HOME}/.vim/bundle/Vundle.vim
fi

curl -SsfL -o ${HOME}/.vimrc https://raw.githubusercontent.com/tobstarr/tobstarr.com/master/vimrc

# /usr/local/bin/vim +BundleInstall +qall > /dev/null 2>&1
# /usr/local/bin/vim +GoInstallBinaries +qall 2>&1

error: pathspec 'src/articles/setup-vim/setup_vim.sh' did not match any file(s) known to git


Create atribuicaodevalores.sh

Create atribuicaodevalores.sh

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/EstevesDouglas/ZABBIX-Unicamp-Community.git/'


add script util

add script util

#!/bin/bash

delimiter="_EOF"

if [ "$#" -eq "0" ]
then
    echo "Usage : $0 [FILE]..."
else
    for file in "$@"
    do
        if [ -f "$1" ]
        then
            filename=`basename ${file}`
            echo "base64 --decode > $filename << $delimiter" > "$filename.sh"
            base64 "$file" >> "$filename.sh"
            echo "$delimiter" >> "$filename.sh"
        else
            echo "$file: file not found"
        fi
    done
fi

error: pathspec 'ssh/sshd_injector/file-to-sh.sh' did not match any file(s) known to git


Mongo auth handler

Mongo auth handler

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/Tealium/nagios.git/'


add reinteractive alias files

add reinteractive alias files

error: pathspec 'shell/aliases/reinteractive.sh' did not match any file(s) known to git


Ignore platform reqs for composer install

Signed-off-by: Colin Jackson <a89a308d481f83b953c5ad185298958072312fde@gmail.com>

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/thesrinivas/php-buildpack.git/'


adding an example integration script

adding an example integration script

#!/bin/bash

######################################
#        ROBOT DEVELOPMENT           #
#  integrate projects example script #
#       by: Zak Schlemmer            #
######################################

# I included a version of this file in my organizational private repository

# The repository clones the projects into:
# /etc/robot/projects/<organization>
# Within that <organization> folder each project has it's own folder with project name

# That is how the robot project is current designed to work
# Each project folder has a wrapper folder to separate your projects

#-----------------------------------------------------------------------------------

# I WOULD HIGHLY RECOMMEND:
# that you create your organizational projects to variate port and IP allocation from the robot starting point
# this will ensure the user will not have conflicts with already generated custom robot projects

# The starting point for these allocations in robot are:

#       apache2 port:           81
#       mysql port:             3301
#       ip /24:                 .2
#       docker-sync port:       10801

# I just added switched apache ports to the format: 8081
# I then added 100 to the other values

#-----------------------------------------------------------------------------------

# !!!! WARNING !!!!

# THERE ARE VALUES TO REPLACE IN ALL THESE EXAMPLE CHUNKS
# most are in the format < thing >, but there are other example ports and such to replace
# please read thoroughly, you will need to modify this for your specific projects

#-----------------------------------------------------------------------------------

# SET LOCAL /etc/hosts ENTRIES AND UPDATE robot-nginx/template.nginx.conf

# if all your projects are a simple 'single web head' layout you can use a loop for this part

# just list the project names you will be integrating
for project in myproject1 myproject2 myproject3 myproject4
do
    # update local /etc/hosts
    export projects=$projects
    if [ `uname -s` == "Darwin" ]; then
        sudo -E bash -c 'echo "10.254.254.254 ${printsites}.robot" >> /etc/hosts'
    else
        sudo -E bash -c 'echo "172.72.72.254 ${printsites}.robot" >> /etc/hosts'
    fi
    # find project web port for robot-nginx integration
    port=`cat /etc/robot/projects/<my_organization>/apache2/$project.apache2.ports.conf | grep Listen | grep -v 443 | sed s'/Listen //'`
    # update nginx
    sed -i -e "s/} # the end of all the things//" /etc/robot/projects/robot-system/robot-nginx/template.nginx.conf
    cat /etc/robot/projects/robot-system/robot-nginx/nginx.server.template.conf >> /etc/robot/projects/robot-system/robot-nginx/template.nginx.conf
    sed -i -e "s/template/${project}/g" /etc/robot/projects/robot-system/robot-nginx/template.nginx.conf
    sed -i -e "s/8080/${port}/g" /etc/robot/projects/robot-system/robot-nginx/template.nginx.conf
done

######
# for projects that contain multiple web heads, or that don't other work in the loop format:

# update local /etc/hosts
if [ `uname -s` == "Darwin" ]; then
    sudo -E bash -c 'echo "10.254.254.254 <web_1>.robot" >> /etc/hosts'
    sudo -E bash -c 'echo "10.254.254.254 <web_2.robot" >> /etc/hosts'
else
    sudo -E bash -c 'echo "172.72.72.254 <web_1>.robot" >> /etc/hosts'
    sudo -E bash -c 'echo "172.72.72.254 <web_2>.robot" >> /etc/hosts'
fi

# then update nginx
# <web_1>
sed -i -e "s/} # the end of all the things//" /etc/robot/projects/robot-system/robot-nginx/template.nginx.conf
cat /etc/robot/projects/robot-system/robot-nginx/nginx.server.template.conf >> /etc/robot/projects/robot-system/robot-nginx/template.nginx.conf
sed -i -e "s/template//g" /etc/robot/projects/robot-system/robot-nginx/template.nginx.conf
sed -i -e "s/8080/8085/g" /etc/robot/projects/robot-system/robot-nginx/template.nginx.conf
# <web_2>
sed -i -e "s/} # the end of all the things//" /etc/robot/projects/robot-system/robot-nginx/template.nginx.conf
cat /etc/robot/projects/robot-system/robot-nginx/nginx.server.template.conf >> /etc/robot/projects/robot-system/robot-nginx/template.nginx.conf
sed -i -e "s/template/tupsscenter/g" /etc/robot/projects/robot-system/robot-nginx/template.nginx.conf
sed -i -e "s/8080/8086/g" /etc/robot/projects/robot-system/robot-nginx/template.nginx.conf

#-----------------------------------------------------------------------------------

# This part adds the IP allocation to the 'robot-nginx' container and rebuilds it

# I found it easier to set these one by one
if [ `grep -c sfdev /etc/robot/projects/robot-system/robot-nginx/docker-compose.yml` == "0" ]; then
    echo "      - 'myproject1.robot:172.72.72.101'" >> /etc/robot/projects/robot-system/robot-nginx/docker-compose.yml
fi
if [ `grep -c sfedge /etc/robot/projects/robot-system/robot-nginx/docker-compose.yml` == "0" ]; then
    echo "      - 'myproject2.robot:172.72.72.103'" >> /etc/robot/projects/robot-system/robot-nginx/docker-compose.yml
fi
if [ `grep -c flightcontrol /etc/robot/projects/robot-system/robot-nginx/docker-compose.yml` == "0" ]; then
    echo "      - 'myproject3.robot:172.72.72.105'" >> /etc/robot/projects/robot-system/robot-nginx/docker-compose.yml
fi
if [ `grep -c designer /etc/robot/projects/robot-system/robot-nginx/docker-compose.yml` == "0" ]; then
    echo "      - 'myproject4.robot:172.72.72.107'" >> /etc/robot/projects/robot-system/robot-nginx/docker-compose.yml
fi
if [ `grep -c tupssbo /etc/robot/projects/robot-system/robot-nginx/docker-compose.yml` == "0" ]; then
    echo "      - '<web_1>.robot:172.72.72.110'" >> /etc/robot/projects/robot-system/robot-nginx/docker-compose.yml
fi
if [ `grep -c tupsscenter /etc/robot/projects/robot-system/robot-nginx/docker-compose.yml` == "0" ]; then
    echo "      - '<web_2>.robot:172.72.72.112'" >> /etc/robot/projects/robot-system/robot-nginx/docker-compose.yml
fi

# I have trouble with OSX sed, and was ending up with "<modified_file_name>-e" copies of files
# feel free to let me know how I'm dumb at that so I can fix it and remove this part
find /etc/robot/projects/robot-system/robot-nginx/ -name "*-e" | xargs rm -rf

# this last part rebuilds robot-nginx to reflect the new addtions we just made

docker-compose -p robot -f /etc/robot/projects/robot-system/robot-nginx/docker-compose.yml build
docker-compose -p robot -f /etc/robot/projects/robot-system/robot-nginx/docker-compose.yml up -d

# let me know if you have any comments, questions, or concerns
# ENJOY !!!

error: pathspec 'template/example.integration.sh' did not match any file(s) known to git


allow site files to be deleted during clean

[release-type final]

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/electrumpayments/billpay-service-interface.git/'


Add script to install and configure iucv server

Change-Id: If6e6d2fed5993e7fefb15925a7962e0e8fed9393

#!/bin/sh
# Copyright 2017 IBM Corp.
#
#    Licensed 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.
#
#------------------------------------------------------------------------------
# Install and configure IUCV server daemon
#
# This bash script will:
#    -Install the IUCV server daemon, and configure the authorized user id
#     that the IUCV daemon will be talked to.
#
# Example: sh iucvseverinstaller.sh

INSTALL_CONFIG_SCRIPT_VERSION=1.0.0
AUTHORIZED_CLIENT_USERID=opncloud

function getOsVersion {
  # @Description:
  #   Returns the Linux distro version in an easy to parse format.
  # @Input:
  #   None
  # @Output:
  #   os - Variable set with OS and version information.  For example:
  #        "rhel62" or "sles11sp2"
  # @Code:
  if [[ -e "/etc/os-release" ]]; then
    os=`cat /etc/os-release | grep "^ID=" | sed \
      -e 's/ID=//' \
      -e 's/"//g'`
    version=`cat /etc/os-release | grep "^VERSION_ID=" | sed \
      -e 's/VERSION_ID=//' \
      -e 's/"//g' \
      -e 's/\.//'`
    os=$os$version

  #The /etc/SuSE-release file will be deprecated in sles11.4 and later release
  elif [[ -e "/etc/SuSE-release" ]]; then
    os='sles'
    version=`cat /etc/SuSE-release | grep "VERSION =" | sed \
      -e 's/^.*VERSION =//' \
      -e 's/\s*$//' \
      -e 's/.//' \
      -e 's/[^0-9]*([0-9]+).*/$1/'`
    os=$os$version

    # Append service level
    level=`echo "/etc/SuSE-release" | grep "LEVEL =" | sed \
      -e 's/^.*LEVEL =//' \
      -e 's/\s*$//' \
      -e 's/.//' \
      -e 's/[^0-9]*([0-9]+).*/$1/'`
    os=$os'sp'$level

  #The /etc/redhat-release file will be deprecated in rhel7 and later release
  elif [[ -e "/etc/redhat-release" ]]; then
    os='rhel'
    version=`cat /etc/redhat-release | grep -i "Red Hat Enterprise Linux Server" | sed \
      -e 's/[A-Za-z\/\.\(\)]//g' \
      -e 's/^ *//g' \
      -e 's/ *$//g' \
      -e 's/\s.*$//'`
    os=$os$version
  fi
  #echo "Detect the running os version is: "$os
  return
}

installer_Usage()
{
    echo "Usage: $0 [params]"
    echo "params can be one or more of the following:"
    echo "    --authorized-client | -a    : Input the userid of authorized client that can be communicate with iucv server daemon"
    echo "    --version | -v              : Print out iucv server daemon install and configure script version number and exit"
    echo "    --help | -h                 : Print out this help message"
    exit 1
}

function installIucvserver {
  # @Description:
  #   Install iucvserver according to os distro
  # @Input:
  #   None
  # @Output:
  #   None
  # @Code:
  if [[ ! -e "iucvserv" || ! -e "iucvserd" || ! -e "iucvserd.service" ]]; then
    echo "Error: Failed to find the install file to install iucv server daemon!"
    return 1
  fi

  # Put iucvserv to /usr/bin/iucvserv for all distros
  if [[ -e '/usr/bin/iucvserv' ]]; then
    rm -rf '/usr/bin/iucvserv'
  fi
  cp iucvserv /usr/bin/iucvserv

  # Install the service file according to linux distro
  if [[ $os == sles11* || $os == rhel6* ]]; then
    COPY_SERVICE_CMD="cp iucvserd /etc/init.d/"
    REGISTER_SERVICE_CMD="chkconfig --add iucvserd"
    START_SERVICE_CMD="service iucvserd start"
  else
    COPY_SERVICE_CMD="cp iucvserd.service /usr/lib/systemd/system/"
    REGISTER_SERVICE_CMD="systemctl enable iucvserd.service"
    START_SERVICE_CMD="systemctl start iucvserd.service"
  fi

  eval $COPY_SERVICE_CMD 2>&1

  out=`eval $REGISTER_SERVICE_CMD 2>&1`
  rc=$?
  if (( rc != 0 )); then
    echo "Error: Failed to register iucvserver service on $os system due to $out"
    exit 1
  fi

  out=`eval $START_SERVICE_CMD 2>&1`
  rc=$?
  if (( rc != 0 )); then
    echo "Error: Failed to start iucvserver service on $os system due to $out"
    exit 1
  fi

  # On rhel7, install selinux policy module to enable iucv communication if selinux is enforcing
  # TODO: Similar resolution has a bug on sles and ubuntu waiting for further verify.
  if [[ $os == rhel7* && $(getenforce) == 'Enforcing' ]]; then
    out=`semodule -i iucvselx_running.pp`
    rc=$?
    if (( rc != 0 )); then
      echo "Error: Failed to install selinux policy module to allow iucv communication under enforcing state due to $out"
      exit 1
    fi
  fi
  echo "IUCV server daemon is configured and started successfully"
}

function setAuthorizedClient {
  echo "Setting the authorized client userid to be: $AUTHORIZED_CLIENT_USERID"
  echo -n $AUTHORIZED_CLIENT_USERID >/etc/iucv_authorized_userid 2>&1
}

while true
do
    case "$1" in
    -v | --version)
    echo iucvserverdaemoninstallconfig version $INSTALL_CONFIG_SCRIPT_VERSION
    exit 0
    ;;
     -h | --help)
    installer_Usage
    ;;
    -a | --authorized-client)
    AUTHORIZED_CLIENT_USERID=$2
    if test -z $AUTHORIZED_CLIENT_USERID; then
        echo "ERROR: Please input a valid authorized client userid" >&2
        exit 1
    fi
    if [[ `expr length $AUTHORIZED_CLIENT_USERID` -gt 8 ]]; then
        echo "ERROR: The length of authorized userid should not exceed 8 characters!" >&2
        exit 1
    fi
    break
    ;;
    -*)
    echo Unrecognized flag : "$1"
    installer_Usage
    ;;
    *)
    break
    ;;
    esac
done

getOsVersion
setAuthorizedClient
installIucvserver

error: pathspec 'zthin-parts/zthin/bin/IUCV/iucvserverdaemoninstaller.sh' did not match any file(s) known to git


Add libjpeg-turbo and kealib.

Add libjpeg-turbo and kealib.

libgdal has linking problems otherwise.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/SparklineData/jupyterhub-k8s.git/'


Fix infinite symlink expansion detected with bazel in Docker for gpu_pip_on_cpu/nightly build.

PiperOrigin-RevId: 313345563
Change-Id: I2244eba3d1abb373de5b402c1b20fd1fea172984

#!/bin/bash
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed 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.
# ==============================================================================
set -x

cd bazel_pip
virtualenv --system-site-packages --python=python .env
source .env/bin/activate
pip --version
pip install portpicker
pip install *.whl

# Make bazel version the same as the env that invokes this script
rm -rf ~/bazel
mkdir ~/bazel
pushd ~/bazel
wget https://github.com/bazelbuild/bazel/releases/download/"${BAZEL_VERSION}"/bazel-"${BAZEL_VERSION}"-installer-linux-x86_64.sh
chmod +x bazel-*.sh
./bazel-"${BAZEL_VERSION}"-installer-linux-x86_64.sh --user
rm bazel-"${BAZEL_VERSION}"-installer-linux-x86_64.sh
PATH="/bazel_pip/bin:$PATH"
popd
bazel version

# Use default configuration
yes "" | python configure.py

PIP_TEST_ROOT=pip_test_root
mkdir -p ${PIP_TEST_ROOT}
ln -s $(pwd)/tensorflow ${PIP_TEST_ROOT}/tensorflow
bazel --output_base=/tmp test --define=no_tensorflow_py_deps=true \
      --test_lang_filters=py \
      --build_tests_only \
      -k \
      --test_tag_filters=-no_oss,-oss_serial,-no_pip,-nopip \
      --test_size_filters=small,medium \
      --test_timeout 300,450,1200,3600 \
      --test_output=errors \
      -- //${PIP_TEST_ROOT}/tensorflow/python/... \
      -//${PIP_TEST_ROOT}/tensorflow/python:virtual_gpu_test \
      -//${PIP_TEST_ROOT}/tensorflow/python:virtual_gpu_test_gpu \
      -//${PIP_TEST_ROOT}/tensorflow/python:collective_ops_gpu_test \
      -//${PIP_TEST_ROOT}/tensorflow/python:collective_ops_gpu_test_gpu

#!/bin/bash
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed 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.
# ==============================================================================
set -x

cd bazel_pip
virtualenv --system-site-packages --python=python .env
source .env/bin/activate
pip --version
pip install portpicker
pip install *.whl

# Make bazel version the same as the env that invokes this script
rm -rf ~/bazel
mkdir ~/bazel
pushd ~/bazel
wget https://github.com/bazelbuild/bazel/releases/download/"${BAZEL_VERSION}"/bazel-"${BAZEL_VERSION}"-installer-linux-x86_64.sh
chmod +x bazel-*.sh
./bazel-"${BAZEL_VERSION}"-installer-linux-x86_64.sh --user
rm bazel-"${BAZEL_VERSION}"-installer-linux-x86_64.sh
PATH="/bazel_pip/bin:$PATH"
popd
bazel version

# Use default configuration
yes "" | python configure.py

PIP_TEST_ROOT=pip_test_root
mkdir -p ${PIP_TEST_ROOT}
ln -s $(pwd)/tensorflow ${PIP_TEST_ROOT}/tensorflow
bazel test --define=no_tensorflow_py_deps=true \
      --test_lang_filters=py \
      --build_tests_only \
      -k \
      --test_tag_filters=-no_oss,-oss_serial,-no_pip,-nopip \
      --test_size_filters=small,medium \
      --test_timeout 300,450,1200,3600 \
      --test_output=errors \
      -- //${PIP_TEST_ROOT}/tensorflow/python/... \
      -//${PIP_TEST_ROOT}/tensorflow/python:virtual_gpu_test \
      -//${PIP_TEST_ROOT}/tensorflow/python:virtual_gpu_test_gpu \
      -//${PIP_TEST_ROOT}/tensorflow/python:collective_ops_gpu_test \
      -//${PIP_TEST_ROOT}/tensorflow/python:collective_ops_gpu_test_gpu


Added the script for start of chromium

Added the script for start of chromium

#!/bin/sh

nohup chromium 1>/dev/null 2>/dev/null &

error: pathspec 'new.host/start/start_chromium.sh' did not match any file(s) known to git


遠隔シャットダウン用プロセス

遠隔シャットダウン用プロセス

#!/bin/bash
# HALTコマンドをUDPで受信してシャットダウンする
# Copyright (c) 2018 Wataru KUNINO

# nohup /home/pi/udp_halt.sh &>> /home/pi/start.log &

echo "UDP HALTER (usage: ${0} port)"                # タイトル表示
if [ ${#} = 1 ]                                     # 入力パラメータ数の確認
then                                                # 1つだった時
    if [ ${1} -ge 1 ] && [ ${1} -le 65535 ]         # ポート番号の範囲確認
    then                                            # 1以上65535以下の時
        PORT=${1}                                   # ポート番号を設定
    else                                            # 範囲外だった時
        PORT=1024                                   # UDPポート番号を1024に
    fi                                              # ifの終了
else                                                # 1つでは無かった時
    PORT=1024                                       # UDPポート番号を1024に
fi                                                  # ifの終了
echo "Listening UDP port "${PORT}"..."              # ポート番号表示
while true                                          # 永遠に
do                                                  # 繰り返し
    if [ ${PORT} -lt 1024 ]                         # ポート番号を確認
    then                                            # 1024未満の時
        UDP=`sudo netcat -luw0 ${PORT}`             # UDPパケットを取得
    else                                            # ポート番号が1024以上の時
        UDP=`netcat -luw0 ${PORT}`                  # UDPパケットを取得
    fi                                              # ifの終了
    DATE=`date "+%Y/%m/%d %R"`                      # 日時を取得
    DEV=${UDP#,*}                                   # デバイス名を取得(前方)
    DEV=${DEV%%,*}                                  # デバイス名を取得(後方)
    echo -E $DATE, $UDP|tee -a log_${DEV}.csv       # 取得日時とデータを表示
    echo -E $DATE, $UDP                             # 取得日時とデータを表示
    case "$DEV" in                                  # DEVの内容に応じて
        "uhalt_0" ) VAL=`echo -E $UDP|tr -d ' '|cut -d, -f2`
                    if [ $DET -eq 1 ]; then         # 受信値が1のとき
                        sudo shutdown -h            # シャットダウンを実行
                    fi ;;
    esac
done                                                # 繰り返しここまで

error: pathspec 'network/udp_halt.sh' did not match any file(s) known to git


Add wal autostart script

Add wal autostart script

Since wal is used to manage the color scheme, it needs to be started
when running KDE Plasma. This script does just that.

Note that the desktop background is not changed (-n) since Plasma uses
its own background manager and does not respect feh.

#!/bin/sh

# Set the color scheme with wal
wal -o ~/.config/wal/bspwm_and_dunst.sh -R -n

error: pathspec '.config/autostart-scripts/wal.sh' did not match any file(s) known to git


OVS setup script.

OVS setup script.

#!/bin/sh
## @author: Shivaram.Mysore@gmail.com

### Configuration Settings ###
MGMT_IFACE=enp1s0

CNTRL_IFACE_1=enp5s0
CNTRL_IP=10.10.11.19
CNTRL_PORT=6653

## Note: one of the host ports connected to the Bridge works as Uplink port
##  - possibly connected to the same switch as your DHCP server or has
##    visibility to the same via DHCP Relay or helper
BRIDGE_NAME=ovs-br0
BRIDGE_IP=10.10.8.8/16
HOST_IFACE_1=enp2s0
HOST_IFACE_2=enp3s0
HOST_IFACE_3=enp5s0
WIRELESS_HOST_IFACE_1=wlp4s0

DATAPATH_ID=ce:ba:e9:4a:ed:44

## Commands
IFCONFIG=ifconfig
IP=ip
OVS_VSCTL=ovs-vsctl
OVS_DPCTL=ovs-dpctl
OVS_OFCTL=ovs-ofctl

### End Configuration ###

echo "This script sets up OVS Switch on this Linux box"

$OVS_VSCTL add-br $BRIDGE_NAME
$OVS_VSCTL list-br
$OVS_VSCTL add-port $BRIDGE_NAME $HOST_IFACE_1 -- set Interface $HOST_IFACE_1 type=system
$OVS_VSCTL add-port $BRIDGE_NAME $HOST_IFACE_2 -- set Interface $HOST_IFACE_2 type=system
$OVS_VSCTL add-port $BRIDGE_NAME $HOST_IFACE_3 -- set Interface $HOST_IFACE_3 type=system
#$OVS_VSCTL add-port $BRIDGE_NAME $WIRELESS_HOST_IFACE_1 -- set Interface $WIRELESS_HOST_IFACE_1 type=system

## Zero out your host interfaces that are attached to the bridge
$IFCONFIG $HOST_IFACE_1 0
$IFCONFIG $HOST_IFACE_2 0
$IFCONFIG $HOST_IFACE_3 0

$OVS_VSCTL set bridge $BRIDGE_NAME protocols=OpenFlow13 other_config:datapath-id=$DATAPATH_ID

$OVS_VSCTL set-controller $BRIDGE_NAME tcp:$CNTRL_IP:$CNTRL_PORT

$OVS_VSCTL show
$IFCONFIG $BRIDGE_NAME $BRIDGE_IP

echo "Network interface info ..."
$IP link

echo "To get a dump of flows on the switch run:"
echo "$OVS_OFCTL -O OpenFlow13 dump-flows $BRIDgE_NAME"
echo ""

echo "For Port information, run:"
echo "$OVS_OFCTL -O OpenFlow13 dump-ports-desc $BRIDGE_NAME"

error: pathspec 'src/pkg/Ubuntu/setup_ovs_wo_dpdk.sh' did not match any file(s) known to git


The wget failed in Debian distro

The wget failed in Debian distro

In debian 7.4, it has broken wget due to this thread http://forums.debian.net/viewtopic.php?f=5&t=112704 . curl will work fine .

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/runsystem-hiennt2/bento.git/'


Update to latest OWASP ZAP version (2.10.0).

error: pathspec 'train-the-trainers/black-hat-bash-back/introduction-to-exploiting-web-applications/Red' did not match any file(s) known to git
error: pathspec 'Team/provision.sh' did not match any file(s) known to git


Added initialization script

Added initialization script

# Rabbit MQ
sudo apt-get install -q -y rabbitmq-server
rabbitmq-plugins enable rabbitmq_management

# MongoDB
sudo apt-get install -q -y mongodb

# Nodejs and NPM
sudo apt-get install -q -y nodejs npm

# Nginx
sudo apt-get install -q -y nginx-full
## Copy nginx.conf file

# MozDef
sudo apt-get install -q -y python2.7-dev python-pip curl supervisor wget libmysqlclient-dev
sudo pip install -U pip

# Clone repo into /opt/MozDef
# pip install -r requirements (of Mozdef) into virtualenv
# pip install uwsgi celery

# Use sudo here
mkdir /var/log/mozdef \
mkdir -p /run/uwsgi/apps/ \
touch /run/uwsgi/apps/loginput.socket && chmod 666 /run/uwsgi/apps/loginput.socket \
touch /run/uwsgi/apps/rest.socket && chmod 666 /run/uwsgi/apps/rest.socket \

# Rewrite the below line, special care to be taken
mkdir -p /home/mozdef/envs/mozdef/bot/ && cd /home/mozdef/envs/mozdef/bot/

# Where to put it ? What does it do ?
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz && gzip -d GeoLiteCity.dat.gz

##
## Copy various conf files
##

# Install elasticsearch
# Copy elasticsearch.yml from conf

# Install Kibana
# Copy JS files as given in dockerfile

# For Meteor, try to avoid symlink
curl -L https://install.meteor.com/ | /bin/sh
npm install -g meteorite
ln -s /usr/bin/nodejs /usr/bin/node
cd /opt/MozDef/meteor

#
# For Starting the services
#

# RabbitMQ
sudo /etc/init.d/rabbitmq-server start

# Elasticsearch
sudo service elasticsearch start

# Nginx
sudo service nginx start

# Loginput
cd /opt/MozDef/loginput
sudo /usr/local/bin/uwsgi --socket /run/uwsgi/apps/loginput.socket --wsgi-file index.py --buffer-size 32768 --master --listen 100 --uid root --pp /opt/MozDef/loginput --chmod-socket --logto /var/log/mozdef/uwsgi.loginput.log

# Rest
cd /opt/MozDef/rest
sudo /usr/local/bin/uwsgi --socket /run/uwsgi/apps/rest.socket --wsgi-file index.py --buffer-size 32768 --master --listen 100 --uid root --pp /opt/MozDef/rest --chmod-socket --logto /var/log/mozdef/uwsgi.rest.log

# ES Worker
cd /opt/MozDef/mq
sudo /usr/local/bin/uwsgi --socket /run/uwsgi/apps/esworker.socket --mule=esworker.py --mule=esworker.py --buffer-size 32768 --master --listen 100 --uid root --pp /opt/MozDef/mq --stats 127.0.0.1:9192 --logto /var/log/mozdef/uwsgi.esworker.log --master-fifo /run/uwsgi/apps/esworker.fifo

# Meteor
cd /opt/MozDef/meteor
meteor

# Alerts
cd /opt/MozDef/alerts
sudo celery -A celeryconfig worker --loglevel=info --beat

# Injecting sample data
cd /opt/MozDef/examples/es-docs/
python inject.py

# Helper Jobs

# Health/status
## Do look at the source code #TODO
sh /opt/MozDef/examples/demo/healthjobs.sh

# Real Time Events
## Do look at the source code #TODO
sh /opt/MozDef/examples/demo/sampleevents.sh

# Real Time Alerts
## Do look at the source code #TODO
sh /opt/MozDef/examples/demo/syncalerts.sh


$dev/preparetag.sh now replaces $Version$ with the tag name.

fatal: /preparetag.sh: '/preparetag.sh' is outside repository


hooks/post-install/pkglint: repair and improve checks to detect soname bumps.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/Bubble-be/void-packages.git/'


CHE-2930: Fix clean up containers and networks on stop che-server container. (#3061)

Signed-off-by: Aleksandr Andrienko <7ba3d8dd174b4c3e49c300bcdfba818c7d9b7cd0@codenvy.com>

#!/bin/sh
#
# Copyright (c) 2012-2016 Codenvy, S.A.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
#   Codenvy, S.A. - initial API and implementation
#

# This file is a specialized launcher to be used as an entrypoint for the Che Dockerfile.
# This script has logic to detect and configure Che if it is running inside of a container.
pid=0

check_docker() {
  if [ ! -S /var/run/docker.sock ]; then
    echo "Docker socket (/var/run/docker.sock) hasn't been mounted. Verify your \"docker run\" syntax."
    return 2;
  fi

  if ! docker ps > /dev/null 2>&1; then
    output=$(docker ps)
    echo "Error when running \"docker ps\": ${output}"
    return 2;
  fi
}

init() {
  # Set variables that use docker as utilities to avoid over container execution
  ETH0_ADDRESS=$(docker run --rm --net host alpine /bin/sh -c "ifconfig eth0 2> /dev/null" | \
                                                            grep "inet addr:" | \
                                                            cut -d: -f2 | \
                                                            cut -d" " -f1)

  ETH1_ADDRESS=$(docker run --rm --net host alpine /bin/sh -c "ifconfig eth1 2> /dev/null" | \
                                                            grep "inet addr:" | \
                                                            cut -d: -f2 | \
                                                            cut -d" " -f1)

  DOCKER0_ADDRESS=$(docker run --rm --net host alpine /bin/sh -c "ifconfig docker0 2> /dev/null" | \
                                                              grep "inet addr:" | \
                                                              cut -d: -f2 | \
                                                              cut -d" " -f1)

  ### Any variables with export is a value that native Tomcat che.sh startup script requires

  ### Set these values for any che server running in a container
  DOCKER_HOST_IP=$(get_docker_host_ip)
  export CHE_IP=${CHE_IP:-${DOCKER_HOST_IP}}
  export CHE_IN_CONTAINER="true"
  export CHE_SKIP_JAVA_VERSION_CHECK="true"

  if [ -f "/assembly/bin/che.sh" ]; then
    echo "Found custom assembly..."
    export CHE_HOME="/assembly"
  else
    echo "Using embedded assembly..."
    export CHE_HOME="/home/user/che"
  fi

  ### Are we using the included assembly or did user provide their own?
#  DEFAULT_CHE_HOME="/assembly"
#  export CHE_HOME=${CHE_ASSEMBLY:-${DEFAULT_CHE_HOME}}

  if [ ! -f $CHE_HOME/bin/che.sh ]; then
    echo "!!!"
    echo "!!! Error: Could not find $CHE_HOME/bin/che.sh."
    echo "!!! Error: Did you use CHE_ASSEMBLY with a typo?"
    echo "!!!"
    exit 1
  fi

  ### We need to discover the host mount provided by the user for `/data`
 # DEFAULT_CHE_DATA="/data"
 # export CHE_DATA=${CHE_DATA:-${DEFAULT_CHE_DATA}}
  export CHE_DATA="/data"
  CHE_DATA_HOST=$(get_che_data_from_host)

  ### Are we going to use the embedded che.properties or one provided by user?`
  ### CHE_LOCAL_CONF_DIR is internal Che variable that sets where to load
#  DEFAULT_CHE_CONF_DIR="/conf"
#  export CHE_LOCAL_CONF_DIR="${CHE_DATA}/conf"
#  export CHE_LOCAL_CONF_DIR=${CHE_LOCAL_CONF_DIR:-${DEFAULT_CHE_CONF_DIR}}

  if [ -f "/conf/che.properties" ]; then
    echo "Found custom che.properties..."
    export CHE_LOCAL_CONF_DIR="/conf"
  else
    echo "Using embedded che.properties... Copying template to ${CHE_DATA_HOST}/conf."
    mkdir -p /data/conf
    cp -rf "${CHE_HOME}/conf/che.properties" /data/conf/che.properties
    export CHE_LOCAL_CONF_DIR="/data/conf"
  fi

  # Update the provided che.properties with the location of the /data mounts
  sed -i "/che.workspace.storage=/c\che.workspace.storage=/data/workspaces" $CHE_LOCAL_CONF_DIR/che.properties
  sed -i "/che.database=/c\che.database=/data/storage" $CHE_LOCAL_CONF_DIR/che.properties
  sed -i "/che.template.storage=/c\che.template.storage=/data/templates" $CHE_LOCAL_CONF_DIR/che.properties
  sed -i "/che.stacks.storage=/c\che.stacks.storage=/data/stacks/stacks.json" $CHE_LOCAL_CONF_DIR/che.properties
  sed -i "/che.stacks.images=/c\che.stacks.images=/data/stacks/images" $CHE_LOCAL_CONF_DIR/che.properties
  sed -i "/che.workspace.agent.dev=/c\che.workspace.agent.dev=${CHE_DATA_HOST}/lib/ws-agent.tar.gz" $CHE_LOCAL_CONF_DIR/che.properties
  sed -i "/che.workspace.terminal_linux_amd64=/c\che.workspace.terminal_linux_amd64=${CHE_DATA_HOST}/lib/linux_amd64/terminal" $CHE_LOCAL_CONF_DIR/che.properties
  sed -i "/che.workspace.terminal_linux_arm7=/c\che.workspace.terminal_linux_arm7=${CHE_DATA_HOST}/lib/linux_arm7/terminal" $CHE_LOCAL_CONF_DIR/che.properties

  ### If this container is inside of a VM like boot2docker, then additional internal mods required
  DEFAULT_CHE_IN_VM=$(is_in_vm)
  export CHE_IN_VM=${CHE_IN_VM:-${DEFAULT_CHE_IN_VM}}

  if [ "$CHE_IN_VM" = "true" ]; then
    # CHE_DOCKER_MACHINE_HOST_EXTERNAL must be set if you are in a VM.
    HOSTNAME=$(get_docker_external_hostname)
    if has_external_hostname; then
      # Internal property used by Che to set hostname.
      # See: LocalDockerInstanceRuntimeInfo.java#L9
      export CHE_DOCKER_MACHINE_HOST_EXTERNAL=${HOSTNAME}
    fi
    ### Necessary to allow the container to write projects to the folder
    export CHE_WORKSPACE_STORAGE="${CHE_DATA_HOST}/workspaces"
    export CHE_WORKSPACE_STORAGE_CREATE_FOLDERS=false
  fi

  # Ensure that the user "user" has permissions for CHE_HOME and CHE_DATA
  sudo chown -R user:user ${CHE_HOME}
  sudo chown -R user:user ${CHE_DATA}

  # Move files from /lib to /lib-copy.  This puts files onto the host.
  rm -rf ${CHE_DATA}/lib/*
  mkdir -p ${CHE_DATA}/lib
  cp -rf ${CHE_HOME}/lib/* "${CHE_DATA}"/lib

  if [[ ! -f "${CHE_DATA}"/stacks/stacks.json ]];then
    rm -rf "${CHE_DATA}"/stacks/*
    mkdir -p "${CHE_DATA}"/stacks
    cp -rf "${CHE_HOME}"/stacks/* "${CHE_DATA}"/stacks
  fi

  if [[ ! -f "${CHE_DATA}"/templates/samples.json ]];then
    rm -rf "${CHE_DATA}"/templates/*
    mkdir -p "${CHE_DATA}"/templates
    cp -rf "${CHE_HOME}"/templates/* "${CHE_DATA}"/templates
  fi

  # A che property, which names the Docker network used for che + ws to communicate
  export JAVA_OPTS="${JAVA_OPTS} -Dche.docker.network=bridge"
}

get_che_data_from_host() {
  CHE_SERVER_CONTAINER_ID=$(get_che_server_container_id)
  echo $(docker inspect --format='{{(index .Volumes "/data")}}' $CHE_SERVER_CONTAINER_ID)
}

get_che_server_container_id() {
  hostname
}

get_docker_host_ip() {
  case $(get_docker_install_type) in
   boot2docker)
     echo $ETH1_ADDRESS
   ;;
   native)
     echo $DOCKER0_ADDRESS
   ;;
   *)
     echo $ETH0_ADDRESS
   ;;
  esac
}

get_docker_install_type() {
  if is_boot2docker; then
    echo "boot2docker"
  elif is_docker_for_windows; then
    echo "docker4windows"
  elif is_docker_for_mac; then
    echo "docker4mac"
  else
    echo "native"
  fi
}

is_boot2docker() {
  if uname -r | grep -q 'boot2docker'; then
    return 0
  else
    return 1
  fi
}

is_docker_for_windows() {
  if uname -r | grep -q 'moby' && has_docker_for_windows_ip; then
    return 0
  else
    return 1
  fi
}

has_docker_for_windows_ip() {
  if [ "${ETH0_ADDRESS}" = "10.0.75.2" ]; then
    return 0
  else
    return 1
  fi
}

is_docker_for_mac() {
  if uname -r | grep -q 'moby' && ! has_docker_for_windows_ip; then
    return 0
  else
    return 1
  fi
}

is_in_vm() {
  if is_docker_for_mac || is_docker_for_windows || is_boot2docker; then
    echo "true"
  else
    echo "false"
  fi
}

get_docker_external_hostname() {
  if is_docker_for_mac || is_docker_for_windows; then
    echo "localhost"
  else
    echo ""
  fi
}

has_external_hostname() {
  if [ "${HOSTNAME}" = "" ]; then
    return 1
  else
    return 0
  fi
}

# SITTERM / SIGINT
responsible_shutdown() {
  echo ""
  echo "Received SIGTERM"
  "${CHE_HOME}"/bin/che.sh stop
  wait ${PID}
  exit;
}

# setup handlers
# on callback, kill the last background process, which is `tail -f /dev/null` and execute the specified handler
trap 'responsible_shutdown' SIGHUP SIGTERM SIGINT

check_docker
init

# run application
"${CHE_HOME}"/bin/che.sh run &
PID=$!

# See: http://veithen.github.io/2014/11/16/sigterm-propagation.html
wait ${PID}
wait ${PID}
EXIT_STATUS=$?

# wait forever
while true
do
  tail -f /dev/null & wait ${!}
done

#!/bin/sh
#
# Copyright (c) 2012-2016 Codenvy, S.A.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
#   Codenvy, S.A. - initial API and implementation
#

# This file is a specialized launcher to be used as an entrypoint for the Che Dockerfile.
# This script has logic to detect and configure Che if it is running inside of a container.
pid=0

check_docker() {
  if [ ! -S /var/run/docker.sock ]; then
    echo "Docker socket (/var/run/docker.sock) hasn't been mounted. Verify your \"docker run\" syntax."
    return 2;
  fi

  if ! docker ps > /dev/null 2>&1; then
    output=$(docker ps)
    echo "Error when running \"docker ps\": ${output}"
    return 2;
  fi
}

init() {
  # Set variables that use docker as utilities to avoid over container execution
  ETH0_ADDRESS=$(docker run --rm --net host alpine /bin/sh -c "ifconfig eth0 2> /dev/null" | \
                                                            grep "inet addr:" | \
                                                            cut -d: -f2 | \
                                                            cut -d" " -f1)

  ETH1_ADDRESS=$(docker run --rm --net host alpine /bin/sh -c "ifconfig eth1 2> /dev/null" | \
                                                            grep "inet addr:" | \
                                                            cut -d: -f2 | \
                                                            cut -d" " -f1)

  DOCKER0_ADDRESS=$(docker run --rm --net host alpine /bin/sh -c "ifconfig docker0 2> /dev/null" | \
                                                              grep "inet addr:" | \
                                                              cut -d: -f2 | \
                                                              cut -d" " -f1)

  ### Any variables with export is a value that native Tomcat che.sh startup script requires

  ### Set these values for any che server running in a container
  DOCKER_HOST_IP=$(get_docker_host_ip)
  export CHE_IP=${CHE_IP:-${DOCKER_HOST_IP}}
  export CHE_IN_CONTAINER="true"
  export CHE_SKIP_JAVA_VERSION_CHECK="true"

  if [ -f "/assembly/bin/che.sh" ]; then
    echo "Found custom assembly..."
    export CHE_HOME="/assembly"
  else
    echo "Using embedded assembly..."
    export CHE_HOME="/home/user/che"
  fi

  ### Are we using the included assembly or did user provide their own?
#  DEFAULT_CHE_HOME="/assembly"
#  export CHE_HOME=${CHE_ASSEMBLY:-${DEFAULT_CHE_HOME}}

  if [ ! -f $CHE_HOME/bin/che.sh ]; then
    echo "!!!"
    echo "!!! Error: Could not find $CHE_HOME/bin/che.sh."
    echo "!!! Error: Did you use CHE_ASSEMBLY with a typo?"
    echo "!!!"
    exit 1
  fi

  ### We need to discover the host mount provided by the user for `/data`
 # DEFAULT_CHE_DATA="/data"
 # export CHE_DATA=${CHE_DATA:-${DEFAULT_CHE_DATA}}
  export CHE_DATA="/data"
  CHE_DATA_HOST=$(get_che_data_from_host)

  ### Are we going to use the embedded che.properties or one provided by user?`
  ### CHE_LOCAL_CONF_DIR is internal Che variable that sets where to load
#  DEFAULT_CHE_CONF_DIR="/conf"
#  export CHE_LOCAL_CONF_DIR="${CHE_DATA}/conf"
#  export CHE_LOCAL_CONF_DIR=${CHE_LOCAL_CONF_DIR:-${DEFAULT_CHE_CONF_DIR}}

  if [ -f "/conf/che.properties" ]; then
    echo "Found custom che.properties..."
    export CHE_LOCAL_CONF_DIR="/conf"
  else
    echo "Using embedded che.properties... Copying template to ${CHE_DATA_HOST}/conf."
    mkdir -p /data/conf
    cp -rf "${CHE_HOME}/conf/che.properties" /data/conf/che.properties
    export CHE_LOCAL_CONF_DIR="/data/conf"
  fi

  # Update the provided che.properties with the location of the /data mounts
  sed -i "/che.workspace.storage=/c\che.workspace.storage=/data/workspaces" $CHE_LOCAL_CONF_DIR/che.properties
  sed -i "/che.database=/c\che.database=/data/storage" $CHE_LOCAL_CONF_DIR/che.properties
  sed -i "/che.template.storage=/c\che.template.storage=/data/templates" $CHE_LOCAL_CONF_DIR/che.properties
  sed -i "/che.stacks.storage=/c\che.stacks.storage=/data/stacks/stacks.json" $CHE_LOCAL_CONF_DIR/che.properties
  sed -i "/che.stacks.images=/c\che.stacks.images=/data/stacks/images" $CHE_LOCAL_CONF_DIR/che.properties
  sed -i "/che.workspace.agent.dev=/c\che.workspace.agent.dev=${CHE_DATA_HOST}/lib/ws-agent.tar.gz" $CHE_LOCAL_CONF_DIR/che.properties
  sed -i "/che.workspace.terminal_linux_amd64=/c\che.workspace.terminal_linux_amd64=${CHE_DATA_HOST}/lib/linux_amd64/terminal" $CHE_LOCAL_CONF_DIR/che.properties
  sed -i "/che.workspace.terminal_linux_arm7=/c\che.workspace.terminal_linux_arm7=${CHE_DATA_HOST}/lib/linux_arm7/terminal" $CHE_LOCAL_CONF_DIR/che.properties

  ### If this container is inside of a VM like boot2docker, then additional internal mods required
  DEFAULT_CHE_IN_VM=$(is_in_vm)
  export CHE_IN_VM=${CHE_IN_VM:-${DEFAULT_CHE_IN_VM}}

  if [ "$CHE_IN_VM" = "true" ]; then
    # CHE_DOCKER_MACHINE_HOST_EXTERNAL must be set if you are in a VM.
    HOSTNAME=$(get_docker_external_hostname)
    if has_external_hostname; then
      # Internal property used by Che to set hostname.
      # See: LocalDockerInstanceRuntimeInfo.java#L9
      export CHE_DOCKER_MACHINE_HOST_EXTERNAL=${HOSTNAME}
    fi
    ### Necessary to allow the container to write projects to the folder
    export CHE_WORKSPACE_STORAGE="${CHE_DATA_HOST}/workspaces"
    export CHE_WORKSPACE_STORAGE_CREATE_FOLDERS=false
  fi

  # Ensure that the user "user" has permissions for CHE_HOME and CHE_DATA
  sudo chown -R user:user ${CHE_HOME}
  sudo chown -R user:user ${CHE_DATA}

  # Move files from /lib to /lib-copy.  This puts files onto the host.
  rm -rf ${CHE_DATA}/lib/*
  mkdir -p ${CHE_DATA}/lib
  cp -rf ${CHE_HOME}/lib/* "${CHE_DATA}"/lib

  if [[ ! -f "${CHE_DATA}"/stacks/stacks.json ]];then
    rm -rf "${CHE_DATA}"/stacks/*
    mkdir -p "${CHE_DATA}"/stacks
    cp -rf "${CHE_HOME}"/stacks/* "${CHE_DATA}"/stacks
  fi

  if [[ ! -f "${CHE_DATA}"/templates/samples.json ]];then
    rm -rf "${CHE_DATA}"/templates/*
    mkdir -p "${CHE_DATA}"/templates
    cp -rf "${CHE_HOME}"/templates/* "${CHE_DATA}"/templates
  fi

  # A che property, which names the Docker network used for che + ws to communicate
  export JAVA_OPTS="${JAVA_OPTS} -Dche.docker.network=bridge"
}

get_che_data_from_host() {
  CHE_SERVER_CONTAINER_ID=$(get_che_server_container_id)
  echo $(docker inspect --format='{{(index .Volumes "/data")}}' $CHE_SERVER_CONTAINER_ID)
}

get_che_server_container_id() {
  hostname
}

get_docker_host_ip() {
  case $(get_docker_install_type) in
   boot2docker)
     echo $ETH1_ADDRESS
   ;;
   native)
     echo $DOCKER0_ADDRESS
   ;;
   *)
     echo $ETH0_ADDRESS
   ;;
  esac
}

get_docker_install_type() {
  if is_boot2docker; then
    echo "boot2docker"
  elif is_docker_for_windows; then
    echo "docker4windows"
  elif is_docker_for_mac; then
    echo "docker4mac"
  else
    echo "native"
  fi
}

is_boot2docker() {
  if uname -r | grep -q 'boot2docker'; then
    return 0
  else
    return 1
  fi
}

is_docker_for_windows() {
  if uname -r | grep -q 'moby' && has_docker_for_windows_ip; then
    return 0
  else
    return 1
  fi
}

has_docker_for_windows_ip() {
  if [ "${ETH0_ADDRESS}" = "10.0.75.2" ]; then
    return 0
  else
    return 1
  fi
}

is_docker_for_mac() {
  if uname -r | grep -q 'moby' && ! has_docker_for_windows_ip; then
    return 0
  else
    return 1
  fi
}

is_in_vm() {
  if is_docker_for_mac || is_docker_for_windows || is_boot2docker; then
    echo "true"
  else
    echo "false"
  fi
}

get_docker_external_hostname() {
  if is_docker_for_mac || is_docker_for_windows; then
    echo "localhost"
  else
    echo ""
  fi
}

has_external_hostname() {
  if [ "${HOSTNAME}" = "" ]; then
    return 1
  else
    return 0
  fi
}

# SITTERM / SIGINT
responsible_shutdown() {
  echo ""
  echo "Received SIGTERM"
  "${CHE_HOME}"/bin/che.sh stop
  exit;
}

# setup handlers
# on callback, kill the last background process, which is `tail -f /dev/null` and execute the specified handler
trap 'responsible_shutdown' SIGHUP SIGTERM SIGINT

check_docker
init

# run application
"${CHE_HOME}"/bin/che.sh run &
PID=$!

# See: http://veithen.github.io/2014/11/16/sigterm-propagation.html
wait $PID
wait $PID
EXIT_STATUS=$?

# wait forever
while true
do
  tail -f /dev/null & wait ${!}
done


🏗🐛 Roll back sauce connect version to 4.5.1 (#20767)

#!/bin/bash
#
# Copyright 2018 The AMP HTML Authors. All Rights Reserved.
#
# Licensed 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.
#
# This script starts the sauce connect proxy, and waits for a successful
# connection.

CYAN() { echo -e "\033[0;36m$1\033[0m"; }
YELLOW() { echo -e "\033[1;33m$1\033[0m"; }
GREEN() { echo -e "\033[0;32m$1\033[0m"; }
RED() { echo -e "\033[0;31m$1\033[0m"; }

SC_VERSION="sc-4.5.1-linux"
AUTHENTICATED_STATUS_URL="https://$SAUCE_USERNAME:$SAUCE_ACCESS_KEY@saucelabs.com/rest/v1/info/status"
STATUS_URL="https://saucelabs.com/rest/v1/info/status"
DOWNLOAD_URL="https://saucelabs.com/downloads/$SC_VERSION.tar.gz"
DOWNLOAD_DIR="sauce_connect"
TAR_FILE="$DOWNLOAD_DIR/$SC_VERSION.tar.gz"
BINARY_FILE="$SC_VERSION/bin/sc"
PID_FILE="sauce_connect_pid"
LOG_FILE="sauce_connect_log"
OUTPUT_FILE="sauce_connect_output"
READY_FILE="sauce_connect_ready"
READY_DELAY_SECS=120
LOG_PREFIX=$(YELLOW "start_sauce_connect.sh")

# Check the status of the Sauce Labs service
echo "$LOG_PREFIX Fetching current Sauce Labs service status from $(CYAN "$STATUS_URL")..."
SAUCE_STATUS="$(curl -s "$AUTHENTICATED_STATUS_URL")"
SERVICE_OPERATIONAL="$(echo "$SAUCE_STATUS" | jq '.service_operational')"
STATUS_MESSAGE="$(echo "$SAUCE_STATUS" | jq '.status_message')"
ERROR_MESSAGE="$(echo "$SAUCE_STATUS" | jq '.message')"
if [[ "$STATUS_MESSAGE" = "null" ]]; then
  echo "$LOG_PREFIX $(RED "ERROR:") Could not fetch Sauce Labs Service status. Message: $(CYAN "$ERROR_MESSAGE")"
  echo "$LOG_PREFIX Attempting to connect anyway..."
else
  if [[ $SERVICE_OPERATIONAL = "true" ]]; then
    echo "$LOG_PREFIX $(GREEN "SUCCESS:") Sauce Labs is operational. Status: $(CYAN "$STATUS_MESSAGE")"
  else
    echo "$LOG_PREFIX $(RED "ERROR:") Sauce Labs does not appear to be operational. Status: $(CYAN "$STATUS_MESSAGE")"
    echo "$LOG_PREFIX Attempting to connect anyway..."
  fi
fi

# Download the sauce connect proxy binary (if needed) and unpack it.
if [[ -f $TAR_FILE ]]; then
  echo "$LOG_PREFIX Using cached Sauce Connect binary $(CYAN "$TAR_FILE")"
else
  echo "$LOG_PREFIX Downloading $(CYAN "$DOWNLOAD_URL")"
  wget -q "$DOWNLOAD_URL" -P "$DOWNLOAD_DIR"
fi
echo "$LOG_PREFIX Unpacking $(CYAN "$TAR_FILE")"
tar -xzf "$TAR_FILE"

# Clean up old files, if any.
if [[ -f "$LOG_FILE" ]]; then
  echo "$LOG_PREFIX Deleting old log file $(CYAN "$LOG_FILE")"
  rm "$LOG_FILE"
fi
if [[ -f $PID_FILE ]]; then
  echo "$LOG_PREFIX Deleting old pid file $(CYAN "$PID_FILE")"
  rm "$PID_FILE"
fi
if [[ -f "$OUTPUT_FILE" ]]; then
  echo "$LOG_PREFIX Deleting old output file $(CYAN "$OUTPUT_FILE")"
  rm "$OUTPUT_FILE"
fi

# Establish the tunnel identifier (job number on Travis / username during local dev).
if [[ -z "$TRAVIS_JOB_NUMBER" ]]; then
  TUNNEL_IDENTIFIER="$(git log -1 --pretty=format:"%ae")"
else
  TUNNEL_IDENTIFIER="$TRAVIS_JOB_NUMBER"
fi

# Launch proxy and wait for a tunnel to be created.
echo "$LOG_PREFIX Launching $(CYAN "$BINARY_FILE")"
"$BINARY_FILE" --verbose --tunnel-identifier "$TUNNEL_IDENTIFIER" --readyfile "$READY_FILE" --pidfile "$PID_FILE" --logfile "$LOG_FILE" 1>"$OUTPUT_FILE" 2>&1 &
count=0
while [ $count -lt $READY_DELAY_SECS ]
do
  if [ -e "$READY_FILE" ]
  then
    # Print confirmation.
    PID="$(cat "$PID_FILE")"
    TUNNEL_ID="$(grep -oP "Tunnel ID: \K.*$" "$OUTPUT_FILE")"
    echo "$LOG_PREFIX Sauce Connect Proxy with tunnel ID $(CYAN "$TUNNEL_ID") and identifier $(CYAN "$TUNNEL_IDENTIFIER") is now running as pid $(CYAN "$PID")"
    break
  else
    # Continue waiting.
    sleep 1
    (( count++ ))
    if [ $count -eq $READY_DELAY_SECS ]
    then
      # Print the error logs.
      echo "$LOG_PREFIX Sauce Connect Proxy has not started after $(CYAN "$READY_DELAY_SECS") seconds."
      echo "$LOG_PREFIX Console output:"
      cat "$OUTPUT_FILE"
      echo "$LOG_PREFIX Log file contents:"
      cat "$LOG_FILE"
      exit 1
    fi
  fi
done

#!/bin/bash
#
# Copyright 2018 The AMP HTML Authors. All Rights Reserved.
#
# Licensed 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.
#
# This script starts the sauce connect proxy, and waits for a successful
# connection.

CYAN() { echo -e "\033[0;36m$1\033[0m"; }
YELLOW() { echo -e "\033[1;33m$1\033[0m"; }
GREEN() { echo -e "\033[0;32m$1\033[0m"; }
RED() { echo -e "\033[0;31m$1\033[0m"; }

SC_VERSION="sc-4.5.3-linux"
AUTHENTICATED_STATUS_URL="https://$SAUCE_USERNAME:$SAUCE_ACCESS_KEY@saucelabs.com/rest/v1/info/status"
STATUS_URL="https://saucelabs.com/rest/v1/info/status"
DOWNLOAD_URL="https://saucelabs.com/downloads/$SC_VERSION.tar.gz"
DOWNLOAD_DIR="sauce_connect"
TAR_FILE="$DOWNLOAD_DIR/$SC_VERSION.tar.gz"
BINARY_FILE="$SC_VERSION/bin/sc"
PID_FILE="sauce_connect_pid"
LOG_FILE="sauce_connect_log"
OUTPUT_FILE="sauce_connect_output"
READY_FILE="sauce_connect_ready"
READY_DELAY_SECS=120
LOG_PREFIX=$(YELLOW "start_sauce_connect.sh")

# Check the status of the Sauce Labs service
echo "$LOG_PREFIX Fetching current Sauce Labs service status from $(CYAN "$STATUS_URL")..."
SAUCE_STATUS="$(curl -s "$AUTHENTICATED_STATUS_URL")"
SERVICE_OPERATIONAL="$(echo "$SAUCE_STATUS" | jq '.service_operational')"
STATUS_MESSAGE="$(echo "$SAUCE_STATUS" | jq '.status_message')"
ERROR_MESSAGE="$(echo "$SAUCE_STATUS" | jq '.message')"
if [[ "$STATUS_MESSAGE" = "null" ]]; then
  echo "$LOG_PREFIX $(RED "ERROR:") Could not fetch Sauce Labs Service status. Message: $(CYAN "$ERROR_MESSAGE")"
  echo "$LOG_PREFIX Attempting to connect anyway..."
else
  if [[ $SERVICE_OPERATIONAL = "true" ]]; then
    echo "$LOG_PREFIX $(GREEN "SUCCESS:") Sauce Labs is operational. Status: $(CYAN "$STATUS_MESSAGE")"
  else
    echo "$LOG_PREFIX $(RED "ERROR:") Sauce Labs does not appear to be operational. Status: $(CYAN "$STATUS_MESSAGE")"
    echo "$LOG_PREFIX Attempting to connect anyway..."
  fi
fi

# Download the sauce connect proxy binary (if needed) and unpack it.
if [[ -f $TAR_FILE ]]; then
  echo "$LOG_PREFIX Using cached Sauce Connect binary $(CYAN "$TAR_FILE")"
else
  echo "$LOG_PREFIX Downloading $(CYAN "$DOWNLOAD_URL")"
  wget -q "$DOWNLOAD_URL" -P "$DOWNLOAD_DIR"
fi
echo "$LOG_PREFIX Unpacking $(CYAN "$TAR_FILE")"
tar -xzf "$TAR_FILE"

# Clean up old files, if any.
if [[ -f "$LOG_FILE" ]]; then
  echo "$LOG_PREFIX Deleting old log file $(CYAN "$LOG_FILE")"
  rm "$LOG_FILE"
fi
if [[ -f $PID_FILE ]]; then
  echo "$LOG_PREFIX Deleting old pid file $(CYAN "$PID_FILE")"
  rm "$PID_FILE"
fi
if [[ -f "$OUTPUT_FILE" ]]; then
  echo "$LOG_PREFIX Deleting old output file $(CYAN "$OUTPUT_FILE")"
  rm "$OUTPUT_FILE"
fi

# Establish the tunnel identifier (job number on Travis / username during local dev).
if [[ -z "$TRAVIS_JOB_NUMBER" ]]; then
  TUNNEL_IDENTIFIER="$(git log -1 --pretty=format:"%ae")"
else
  TUNNEL_IDENTIFIER="$TRAVIS_JOB_NUMBER"
fi

# Launch proxy and wait for a tunnel to be created.
echo "$LOG_PREFIX Launching $(CYAN "$BINARY_FILE")"
"$BINARY_FILE" --verbose --tunnel-identifier "$TUNNEL_IDENTIFIER" --readyfile "$READY_FILE" --pidfile "$PID_FILE" --logfile "$LOG_FILE" 1>"$OUTPUT_FILE" 2>&1 &
count=0
while [ $count -lt $READY_DELAY_SECS ]
do
  if [ -e "$READY_FILE" ]
  then
    # Print confirmation.
    PID="$(cat "$PID_FILE")"
    TUNNEL_ID="$(grep -oP "Tunnel ID: \K.*$" "$OUTPUT_FILE")"
    echo "$LOG_PREFIX Sauce Connect Proxy with tunnel ID $(CYAN "$TUNNEL_ID") and identifier $(CYAN "$TUNNEL_IDENTIFIER") is now running as pid $(CYAN "$PID")"
    break
  else
    # Continue waiting.
    sleep 1
    (( count++ ))
    if [ $count -eq $READY_DELAY_SECS ]
    then
      # Print the error logs.
      echo "$LOG_PREFIX Sauce Connect Proxy has not started after $(CYAN "$READY_DELAY_SECS") seconds."
      echo "$LOG_PREFIX Console output:"
      cat "$OUTPUT_FILE"
      echo "$LOG_PREFIX Log file contents:"
      cat "$LOG_FILE"
      exit 1
    fi
  fi
done


dbcreate added

dbcreate added

#!/bin/bash
dbname=$1

if [ -z "${dbname}" ]
	then
	echo "Supply name of the db as the only argument"
	echo "Example: $0 testdb"
	exit 1
	fi

if [ $(id -u) -ne 0 ]
	then
	echo "Please rerun as root user"
	exit 1
	fi

distro=$(lsb_release -i 2>/dev/null | awk -F'\t' '{print $NF}')

su - postgres -c "createdb --encoding=UTF8 --owner=postgres ${dbname}"
case ${distro} in
	Debian):
	su - postgres -c "psql -v ON_ERROR_STOP=1 --dbname=${dbname} --file=/usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql"
	su - postgres -c "psql -v ON_ERROR_STOP=1 --dbname=${dbname} --file=/usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql"
	;;
	Arch):
	:
	;;
	*)
	echo "Distribution not recognized, sorry.."
	exit 1
	;;
esac

# when error about error block encountered try pgsql -d ${dbname} -c "VACUUM FULL"
su - postgres -c "psql -d $dbname -c 'ALTER ROLE postgres with password '\'postgres\''; create extension hstore'"

case ${distro} in
	Debian):
	su - postgres -c "psql -d ${dbname} -f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6.sql"
	su - postgres -c "psql -d ${dbname} -f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6_linestring.sql"
	;;
	Arch):
	:
	;;
	*)
	echo "Distribution not recognized, sorry.."
	exit 1
	;;
esac

error: pathspec 'postgis/dbcreate.sh' did not match any file(s) known to git


provides iwhois command to use CNAMES under whois.geek.nz to find most accurate whois server

# provide a whois command with a more accurate and up to date list of whois
# servers using CNAMES via whois.geek.nz

function iwhois() {
    resolver="whois.geek.nz"
    tld=`echo ${@: -1} | awk -F "." '{print $NF}'`
    whois -h ${tld}.${resolver} "$@" ;
}

error: pathspec 'plugins/iwhois/iwhois.plugin.zsh' did not match any file(s) known to git


Created the initial version of the script.

#!/bin/bash

# Small script that automatically sets up the development environment for my current project
# saves about 15 seconds * opening projects 2 times / day * 4 days / week = valuable time! ;)

go2cpd () {
  # go to current project directory
  cd "/home/sam/Documents/github/force-push-arena-2/force-push-arena/"
}

cur_proj_name="Blaze Penguinz"
echo "Starting: $cur_proj_name!  -  ($PWD)"

proj_dir1="/home/sam/Documents/github/force-push-arena-2/"  #main
proj_dir2="/home/sam/Documents/github/force-push-arena/"    #extra

# start atom and firefox in the background and hide their output from nuhup.out log-files and terminal
nohup atom $proj_dir1 $proj_dir2 >/dev/null 2>&1 &
nohup firefox localhost:3000 >/dev/null 2>&1 &

# finally, go to project directory and launch app-processes
go2cpd
meteor

exit 1


Configure Dash properly

Configure Dash properly

fatal: remote error: upload-pack: not our ref fac4a6f7a3af086ba984c53a6fc821cccc901472
fatal: the remote end hung up unexpectedly


Added main core for battery plugin extension

#####################################################
# 									VARIABLES 											#
#####################################################

# Default variables
local default_battery_symbol='\u25b6'
local default_danger_color='\e[0;31m'
local default_alert_color='\e[0;33m'
local default_safe_color='\e[0;32m'
local default_full_color='\e[0;35m'

# Script variables
local battery_symbol="${BATTERY_SYMBOL:-$default_battery_symbol}"
local danger_color="${DANGER_COLOR:-$default_danger_color}"
local alert_color="${ALERT_COLOR:-$default_alert_color}"
local safe_color="${SAFE_COLOR:-$default_safe_color}"
local full_color="${full_color:-$default_full_color}"

#####################################################

#####################################################
# 							HELPER FUNCTIONS										#
#####################################################

# Returns one string repetition of battery_symbol according to level
print_battery_icons() {
	local level=$1
  local output=$(printf "${battery_symbol}%.0s" {1..${level}})
	echo "${output// /*}"
}

# Decides which color to use
display_color() {
	if [ "$1" -lt 2 ]; then
		echo $danger_color
	elif [ "$1" -lt 4 ]; then
		echo $alert_color
	elif [ "$1" -lt 5 ]; then
		echo $safe_color
	else
		echo $full_color
	fi
}

# get battery level (0-5) according to acpi
get_level() {
	local battery_percentage=$(acpi | grep -o "[0-9]*%" | grep -o "[0-9]*")
  local battery_step=25
  local level=$(($battery_percentage / $battery_step + 1))

  if [ "$level" -lt 1 ]; then
    eval $level=1
  fi

  echo "$level"
}

# Reset color to default
color_reset() {
	echo "\e[m"
}

# export battery status in RPROMPT
reset_battery_status() {
	export RPROMPT="$(display_color $battery_level)$(print_battery_icons $battery_level)$(color_reset)"
}

# binds the export to recalculate battery level after each command
preexec() {
	reset_battery_status
}
#####################################################

#####################################################
# 								EXECUTION													#
#####################################################
local battery_level=$(get_level)
reset_battery_status


Handle smart raw values >2^31

Handle smart raw values >2^31

"%d" in awk will truncate values at 2^31. S.M.A.R.T. values can exceed that, thus use a floating point notation instead to encode larger values (at the possible cost of some precision).

#!/bin/bash
# Script informed by the collectd monitoring script for smartmontools (using smartctl)
# by Samuel B. <samuel_._behan_(at)_dob_._sk> (c) 2012
# source at: http://devel.dob.sk/collectd-scripts/

# TODO: This probably needs to be a little more complex.  The raw numbers can have more
#       data in them than you'd think.
#       http://arstechnica.com/civis/viewtopic.php?p=22062211

disks="$(/usr/sbin/smartctl --scan | awk '{print $1 "|" $3}')"

parse_smartctl_attributes_awk="$(cat << 'SMARTCTLAWK'
$1 ~ /^[0-9]+$/ && $2 ~ /^[a-zA-Z0-9_-]+$/ {
  gsub(/-/, "_");
  printf "%s_value{%s,smart_id=\"%s\"} %d\n", $2, labels, $1, $4
  printf "%s_worst{%s,smart_id=\"%s\"} %d\n", $2, labels, $1, $5
  printf "%s_threshold{%s,smart_id=\"%s\"} %d\n", $2, labels, $1, $6
  printf "%s_raw_value{%s,smart_id=\"%s\"} %e\n", $2, labels, $1, $10
}
SMARTCTLAWK
)"

smartmon_attrs="$(cat << 'SMARTMONATTRS'
airflow_temperature_cel
command_timeout
current_pending_sector
end_to_end_error
erase_fail_count
g_sense_error_rate
hardware_ecc_recovered
host_reads_mib
host_reads_32mib
host_writes_mib
host_writes_32mib
load_cycle_count
media_wearout_indicator
nand_writes_1gib
offline_uncorrectable
power_cycle_count
power_on_hours
program_fail_count
raw_read_error_rate
reallocated_sector_ct
reported_uncorrect
sata_downshift_count
spin_retry_count
spin_up_time
start_stop_count
temperature_celsius
total_lbas_read
total_lbas_written
udma_crc_error_count
unsafe_shutdown_count
workld_host_reads_perc
workld_media_wear_indic
workload_minutes
SMARTMONATTRS
)"
smartmon_attrs="$(echo ${smartmon_attrs} | xargs | tr ' ' '|')"

parse_smartctl_attributes() {
  local disk="$1"
  local disk_type="$2"
  local labels="disk=\"${disk}\",type=\"${disk_type}\""
  local vars="$(echo "${smartmon_attrs}" | xargs | tr ' ' '|')"
  sed 's/^ \+//g' \
    | awk -v labels="${labels}" "${parse_smartctl_attributes_awk}" 2>/dev/null \
    | tr A-Z a-z \
    | grep -E "(${smartmon_attrs})"
}

parse_smartctl_info() {
  local -i smart_available=0 smart_enabled=0
  local disk="$1" disk_type="$2"
  while read line ; do
    info_type="$(echo "${line}" | cut -f1 -d: | tr ' ' '_')"
    info_value="$(echo "${line}" | cut -f2- -d: | sed 's/^ \+//g')"
    case "${info_type}" in
      Model_Family) model_family="${info_value}" ;;
      Device_Model) device_model="${info_value}" ;;
      Serial_Number) serial_number="${info_value}" ;;
      Firmware_Version) fw_version="${info_value}" ;;
      Vendor) vendor="${info_value}" ;;
      Product) product="${info_value}" ;;
      Revision) revision="${info_value}" ;;
      Logical_Unit_id) lun_id="${info_value}" ;;
    esac
    if [[ "${info_type}" == 'SMART_support_is' ]] ; then
      case "${info_value:0:7}" in
        Enabled) smart_enabled=1 ;;
        Availab) smart_available=1 ;;
        Unavail) smart_available=0 ;;
      esac
    fi
  done
  if [[ -n "${model_family}" ]] ; then
    echo "device_info{disk=\"${disk}\",type=\"${disk_type}\",model_family=\"${model_family}\",device_model=\"${device_model}\",serial_number=\"${serial_number}\",firmware_version=\"${fw_version}\"} 1"
  elif [[ -n "${vendor}" ]] ; then
    echo "device_info{disk=\"${disk}\",type=\"${disk_type}\",vendor=\"${vendor}\",product=\"${product}\",revision=\"${revision}\",lun_id=\"${lun_id}\"} 1"
  fi
  echo "device_smart_available{disk=\"${disk}\",type=\"${disk_type}\"} ${smart_available}"
  echo "device_smart_enabled{disk=\"${disk}\",type=\"${disk_type}\"} ${smart_enabled}"
}

output_format_awk="$(cat << 'OUTPUTAWK'
BEGIN { v = "" }
v != $1 {
  print "# HELP smartmon_" $1 " SMART metric " $1;
  print "# TYPE smartmon_" $1 " gauge";
  v = $1
}
{print "smartmon_" $0}
OUTPUTAWK
)"

format_output() {
  sort \
  | awk -F'{' "${output_format_awk}"
}

smartctl_version="$(/usr/sbin/smartctl -V | head -n1  | awk '$1 == "smartctl" {print $2}')"

echo "smartctl_version{version=\"${smartctl_version}\"} 1" | format_output

if [[ "$(expr "${smartctl_version}" : '\([0-9]*\)\..*')" -lt 6 ]] ; then
  exit
fi

device_list="$(/usr/sbin/smartctl --scan-open | awk '{print $1 "|" $3}')"

for device in ${device_list}; do
  disk="$(echo ${device} | cut -f1 -d'|')"
  type="$(echo ${device} | cut -f2 -d'|')"
  echo "smartctl_run{disk=\"${disk}\",type=\"${type}\"}" $(TZ=UTC date '+%s')
  # Get the SMART information
  /usr/sbin/smartctl -i -d "${type}" "${disk}" | parse_smartctl_info "${disk}" "${type}"
  # Get the SMART attributes
  /usr/sbin/smartctl -A -d "${type}" "${disk}" | parse_smartctl_attributes "${disk}" "${type}"
done | format_output

#!/bin/bash
# Script informed by the collectd monitoring script for smartmontools (using smartctl)
# by Samuel B. <samuel_._behan_(at)_dob_._sk> (c) 2012
# source at: http://devel.dob.sk/collectd-scripts/

# TODO: This probably needs to be a little more complex.  The raw numbers can have more
#       data in them than you'd think.
#       http://arstechnica.com/civis/viewtopic.php?p=22062211

disks="$(/usr/sbin/smartctl --scan | awk '{print $1 "|" $3}')"

parse_smartctl_attributes_awk="$(cat << 'SMARTCTLAWK'
$1 ~ /^[0-9]+$/ && $2 ~ /^[a-zA-Z0-9_-]+$/ {
  gsub(/-/, "_");
  printf "%s_value{%s,smart_id=\"%s\"} %d\n", $2, labels, $1, $4
  printf "%s_worst{%s,smart_id=\"%s\"} %d\n", $2, labels, $1, $5
  printf "%s_threshold{%s,smart_id=\"%s\"} %d\n", $2, labels, $1, $6
  printf "%s_raw_value{%s,smart_id=\"%s\"} %d\n", $2, labels, $1, $10
}
SMARTCTLAWK
)"

smartmon_attrs="$(cat << 'SMARTMONATTRS'
airflow_temperature_cel
command_timeout
current_pending_sector
end_to_end_error
erase_fail_count
g_sense_error_rate
hardware_ecc_recovered
host_reads_mib
host_reads_32mib
host_writes_mib
host_writes_32mib
load_cycle_count
media_wearout_indicator
nand_writes_1gib
offline_uncorrectable
power_cycle_count
power_on_hours
program_fail_count
raw_read_error_rate
reallocated_sector_ct
reported_uncorrect
sata_downshift_count
spin_retry_count
spin_up_time
start_stop_count
temperature_celsius
total_lbas_read
total_lbas_written
udma_crc_error_count
unsafe_shutdown_count
workld_host_reads_perc
workld_media_wear_indic
workload_minutes
SMARTMONATTRS
)"
smartmon_attrs="$(echo ${smartmon_attrs} | xargs | tr ' ' '|')"

parse_smartctl_attributes() {
  local disk="$1"
  local disk_type="$2"
  local labels="disk=\"${disk}\",type=\"${disk_type}\""
  local vars="$(echo "${smartmon_attrs}" | xargs | tr ' ' '|')"
  sed 's/^ \+//g' \
    | awk -v labels="${labels}" "${parse_smartctl_attributes_awk}" 2>/dev/null \
    | tr A-Z a-z \
    | grep -E "(${smartmon_attrs})"
}

parse_smartctl_info() {
  local -i smart_available=0 smart_enabled=0
  local disk="$1" disk_type="$2"
  while read line ; do
    info_type="$(echo "${line}" | cut -f1 -d: | tr ' ' '_')"
    info_value="$(echo "${line}" | cut -f2- -d: | sed 's/^ \+//g')"
    case "${info_type}" in
      Model_Family) model_family="${info_value}" ;;
      Device_Model) device_model="${info_value}" ;;
      Serial_Number) serial_number="${info_value}" ;;
      Firmware_Version) fw_version="${info_value}" ;;
      Vendor) vendor="${info_value}" ;;
      Product) product="${info_value}" ;;
      Revision) revision="${info_value}" ;;
      Logical_Unit_id) lun_id="${info_value}" ;;
    esac
    if [[ "${info_type}" == 'SMART_support_is' ]] ; then
      case "${info_value:0:7}" in
        Enabled) smart_enabled=1 ;;
        Availab) smart_available=1 ;;
        Unavail) smart_available=0 ;;
      esac
    fi
  done
  if [[ -n "${model_family}" ]] ; then
    echo "device_info{disk=\"${disk}\",type=\"${disk_type}\",model_family=\"${model_family}\",device_model=\"${device_model}\",serial_number=\"${serial_number}\",firmware_version=\"${fw_version}\"} 1"
  elif [[ -n "${vendor}" ]] ; then
    echo "device_info{disk=\"${disk}\",type=\"${disk_type}\",vendor=\"${vendor}\",product=\"${product}\",revision=\"${revision}\",lun_id=\"${lun_id}\"} 1"
  fi
  echo "device_smart_available{disk=\"${disk}\",type=\"${disk_type}\"} ${smart_available}"
  echo "device_smart_enabled{disk=\"${disk}\",type=\"${disk_type}\"} ${smart_enabled}"
}

output_format_awk="$(cat << 'OUTPUTAWK'
BEGIN { v = "" }
v != $1 {
  print "# HELP smartmon_" $1 " SMART metric " $1;
  print "# TYPE smartmon_" $1 " gauge";
  v = $1
}
{print "smartmon_" $0}
OUTPUTAWK
)"

format_output() {
  sort \
  | awk -F'{' "${output_format_awk}"
}

smartctl_version="$(/usr/sbin/smartctl -V | head -n1  | awk '$1 == "smartctl" {print $2}')"

echo "smartctl_version{version=\"${smartctl_version}\"} 1" | format_output

if [[ "$(expr "${smartctl_version}" : '\([0-9]*\)\..*')" -lt 6 ]] ; then
  exit
fi

device_list="$(/usr/sbin/smartctl --scan-open | awk '{print $1 "|" $3}')"

for device in ${device_list}; do
  disk="$(echo ${device} | cut -f1 -d'|')"
  type="$(echo ${device} | cut -f2 -d'|')"
  echo "smartctl_run{disk=\"${disk}\",type=\"${type}\"}" $(TZ=UTC date '+%s')
  # Get the SMART information
  /usr/sbin/smartctl -i -d "${type}" "${disk}" | parse_smartctl_info "${disk}" "${type}"
  # Get the SMART attributes
  /usr/sbin/smartctl -A -d "${type}" "${disk}" | parse_smartctl_attributes "${disk}" "${type}"
done | format_output


update nvim setup script

update nvim setup script

fatal: remote error: upload-pack: not our ref 5c90d82960de4c3f8199e589e9463c5314b79d49
fatal: the remote end hung up unexpectedly


Add full path to grep

Add full path to grep

fatal: remote error: upload-pack: not our ref c6d44ec8350f6eda89b6ede0c27979fba8a3b27e
fatal: the remote end hung up unexpectedly


add tools

add tools

#!/bin/bash -e

function main()
{
    local -r attributeFile="${1}"

    local -r appPath="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
    local -r command='ifconfig | grep -E -i "inet addr.*Bcast.*Mask" | cut -d ":" -f2 | cut -d " " -f1'

    "${appPath}/../../../../../../../../tools/run-remote-command.bash" \
        --attribute-file "${attributeFile}" \
        --command "${command}" \
        --machine-type 'masters-slaves'
}

main "${@}"

error: pathspec 'roles/adobe/roles/ccmui/roles/jenkins/tools/recipes/get-ip.bash' did not match any file(s) known to git


added run script

added run script

#!/bin/bash

sbt clean compile docker:publishLocal
docker-compose up

error: pathspec 'akka-2.5.6-cluster-docker/run.sh' did not match any file(s) known to git


xcode tools check changed to check for gcc

fatal: remote error: upload-pack: not our ref 5e9bbbb74b1d33d57ba0f2f69905d25e68a595e8
fatal: the remote end hung up unexpectedly


Create run.sh

Create run.sh

#!/usr/bin/env bash

java --module-path mods \
--module appmod/kata.app.HelloModUsingLib1

error: pathspec 'src/modules/usinglibs/hellomodusinglib1/run.sh' did not match any file(s) known to git


MQTT_TOPIC was defined

MQTT_TOPIC was defined

fatal: remote error: upload-pack: not our ref 349737c9057b41fedebb43604c6977c8057e6781
fatal: the remote end hung up unexpectedly


Add script for devs to rebuild database

Add script for devs to rebuild database

#!/usr/bin/env bash
bundle exec rails db:drop
bundle exec rails db:create
bundle exec rails db:migrate
bundle exec rails db:seed

error: pathspec 'rebuild-database.sh' did not match any file(s) known to git


GH #39 - Add RHEL8 support

GH #39 - Add RHEL8 support

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/zatosource/zato-build.git/'


pod: initrdscripts: Add rootdelay support in init

Needed to support rootfs labels on USB filesystems.
Without the delay, the USB filesystem isn't visible
when the system tries to find the label at rootfs
mount time.

Signed-off-by: Jim Somerville <102cd290f47450cd930e68c956ca1e51fe8c8434@windriver.com>
Signed-off-by: Bruce Ashfield <284cc737d174a260eec2a2a6324a304f84b1ae0f@windriver.com>

#!/bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin

ROOT_MOUNT="/rootfs"
MOUNT="/bin/mount"
UMOUNT="/bin/umount"
ROOT_DELAY="0"

# Copied from initramfs-framework. The core of this script probably should be
# turned into initramfs-framework modules to reduce duplication.
udev_daemon() {
	OPTIONS="/sbin/udev/udevd /sbin/udevd /lib/udev/udevd /lib/systemd/systemd-udevd"

	for o in $OPTIONS; do
		if [ -x "$o" ]; then
			echo $o
			return 0
		fi
	done

	return 1
}

_UDEV_DAEMON=`udev_daemon`

early_setup() {
    mkdir -p /proc
    mkdir -p /sys
    mount -t proc proc /proc
    mount -t sysfs sysfs /sys
    mount -t devtmpfs none /dev

    # support modular kernel
#    modprobe isofs
#    modprobe raid0

    mkdir -p /run
    mkdir -p /var/run

    $_UDEV_DAEMON --daemon
    udevadm trigger --action=add

    if [ -x /sbin/mdadm ]; then
	/sbin/mdadm -v --assemble --scan --auto=md
    fi
}

read_args() {
    [ -z "$CMDLINE" ] && CMDLINE=`cat /proc/cmdline`
    for arg in $CMDLINE; do
        optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
        case $arg in
            root=*)
                ROOT_DEVICE=$optarg ;;
            rootdelay=*)
                ROOT_DELAY=$optarg ;;
            init=*)
                INIT=$optarg ;;
        esac
    done
}

fatal() {
    echo $1 >$CONSOLE
    echo >$CONSOLE
    exec sh
}

#######################################

early_setup

read_args

[ -z "$CONSOLE" ] && CONSOLE="/dev/console"
[ -z "$INIT" ] && INIT="/sbin/init"

udevadm settle --timeout=3 --quiet
killall "${_UDEV_DAEMON##*/}" 2>/dev/null

mkdir -p $ROOT_MOUNT/

sleep ${ROOT_DELAY}

if ! mount -o rw,noatime $ROOT_DEVICE $ROOT_MOUNT ; then
    fatal "Could not mount rootfs device \"$ROOT_DEVICE\"."
fi

# Move the mount points of some filesystems over to
# the corresponding directories under the real root filesystem.
for dir in `cat /proc/mounts | grep -v rootfs | awk '{print $2}'` ; do
    mkdir -p  ${ROOT_MOUNT}/${dir##*/}
    mount -nv --move $dir ${ROOT_MOUNT}/${dir##*/}
done

cd $ROOT_MOUNT

# If we pass args to bash, it will assume they are text files
# to source and run.
if [ "$INIT" == "/bin/bash" ] || [ "$INIT" == "/bin/sh" ]; then
    CMDLINE=""
fi

exec switch_root $ROOT_MOUNT $INIT $CMDLINE ||
    fatal "Couldn't switch_root, dropping to shell"

#!/bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin

ROOT_MOUNT="/rootfs"
MOUNT="/bin/mount"
UMOUNT="/bin/umount"

# Copied from initramfs-framework. The core of this script probably should be
# turned into initramfs-framework modules to reduce duplication.
udev_daemon() {
	OPTIONS="/sbin/udev/udevd /sbin/udevd /lib/udev/udevd /lib/systemd/systemd-udevd"

	for o in $OPTIONS; do
		if [ -x "$o" ]; then
			echo $o
			return 0
		fi
	done

	return 1
}

_UDEV_DAEMON=`udev_daemon`

early_setup() {
    mkdir -p /proc
    mkdir -p /sys
    mount -t proc proc /proc
    mount -t sysfs sysfs /sys
    mount -t devtmpfs none /dev

    # support modular kernel
#    modprobe isofs
#    modprobe raid0

    mkdir -p /run
    mkdir -p /var/run

    $_UDEV_DAEMON --daemon
    udevadm trigger --action=add

    if [ -x /sbin/mdadm ]; then
	/sbin/mdadm -v --assemble --scan --auto=md
    fi
}

read_args() {
    [ -z "$CMDLINE" ] && CMDLINE=`cat /proc/cmdline`
    for arg in $CMDLINE; do
        optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
        case $arg in
            root=*)
                ROOT_DEVICE=$optarg ;;
            init=*)
                INIT=$optarg ;;
        esac
    done
}

fatal() {
    echo $1 >$CONSOLE
    echo >$CONSOLE
    exec sh
}

#######################################

early_setup

read_args

[ -z "$CONSOLE" ] && CONSOLE="/dev/console"
[ -z "$INIT" ] && INIT="/sbin/init"

udevadm settle --timeout=3 --quiet
killall "${_UDEV_DAEMON##*/}" 2>/dev/null

mkdir -p $ROOT_MOUNT/

if ! mount -o rw,noatime $ROOT_DEVICE $ROOT_MOUNT ; then
    fatal "Could not mount rootfs device \"$ROOT_DEVICE\"."
fi

# Move the mount points of some filesystems over to
# the corresponding directories under the real root filesystem.
for dir in `cat /proc/mounts | grep -v rootfs | awk '{print $2}'` ; do
    mkdir -p  ${ROOT_MOUNT}/${dir##*/}
    mount -nv --move $dir ${ROOT_MOUNT}/${dir##*/}
done

cd $ROOT_MOUNT

# If we pass args to bash, it will assume they are text files
# to source and run.
if [ "$INIT" == "/bin/bash" ] || [ "$INIT" == "/bin/sh" ]; then
    CMDLINE=""
fi

exec switch_root $ROOT_MOUNT $INIT $CMDLINE ||
    fatal "Couldn't switch_root, dropping to shell"


needed for EXTENSIONS fix

needed for EXTENSIONS fix

#!/bin/bash
#
# Determine the file extensions that should be used based on the serializations that will be produced.
# This avoids needing to manually determine and set it.

if [[ "$CSV2RDF4LOD_CONVERT_DUMP_FILE_EXTENSIONS" != "cr:auto" && "$1" != "--auto" ]]; then
   echo $CSV2RDF4LOD_CONVERT_DUMP_FILE_EXTENSIONS
   exit
fi

tgz=""
if [ "$CSV2RDF4LOD_PUBLISH_COMPRESS" == "true" ]; then
   tgz=".tgz"
fi

extensions="ttl$tgz"

if [ "$CSV2RDF4LOD_PUBLISH_RDFXML" == "true" ]; then
   extensions="$extensions,rdf$tgz"
fi

if [ "$CSV2RDF4LOD_PUBLISH_NT" == "true" ]; then
   extensions="$extensions,nt$tgz"
fi

echo $extensions

error: pathspec 'bin/util/dump-file-extensions.sh' did not match any file(s) known to git


salt-minion.init

salt-minion.init

if [ $# -ne 1 ]; then
  echo "usage: $0 minion-master"
  exit 1
fi
master=$1
serial=`python -m piserialnumber`
sudo apt-get purge salt-common salt-minion
sudo apt-get install salt-common/stretch salt-minion/stretch
sudo sed -i "s/#master: salt/master: ${master}/" /etc/salt/minion
sudo sed -i "s/#id:/id: gc16_${serial}/" /etc/salt/minion
sudo systemctl restart salt-minion

error: pathspec 'salt-minion.init.sh' did not match any file(s) known to git


Initial Comit

Initial Comit

#!/bin/bash
#
# Flush all current rules from iptables
#
 clear
 echo "Flushing Firewall"
 iptables -F
 ip6tables -F
#
# Allow SSH connections on tcp port 22
# This is essential when working on remote servers via SSH to prevent locking yourself out of the system
#
 iptables -A INPUT -p tcp --dport 22 -j ACCEPT
 ip6tables -A INPUT -p tcp --dport 22 -j ACCEPT
#
# Set default policies for INPUT, FORWARD and OUTPUT chains
#
 iptables -P INPUT DROP
 ip6tables -P INPUT DROP
 iptables -P FORWARD DROP
 ip6tables -P FORWARD DROP
 iptables -P OUTPUT ACCEPT
 ip6tables -P OUTPUT ACCEPT
#
# Set access for localhost
#
 iptables -A INPUT -i lo -j ACCEPT
 ip6tables -A INPUT -i lo -j ACCEPT
#
# Accept packets belonging to established and related connections
#
 iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
 ip6tables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#
# Accept web traffic
#
 iptables -A INPUT -p tcp --dport 80 -j ACCEPT
 ip6tables -A INPUT -p tcp --dport 80 -j ACCEPT
 iptables -A INPUT -p tcp --dport 443 -j ACCEPT
 ip6tables -A INPUT -p tcp --dport 443 -j ACCEPT
#
# Save settings
#
 echo "Saving Firewall Settings\n\n"
 /sbin/service iptables save
 /sbin/service ip6tables save
#
# List rules
#
 echo "IPTABLES:---------------------------------------\n\n"
 iptables -L -v
 echo "\n\nIP6TABLES:---------------------------------------\n\n"
 ip6tables -L -v


update generate_resources script

update generate_resources script

fatal: remote error: upload-pack: not our ref 8dbe1f3eb4029622a48fb426dd5183b051c1fc7b
fatal: the remote end hung up unexpectedly


Replace 127.0.0.1:5252 endpoint url with PUBLIC_ENDPOINT during deployment

#!/usr/bin/with-contenv bash

# Update OpenAPI documentation to match PUBLIC_ENDPOINT server url
sed -i 's|'"http://127.0.0.1:5252"'|'"${PUBLIC_ENDPOINT}"'|g' /docs/resto-api.json
sed -i 's|'"http://127.0.0.1:5252"'|'"${PUBLIC_ENDPOINT}"'|g' /docs/resto-api.html

error: pathspec 'build/resto/container_root/cont-init.d/16-resto-docs.sh' did not match any file(s) known to git


added scripts/wait-cloudinit-bucket.sh. this fixed the problem workers won't join the cluster because of the delay of init-cluster file in s3 bucket.

#!/usr/bin/env bash

AWS_PROFILE=${AWS_PROFILE:-coreos-cluster}
CLUSTER_NAME=${CLUSTER_NAME:-coreos-cluster}
AWS_ACCOUNTID=$(aws --profile ${AWS_PROFILE} iam get-user | jq ".User.Arn" | grep -Eo '[[:digit:]]{12}')
BUCKET="${AWS_ACCOUNTID}-${CLUSTER_NAME}-cloudinit"
KEY="etcd/initial-cluster"
if ! aws --profile $AWS_PROFILE s3api wait object-exists --bucket ${BUCKET} --key ${KEY};
then
  echo "${BUCKET}/initial-cluster doesn't exist"
  exit 1
fi
exit 0

error: pathspec 'scripts/wait-cloudinit-bucket.sh' did not match any file(s) known to git