Are environment variables getting passed through?

#!/bin/bash
set -e
# Activate Holy Build Box environment.
source /hbb_exe/activate

echo "UPLOAD = $UPLOAD"

set -x
yum install -y git
curl -s -O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p /anaconda
PATH=/opt/rh/devtoolset-2/root/usr/bin:/opt/rh/autotools-latest/root/usr/bin:/anaconda/bin:$PATH
conda config --add channels omnia
conda install -yq conda-build jinja2 anaconda-client
/io/conda-build-all --check-against omnia $UPLOAD /io/*

#!/bin/bash
set -e
# Activate Holy Build Box environment.
source /hbb_exe/activate

set -x
yum install -y git
curl -s -O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p /anaconda
PATH=/opt/rh/devtoolset-2/root/usr/bin:/opt/rh/autotools-latest/root/usr/bin:/anaconda/bin:$PATH
conda config --add channels omnia
conda install -yq conda-build jinja2 anaconda-client
/io/conda-build-all --check-against omnia $UPLOAD /io/*


more udpdates to airflow

more udpdates to airflow

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/BrentDorsey/pipeline.git/'


Debian Install Script update

Debian Install Script update

#!/bin/bash -e
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# Should we run as interactive mode ? (-s non interactive mode)
INTERACTIVE=1
while getopts ":s" OPTION
do
	case ${OPTION} in
		s) INTERACTIVE=0;;
		*) echo "Unknown option, exiting..."; exit 1;;   # DEFAULT
	esac
done

echo 'Hi there ! Please read carefully the following (not long)'.
echo 'This script will attempt to install PaSSHport on this system.'
echo 'This script works on Debian 8 (Jessy) and Debian 9 (Stretch).'
echo "It may also work on Debian 7, but it hasn't been tested."
echo ''
echo 'What this script will do to your existing system:'
echo '- install "python3-pip", "git" and "openssl" packages.'
echo '- update PIP via pip3 script, installed previously'
echo '- install virtualenv via pip3 script'
echo '- add a "passhport" system user'
echo '- create an "/etc/passhport" directory'
echo '- create a "/var/lib/passhport" directory'
echo '- create a "/var/log/passhport" directory'
echo ''
echo 'The remaining process will only create and/or modify files and'
echo 'directories WITHIN the directories mentionned above, so which includes:'
echo '- /home/passhport'
echo '- /etc/passhport'
echo '- /var/lib/passhport'
echo '- /var/log/passhport'
echo ''
echo 'If you want to remove passhportd from this system, run the following,'
echo 'as root:'
echo 'userdel passhport'
echo 'rm -rf /home/passhport'
echo 'rm -rf /etc/passhport'
echo 'rm -rf /var/lib/passhport'
echo 'rm -rf /var/log/passhport'
echo 'rm /usr/bin/passhport-admin'
echo 'rm /usr/sbin/passhportd'
echo 'rm /etc/bash_completion.d/passhport-admin'
echo ''
echo 'Remove the systemd service :'
echo '# systemctl disable passhportd'
echo '# rm /etc/systemd/system/passhportd.service'
echo '# systemctl daemon-reload'
echo ''
echo "Finally you may also purge the following packages if you don't need them"
echo 'anymore:'
echo 'python3-pip, git, openssl, virtualenv, libpython3-dev (# apt purge python3-pip git openssl virtualenv libpython3-dev)'
echo ''

if [ ${INTERACTIVE} -eq 1 ]
then
	echo 'Once you read and understood the above lines, you may proceed by typing'
	echo '"yes", or exit by the famous "CTRL+C" :'
	read ANSWER;
else
	ANSWER='yes'
fi

while [ "${ANSWER}" != 'yes' ]
do
	echo 'Please type excatly "yes" or exit by pressing "CTRL+C".'
	read ANSWER
done

echo '##############################################################'
echo '# Updating repos…'
echo '##############################################################'
apt update
echo '##############################################################'
echo '# Installing git, openssl, virtualenv and libpython3-dev package…'
echo '##############################################################'
apt install -y python3-pip git openssl virtualenv libpython3-dev
echo '##############################################################'
echo '# Creating "passhport" system user'
echo '##############################################################'
useradd --home-dir /home/passhport --shell /bin/bash --create-home passhport
echo '##############################################################'
echo '# Creating the virtual-env for passhport…'
echo '##############################################################'
su - passhport -c "virtualenv -p python3 passhport-run-env"
echo '##############################################################'
echo '# Installing mandatory packages in the virtual environment…'
echo '##############################################################'
su - passhport -c "/home/passhport/passhport-run-env/bin/pip install sqlalchemy-migrate flask-migrate requests docopt configparser tabulate flask-login ldap3 psutil cryptography"
echo '##############################################################'
echo '# Cloning passhport git from github'
echo '##############################################################'
su - passhport -c "git clone https://github.com/LibrIT/passhport.git"
echo '##############################################################'
echo '# Creating "/var/log/passhport" log directory'
echo '##############################################################'
mkdir -p /var/log/passhport/
chown passhport:passhport /var/log/passhport/
echo '##############################################################'
echo '# Creating "/etc/passhport" conf directory '
echo '##############################################################'
mkdir /etc/passhport
cp /home/passhport/passhport/passhportd/passhportd.ini /etc/passhport/.
cp /home/passhport/passhport/passhport/passhport.ini /etc/passhport/.
cp /home/passhport/passhport/passhport-admin/passhport-admin.ini /etc/passhport/.
cp /home/passhport/passhport/passhportd/passhportd.ini /etc/passhport/.
echo '##############################################################'
echo '# Generating PaSSHport RSA (4096b) and ecdsa (521b) keys…'
echo '##############################################################'
su - passhport -c '/usr/bin/ssh-keygen -t rsa -b 4096 -N "" -f "/home/passhport/.ssh/id_rsa"'
su - passhport -c '/usr/bin/ssh-keygen -t ecdsa -b 521 -N "" -f "/home/passhport/.ssh/id_ecdsa"'
echo '##############################################################'
echo '# Creating PaSSHport database directory…'
echo '##############################################################'
mkdir -p /var/lib/passhport
chown -R passhport:passhport /var/lib/passhport/
echo '##############################################################'
echo '# Editing PaSSHport conf files…'
echo '##############################################################'
sed -i -e 's#SQLALCHEMY_DATABASE_DIR\s*=.*#SQLALCHEMY_DATABASE_DIR        = /var/lib/passhport/#' /etc/passhport/passhportd.ini
sed -i -e 's#LISTENING_IP\s*=.*#LISTENING_IP = 0.0.0.0#' /etc/passhport/passhportd.ini
sed -i -e 's#SQLALCHEMY_MIGRATE_REPO\s*=.*#SQLALCHEMY_MIGRATE_REPO        = /var/lib/passhport/db_repository#' /etc/passhport/passhportd.ini
sed -i -e 's#SQLALCHEMY_DATABASE_URI\s*=.*#SQLALCHEMY_DATABASE_URI        = sqlite:////var/lib/passhport/app.db#' /etc/passhport/passhportd.ini
sed -i -e "s#PASSHPORTD_HOSTNAME\s*=.*#PASSHPORTD_HOSTNAME = localhost#" /etc/passhport/passhport-admin.ini
sed -i -e "s#PASSHPORTD_HOSTNAME\s*=.*#PASSHPORTD_HOSTNAME = localhost#" /etc/passhport/passhport.ini
echo '##############################################################'
echo '# Creating database for PaSSHport (SQLite)…'
echo '##############################################################'
su - passhport -c "/home/passhport/passhport-run-env/bin/python /home/passhport/passhport/passhportd/db_create.py"
echo '##############################################################'
echo '# Creating bash_completion file for passhport-admin script…'
echo '##############################################################'
if [ ! -d "/etc/bash_completion.d/" ]
then
	mkdir "/etc/bash_completion.d/"
fi
cp /home/passhport/passhport/tools/passhport-admin.bash_completion /etc/bash_completion.d/passhport-admin
. /etc/bash_completion.d/passhport-admin
echo '##############################################################'
echo '# Creating symbolink links to binaries…'
echo '##############################################################'
ln -s /home/passhport/passhport/tools/passhport-admin.sh /usr/bin/passhport-admin
ln -s /home/passhport/passhport/tools/passhportd.sh /usr/sbin/passhportd
echo '##############################################################'
echo '# Creating Web-API cert directory…'
echo '##############################################################'
su - passhport -c "mkdir /home/passhport/certs"
su - passhport -c "chmod 700 /home/passhport/certs"
echo '##############################################################'
echo '# Generating Web-API RSA key (4096b)'
echo '##############################################################'
su - passhport -c "openssl genrsa -out "/home/passhport/certs/key.pem" 4096"
echo '##############################################################'
echo '# Adding choosen IP to the certificate…'
echo '##############################################################'
sed -i -e "s#^\(DNS.*\s*=\s*\)TO_CHANGE#\1`hostname -f`#g" /home/passhport/passhport/tools/openssl-for-passhportd.cnf
echo '##############################################################'
echo '# Generating Web-API certificate…'
echo '##############################################################'
openssl req -new -key "/home/passhport/certs/key.pem" \
	-config "/home/passhport/passhport/tools/openssl-for-passhportd.cnf" \
	-out "/home/passhport/certs/cert.pem" \
	-subj "/C=FR/ST=Ile De France/L=Ivry sur Seine/O=LibrIT/OU=DSI/CN=passhport.librit.fr" \
	-x509 \
	-days 365 \
	-sha256 \
	-extensions v3_req
# We try to detect if we run on a systemd OS.
if (stat /proc/1/exe | head -n 1 | grep systemd &>/dev/null)
then
	echo '##############################################################'
	echo '# Importing passhportd service in systemd…'
	echo '##############################################################'
	cp /home/passhport/passhport/tools/passhportd.service /etc/systemd/system/passhportd.service
	systemctl daemon-reload
	systemctl enable passhportd
	echo "passhportd has been enabled at startup."
	systemctl start passhportd
	echo "passhportd has been started."
	echo 'Please use systemctl to start/stop service.'
fi
echo '##############################################################'
echo '# Adding root@localhost target…'
echo '##############################################################'
# Sleep 2 seconds so passhportd has enough time to start
sleep 2
[ ! -d "/root/.ssh" ] && mkdir "/root/.ssh" && chmod 700 "/root/.ssh"
cat "/home/passhport/.ssh/id_ecdsa.pub" >> "/root/.ssh/authorized_keys"
su - passhport -c 'passhport-admin target create root@localhost 127.0.0.1 --comment="Localhost target added during the PaSSHport installation process."'
if [ ${INTERACTIVE} -eq 1 ]
then
	echo 'Do you want to add your first user now ? Y/n'
	read DO_CREATE_USER
else
	DO_CREATE_USER='n'
fi
while [ "${DO_CREATE_USER,,}" != "y" ] && [ ! -z "${DO_CREATE_USER}" ] && [ "${DO_CREATE_USER,,}" != "n" ]
do
	echo 'Do you want to add your first user now ? Y/n'
	read DO_CREATE_USER
done
if [ "${DO_CREATE_USER,,}" == "y" ] || [ -z "${DO_CREATE_USER}" ]
then
	echo 'Remember : no space in the user name!'
	su - passhport -c "passhport-admin user create"
	echo 'Do you want to link this user to the target root@localhost ? Y/n'
	read DO_LINK_USER
	while [ "${DO_LINK_USER,,}" != "y" ] && [ ! -z "${DO_LINK_USER}" ] && [ "${DO_LINK_USER,,}" != "n" ]
	do
		echo 'Do you want to link this user to the target root@localhost ? Y/n'
		read DO_LINK_USER
	done
	if [ "${DO_LINK_USER,,}" == "y" ] || [ -z "${DO_LINK_USER}" ]
	then
		FIRST_USER=`su - passhport -c "passhport-admin user list"`
		su - passhport -c "passhport-admin target adduser ${FIRST_USER} root@localhost"
	fi
fi

echo "PaSSHport is now installed on your system."

echo '##############################################################'
echo '# You can test that passhportd is running by running :'
echo '# curl -s --insecure https://localhost:5000'
echo '# if it displays : '
echo '# "passhportd is running, gratz!"'
echo '# you successfuly installed PaSSHport. Well done !'

if [ ${INTERACTIVE} -eq 1 ]
then
	echo '# If you created your first user, you can connect to PaSSHport'
	echo '# using "ssh -i the_key_you_used passhport@PASSHPORT_HOST"'
fi
echo '##############################################################'

#!/bin/bash -e
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# Should we run as interactive mode ? (-s non interactive mode)
INTERACTIVE=1
while getopts ":s" OPTION
do
	case ${OPTION} in
		s) INTERACTIVE=0;;
		*) echo "Unknown option, exiting..."; exit 1;;   # DEFAULT
	esac
done

echo 'Hi there ! Please read carefully the following (not long)'.
echo 'This script will attempt to install PaSSHport on this system.'
echo 'This script works on Debian 8 (Jessy) and Debian 9 (Stretch).'
echo "It may also work on Debian 7, but it hasn't been tested."
echo ''
echo 'What this script will do to your existing system:'
echo '- install "python3-pip", "git" and "openssl" packages.'
echo '- update PIP via pip3 script, installed previously'
echo '- install virtualenv via pip3 script'
echo '- add a "passhport" system user'
echo '- create an "/etc/passhport" directory'
echo '- create a "/var/lib/passhport" directory'
echo '- create a "/var/log/passhport" directory'
echo ''
echo 'The remaining process will only create and/or modify files and'
echo 'directories WITHIN the directories mentionned above, so which includes:'
echo '- /home/passhport'
echo '- /etc/passhport'
echo '- /var/lib/passhport'
echo '- /var/log/passhport'
echo ''
echo 'If you want to remove passhportd from this system, run the following,'
echo 'as root:'
echo 'userdel passhport'
echo 'rm -rf /home/passhport'
echo 'rm -rf /etc/passhport'
echo 'rm -rf /var/lib/passhport'
echo 'rm -rf /var/log/passhport'
echo 'rm /usr/bin/passhport-admin'
echo 'rm /usr/sbin/passhportd'
echo 'rm /etc/bash_completion.d/passhport-admin'
echo ''
echo 'You may also remove virtualenv that has been installed by pip3 :'
echo '# pip3 uninstall virtualenv'
echo ''
echo 'Remove the systemd service :'
echo '# systemctl disable passhportd'
echo '# rm /etc/systemd/system/passhportd.service'
echo '# systemctl daemon-reload'
echo ''
echo "Finally you may also purge the following packages if you don't need them"
echo 'anymore:'
echo 'python3-pip, git, openssl (# apt purge python3-pip git openssl)'
echo ''

if [ ${INTERACTIVE} -eq 1 ]
then
	echo 'Once you read and understood the above lines, you may proceed by typing'
	echo '"yes", or exit by the famous "CTRL+C" :'
	read ANSWER;
else
	ANSWER='yes'
fi

while [ "${ANSWER}" != 'yes' ]
do
	echo 'Please type excatly "yes" or exit by pressing "CTRL+C".'
	read ANSWER
done

echo '##############################################################'
echo '# Updating repos…'
echo '##############################################################'
apt update
echo '##############################################################'
echo '# Installing python3-pip, git and openssl package…'
echo '##############################################################'
apt install -y python3-pip git openssl
echo '##############################################################'
echo '# Installing virtualenv with pip…'
echo '##############################################################'
pip3 install virtualenv
echo '##############################################################'
echo '# Creating "passhport" system user'
echo '##############################################################'
useradd --home-dir /home/passhport --shell /bin/bash --create-home passhport
echo '##############################################################'
echo '# Creating the virtual-env for passhport…'
echo '##############################################################'
su - passhport -c "virtualenv -p python3 passhport-run-env"
echo '##############################################################'
echo '# Installing mandatory packages in the virtual environment…'
echo '##############################################################'
su - passhport -c "/home/passhport/passhport-run-env/bin/pip install sqlalchemy-migrate flask-migrate requests docopt configparser tabulate flask-login ldap3 psutil cryptography"
echo '##############################################################'
echo '# Cloning passhport git from github'
echo '##############################################################'
su - passhport -c "git clone https://github.com/LibrIT/passhport.git"
echo '##############################################################'
echo '# Creating "/var/log/passhport" log directory'
echo '##############################################################'
mkdir -p /var/log/passhport/
chown passhport:passhport /var/log/passhport/
echo '##############################################################'
echo '# Creating "/etc/passhport" conf directory '
echo '##############################################################'
mkdir /etc/passhport
cp /home/passhport/passhport/passhportd/passhportd.ini /etc/passhport/.
cp /home/passhport/passhport/passhport/passhport.ini /etc/passhport/.
cp /home/passhport/passhport/passhport-admin/passhport-admin.ini /etc/passhport/.
cp /home/passhport/passhport/passhportd/passhportd.ini /etc/passhport/.
echo '##############################################################'
echo '# Generating PaSSHport RSA (4096b) and ecdsa (521b) keys…'
echo '##############################################################'
su - passhport -c '/usr/bin/ssh-keygen -t rsa -b 4096 -N "" -f "/home/passhport/.ssh/id_rsa"'
su - passhport -c '/usr/bin/ssh-keygen -t ecdsa -b 521 -N "" -f "/home/passhport/.ssh/id_ecdsa"'
echo '##############################################################'
echo '# Creating PaSSHport database directory…'
echo '##############################################################'
mkdir -p /var/lib/passhport
chown -R passhport:passhport /var/lib/passhport/
echo '##############################################################'
echo '# Editing PaSSHport conf files…'
echo '##############################################################'
sed -i -e 's#SQLALCHEMY_DATABASE_DIR\s*=.*#SQLALCHEMY_DATABASE_DIR        = /var/lib/passhport/#' /etc/passhport/passhportd.ini
sed -i -e 's#LISTENING_IP\s*=.*#LISTENING_IP = 0.0.0.0#' /etc/passhport/passhportd.ini
sed -i -e 's#SQLALCHEMY_MIGRATE_REPO\s*=.*#SQLALCHEMY_MIGRATE_REPO        = /var/lib/passhport/db_repository#' /etc/passhport/passhportd.ini
sed -i -e 's#SQLALCHEMY_DATABASE_URI\s*=.*#SQLALCHEMY_DATABASE_URI        = sqlite:////var/lib/passhport/app.db#' /etc/passhport/passhportd.ini
sed -i -e "s#PASSHPORTD_HOSTNAME\s*=.*#PASSHPORTD_HOSTNAME = localhost#" /etc/passhport/passhport-admin.ini
sed -i -e "s#PASSHPORTD_HOSTNAME\s*=.*#PASSHPORTD_HOSTNAME = localhost#" /etc/passhport/passhport.ini
echo '##############################################################'
echo '# Creating database for PaSSHport (SQLite)…'
echo '##############################################################'
su - passhport -c "/home/passhport/passhport-run-env/bin/python /home/passhport/passhport/passhportd/db_create.py"
echo '##############################################################'
echo '# Creating bash_completion file for passhport-admin script…'
echo '##############################################################'
if [ ! -d "/etc/bash_completion.d/" ]
then
	mkdir "/etc/bash_completion.d/"
fi
cp /home/passhport/passhport/tools/passhport-admin.bash_completion /etc/bash_completion.d/passhport-admin
. /etc/bash_completion.d/passhport-admin
echo '##############################################################'
echo '# Creating symbolink links to binaries…'
echo '##############################################################'
ln -s /home/passhport/passhport/tools/passhport-admin.sh /usr/bin/passhport-admin
ln -s /home/passhport/passhport/tools/passhportd.sh /usr/sbin/passhportd
echo '##############################################################'
echo '# Creating Web-API cert directory…'
echo '##############################################################'
su - passhport -c "mkdir /home/passhport/certs"
su - passhport -c "chmod 700 /home/passhport/certs"
echo '##############################################################'
echo '# Generating Web-API RSA key (4096b)'
echo '##############################################################'
su - passhport -c "openssl genrsa -out "/home/passhport/certs/key.pem" 4096"
echo '##############################################################'
echo '# Adding choosen IP to the certificate…'
echo '##############################################################'
sed -i -e "s#^\(DNS.*\s*=\s*\)TO_CHANGE#\1`hostname -f`#g" /home/passhport/passhport/tools/openssl-for-passhportd.cnf
echo '##############################################################'
echo '# Generating Web-API certificate…'
echo '##############################################################'
openssl req -new -key "/home/passhport/certs/key.pem" \
	-config "/home/passhport/passhport/tools/openssl-for-passhportd.cnf" \
	-out "/home/passhport/certs/cert.pem" \
	-subj "/C=FR/ST=Ile De France/L=Ivry sur Seine/O=LibrIT/OU=DSI/CN=passhport.librit.fr" \
	-x509 \
	-days 365 \
	-sha256 \
	-extensions v3_req
# We try to detect if we run on a systemd OS.
if (stat /proc/1/exe | head -n 1 | grep systemd &>/dev/null)
then
	echo '##############################################################'
	echo '# Importing passhportd service in systemd…'
	echo '##############################################################'
	cp /home/passhport/passhport/tools/passhportd.service /etc/systemd/system/passhportd.service
	systemctl daemon-reload
	systemctl enable passhportd
	echo "passhportd has been enabled at startup."
	systemctl start passhportd
	echo "passhportd has been started."
	echo 'Please use systemctl to start/stop service.'
fi
echo '##############################################################'
echo '# Adding root@localhost target…'
echo '##############################################################'
# Sleep 2 seconds so passhportd has enough time to start
sleep 2
[ ! -d "/root/.ssh" ] && mkdir "/root/.ssh" && chmod 700 "/root/.ssh"
cat "/home/passhport/.ssh/id_ecdsa.pub" >> "/root/.ssh/authorized_keys"
su - passhport -c 'passhport-admin target create root@localhost 127.0.0.1 --comment="Localhost target added during the PaSSHport installation process."'
if [ ${INTERACTIVE} -eq 1 ]
then
	echo 'Do you want to add your first user now ? Y/n'
	read DO_CREATE_USER
else
	DO_CREATE_USER='n'
fi
while [ "${DO_CREATE_USER,,}" != "y" ] && [ ! -z "${DO_CREATE_USER}" ] && [ "${DO_CREATE_USER,,}" != "n" ]
do
	echo 'Do you want to add your first user now ? Y/n'
	read DO_CREATE_USER
done
if [ "${DO_CREATE_USER,,}" == "y" ] || [ -z "${DO_CREATE_USER}" ]
then
	echo 'Remember : no space in the user name!'
	su - passhport -c "passhport-admin user create"
	echo 'Do you want to link this user to the target root@localhost ? Y/n'
	read DO_LINK_USER
	while [ "${DO_LINK_USER,,}" != "y" ] && [ ! -z "${DO_LINK_USER}" ] && [ "${DO_LINK_USER,,}" != "n" ]
	do
		echo 'Do you want to link this user to the target root@localhost ? Y/n'
		read DO_LINK_USER
	done
	if [ "${DO_LINK_USER,,}" == "y" ] || [ -z "${DO_LINK_USER}" ]
	then
		FIRST_USER=`su - passhport -c "passhport-admin user list"`
		su - passhport -c "passhport-admin target adduser ${FIRST_USER} root@localhost"
	fi
fi

echo "PaSSHport is now installed on your system."

echo '##############################################################'
echo '# You can test that passhportd is running by running :'
echo '# curl -s --insecure https://localhost:5000'
echo '# if it displays : '
echo '# "passhportd is running, gratz!"'
echo '# you successfuly installed PaSSHport. Well done !'

if [ ${INTERACTIVE} -eq 1 ]
then
	echo '# If you created your first user, you can connect to PaSSHport'
	echo '# using "ssh -i the_key_you_used passhport@PASSHPORT_HOST"'
fi
echo '##############################################################'


updated start scripts

updated start scripts

#!/bin/bash

cd $PIPELINE_HOME

echo '...Starting ElasticSearch...'
nohup elasticsearch -Des.insecure.allow.root=true -p $ELASTICSEARCH_HOME/RUNNING_PID --path.conf $CONFIG_HOME/elasticsearch &

echo '...Starting Logstash...'
nohup logstash -f $LOGSTASH_HOME/logstash.conf &

echo '...Starting SSH...'
service ssh start

echo '...Starting Ganglia...'
service ganglia-monitor start
service gmetad start

echo '...Starting Apache2 Httpd...'
service apache2 start

echo '...Starting MySQL...'
service mysql start

echo '...Starting Cassandra...'
nohup cassandra

echo '...Starting ZooKeeper...'
nohup zookeeper-server-start $CONFIG_HOME/kafka/zookeeper.properties &

#echo '...Starting Redis...'
#nohup redis-server &

#echo '...Starting Webdis...'
#nohup webdis $WEBDIS_HOME/webdis.json &

echo '...Starting Kafka...'
nohup kafka-server-start $CONFIG_HOME/kafka/server.properties &

echo '...Starting Zeppelin...'
nohup $ZEPPELIN_HOME/bin/zeppelin-daemon.sh start

echo '...Starting Spark Master...'
nohup $SPARK_HOME/sbin/start-master.sh --webui-port 6060 -h 127.0.0.1

echo '...Starting Spark Worker...'
nohup $SPARK_HOME/sbin/start-slave.sh --cores 4 --memory 4g --webui-port 6061 -h 127.0.0.1 spark://127.0.0.1:7077

#echo '...Starting Spark External Shuffle Service...'
#nohup $SPARK_HOME/sbin/start-shuffle-service.sh

#echo '...Starting Spark History Server...'
#nohup $SPARK_HOME/sbin/start-history-server.sh &

#echo '...Starting Flink...'
#nohup start-local.sh &

echo '...Starting Kibana...'
nohup kibana &

echo '...Starting Jupyter Notebook Server (via pipeline-pyspark.sh)...'
nohup pipeline-pyspark.sh &

#echo '...Starting NiFi...'
#nohup nifi.sh start &

#echo '...Starting Airflow...'
#nohup airflow webserver &

#echo '...Starting Presto...'
#nohup launcher start

echo '...Starting Kafka Schema Registry...'
# Starting this at the end due to race conditions with other kafka components
nohup schema-registry-start $CONFIG_HOME/schema-registry/schema-registry.properties &

echo '...Starting Kafka REST Proxy...'
nohup kafka-rest-start $CONFIG_HOME/kafka-rest/kafka-rest.properties &

#echo '...Starting Titan...'
#nodetool enablethrift
#nohup $TITAN_HOME/bin/gremlin-server.sh $TITAN_HOME/conf/gremlin-server/gremlin-server-rest-modern.yaml &

#!/bin/bash

cd $PIPELINE_HOME

echo '...Starting ElasticSearch...'
nohup elasticsearch -Des.insecure.allow.root=true -p $ELASTICSEARCH_HOME/RUNNING_PID --path.conf $CONFIG_HOME/elasticsearch &

echo '...Starting Logstash...'
nohup logstash -f $LOGSTASH_HOME/logstash.conf &

echo '...Starting SSH...'
service ssh start

echo '...Starting Ganglia...'
service ganglia-monitor start
service gmetad start

echo '...Starting Apache2 Httpd...'
service apache2 start

echo '...Starting MySQL...'
service mysql start

echo '...Starting Cassandra...'
nohup cassandra

echo '...Starting ZooKeeper...'
nohup zookeeper-server-start $CONFIG_HOME/kafka/zookeeper.properties &

#echo '...Starting Redis...'
#nohup redis-server &

#echo '...Starting Webdis...'
#nohup webdis $WEBDIS_HOME/webdis.json &

#echo '...Starting Kafka...'
#nohup kafka-server-start $CONFIG_HOME/kafka/server.properties &

echo '...Starting Zeppelin...'
nohup $ZEPPELIN_HOME/bin/zeppelin-daemon.sh start

echo '...Starting Spark Master...'
nohup $SPARK_HOME/sbin/start-master.sh --webui-port 6060 -h 127.0.0.1

echo '...Starting Spark Worker...'
nohup $SPARK_HOME/sbin/start-slave.sh --cores 4 --memory 4g --webui-port 6061 -h 127.0.0.1 spark://127.0.0.1:7077

#echo '...Starting Spark External Shuffle Service...'
#nohup $SPARK_HOME/sbin/start-shuffle-service.sh

#echo '...Starting Spark History Server...'
#nohup $SPARK_HOME/sbin/start-history-server.sh &

#echo '...Starting Flink...'
#nohup start-local.sh &

echo '...Starting Kibana...'
nohup kibana &

echo '...Starting Jupyter Notebook Server (via pipeline-pyspark.sh)...'
nohup pipeline-pyspark.sh &

#echo '...Starting NiFi...'
#nohup nifi.sh start &

#echo '...Starting Airflow...'
#nohup airflow webserver &

#echo '...Starting Presto...'
#nohup launcher start

echo '...Starting Kafka Schema Registry...'
# Starting this at the end due to race conditions with other kafka components
nohup schema-registry-start $CONFIG_HOME/schema-registry/schema-registry.properties &

#echo '...Starting Kafka REST Proxy...'
#nohup kafka-rest-start $CONFIG_HOME/kafka-rest/kafka-rest.properties &

#echo '...Starting Titan...'
#nodetool enablethrift
#nohup $TITAN_HOME/bin/gremlin-server.sh $TITAN_HOME/conf/gremlin-server/gremlin-server-rest-modern.yaml &


add 'deb' plugin with Debian's apt aliases

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/joeylomanto/oh-my-zsh.git/'


Add xresources feature.

Add xresources feature.

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/boweevil/configurator.git/'


fix while args

fix while args

#!/usr/bin/env bash

workdir="${GITHUB_WORKSPACE}/build"
docker_files=$(find "${workdir}/" -name "bareos-*.tar" 2>/dev/null)

# Enable experimental feature in Docker
export DOCKER_CLI_EXPERIMENTAL="enabled"

# Load Dockerfiles
for file in $docker_files; do
  docker load --input "$file"
done

# Connect Docker Hub
docker login -u 'barcus' -p "${INPUT_DOCKER_PASS}"

# Push images and manifests
while read app version arch app_path ; do
  build_tag=${version}
  re='^[0-9]+-alpine.*$'
  if [[ $version =~ $re ]] ; then
    build_tag="${version}-${arch}"
    rm_tag="$rm_tag ${GITHUB_REPOSITORY}-${app}:${build_tag}"
  fi
  # Push build_tag
  docker push "${GITHUB_REPOSITORY}-${app}:${build_tag}"
done < "${workdir}/app_build.txt"

while read build_app s_tag t_tag ; do
  # Add and push tag for Ubuntu
  if [[ $s_tag =~ ^[0-9]+-ubuntu.*$ ]]; then
    docker tag "${GITHUB_REPOSITORY}-${build_app}:${s_tag}" \
      "${GITHUB_REPOSITORY}-${build_app}:${t_tag}"
    docker push "${GITHUB_REPOSITORY}-${build_app}:${t_tag}"
  fi
  # Create and push manifest for Alpuine (arm64 + amd64)
  if [[ $s_tag =~ ^[0-9]+-alpine.*$ ]]; then
    docker manifest create "${GITHUB_REPOSITORY}-${build_app}:${t_tag}" \
      "${GITHUB_REPOSITORY}-${build_app}:${s_tag}-amd64" \
      "${GITHUB_REPOSITORY}-${build_app}:${s_tag}-arm64"
    docker manifest push "${GITHUB_REPOSITORY}-${build_app}:${t_tag}"
  fi
done < "${workdir}/tag_build.txt"

# Clean Alpine build_tag by arch
docker run --rm lumir/remove-dockerhub-tag \
  --user "${GITHUB_ACTOR}" --password "${INPUT_DOCKER_PASS}" $rm_tag

#EOF

#!/usr/bin/env bash

workdir="${GITHUB_WORKSPACE}/build"
docker_files=$(find "${workdir}/" -name "bareos-*.tar" 2>/dev/null)

# Enable experimental feature in Docker
export DOCKER_CLI_EXPERIMENTAL="enabled"

# Load Dockerfiles
for file in $docker_files; do
  docker load --input "$file"
done

# Connect Docker Hub
docker login -u 'barcus' -p "${INPUT_DOCKER_PASS}"

# Push images and manifests
while read app version arch ; do
  build_tag=${version}
  re='^[0-9]+-alpine.*$'
  if [[ $version =~ $re ]] ; then
    build_tag="${version}-${arch}"
    rm_tag="$rm_tag ${GITHUB_REPOSITORY}-${app}:${build_tag}"
  fi
  # Push build_tag
  docker push "${GITHUB_REPOSITORY}-${app}:${build_tag}"
done < "${workdir}/app_build.txt"

while read build_app s_tag t_tag ; do
  # Add and push tag for Ubuntu
  if [[ $s_tag =~ ^[0-9]+-ubuntu.*$ ]]; then
    docker tag "${GITHUB_REPOSITORY}-${build_app}:${s_tag}" \
      "${GITHUB_REPOSITORY}-${build_app}:${t_tag}"
    docker push "${GITHUB_REPOSITORY}-${build_app}:${t_tag}"
  fi
  # Create and push manifest for Alpuine (arm64 + amd64)
  if [[ $s_tag =~ ^[0-9]+-alpine.*$ ]]; then
    docker manifest create "${GITHUB_REPOSITORY}-${build_app}:${t_tag}" \
      "${GITHUB_REPOSITORY}-${build_app}:${s_tag}-amd64" \
      "${GITHUB_REPOSITORY}-${build_app}:${s_tag}-arm64"
    docker manifest push "${GITHUB_REPOSITORY}-${build_app}:${t_tag}"
  fi
done < "${workdir}/tag_build.txt"

# Clean Alpine build_tag by arch
docker run --rm lumir/remove-dockerhub-tag \
  --user "${GITHUB_ACTOR}" --password "${INPUT_DOCKER_PASS}" $rm_tag

#EOF


add maven plugin

add maven plugin

function listMavenCompletions {
reply=(
cli:execute cli:execute-phase archetype:generate generate-sources compile clean install test test-compile deploy package cobertura:cobertura jetty:run gwt:run gwt:debug -DskipTests -Dmaven.test.skip=true -Dtest= `if [ -d ./src ] ; then find ./src -type f | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`);
}

compctl -K listMavenCompletions mvn

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


otp: added a plugin for oathtool one-time passwords (#3862)

export OTP_HOME=~/.otp
mkdir -p $OTP_HOME

function ot () {
  if ! command -v oathtool > /dev/null 2>&1; then
    echo "Note: you need to install oathtool or oath-toolkit, depending on your OS or distribution."
    return 1
  fi

  if ! command -v gpg > /dev/null 2>&1; then
    echo "Note: you need to install gpg and create an ID using 'gpg --gen-key', unless you have one already."
    return 1
  fi

  if [[ `uname` == 'Darwin' ]] then # MacOS X
    export COPY_CMD='pbcopy'
  elif command -v xsel > /dev/null 2>&1; then # Any Unix with xsel installed
    export COPY_CMD='xsel --clipboard --input'
  else
    COPY_CMD='true'
  fi

  if [[ "x$1" == "x" ]]; then
    echo "usage: otpw <profile.name>"
    return 1
  elif [ ! -f $OTP_HOME/$1.otp.asc ]; then
    echo "missing profile $1, you might need to create it first using otp_add_device"
    return 1
  else
    totpkey=$(gpg --decrypt $OTP_HOME/$1.otp.asc)
    oathtool --totp --b $totpkey | tee /dev/stderr | `echo $COPY_CMD`
    if [[ $COPY_CMD == 'true' ]] then
      echo "Note: you might consider installing xsel for clipboard integration"
    fi
  fi
}

function otp_add_device () {
  if [[ "x$1" == "x" ]] then
    echo "usage: otp_add <profile.name>"
    return 1
  else
    echo "Enter an email address attached to your GPG private key, then paste the secret configuration key followed by ^D"

    rm -f $OTP_HOME/$1.otp.asc
    gpg --armor --encrypt --output $OTP_HOME/$1.otp.asc /dev/stdin
  fi
}

function otp_devices () {
  reply=($(find $OTP_HOME -name \*.otp.asc | xargs basename -s .otp.asc))
}

compctl -K otp_devices ot

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


Added task 2.3

Added task 2.3

Added task 2.3

#!/bin/bash

home_dir_name=`basename $HOME`;

echo "Home dir name is \"$home_dir_name\" ";

parentdir="$(dirname "$HOME")";

parentdir=`basename $parentdir`;

echo "Parent dir of home dir is \"$parentdir\" ";

exit 0;

error: pathspec '2/3_print_home_and_parent_dir_name.sh' did not match any file(s) known to git


update

update

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/dengxiangyu768/dengxytools.git/'


system/lxsession: Add a previously forgotten file.

Signed-off-by: Matteo Bernardini <638c89fd48409d8ef3e3a3c9b0a27af8629fef36@slackbuilds.org>

if [ -x /usr/bin/update-desktop-database ]; then
  /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
fi

error: pathspec 'system/lxsession/doinst.sh' did not match any file(s) known to git


修改安装VS Code go语言扩展工具的shell

修改安装VS Code go语言扩展工具的shell

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/cloudfstrife/note.git/'


Import de la drev traitement des lignes de revendication de l'export extravitis

#!/bin/bash

. bin/config.inc

WORKDIR=$TMPDIR/import_drev
WORKDIROPERATEUR=$TMPDIR/import_operateurs
DATADIR=data/import/extravitis/revendication
mkdir $WORKDIR 2> /dev/null

bash bin/import/operateur.sh

#---DOSSIER---

cat $DATADIR/drev_dossier.csv | iconv -f iso88591 -t utf8 | tr -d "\r" | cut -d ";" -f 1,3,4 | sort -t ";" -k 3,3 > $WORKDIR/dossier.csv

join -t ";" -1 1 -2 3 $WORKDIROPERATEUR/id_evv_cvi.sort_evv.csv $WORKDIR/dossier.csv | cut -d ";" -f 4,3,5 | sort -t ";" -k 2,2 > $WORKDIR/dossier_cvi.csv

#---LIGNE----

cat $DATADIR/drev_ligne.csv | iconv -f iso88591 -t utf8 | tr -d "\r" | cut -d ";" -f 1,2 | sort -t ";" -k 2,2 > $WORKDIR/ligne.csv

join -t ";" -1 2 -2 2 $WORKDIR/dossier_cvi.csv $WORKDIR/ligne.csv | cut -d ";" -f 2,3,4 | sort -t ";" -k 2,2 > $WORKDIR/ligne_cvi.csv

#---VALEUR---

cat $DATADIR/drev_valeur.csv | iconv -f iso88591 -t utf8 | tr -d "\r" | sort -t ";" -k 4,4 > $WORKDIR/valeur.csv

join -t ";" -1 2 -2 4 $WORKDIR/ligne_cvi.csv $WORKDIR/valeur.csv | cut -d ";" -f 1,2,3,5,6 | sed -r 's/^([0-9]+);([0-9]+);/\2;\1;/' | sed -r 's/;([0-9,]+);([0-9]+)$/;\2;\1/' | sort -t ";" -k 4,4 > $WORKDIR/valeur_cvi.csv

cat $DATADIR/drev_param_colonne.csv | iconv -f iso88591 -t utf8 | tr -d "\r" | cut -d ";" -f 1,4 | sort -t ";" -k 1,1 > $WORKDIR/valeur_param.csv

join -t ";" -1 4 -2 1 $WORKDIR/valeur_cvi.csv $WORKDIR/valeur_param.csv | awk -F ";" '{ print $2 ";" $3 ";" $4 ";" $1 ";" $6 ";" $5 }' | sort > $WORKDIR/valeur_cvi_param.csv

error: pathspec 'project/bin/import/drev.sh' did not match any file(s) known to git


update

update

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/JonnyCE/project-platform.git/'


New test to verify that when git-clone fails it cleans up the new directory.

Signed-off-by: Carl Worth <3966d6ecbaaa47b45708b84fc68464c10c40d492@cworth.org>
Signed-off-by: Junio C Hamano <dc50d1021234060e53ec42a77d526afa2fe07479@cox.net>

#!/bin/sh
#
# Copyright (C) 2006 Carl D. Worth <cworth@cworth.org>
#

test_description='test git-clone to cleanup after failure

This test covers the fact that if git-clone fails, it should remove
the directory it created, to avoid the user having to manually
remove the directory before attempting a clone again.'

. ./test-lib.sh

test_expect_failure \
    'clone of non-existent source should fail' \
    'git-clone foo bar'

test_expect_failure \
    'failed clone should not leave a directory' \
    'cd bar'

# Need a repo to clone
test_create_repo foo

# clone doesn't like it if there is no HEAD. Is that a bug?
(cd foo && touch file && git add file && git commit -m 'add file' >/dev/null 2>&1)

test_expect_success \
    'clone should work now that source exists' \
    'git-clone foo bar'

test_expect_success \
    'successfull clone must leave the directory' \
    'cd bar'

test_done

error: pathspec 't/t5600-clone-fail-cleanup.sh' did not match any file(s) known to git


Initial checkin of bash completion

Initial checkin of bash completion

Signed-off-by: Tony Asleson <1ef2d381aa56d512126ddaacc29e68136e4fdf55@redhat.com>

# Copyright (C) 2015 Red Hat, Inc.,  Tony Asleson <tasleson@redhat.com>
# Distributed under the GNU General Public License, version 2.0.
# See: https://www.gnu.org/licenses/gpl-2.0.html
#
# Bash completion for lsmcli. This may be far from ideal,
# suggestions & improvements appreciated!

_lsm()
{
    local cur prev opts
    sep='#|#'
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    opts_short="-b -v -u -P -H -t -e -f -w -b"
    opts_long=" --help --version --uri --prompt --human --terse --enum \
              --force --wait --header --script "
    opts_cmds="list job-status capabilities plugin-info"

    list_args="--type"
    list_type_args="volumes pools fs snapshots exports nfs_client_auth \
                    access_groups systems disks plugins target_ports"

    opts_filter="--sys --pool --vol --disk --ag --fs --nfs"

    cap_args="--sys"

    # Check if we have a previous
    case "${prev}" in
        '--sys')
            # Is there a better way todo this?
            local items=`lsmcli list --type systems -t${sep} | awk -F '#' '{print $1}'`
            COMPREPLY=( $(compgen -W "${items}" -- ${cur}) )
            return 0
            ;;
        '--pool')
            # Is there a better way todo this?
            local items=`lsmcli list --type pools -t${sep} | awk -F '#' '{print $1}'`
            COMPREPLY=( $(compgen -W "${items}" -- ${cur}) )
            return 0
            ;;
        '--vol')
            # Is there a better way todo this?
            local items=`lsmcli list --type volumes -t${sep} | awk -F '#' '{print $1}'`
            COMPREPLY=( $(compgen -W "${items}" -- ${cur}) )
            return 0
            ;;
        '--disk')
            # Is there a better way todo this?
            local items=`lsmcli list --type disks -t${sep} | awk -F '#' '{print $1}'`
            COMPREPLY=( $(compgen -W "${items}" -- ${cur}) )
            return 0
            ;;
        '--ag')
            # Is there a better way todo this?
            local items=`lsmcli list --type access_groups -t${sep} | awk -F '#' '{print $1}'`
            COMPREPLY=( $(compgen -W "${items}" -- ${cur}) )
            return 0
            ;;
        '--nfs-export')
            # Is there a better way todo this?
            local items=`lsmcli list --type exports  -t${sep} | awk -F '#' '{print $1}'`
            COMPREPLY=( $(compgen -W "${items}" -- ${cur}) )
            return 0
            ;;
        '--tgt')
            # Is there a better way todo this?
            local items=`lsmcli list --type target_ports  -t${sep} | awk -F '#' '{print $1}'`
            COMPREPLY=( $(compgen -W "${items}" -- ${cur}) )
            return 0
            ;;
        '--fs')
            local items=`lsmcli list --type fs -t${sep} | awk -F '#' '{print $1}'`
            COMPREPLY=( $(compgen -W "${items}" -- ${cur}) )
            return 0
            ;;
        'snapshots')
            # Specific listing case where you need a fs too
            if [[ ${COMP_WORDS[COMP_CWORD-2]} == '--type' && \
                  ${COMP_WORDS[COMP_CWORD-3]} == 'list' ]] ; then
                COMPREPLY=( $(compgen -W "--fs" -- ${cur}) )
                return 0
            fi
            ;;
        '--type')
            COMPREPLY=( $(compgen -W "${list_type_args}" -- ${cur}) )
            return 0
            ;;
        job-status)
            COMPREPLY=( $(compgen -W "--job" -- ${cur}) )
            return 0
            ;;
        list)
            COMPREPLY=( $(compgen -W "${list_args}" -- ${cur}) )
            return 0
            ;;
        capabilities)
            COMPREPLY=( $(compgen -W "${cap_args}" -- ${cur}) )
            return 0
            ;;
        *)
        ;;
    esac

    # Handle the case where we are starting out with nothing
    if [[ ${prev} == 'lsmcli' ]] ; then
        if [[ ${cur} == --* ]] ; then
            COMPREPLY=( $(compgen -W "${opts_long}"  -- ${cur}) )
            return 0
        fi

        if [[ ${cur} == -* ]] ; then
            COMPREPLY=( $(compgen -W "${opts_short}${opts_long}"  -- ${cur}) )
            return 0
        fi

        if [[ ${cur} == * ]] ; then
            COMPREPLY=( $(compgen -W "${opts_short}${opts_long}${opts_cmds}"  -- ${cur}) )
            return 0
        fi
    fi
}
complete -F _lsm lsmcli

error: pathspec 'doc/lsmcli.bash' did not match any file(s) known to git


Add own wrapper for our personal SMF scripts which should be included / imported

# This script load all SMF manifests from /opt/core/lib/svc/manifest

CORE_SVC_DIR='/opt/core/lib/svc/manifest/'

for xml in ${CORE_SVC_DIR}*; do
	svccfg import ${xml}
done

error: pathspec 'copy/opt/core/var/mdata-setup/includes/99-core-smf.sh' did not match any file(s) known to git


Fixed SED statement for DATE_TIME

Fixed SED statement for DATE_TIME

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


Simplified hombebrew install file

Simplified hombebrew install file

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/lfiolhais/dotfiles.git/'


make sure modules are installed

make sure modules are installed

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/REI-Systems/mortal-kombat.git/'


Add missing test script

Add missing test script

#! /usr/bin/env bash

npm rebuild

echo ">> Starting server..."

grunt --no-color forever:app:start

echo ">> Server started"

sleep 5

echo ">> Running acceptance tests..."
grunt --no-color mochaTest:acceptance
_test_exit_code=$?

echo ">> Killing server"

grunt --no-color forever:app:stop

echo ">> Done"

exit $_test_exit_code

error: pathspec 'services/chat/test/acceptance/scripts/full-test.sh' did not match any file(s) known to git


Setup

Setup

- Added the first draft of a fully automated setup script, which is a hand-
  holding, crutch-providing, training-wheel, remedial utility for following
  the setup instructions without getting it wrong.

#!/bin/bash

################################################################################
#
# Copyright 2010 - 2014, Göteborg Bit Factory.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# http://www.opensource.org/licenses/mit-license.php
#
################################################################################

# Ask a series of questions, and proceed through a fully automated Taskserver
# configuration and setup. This script has two purposes:
#
# 1. To allow casual users to simply setup a server for taskwarrior users,
#    without needing to read or follow the detailed setup process.
# 2. To provide an example of the setup process for advanced users to modify.

################################################################################
# Useful functions.
log_ok()
{
  echo "$1"
}

log_warning()
{
  echo "$1"
}

log_error()
{
  echo "$1"
}

log_line()
{
  printf "%-60s" "$1"
}

log()
{
  echo "$1"
}

configure()
{
  log_line "$1"
  OUTPUT=$($TASKD_BINARY config --force --data $TASKDDATA "$2" "$3")
  if [ $? -eq 0 ]; then
    log_ok "Ok"
  else
    log_error "Failed"
    log
    log $OUTPUT
    exit 1
  fi
}

################################################################################
# Taskserver defaults.
DEFAULT_SETUP=$0
DEFAULT_PKI=$(dirname $DEFAULT_SETUP)/../pki
DEFAULT_TASKDDATA=/var/taskd
DEFAULT_HOST=localhost
DEFAULT_PORT=53589

# Explain what is going to happen.
log
log_warning "This is an experimental script.  It does not work yet."
log
log "Simple Taskserver configuration and setup."
log
log "This script will check your system, then setup and launch a Taskserver"
log "instance for you. You will be asked to confirm before anything is written."
log "Please be careful with your answers."
log

# Show setup script location.
log_line "Location of this script"
log_ok $DEFAULT_SETUP

# Look for pki scripts, relative to $0, which assumes this script is in the
# $REPO/scripts/ directory.
log_line "Checking for pki script directory"
if [ -d $DEFAULT_PKI ]; then
  log_ok "Found $DEFAULT_PKI"
else
  log_error "error"
  exit 1
fi

# Verify certtool or gnutls-certtool is available.
log_line "Looking for certtool or gnutls-certtool"
CERTTOOL=
FOUND_GNUTLSCERTTOOL=$(which gnutls-certtool)
FOUND_CERTTOOL=$(which certtool)
if [ -n "$FOUND_GNUTLSCERTTOOL" ]; then
  CERTTOOL=$FOUND_GNUTLSCERTTOOL
  log_ok "Found $FOUND_GNUTLSCERTTOOL"
else
  if [ -n "$FOUND_CERTTOOL" ]; then
    CERTTOOL=$FOUND_CERTTOOL
    log_ok "Found $FOUND_CERTTOOL"
  else
    log_error "Not found"
    exit 1
  fi
fi

# Verify taskd is in $PATH.
log_line "Looking for 'taskd' in \$PATH"
TASKD_BINARY=$(which taskd)
if [ -n "TASKD_BINARY" ]; then
  log_ok "Found $TASKD_BINARY"
else
  log_error "Not found"
  log
  log "Either your \$PATH variable does not include the install location, or"
  log "you did not build and install taskd."
  exit 1
fi

# Verify taskdctl is in $PATH.
log_line "Looking for 'taskdctl' in \$PATH"
TASKDCTL_BINARY=$(which taskdctl)
if [ -n "TASKDCTL_BINARY" ]; then
  log_ok "Found $TASKDCTL_BINARY"
else
  log_error "Not found"
  log
  log "Either your \$PATH variable does not include the install location, or"
  log "you did not build and install taskd."
  exit 1
fi

# Determine $TASKDDATA.
log_line "Choose a directory for all data: [$DEFAULT_TASKDDATA]"
read TASKDDATA
TASKDDATA="${TASKDDATA:-$DEFAULT_TASKDDATA}"
if [ ${TASKDDATA:0:1} != "/" ]; then
  log_line
  log_error "Relative path"
  log
  log "You may not specify a relative path"
  exit 1
fi
log_line " --> Using TASKDDATA"
log_ok $TASKDDATA

# Determine $USER is the desired owner of $TASKDDATA.
log_line "User ID that will run the server [$USER]"
read USER_ID
USER_ID="${USER_ID:-$USER}"
if [ "$USER_ID" == "$USER" ]; then
  log_line " --> Using USER_ID"
  log_ok $USER_ID
else
  USER_EXISTS=$(id $USER_ID 2>&1)
  if [ $? -eq 0 ]; then
    log_line
    log_error "Wrong account"
    log
    log "You are logged in as '$USER'. Log in as '$USER_ID' and rerun $DEFAULT_SETUP"
  else
    log_line
    log_error "Missing user"
    log
    log "The user '$USER_ID' does not yet exist"
  fi
  exit 1
fi

# Determine host name for the server.
log_line "Choose a hostname to listen on: [$DEFAULT_HOST]"
read HOST
HOST="${HOST:-$DEFAULT_HOST}"
log_line " --> Using HOST"
log_ok $HOST

# Determine port number to listen on.
log_line "Choose a port to listen on: [$DEFAULT_PORT]"
read PORT
PORT="${PORT:-$DEFAULT_PORT}"
log_line " --> Using PORT"
log_ok $PORT

# Initial data gathering complete - confirm permission to proceed.
log_line "Okay to proceed and configure server? [y|N]"
read PROCEED
PROCEED="${PROCEED:-N}"
if [ "$PROCEED" != "y" ]; then
  log_error "Terminating - nothing was changed"
  exit 1
fi

# Create $TASKDDATA.
log_line "Creating TASKDDATA"
if [ -d "$TASKDDATA" ]; then
  log_warning "Already exists"
else
  PARENT=$(dirname $TASKDDATA)
  if [ -w $PARENT ]; then
    mkdir -p $TASKDDATA $TASKDDATA/cert $TASKDDATA/log $TASKDDATA/run
    if [ $? -eq 0 ]; then
      log_ok "Created"
    else
      log_error "Failed"
      log
      log "There was a problem creating $TASKDDATA"
      exit 1
    fi
  else
    log_error "Permission error"
    log
    log "$PARENT is not writable for $USER"
    exit 1
  fi
fi

# Initialize $TASKDDATA.
log_line "Running 'taskd init --data \$TASKDDATA' --log"
OUTPUT=$($TASKD_BINARY init --data $TASKDDATA --log 2>&1)
if [ $? -eq 0 ]; then
  log_ok "Ok"
else
  log_error "Failed"
  log
  log "$OUTPUT"
  exit 1
fi

# Capture settings.
configure "Configuring host:port"     server        $HOST:$PORT
configure "Configuring log"           log           "$TASKDDATA/log/taskd.log"
configure "Configuring pid.file"      pid.file      "$TASKDDATA/run/taskd.pid"
configure "Configuring ip.log"        ip.log        1
configure "Configuring request.limit" request.limit 10485760
configure "Configuring ciphers"       ciphers       NORMAL

# Verify there are no certs in $DEFAULT_PKI
cd $DEFAULT_PKI
OUTPUT=$(ls $DEFAULT_PKI/*.pem)
if [ $? -eq 0 ]; then
  log "There are PEM files in $DEFAULT_PKI, which will be overwritten"
  log_line "Continue? [y|N]"
  read PROCEED
  PROCEED="${PROCEED:-N}"
  if [ "$PROCEED" != "y" ]; then
    log_error "Terminating"
    exit 1
  fi
fi

# TODO Verify there are no certs in $TASKDDATA/cert

log_line "Generating server CA cert"

OUTPUT=$($DEFAULT_PKI/generate.ca 2>&1)
if [ $? -eq 0 ]; then
  log_ok "Ok"

  log_line "Installing ca.cert.pem"
  cp $DEFAULT_PKI/ca.cert.pem $TASKDDATA/cert/ca.cert.pem
  if [ $? -eq 0 ]; then
    log_ok "Ok"
  else
    log_error "Failed"
    exit 1
  fi

  configure "Configuring ca.cert" ca.cert $TASKDDATA/cert/ca.cert.pem
else
  log_error "Failed"
  log
  log "$OUTPUT"
  exit 1
fi

log_line "Generating server key/cert pair"
OUTPUT=$($DEFAULT_PKI/generate.server 2>&1)
if [ $? -eq 0 ]; then
  log_ok "Ok"

  log_line "Installing server.cert.pem"
  cp $DEFAULT_PKI/server.cert.pem $TASKDDATA/cert/server.cert.pem
  if [ $? -eq 0 ]; then
    log_ok "Ok"
  else
    log_error "Failed"
    exit 1
  fi

  log_line "Installing server.key.pem"
  cp $DEFAULT_PKI/server.key.pem $TASKDDATA/cert/server.key.pem
  if [ $? -eq 0 ]; then
    log_ok "Ok"
  else
    log_error "Failed"
    exit 1
  fi

  configure "Configuring server.cert" server.cert $TASKDDATA/cert/server.cert.pem
  configure "Configuring server.key"  server.key  $TASKDDATA/cert/server.key.pem
else
  log_error "Failed"
  log
  log "$OUTPUT"
  exit 1
fi

log_line "Generating server CRL"
OUTPUT=$($DEFAULT_PKI/generate.crl 2>&1)
if [ $? -eq 0 ]; then
  log_ok "Ok"

  log_line "Installing server.crl.pem"
  cp $DEFAULT_PKI/server.crl.pem $TASKDDATA/cert/server.crl.pem
  if [ $? -eq 0 ]; then
    log_ok "Ok"
  else
    log_error "Failed"
    exit 1
  fi

  configure "Configuring server.crl" server.crl $TASKDDATA/cert/server.crl.pem
else
  log_error "Failed"
  log
  log "$OUTPUT"
  exit 1
fi

log_line "Generating API key/cert pair"
OUTPUT=$($DEFAULT_PKI/generate.client client 2>&1)
if [ $? -eq 0 ]; then
  log_ok "Ok"

  log_line "Installing client.cert.pem"
  cp $DEFAULT_PKI/client.cert.pem $TASKDDATA/cert/client.cert.pem
  if [ $? -eq 0 ]; then
    log_ok "Ok"
  else
    log_error "Failed"
    exit 1
  fi

  log_line "Installing client.key.pem"
  cp $DEFAULT_PKI/client.key.pem $TASKDDATA/cert/client.key.pem
  if [ $? -eq 0 ]; then
    log_ok "Ok"
  else
    log_error "Failed"
    exit 1
  fi

  configure "Configuring client.cert" client.cert $TASKDDATA/cert/client.cert.pem
  configure "Configuring client.key"  client.key  $TASKDDATA/cert/client.key.pem
else
  log_error "Failed"
  log
  log "$OUTPUT"
  exit 1
fi

# Setup a number of users.
log_line "Would you like to set up a user account now? [y|N]"
read ANSWER
ANSWER="${ANSWER:-N}"
if [ "$ANSWER" == "y" ]; then
  log_line
  log_ok "Setting up user account"

  while [ 1 ]; do
    log_line "Enter the organization name for the user account [PUBLIC]"
    read ORGNAME
    ORGNAME="${ORGNAME:-PUBLIC}"

    if [ -n "$ORGNAME" ]; then

      log_line "Enter the full user name (e.g. 'First Last')"
      read USERNAME
      if [ -n "$USERNAME" ]; then

        # Create org if necessary
        log_line "Creating organization '$ORGNAME'"
        if [ -d "$TASKDDATA/orgs/$ORGNAME" ]; then
          log_ok "Already created"
        else
          OUTPUT=$($TASKD_BINARY add --data $TASKDDATA org "$ORGNAME" 2>&1)
          if [ $? -eq 0 ]; then
            log_ok "Ok"
          else
            log_error "Failed"
            log
            log "$OUTPUT"
            exit 1
          fi
        fi

        # Create user
        log_line "Creating user '$USERNAME'"
        OUTPUT=$($TASKD_BINARY add --data $TASKDDATA user --quiet "$ORGNAME" "$USERNAME" 2>&1)
        if [ $? -eq 0 ]; then
          log_ok "Ok"
          USERKEY=${OUTPUT:14}

          # Create user key/cert
          USERFILE=${USERNAME// /_}

          log_line "Generating $USERNAME key/cert pair"
          OUTPUT=$($DEFAULT_PKI/generate.client $USERFILE 2>&1)
          if [ $? -eq 0 ]; then
            log_ok "Ok"
          else
            log_error "Failed"
            log
            log "$OUTPUT"
            exit 1
          fi

          # Show tw configuration details
          log
          log "Taskwarrior Configuration details for $USERNAME."
          log
          log "  $USERNAME must copy these files to ~/.task"
          log "    $DEFAULT_PKI/ca.cert.pem"
          log "    $DEFAULT_PKI/$USERFILE.cert.pem"
          log "    $DEFAULT_PKI/$USERFILE.key.pem"
          log
          log "  $USERNAME must run these commands:"
          log "    task config taskd.server       $HOST:$PORT"
          log "    task config taskd.credentials  '$ORGNAME/$USERNAME/$USERKEY'"
          log "    task config taskd.certificate  ~/.task/$USERFILE.cert.pem"
          log "    task config taskd.key          ~/.task/$USERFILE.key.pem"
          log "    task config taskd.ca           ~/.task/ca.cert.pem"
          log "    task config taskd.trust        strict"
          log "    task config taskd.ciphers      NORMAL"
          log
        else
          log_error "Failed"
          log
          log "$OUTPUT"
          exit 1
        fi
      else
        log_error "Missing data"
        log
        log "You must specify an account name."
        exit 1
      fi
    else
      log_error "Missing data"
      log
      log "You must specify an organization."
      exit 1
    fi

    log_line "Create another user account? [y|N]"
    read ANSWER
    ANSWER="${ANSWER:-N}"
    if [ "$ANSWER" != "y" ]; then
      break;
    fi
  done
fi

# TODO Verify port is not in use

# Launch the server.
log
log "Your Taskserver is configured and ready."
log_line "Would you like to launch the server daemon? [y|N]"
read ANSWER
ANSWER="${ANSWER:-N}"
if [ "$ANSWER" == "y" ]; then
  log_line
  log_ok "Launching"
  OUTPUT=$(TASKDDATA=$TASKDDATA $TASKDCTL_BINARY start 2>&1)
  if [ $? -eq 0 ]; then
    log_line
    log_ok "Launched"
  else
    log_error "Failed"
    log
    log "$OUTPUT"
    exit 1
  fi

  # TODO Verify server running via log file
fi

log "Launch your Taskserver using this command:"
log
log "    TASKDDATA=$TASKDDATA $TASKDCTL_BINARY start"
log
log "Shut down your Taskserver using this command:"
log
log "    TASKDDATA=$TASKDDATA $TASKDCTL_BINARY stop"
log

log_ok "Done"
exit 0

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

error: pathspec 'scripts/i_cant_follow_instructions.bash' did not match any file(s) known to git


Create serpicoInstall.sh

Create serpicoInstall.sh

# serpicoInstall.sh

#!/bin/bash

username="r3b00t"

# Use this to download the rvm gpg
\curl -sSL https://rvm.io/mpapis.asc | sudo gpg --import -

# Download and install the stable version of RVM in multi user mode
\curl -sSL https://get.rvm.io | sudo bash -s stable

sudo -s <<EOF
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
adduser root rvm
adduser $username rvm

# Run this once to allow rvm to be run
source /etc/profile.d/rvm.sh

# This will add the source command to your .bashrc to ensure you don't have to run it each time
echo source /etc/profile >> /home/$username/.bashrc
echo source /etc/profile >> /root/.bashrc

# Install openssl library (required for ruby install 2.1.5)
apt-get install -y libssl1.0-dev

rvm get master

# Install and use Ruby 2.1.5, the version used by Serpico
rvm install 2.1.5

source /etc/profile.d/rvm.sh
rvm use 2.1.5

# Serpico Dependencies
apt-get -y install libsqlite3-dev libxslt-dev libxml2-dev zlib1g-dev gcc

# Get and install the development version of Serpico
git clone https://github.com/SerpicoProject/Serpico.git /opt/Serpico-Dev
cd /opt/Serpico-Dev/

gem install bundler

# The Gemfile has an issue during installation, run the below to preemptively resolve it
gem install msfrpc-client -v 1.0.3

bundle install

# Initialize the findings database
ruby scripts/first_time.rb
EOF

# One completed, you can edit /opt/Serpico-Dev/config.json so that your Serpico instance is local only.
# Change "bind_address": "0.0.0.0", to "bind_address": "127.0.0.1",

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


'./scripts/setup-intellji.sh' will check if 'scripts/compile/env_exec.sh' exists (#1429)

* addressed comments raised by billonahill

#!/bin/bash

# Make sure ./bazel_configure.py is run before runing this scripts
if [[ ! -f ./scripts/compile/env_exec.sh ]] ; then
  echo "ERROR: File ./scripts/compile_env/env_exec.sh is not found."
  echo "Run ./bazel_configure.py first."
  exit
fi

# Generates an IntelliJ project in heron

set -o errexit
cd $(dirname "$0")
echo "changing to `pwd`/.."
cd ..
mkdir -p .idea/
cp -R scripts/resources/idea/* .idea/
source scripts/get_all_heron_paths.sh
echo "Generating IDEA project..."

readonly iml_file=heron.iml
# Code generated by AutoValue is put in $MODULE_DIR/out/generated; adding it as a Source Root
# allows IntelliJ to find it while editing. (that is, generated classes won't be marked as unknown.)
cat > $iml_file <<EOH
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
  <component name="FacetManager">
    <facet type="Python" name="Python">
      <configuration sdkName="Python 2.7.10 (/usr/bin/python)" />
    </facet>
  </component>
  <component name="NewModuleRootManager">
    <orderEntry type="sourceFolder" forTests="false" />
    <output url="file://\$MODULE_DIR\$/out" />
EOH

# Find all top-level dirs that should be parsed for possible source/tests
for content_dir in `find . -maxdepth 1 -type d -path './[^.]*' | cut -d '/' -f 2 | grep -v out`; do

  if [ "$content_dir" == "heron" ]; then

  cat >> $iml_file <<EOH
    <content url="file://\$MODULE_DIR$/heron">
EOH
  echo '      <sourceFolder url="file://$MODULE_DIR$/heron/config/src" type="java-resource" />'>> $iml_file
  heron_java_paths="$(get_heron_source_paths)"

  for source in ${heron_java_paths}; do
    if [[ $source == *"javatests" ]]; then
      is_test_source="true"
    elif [[ $source == *"tests/"* ]]; then
      is_test_source="true"
    else
      is_test_source="false"
    fi
    folderType="sourceFolder";
    if [[ -f "$source/xxBUILD" ]]; then
      folderType="excludeFolder"
      echo '      <excludeFolder url="file://$MODULE_DIR$/'"${source}\"  />" >> $iml_file
    else
      echo '      <sourceFolder url="file://$MODULE_DIR$/'"${source}\" isTestSource=\"${is_test_source}\" />" >> $iml_file
    fi
  done

  else
    echo "    <content url=\"file://\$MODULE_DIR$/${content_dir}\">"  >> $iml_file
  fi
  cat >> $iml_file <<'EOF'
    </content>
EOF
done

# Write a module-library entry, usually a jar file but occasionally a directory.
function write_jar_entry() {
  local root_file=$1
  if [[ $# > 1 ]]; then
    local source_path=$2
  else
    local source_path=""
  fi
  local protocol="file"
  local file_end=""
  if [[ $root_file == *.jar ]]; then
    protocol="jar"
    file_end="!"
  fi
  local  libfile="\$MODULE_DIR\$/${root_file}"
  if [[ "$root_file" = /* ]]; then
    libfile="${root_file}"
  fi
  local readonly basename=${root_file##*/}
    cat >> $iml_file <<EOF
      <orderEntry type="module-library">
        <library name="${basename}">
          <CLASSES>
            <root url="${protocol}://${libfile}${file_end}/" />
          </CLASSES>
          <JAVADOC />
EOF
  if [[ -z "${source_path}" ]]; then
    echo "          <SOURCES />" >> $iml_file
  else
    cat >> $iml_file <<EOF
          <SOURCES>
            <root url="jar:/\$MODULE_DIR\$/${source_path}!/" />
          </SOURCES>
EOF
  fi
  if [[ $protocol == "file" ]]; then
    cat >> $iml_file <<EOF
          <jarDirectory url="file://\$MODULE_DIR\$/${root_file}" recursive="false" />
EOF
  fi
  cat >> $iml_file <<'EOF'
      </library>
    </orderEntry>
EOF
}

# Slight hack to make sure (1) our langtools is picked up before the SDK
# default, but that (2) SDK is picked up before auto-value, because that
# apparently causes problems for auto-value otherwise.
readonly javac_jar="third_party/java/jdk/langtools/javac.jar"
write_jar_entry "$javac_jar"

cat >> $iml_file <<'EOF'
    <orderEntry type="inheritedJdk" />
EOF
heron_thirdparty_deps="$(get_heron_thirdparty_dependencies)"
for jar in ${heron_thirdparty_deps}; do
  if [[ jar != "$javac_jar" ]]; then
    write_jar_entry $jar
  fi
done

for path_pair in ${GENERATED_PATHS}; do
  write_jar_entry ${path_pair//:/ }
done
heron_resolved_deps="$(get_heron_bazel_deps)"

for jar in ${heron_resolved_deps}; do
  write_jar_entry $jar
done
#<orderEntry type="library" name="proto" level="application" />
heron_binary_paths="$(collect_generated_binary_deps)"

for jar in ${heron_binary_paths}; do
  write_jar_entry "$jar";
done
#write_jar_entry "bazel-bin/heron/metricsmgr/src/thrift"

cat >> $iml_file <<'EOF'
    <orderEntry type="library" name="Python 2.7.10 (/usr/bin/python) interpreter library" level="application" />
  </component>
</module>
EOF

echo Done. IDEA module file: $iml_file

IDEA=`ls -1d /Applications/IntelliJ\ * 2> /dev/null| tail -n1`
if [ -n "$IDEA" ]; then
  echo "Opening Heron project in IDEA..."
  open -a "$IDEA" .
  echo "Done."
else
  echo
  echo "Could not locate IntelliJ IDEA. Manually open `pwd` as a project in IDEA."
fi

#!/bin/bash

# Generates an IntelliJ project in heron

set -o errexit
cd $(dirname "$0")
echo "changing to `pwd`/.."
cd ..
mkdir -p .idea/
cp -R scripts/resources/idea/* .idea/
source scripts/get_all_heron_paths.sh
echo "Generating IDEA project..."

readonly iml_file=heron.iml
# Code generated by AutoValue is put in $MODULE_DIR/out/generated; adding it as a Source Root
# allows IntelliJ to find it while editing. (that is, generated classes won't be marked as unknown.)
cat > $iml_file <<EOH
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
  <component name="FacetManager">
    <facet type="Python" name="Python">
      <configuration sdkName="Python 2.7.10 (/usr/bin/python)" />
    </facet>
  </component>
  <component name="NewModuleRootManager">
    <orderEntry type="sourceFolder" forTests="false" />
    <output url="file://\$MODULE_DIR\$/out" />
EOH

# Find all top-level dirs that should be parsed for possible source/tests
for content_dir in `find . -maxdepth 1 -type d -path './[^.]*' | cut -d '/' -f 2 | grep -v out`; do

  if [ "$content_dir" == "heron" ]; then

  cat >> $iml_file <<EOH
    <content url="file://\$MODULE_DIR$/heron">
EOH
  echo '      <sourceFolder url="file://$MODULE_DIR$/heron/config/src" type="java-resource" />'>> $iml_file
  heron_java_paths="$(get_heron_source_paths)"

  for source in ${heron_java_paths}; do
    if [[ $source == *"javatests" ]]; then
      is_test_source="true"
    elif [[ $source == *"tests/"* ]]; then
      is_test_source="true"
    else
      is_test_source="false"
    fi
    folderType="sourceFolder";
    if [[ -f "$source/xxBUILD" ]]; then
      folderType="excludeFolder"
      echo '      <excludeFolder url="file://$MODULE_DIR$/'"${source}\"  />" >> $iml_file
    else
      echo '      <sourceFolder url="file://$MODULE_DIR$/'"${source}\" isTestSource=\"${is_test_source}\" />" >> $iml_file
    fi
  done

  else
    echo "    <content url=\"file://\$MODULE_DIR$/${content_dir}\">"  >> $iml_file
  fi
  cat >> $iml_file <<'EOF'
    </content>
EOF
done

# Write a module-library entry, usually a jar file but occasionally a directory.
function write_jar_entry() {
  local root_file=$1
  if [[ $# > 1 ]]; then
    local source_path=$2
  else
    local source_path=""
  fi
  local protocol="file"
  local file_end=""
  if [[ $root_file == *.jar ]]; then
    protocol="jar"
    file_end="!"
  fi
  local  libfile="\$MODULE_DIR\$/${root_file}"
  if [[ "$root_file" = /* ]]; then
    libfile="${root_file}"
  fi
  local readonly basename=${root_file##*/}
    cat >> $iml_file <<EOF
      <orderEntry type="module-library">
        <library name="${basename}">
          <CLASSES>
            <root url="${protocol}://${libfile}${file_end}/" />
          </CLASSES>
          <JAVADOC />
EOF
  if [[ -z "${source_path}" ]]; then
    echo "          <SOURCES />" >> $iml_file
  else
    cat >> $iml_file <<EOF
          <SOURCES>
            <root url="jar:/\$MODULE_DIR\$/${source_path}!/" />
          </SOURCES>
EOF
  fi
  if [[ $protocol == "file" ]]; then
    cat >> $iml_file <<EOF
          <jarDirectory url="file://\$MODULE_DIR\$/${root_file}" recursive="false" />
EOF
  fi
  cat >> $iml_file <<'EOF'
      </library>
    </orderEntry>
EOF
}

# Slight hack to make sure (1) our langtools is picked up before the SDK
# default, but that (2) SDK is picked up before auto-value, because that
# apparently causes problems for auto-value otherwise.
readonly javac_jar="third_party/java/jdk/langtools/javac.jar"
write_jar_entry "$javac_jar"

cat >> $iml_file <<'EOF'
    <orderEntry type="inheritedJdk" />
EOF
heron_thirdparty_deps="$(get_heron_thirdparty_dependencies)"
for jar in ${heron_thirdparty_deps}; do
  if [[ jar != "$javac_jar" ]]; then
    write_jar_entry $jar
  fi
done

for path_pair in ${GENERATED_PATHS}; do
  write_jar_entry ${path_pair//:/ }
done
heron_resolved_deps="$(get_heron_bazel_deps)"

for jar in ${heron_resolved_deps}; do
  write_jar_entry $jar
done
#<orderEntry type="library" name="proto" level="application" />
heron_binary_paths="$(collect_generated_binary_deps)"

for jar in ${heron_binary_paths}; do
  write_jar_entry "$jar";
done
#write_jar_entry "bazel-bin/heron/metricsmgr/src/thrift"

cat >> $iml_file <<'EOF'
    <orderEntry type="library" name="Python 2.7.10 (/usr/bin/python) interpreter library" level="application" />
  </component>
</module>
EOF

echo Done. IDEA module file: $iml_file

IDEA=`ls -1d /Applications/IntelliJ\ * 2> /dev/null| tail -n1`
if [ -n "$IDEA" ]; then
  echo "Opening Heron project in IDEA..."
  open -a "$IDEA" .
  echo "Done."
else
  echo
  echo "Could not locate IntelliJ IDEA. Manually open `pwd` as a project in IDEA."
fi


commit

commit

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/rogierlommers/dotfiles.git/'


Add test for repeated triggers

Add test for repeated triggers

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/jnbnyc/jenkins-test-github.git/'


lab8 spam bash script

lab8 spam bash script

#! /bin/bash

#read recipient sender
website=`echo $2 | cut -d '@' -f 2`

echo "recipiennt $1 sender $2"

(
sleep 3
echo "helo $website"
sleep 2
echo "mail from: $2"
sleep 2
echo "rcpt to: $1"
sleep 2
echo "data"
sleep 2
echo "Subject: I'm da captain"
sleep 2
echo "i'm da captain now."
sleep 2
echo "."
) |
telnet mail.cs.ucr.edu 25

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


correct version copied now

correct version copied now

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/yafraorg/docker-yafrajava.git/'


add a simple helper script to start server for local debugging

#!/bin/bash
PYRAMID_RELOAD_TEMPLATES=1 bin/gunicorn -b 127.0.0.1:7001 -w 1 -t 600 ichnaea:application

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


git rewrite author

git rewrite author

git filter-branch --env-filter '
OLD_EMAIL="xxxx"
CORRECT_NAME="Nikunj Chapadia"
CORRECT_EMAIL="nikunj.chapadia@gmail.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_COMMITTER_NAME="$CORRECT_NAME"
    export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_AUTHOR_NAME="$CORRECT_NAME"
    export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags

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


Added script to run prost without rddlsim

#!/bin/bash
# Author: Gerard Canal <gcanal@iri.upc.edu>
# This script runs the rddlsim and prost together, to work as a single planner executable
# Usage: ./run_prost.sh RDDL_DOMAIN_FILE RDDL_PROBLEM_FILE SEARCH_OPTIONS (Both rddl files must be in the same folder!)

########################################################################################################################
## Get arguments
RDDL_DOMAIN_FILE=$(realpath $1)
RDDL_PROBLEM_FILE=$(realpath $2)
SEARCH_OPTIONS=$3
ARGC=$#
WAIT_SERVER_TIME=0.5  # Seconds

if [[ $ARGC -ne 3 ]]; then
	echo -e "Usage: ./run_prost_online.sh RDDL_DOMAIN_FILE RDDL_PROBLEM_FILE SEARCH_OPTIONS\n(Both rddl files must be in the same folder!)"
	exit 1
fi

########################################################################################################################
## Check file existances
if [ ! -f "$RDDL_DOMAIN_FILE" ]; then
  echo "Error: Provided RDDL domain file $RDDL_DOMAIN_FILE was not found!"
  exit 2
fi

if [ ! -f "$RDDL_PROBLEM_FILE" ]; then
  echo "Error: Provided RDDL instance file $RDDL_PROBLEM_FILE was not found!"
  exit 2
fi

PROST_HOME="$(rospack find rosplan_planning_system)/common/bin/prost"
if [ ! -d "$PROST_HOME" ]; then
  echo "Error: prost was not found in $PROST_HOME"
  exit 2
fi

########################################################################################################################
## Get the files folders and join them for rddlsim
FILES_FOLDER_PATH=$(dirname $RDDL_DOMAIN_FILE)
PROBLEM_FOLDER_PATH=$(dirname $RDDL_PROBLEM_FILE)

MOVED_PROBLEM_FILE=0;
if [[ "$FILES_FOLDER_PATH" != "$PROBLEM_FOLDER_PATH" ]]; then
	cp $RDDL_PROBLEM_FILE $FILES_FOLDER_PATH;
	MOVED_PROBLEM_FILE=1;
	RDDL_PROBLEM_FILE=$FILES_FOLDER_PATH/$(basename $RDDL_PROBLEM_FILE)
fi

########################################################################################################################
# Get instance name from PROBLEM FILE
INSTANCE_NAME=$(sed -n 's/instance \(.*\) {/\1/p' $RDDL_PROBLEM_FILE)

########################################################################################################################
########################################################################################################################
########################################################################################################################
## Run the parser and planner
SERVER_PORT=3234

# Wait for the server to be online
# The above command gets the PID of a process using the port $SERVER_PORT
while [[ -z $SERVER_PID ]]; do
	SERVER_PID=$(netstat -tulpn 2>&1 | grep $SERVER_PORT | sed -n 's_.*\s\([0-9]\+\)/.*_\1_p')
	sleep $WAIT_SERVER_TIME # Give time for the server to die
done

cd $PROST_HOME
rm $INSTANCE_NAME parser_in.rddl >/dev/null 2>&1 # Clean-up previous files

# Run rddl parser to generate prost's files
$PROST_HOME/rddl-parser $RDDL_DOMAIN_FILE $RDDL_PROBLEM_FILE . >/dev/null 2>&1

# Run prost planner
export LIBC_FATAL_STDERR_=1 # To avoid printing planner errors: https://stackoverflow.com/a/4616162
$PROST_HOME/prost $INSTANCE_NAME -h localhost -p $SERVER_PORT $SEARCH_OPTIONS >/dev/null 2>&1
EXIT_CODE=$?

rm $INSTANCE_NAME parser_in.rddl >/dev/null 2>&1 # Clean-up generated files

### Cleanup
if [[ $MOVED_PROBLEM_FILE -eq 1 ]]; then
	rm $RDDL_PROBLEM_FILE;
fi

exit $EXIT_CODE
########################################################################################################################
########################################################################################################################
########################################################################################################################

# Debug variables
echo RDDL_DOMAIN_FILE $RDDL_DOMAIN_FILE
echo RDDL_PROBLEM_FILE $RDDL_PROBLEM_FILE
echo SEARCH_OPTIONS $SEARCH_OPTIONS
echo FILES_FOLDER_PATH $FILES_FOLDER_PATH
echo PROBLEM_FOLDER_PATH $PROBLEM_FOLDER_PATH
echo MOVED_PROBLEM_FILE $MOVED_PROBLEM_FILE
echo INSTANCE_NAME $INSTANCE_NAME
echo RDDLSIM_PID $RDDLSIM_PID
exit

error: pathspec 'rosplan_planning_system/common/bin/prost/run_prost_online.sh' did not match any file(s) known to git


Add details function for collecting details from command-line

#!/usr/bin/zsh

details ()
{
    echo "$@" | pbcopy;
    sleep 1;
    $@ | pbcopy
}

error: pathspec 'zsh/functions/details.sh' did not match any file(s) known to git


Fix typo on build.sh [#6]

Fix typo on build.sh [#6]

#! /bin/bash

# TODO: Stop using JSBuild on windows and sed on linux and use internal
#       Microsoft.Ajax.Utilities.Minifier to minify JavaScript code.
#       This is already done during translation and left just for transition.

jsbfile="Bridge.jsb"
jsfile="bridge.js"
jsminf="bridge.min.js"
ts="$(date +%Y%m%d%H%M%S)"
tmpbrjs="bridge-${ts}.js"

echo "$(date) - Building ${jsfile} and ${jsminf}"
cd ../../Resources || {
 if [ ! -e "${jsbfile}" ]; then
  echo "Unable to move to ../../Resources. Current WD: '$(pwd)'."
  exit 1
 fi
 # else, we're probably running build.sh from the directory itself
}

if [ ! -e "${jsbfile}" ]; then
 echo "Unable to locate '${jsbfile}'."
 exit 1
fi

filelist="$(cat "${jsbfile}" | grep "<include name=" | sed "s/^.*<include name=\"\(.*\)\" *\/>.*\$/\1/")"

echo "Merging $(echo "${filelist}" | wc -l) files."
if [ -e "${tmpbrjs}" ]; then
 rm "${tmpbrjs}" || {
  echo "Unable to remove '${tmpbrjs}'."
  exit 1
 }
fi

for file in ${filelist}; do
 if [ -e "${file}" ]; then
#  echo "
#// @source ${file}
#" >> "${tmpbrjs}"
  cat "${file}" >> "${tmpbrjs}"
  echo "" >> "${tmpbrjs}" # add EOL at EOF. :)
 else
  echo "File '${file}' not found."
  exit 1
 fi
done

cp "${tmpbrjs}" "${jsfile}"

function minify() {
 mv "${tmpbrjs}" "${jsminf}"

 echo "Minifying '${jsminf}'."
 sedcmd="s#(^|^.*[^:])//.*\$#\1#g;s/^ *//g;s/ *\$//g;s/  +/ /g;/^ *\$/d"
 if [ "$(uname -s)" == "Darwin" ]; then
  sed -i '' -E -e "s/	/ /g" "${jsminf}" # Replate tab chars
  LC_ALL=C sed -i '' -E -e "${sedcmd}" "${jsminf}"
 else
  # TODO: Check on linux!
  sed -i -E -e "s/\t/ /g" "${jsminf}" # Replace tab chars
  sed -i -E -e "${sedcmd}" "${jsminf}"
 fi

 # Removing line breaks from JavaScript files can break code in some situations.
 #cat "${jsminf}" | tr '\n' ' ' > "${tmpbrjs}"
 #mv "${tmpbrjs}" "${jsminf}"
}

# Minifying left just during the transition between resource and dynamic
# minification.
minify

echo "$(date) - Done building ${jsfile}."

#! /bin/bash

# TODO: Stop using JSBuild on windows and sed on linux and use internal
#       Microsoft.Ajax.Utilities.Minifier to minify JavaScript code.
#       This is already done during translation and left just for transition.

jsbfile="Bridge.jsb"
jsfile="bridge.js"
jsminf="bridge.min.js"
ts="$(date +%Y%m%d%H%M%S)"
tmpbrjs="bridge-${ts}.js"

echo "$(date) - Building ${jsfile} and ${jsminf}"
cd ../../Resources || {
 if [ ! -e "${jsbfile}" ]; then
  echo "Unable to move to ../../Resources. Current WD: '$(pwd)'."
  exit 1
 fi
 # else, we're probably running build.sh from the directory itself
}

if [ ! -e "${jsbfile}" ]; then
 echo "Unable to locate '${jsbfile}'."
 exit 1
fi

filelist="$(cat "${jsbfile}" | grep "<include name=" | sed "s/^.*<include name=\"\(.*\)\" *\/>.*\$/\1/")"

echo "Merging $(echo "${filelist}" | wc -l) files."
if [ -e "${tmpbrjs}" ]; then
 rm "${tmpbrjs}" || {
  echo "Unable to remove '${tmpbrjs}'."
  exit 1
 }
fi

for file in ${filelist}; do
 if [ -e "${file}" ]; then
#  echo "
#// @source ${file}
#" >> "${tmpbrjs}"
  cat "${file}" >> "${tmpbrjs}"
  echo "" >> "${tmpbrjs}" # add EOL at EOF. :)
 else
  echo "File '${file}' not found."
  exit 1
 fi
done

cp "${tmpbrjs}" "${jsfile}"

function minify() {
 mv "${tmpbrjs}" "${jsminf}"

 echo "Minifying '${jsminf}'."
 sedcmd="s#(^|^.*[^:])//.*\$#\1#g;s/^ *//g;s/ *\$//g;s/  +/ /g;/^ *\$/d"
 if [ "$(uname -s)" == "Darwin" ]; then
  sed -i '' -E -e "s/	/ /g" "${jsminf}" # Replate tab chars
  LC_ALL=C sed -i '' -E -e "${sedcmd}" "${jsminf}"
 else
  # TODO: Check on linux!
  sed -i -E -e "s/\t/ /g" "${jsminf}" # Replace tab chars
  sed -i -E -e "${sedcmd}" "${jsminf}"
 fi

 # Removing line breaks from JavaScript files can break code in some situations.
 #cat "${jsminf}" | tr '\n' ' ' > "${tmpbrjs}"
 #mv "${tmpbrjs}" "${jsminf}"
}

# Minifying left just during the transition between resource and dynamic
# minification.
minify()

echo "$(date) - Done building ${jsfile}."


Create backdoor_dyld_print.sh

Create backdoor_dyld_print.sh

100% from Stefan Esser

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/perfaram/DYLD_PRINT_TO_FILE.git/'


hide stdout output of hadoop -rm command

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/pordoqui/dcs-fastvel-wf.git/'


add test for creating and logging timestamps

#!/bin/bash
# Tests logging timestamps
#
# usage : source ./test/test_timestamp.sh
#
# Copyright (C) 2014 Dieter Adriaenssens
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# get folder where script is locatedi (bootstrap, init.sh will set BUILD_TREND_HOME)
BUILD_TREND_TEST=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)
BUILD_TREND_HOME=$BUILD_TREND_TEST/..

source $BUILD_TREND_TEST/../init.sh
echo "location of build-trend scripts : " $BUILD_TREND_HOME
echo

timestamp.sh start
echo "sleep 2 seconds"
sleep 2
timestamp.sh test1
echo "sleep 5 seconds"
sleep 5
timestamp.sh test2
echo "sleep 10 seconds"
sleep 10
timestamp.sh end

echo
echo "analyse timestamps"
analyse.sh

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


Add MOTD notice to the cloudserver-aio.sh build

This patch adds a MOTD notice to the cloudserver-aio.sh build which
wanrs the user that after a reboot the server will not operate until
Galera has been re-bootstrapped. It also provides the execution steps to
help the user know how to do that.

Change-Id: I18ffb4d49b88b14a734fd81ae42faf797676b9b0
Closes-Bug: #1402977

#!/usr/bin/env bash
# Copyright 2014, Rackspace US, Inc.
#
# 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 -u -v -x

REPO_URL=${REPO_URL:-"https://github.com/stackforge/os-ansible-deployment.git"}
REPO_BRANCH=${REPO_BRANCH:-"master"}
WORKING_FOLDER=${WORKING_FOLDER:-"/opt/stackforge/os-ansible-deployment"}

# install git so that we can fetch the repo
apt-get update && apt-get install -y git

# fetch the repo
git clone -b ${REPO_BRANCH} ${REPO_URL} ${WORKING_FOLDER}/

# put an motd in place to help the user know how to restart galera after reboot
cat > /etc/update-motd.d/20-openstack<< EOF
#!/usr/bin/env bash
echo ""
echo "############ ansible-os-deployment all-in-one build #############"
echo "If this server has been rebooted, you will need to re-bootstrap"
echo "Galera to get the cluster operational. To do this execute:"
echo ""
echo "cd /opt/ansible-lxc-rpc/rpc_deployment"
echo "ansible-playbook -e @/etc/rpc_deploy/user_variables.yml playbooks/infrastructure/galera-startup.yml"
EOF
chmod +x /etc/update-motd.d/00-rpc-notice

# run the same aio build script that is used in the OpenStack CI pipeline
cd ${WORKING_FOLDER}
./scripts/os-ansible-aio-check.sh

#!/usr/bin/env bash
# Copyright 2014, Rackspace US, Inc.
#
# 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 -u -v -x

REPO_URL=${REPO_URL:-"https://github.com/stackforge/os-ansible-deployment.git"}
REPO_BRANCH=${REPO_BRANCH:-"master"}
WORKING_FOLDER=${WORKING_FOLDER:-"/opt/stackforge/os-ansible-deployment"}

# install git so that we can fetch the repo
apt-get update && apt-get install -y git

# fetch the repo
git clone -b ${REPO_BRANCH} ${REPO_URL} ${WORKING_FOLDER}/

# run the same aio build script that is used in the OpenStack CI pipeline
cd ${WORKING_FOLDER}
./scripts/os-ansible-aio-check.sh


debug: remove git diff on deploy

debug: remove git diff on deploy

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/SenHeng/AngularTypescriptWebpack.git/'


Transfert des new images

Transfert des new images

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/gandalf-the-white/foundation.git/'


remove z.sh

remove z.sh

fatal: Invalid path '/root/.oh-my-zsh': No such file or directory


test multiple substutions

test multiple substutions

#!/bin/bash
#
# chain 2 sed substitutions for output
#

sed "s/hello/goodbye/g; s/quick/slow/g" <<EOF
hello, world!
hello, universe!
the quick brown fox
EOF

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


add beautify script

add beautify script

#!/bin/bash -e

function removeNewlineAtEndOfFile()
{
    local repositoryFolderPath="${1}"

    find \
        "${repositoryFolderPath}" \
        -type f \
        \( \
            -name 'authorized_keys' -o \
            -name 'known_hosts' -o \
            -name "*.bash" -o \
            -name "*.conf" -o \
            -name "*.profile" -o \
            -name "*.upstart" \
        \) \
        \( \
            -not -path "${repositoryFolderPath}/.git/*" \
        \) \
        -exec bash -c -e '
            for file
            do
                printf '%s' "$(< "${file}")" > "${file}"
            done' bash '{}' \;
}

function main()
{
    local repositoryFolderPath="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

    removeNewlineAtEndOfFile "${repositoryFolderPath}"
}

main "${@}"

error: pathspec 'bin/beautify-bash.bash' did not match any file(s) known to git


add wrapper script

add wrapper script

#!/bin/bash

#- This script is called by the data transfer daemon via ssh
#- to launch new jobs for each exposure as they arrive.

#- Add module locations that are not included by default when spawning
#- a command via ssh
module use /usr/common/software/modulefiles

#- define the software environment to use
source /project/projectdirs/desi/software/desi_environment.sh 18.11

#- define the production specific environment variables
source /global/cscratch1/sd/desi/desi/spectro/redux/nightly/setup.sh

#- call desi_night with whatever args were passed in
echo RUNNING desi_night $@
# echo '  (not really)'
desi_night $@

#- debugging; maybe leave on to show what happens?
echo 'Production database tasks:'
desi_pipe top --once
echo 'Batch jobs in the queue:'
squeue -u $USER

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


kubernetes-csi: generator script

kubernetes-csi: generator script

Kubernetes-CSI produces a lot of different images. This script
simplifies promotion of the release images by printing the images.yaml
content to stdout.

#! /bin/sh

# List of repos under https://console.cloud.google.com/gcr/images/k8s-staging-csi/GLOBAL
repos="
csi-attacher
csi-node-driver-registrar
csi-provisioner
csi-resizer
csi-snapshotter
hostpathplugin
livenessprobe
mock-driver
snapshot-controller
"

for repo in $repos; do
    echo "- name: $repo"
    echo "  dmap:"
    gcloud container images list-tags gcr.io/k8s-staging-csi/$repo --format='get(digest, tags)' --filter='tags~v.* AND NOT tags~v2020.* AND NOT tags~.*rc.*' |
        sed -e 's/\([^ ]*\)\t\(.*\)/    "\1": [ "\2" ]/'
done

error: pathspec 'k8s.gcr.io/images/k8s-staging-csi/generate.sh' did not match any file(s) known to git