First round

First round

#!/bin/bash

#
# Prevents 'clear' on exit of mingw64 bash shell
#
SHLVL=0

#
# Allows us to check for existence of subfolders in help/
#
shopt -s nullglob

#
# In this script we update the git repo and copy the Keyman Desktop
# documentation over. This should be run after a full build.
#

#
# These are passed via environment:
#
# HELP_KEYMAN_COM = the home of the help.keyman.com repository
#
# That repo must have push to origin configured and logged in
#

if [ -z ${HELP_KEYMAN_COM+x} ]; then
  >&2 echo "Not uploading documentation: must set HELP_KEYMAN_COM in environment."
  exit 1
fi

if [ ! -d "$HELP_KEYMAN_COM/products/desktop/10.0/docs" ]; then
  >&2 echo "HELP_KEYMAN_COM path ($HELP_KEYMAN_COM) does not appear to be valid."
  exit 1
fi

#
# Environment
#

KEYMANROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.."

# . "$KEYBOARDROOT/servervars.sh"
# . "$KEYBOARDROOT/resources/util.sh"

echo "Uploading Keyman Desktop documentation to help.keyman.com"

#
# Uploading Keyman Desktop documentation
#

##
## Upload documentation updates to help.keyman.com
##
function upload_keyman_desktop_help {

  #
  # Note: release/packages which contain multiple keyboards should also have the keyboards
  # as separate entries in the release/ folder. This means we may have a combined package
  # help file as well as a per-keyboard help file. It is acceptable in this situation to
  # make the combined help file link to the per-keyboard help files.
  #

  #
  # Copy all files in that folder, according to the current
  # version of the keyboard, to help.keyman.com/keyboard/<id>/<version>/
  #

  local helppath=$KEYMANROOT/../bin/php/desktop

  #
  # Look for help source folder.
  #

  if [[ ! -d "$helppath" ]]; then
    echo "${t_yel}Warning: The source path $helppath does not exist${t_end}"
    return 0
  fi

  local dstpath="$HELP_KEYMAN_COM/products/desktop/10.0/docs"

  if [[ ! -d "$dstpath" ]]; then
    echo "${t_yel}Warning: The destination path $dstpath does not exist${t_end}"
    return 0
  fi

  rm -rf "$dstpath/*"
  cp -r "$helppath"/* "$dstpath/"
}

#
# Commit and push to the help.keyman.com repo
#

function commit_and_push {
  echo "Committing and pushing updated keyboard documentation (if any)"

  pushd $HELP_KEYMAN_COM
  git config user.name "Keyman Build Server"
  git config user.email "keyman-server@users.noreply.github.com"
  git add products/desktop/10.0/docs || return 1
  git diff --cached --no-ext-diff --quiet --exit-code && {
    # if no changes then don't do anything.
    echo "No changes to commit"
    popd
    return 0
  }

  echo "changes added to cache...>>>"
  git commit -m "Keyman Desktop help deployment (automatic)" || return 1
  git push origin master || return 1
  popd

  echo "Push to help.keyman.com complete"

  return 0
}

#
# Main
#

upload_keyman_desktop_help || exit 1
# commit_and_push || exit 1

error: pathspec 'windows/src/buildtools/help-keyman-com.sh' did not match any file(s) known to git


Added an install script for OS X.

Added an install script for OS X.

#!/bin/sh
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" && brew install hg git python wxpython && pip install -r requirements.txt

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


Corrected bug on oh-my-zsh

Corrected bug on oh-my-zsh

tested on 16.04.5

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/jig/myubuntu.git/'


profiling script using perf + flamegraph

#!/usr/bin/env bash

BIN=./smbc.native

perf record --call-graph=dwarf "$BIN" $@

perf script \
  | stackcollapse-perf --kernel \
  | sed 's/caml//g' \
  | flamegraph > perf.svg

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


remove MIX_ENV=test when running mix test

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/izakp/APR.git/'


hack: add script to regenerate certificates

Certificates were originally added in c000cb64712349141596318dea2a8de2462c8f81,
but did not include a script to generate them. Current versions of Go expect
certificates to use SAN instead of Common Name fields, so updating the script
to include those;

    x509: certificate relies on legacy Common Name field, use SANs or temporarily
    enable Common Name matching with GODEBUG=x509ignoreCN=0

Some fields were updated to be a bit more descriptive (instead of "replaceme"),
and the `-text` option was used to include a human-readable variant of the
content.

Signed-off-by: Sebastiaan van Stijn <64b2b6d12bfe4baae7dad3d018f8cbf6b0e7a044@gone.nl>

#!/bin/bash
set -eu

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"

# integration/testdata/https (and integration-cli/fixtures/https, which has symlinks to these files)
OUT_DIR="${SCRIPT_DIR}/../integration/testdata/https"

# generate CA
echo 01 > "${OUT_DIR}/ca.srl"
openssl genrsa -out "${OUT_DIR}/ca-key.pem"

openssl req \
	-new \
	-x509 \
	-days 3652 \
	-subj "/C=US/ST=CA/L=SanFrancisco/O=Moby-project/OU=ci/CN=moby-ci/name=moby/emailAddress=moby@example.org" \
	-nameopt compat \
	-text \
	-key "${OUT_DIR}/ca-key.pem" \
	-out "${OUT_DIR}/ca.pem"

# Now that we have a CA, create a server key and certificate signing request.
# Make sure that `"Common Name (e.g. server FQDN or YOUR name)"` matches the hostname you will use
# to connect or just use '*' for a certificate valid for any hostname:

openssl genrsa -out server-key.pem
openssl req -new \
	-subj "/C=US/ST=CA/L=SanFrancisco/O=Moby-project/OU=ci/CN=server/name=moby/emailAddress=moby@example.org" \
	-text \
	-key "${OUT_DIR}/server-key.pem" \
	-out "${OUT_DIR}/server.csr"

# Options for server certificate
cat > "${OUT_DIR}/server-options.cfg" << 'EOF'
basicConstraints=CA:FALSE
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer
extendedKeyUsage=serverAuth
subjectAltName=DNS:*,DNS:localhost,IP:127.0.0.1,IP:::1
EOF

# Generate the certificate and sign with our CA
openssl x509 \
	-req \
	-days 3652 \
	-extfile "${OUT_DIR}/server-options.cfg" \
	-CA "${OUT_DIR}/ca.pem" \
	-CAkey "${OUT_DIR}/ca-key.pem" \
	-nameopt compat \
	-text \
	-in "${OUT_DIR}/server.csr" \
	-out "${OUT_DIR}/server-cert.pem"

# For client authentication, create a client key and certificate signing request
openssl genrsa -out "${OUT_DIR}/client-key.pem"
openssl req -new \
	-subj "/C=US/ST=CA/L=SanFrancisco/O=Moby-project/OU=ci/CN=client/name=moby/emailAddress=moby@example.org" \
	-text \
	-key "${OUT_DIR}/client-key.pem" \
	-out "${OUT_DIR}/client.csr"

# Options for client certificate
cat > "${OUT_DIR}/client-options.cfg" << 'EOF'
basicConstraints=CA:FALSE
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer
extendedKeyUsage=clientAuth
subjectAltName=DNS:*,DNS:localhost,IP:127.0.0.1,IP:::1
EOF

# Generate the certificate and sign with our CA:
openssl x509 \
	-req \
	-days 3652 \
	-extfile "${OUT_DIR}/client-options.cfg" \
	-CA "${OUT_DIR}/ca.pem" \
	-CAkey "${OUT_DIR}/ca-key.pem" \
	-nameopt compat \
	-text \
	-in "${OUT_DIR}/client.csr" \
	-out "${OUT_DIR}/client-cert.pem"

rm "${OUT_DIR}/ca.srl"
rm "${OUT_DIR}/ca-key.pem"
rm "${OUT_DIR}"/*.cfg
rm "${OUT_DIR}"/*.csr

error: pathspec 'hack/generate-test-certs.sh' did not match any file(s) known to git


add useful chaos diagnosis script

add useful chaos diagnosis script

#!/bin/bash
echo "Breakdown of what MT4 logged for requests issued from the isolation test"

echo "started renders"
docker logs dockerchaos_metrictank4_1 2>&1 | grep -c 'Started GET /render.*15s'
echo "completed renders"
docker logs dockerchaos_metrictank4_1 2>&1 | grep -c 'Completed /render.*15s'

echo "renders that completed in a mere µs|ms"
ms=$(docker logs dockerchaos_metrictank4_1 2>&1 | grep 'Completed /render.*15s' | egrep -c 'µs|ms')
echo $ms
echo "renders that completed in <5s"
s=$(docker logs dockerchaos_metrictank4_1 2>&1 | grep 'Completed /render.*15s' | grep -c 'OK.*[0-4]\.[0-9]*s')
echo $s

echo "render 503 not available - within 100ms after cluster timeout of 5s"
good=$(docker logs dockerchaos_metrictank4_1 2>&1 | grep -c 'Completed /render.*15s.*503 Service Unavailable in 5\.0[0-9]*s')
echo $good
echo "render 503 not available - within 100-300ms after cluster timeout of 5s (should be 0)"
ok=$(docker logs dockerchaos_metrictank4_1 2>&1 | grep -c 'Completed /render.*15s.*503 Service Unavailable in 5\.[1-2][0-9]*s')
echo $ok
echo "render 503 not available - other (should be 0)"
all=$(docker logs dockerchaos_metrictank4_1 2>&1 | grep -c 'Completed /render.*15s.*503 Service Unavailable in')
echo $((all-ok-good))

echo "all render calls that may have timed out the client"
docker logs dockerchaos_metrictank4_1 2>&1 | grep 'Completed /render.*15s' | egrep -v 'µs|ms|Completed /render.*503 Service Unavailable in 5\.[0-2][0-9]*s|200 OK.*[0-4]\.[0-9]*s'

error: pathspec 'chaos/analyze-mt4-out.sh' did not match any file(s) known to git


install sh

install sh

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


update install.sh

update install.sh

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


added java plugin

added java plugin

function configure_java() {
	local -n __var=$1
	JAVA_HOME="$HOME/install/java"
	if [ -d "$JAVA_HOME" ]
	then
		pathutils_add_head PYTHONPATH "${JAVA_HOME}/bin"
		pathutils_add_head LD_LIBRARY_PATH "${JAVA_HOME}/lib"
		export JAVA_HOME
		__var=0
		return
	fi
	__var=1
}

register configure_java

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


New script to break blob lease

New script to break blob lease

#/bin/bash

error()
{
  if [[ -n "$@" ]]
  then
    tput setaf 1
    echo "ERROR: $@" >&2
    tput sgr0
  fi

  exit 1
}

yellow() { tput setaf 3; cat - ; tput sgr0; return; }
cyan()   { tput setaf 6; cat - ; tput sgr0; return; }

# Check the backend exists, grab the parameters and check the values are valid
[[ ! -f backend.tf ]] && error "backend.tf does not exist"
eval $(grep -E "storage_account_name|container_name|key|access_key" backend.tf  | tr -d " ")

[[ -z "$storage_account_name" ]] && error "storage_account_name not defined in backend.tf"
[[ -z "$container_name" ]]       && error "container_name not defined in backend.tf"
[[ -z "$key" ]]                  && error "key not defined in backend.tf"
[[ -z "$access_key" ]]           && error "access_key not defined in backend.tf"

# Export environment variables for storage CLI commands

export AZURE_STORAGE_ACCOUNT=$storage_account_name
export AZURE_STORAGE_KEY=$access_key

# Check the current blob lease is locked

state=$(az storage blob show --container-name $container_name --name $key --query properties.lease.status --output tsv)
[[ "$state" != "locked" ]] && error "Expected state to be locked. Current state is $state."

# Break the lease

echo "az storage blob lease break --container-name $container_name --blob-name $key" | yellow
az storage blob lease break --container-name $container_name --blob-name $key

[[ $? -ne 0 ]] && error "Failed to break lock"

## Output the current status

echo "az storage blob show --container-name $container_name --name $key --query properties.lease" | yellow
az storage blob show --container-name $container_name --name $key --query properties.lease

exit 0

error: pathspec 'workshops/terraform/breakStateLock.sh' did not match any file(s) known to git


add a clamscan runner script

add a clamscan runner script

#!/bin/sh -eu

result="`clamscan --no-summary -ri /home/kui`"
line_num="`echo -n "result" | wc -l`"

[ $line_num -ne 0 ] && echo "$result" > $HOME/Desktop/clamscan_result.txt

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


Comitting empty file. I don't remember what this used to have, but I codeded it in for something.

error: pathspec 'zsh-custom/my-aliases-exports-etc.zsh' did not match any file(s) known to git


add load test

add load test

loadtest -c 20 --rps 100 http://inter.qiyi.com/test

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


added simple pdfcrop wrapper

added simple pdfcrop wrapper

#!/bin/bash

if [ "$1" = "${1%.pdf}" ]; then
    echo "Usage: $0 <pdf file>" >&2
    exit 1
fi

pdfcrop "$1"
mv -f "${1%.pdf}-crop.pdf" "$1"

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


TravisCI: Fail when one thing failed

TravisCI: Fail when one thing failed

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/sourcerer-mike/crmp.git/'


Removed no longer needed regression test script

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/thammegowda/incubator-joshua.git/'


Added Bootstrap Folder

Added Bootstrap Folder

######################################################################
## This Script will perform the below actions
## 1) Create a GCP project directly under the GCP Org
## 2) Provision a Terraform service account with required permissions in the seed project
######################VARIABLES
## 1) Dept naming convention. = This will be suffix of seed project dept-seed-project
## 2) Billing account ID to be used.
## 3) Organization ID
##########################USAGE
## sh GCP_seed_project.sh -d 'DEPT NAME' -o orgnaization_id -b 'Billing ID'
######################################################################

#!bin/bash

while getopts "d:o:b:" flag;
do
    case "${flag}" in
        d) dpt=${OPTARG};;
        o) org_id=${OPTARG};;
        b) billing_id=${OPTARG};;
    esac
done
seed_project_id="${dpt}-seed-project"
#echo "seed project id: $seed_project_id";
#echo "org id: $org_id";
#echo "billing id: $billing_id";

act=""

seed_gcp () {

tf="tfadmin-${dpt}"

#Step1 Create GCP seed Project
gcloud projects create "${seed_project_id}" --organization=${org_id}  --quiet

#Step 2 : Associate billing id with project
gcloud beta billing projects link "${seed_project_id}" --billing-account "${billing_id}" --quiet

#Step 3 Create Terraform service account
gcloud iam service-accounts create "${tf}" --display-name "Terraform admin account" --project=${seed_project_id} --quiet
act=`gcloud iam service-accounts list --project="${seed_project_id}" --filter=tfadmin --format="value(email)"`

#Step 4 Assign org level and project level role to TF account

}

main () {

seed_gcp
status=$?
if [ $status == 0 ]
then
echo "GCP seed project created project id: ""${seed_project_id} \n"
echo " Terraform Service account to be used for creating GCP landing zone = " "${act} \n"
echo " Please follow instructions to setup Terraform service account keys before launching Terraform scripts."
else
echo " GCP service account creation failed. Please debug and rerun"
fi
}

main

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


add bump version # script

add bump version # script

#!/bin/bash

if [ "$1" != "" ]; then
  sed -i "" "s/\(s.version[ ]*=[ ]\).*/\1 \"$1\"/g" LionheartTableViewCells.podspec
  git add .
  git commit -m "bump version to $1"
  git tag $1
  git push origin master
  git push --tags
  pod trunk push
fi

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


ISO download script

ISO download script

#!/bin/sh
dhcpd
wget http://static.redox-os.org/redox-installer.iso > redox_installer.iso

error: pathspec 'filesystem/home/dl_iso.sh' did not match any file(s) known to git


Drop ci_support/checkout_merge_commit.sh

This shouldn't be needed at the top-level.

#!/bin/bash

# Update PR refs for testing.
if [[ -n "${CIRCLE_PR_NUMBER}" ]]
then
    FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head"
    FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge"
fi

# Retrieve the refs.
if [[ -n "${CIRCLE_PR_NUMBER}" ]]
then
    git fetch -u origin ${FETCH_REFS}
fi

# Checkout the PR merge ref.
if [[ -n "${CIRCLE_PR_NUMBER}" ]]
then
    git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge"
fi

# Check for merge conflicts.
if [[ -n "${CIRCLE_PR_NUMBER}" ]]
then
    git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null
fi


#107 Docker: acceptance tests, up and down

#!/bin/sh
# Runs the acceptance tests in a VM created using Docker

# Help function
function show_help {
	echo "Ontrack acceptance tests using Docker."
	echo ""
	echo "Available options are:"
	echo "General:"
	echo "    -h, --help                    Displays this help"
	echo "Input:"
	echo "    -j, --jar                     (* required) Path to the ontrack JAR"
	echo "    -a, --acceptance              (* required) Path to the acceptance test JAR"
	echo "Control:"
	echo "    -k, --keep                    If set, the container is not destroyed after"
}

# Check function

function check {
	if [ "$1" == "" ]
	then
		echo $2
		exit 1
	fi
}

# Defaults

ONTRACK_JAR=

CONTROL_KEEP=no

# Command central

for i in "$@"
do
	case $i in
		-h|--help)
			show_help
			exit 0
			;;
		-j=*|--jar=*)
            ONTRACK_JAR=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
			;;
		-k|--keep)
            CONTROL_KEEP=yes
			;;
		*)
			echo "Unknown option: $i"
			show_help
			exit 1
		;;
	esac
done

# Checks

check "$ONTRACK_JAR" "Ontrack JAR (--jar) is required."

# Logging
echo "Ontrack JAR:            ${ONTRACK_JAR}"
echo "Keeping containers:     ${CONTROL_KEEP}"

# Mount point

MOUNT=`pwd`/acceptance
rm -f ${MOUNT}
mkdir -p ${MOUNT}
echo "Ontrack data at:        ${MOUNT}"

# Docker Ontrack VM up
# TODO Docker nginx VM up

./docker-setup.sh \
    --docker-image=ontrack \
    --port=8080 \
    --mount=${MOUNT} \
    --run \
    --jar=${ONTRACK_JAR}

ONTRACK_CID=`cat ontrack.cid`

echo "[ACCEPTANCE] Ontrack container created: ${ONTRACK_CID}"

# Docker Ontrack VM down
# TODO Docker nginx VM down

if [ "${CONTROL_KEEP}" == "no" ]
then
    echo "[ACCEPTANCE] Removing Ontrack container at: ${ONTRACK_CID}"
    docker rm -f ${ONTRACK_CID}
fi

error: pathspec 'ontrack-delivery/docker-acceptance.sh' did not match any file(s) known to git


fix prezto deploy

fix prezto deploy

ZDOTDIR=${HOME}/.homesick/repos/anchor/garden

setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR}"/.zprezto/runcoms/^README.md(.N); do
  ln -s "$rcfile" "${ZDOTDIR:HOME}/.${rcfile:t}"
done

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


Script to extract read or contig names that hit a particular species in a blast xml file

#!/bin/bash
species=$1
filename=$2
grep -C 10 "<Hit_num>1</Hit_num>" $filename | grep -B 10 $species | grep "<Iteration_query-def>"

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


create output dir

create output dir

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/jtrecenti/formspree.git/'


Add a script to recreate the integration test fixtures

Signed-off-by: Micah Young <fdf13b7ed10a326d826b25626a7ce7cb94d81b94@pivotal.io>

#!/bin/bash

set -ex

pushd "$(dirname "$0")"
go build consume.go && tar -czvf consume.tgz consume.exe &&
  go build -o connect_to_remote_url.exe connect_to_remote_url/main.go && tar -czvf connect_to_remote_url.tgz connect_to_remote_url.exe &&
  go build -o launcher.exe launcher/main.go && tar -czvf launcher.tgz launcher.exe &&
  go build -o loop.exe loop/loop.go && tar -czvf loop.tgz loop.exe
popd

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


Update initialization script to use webpack.

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/addrummond/nodeibexfarm.git/'


export script (needs a rules-file)

export script (needs a rules-file)

#!/bin/sh

RULES=$1
SVNPATH=$(realpath ${0%/*}/../01.backup/svn)
AUTHORS=$(realpath ${0%/*}/AUTHORS.txt)

error() {
  echo "$@" 1>&2
}

if [ -e "${RULES}" ]; then
 :
else
 error "unable to read rules file: ${RULES}"
 exit 1
fi

if [ ! -d "${SVNPATH}" ]; then
 error "unable to find SVN-repository ${SVNPATH}"
 exit 1
fi

if [ ! -e "${AUTHORS}" ]; then
 error "unable to find authors-map ${AUTHORS}"
 exit 1
fi

svn-all-fast-export --identity-map="${AUTHORS}" --rules="${RULES}" "${SVNPATH}"

error: pathspec '03.migrate/export.sh' did not match any file(s) known to git


A minor update

A minor 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/bus710/scripts.git/'


initial commit of the chroot build method

git-svn-id: 0078f79ef0c13d8ca30f49297e7ed6c465429331@8591 7da46fd8-bd2a-0410-a152-cf9810cf5b10

#!/bin/sh
#################################################
#
# Purpose: Creating OSGeoLive as an Ubuntu customization
# 	   https://help.ubuntu.com/community/LiveCDCustomization
# Authors: Alex Mandel <tech_dev@wildintellect.com>
#	   Angelos Tzotsos <tzotsos@gmail.com>
#
#################################################
# Copyright (c) 2010 Open Source Geospatial Foundation (OSGeo)
#
# Licensed under the GNU LGPL.
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 2.1 of the License,
# or any later version.  This library 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 Lesser General Public License for more details, either
# in the "LICENSE.LGPL.txt" file distributed with this software or at
# web page "http://www.fsf.org/licenses/lgpl.html".
##################################################

#DIR=`dirname ${0}`
#VERSION=`cat "$DIR"/../VERSION.txt`
VERSION="6.0beta7"
PACKAGE_NAME="osgeo-live"
ISO_NAME="${PACKAGE_NAME}-${VERSION}"

sudo apt-get install squashfs-tools genisoimage

#TODO add wget to grab a fresh image, optional

#Stuff to be done the 1st time, should already be in place for additional builds
mkdir ~/livecdtmp
cd ~/livecdtmp
#mv ubuntu-9.04-desktop-i386.iso ~/livecdtmp
wget http://se.archive.ubuntu.com/mirror/cdimage.ubuntu.com/xubuntu/releases/12.04/release/xubuntu-12.04-desktop-i386.iso
#mv xubuntu-10.04-desktop-i386.iso ~/livecdtmps

mkdir mnt

#Start with a fresh copy
sudo mount -o loop xubuntu-12.04-desktop-i386.iso mnt

mkdir extract-cd
rsync --exclude=/casper/filesystem.squashfs -a mnt/ extract-cd

sudo unsquashfs mnt/casper/filesystem.squashfs
#Does the above need to be done every time or can it be done once, and then just make a fresh copy of the chroot for each builds
sudo mv squashfs-root edit

sudo cp /etc/resolv.conf edit/etc/
sudo cp /etc/hosts edit/etc/

sudo mount --bind /dev/ edit/dev
sudo chroot edit
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devpts none /dev/pts

export HOME=/roots
export LC_ALL=C

dbus-uuidgen > /var/lib/dbus/machines-id
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl

#Execute the build
cd /tmp/
wget https://svn.osgeo.org/osgeo/livedvd/gisvm/trunk/bin/bootstrap.sh
chmod a+x bootstrap.sh
./bootstrap.sh
cd /usr/local/share/gisvm
svn update -r 8413
cd bin
./main.sh 2>&1 | tee /var/log/osgeolive/main_install.log

#After the build
#Check for users above 999
awk -F: '$3 > 999' /etc/passwd

#Cleanup
apt-get clean
rm -rf /tmp/* ~/.bash_history
rm /etc/hosts
rm /etc/resolv.conf
rm /var/lib/dbus/machine-id
rm /sbin/initctl
dpkg-divert --rename --remove /sbin/initctl
umount /proc || umount -lf /proc
umount /sys
umount /dev/pts
exit
sudo umount edit/dev
tar czf osgeo-live-${VERSION}-log.tar.gz -C edit/var/log osgeolive

#remaster the dvd
chmod +w extract-cd/casper/filesystem.manifest
sudo chroot edit dpkg-query -W --showformat='${Package} ${Version}\n' > extract-cd/casper/filesystem.manifest
sudo cp extract-cd/casper/filesystem.manifest extract-cd/casper/filesystem.manifest-desktop
sudo sed -i '/ubiquity/d' extract-cd/casper/filesystem.manifest-desktop
sudo sed -i '/casper/d' extract-cd/casper/filesystem.manifest-desktop

sudo rm extract-cd/casper/filesystem.squashfs
sudo mksquashfs edit extract-cd/casper/filesystem.squashfs

#Update the filesystem.size file, which is needed by the installer:
# TODO: get it to run as sudo no sudo su
chmod +w extract-cd/casper/filesystem.size
printf $(sudo du -sx --block-size=1 edit | cut -f1) > extract-cd/casper/filesystem.size
chmod -w extract-cd/casper/filesystem.size
cd ~/livecdtmp
sudo rm -rf edit

#Set an image name in extract-cd/README.diskdefines
#KVM VNC doesn't pass ctrl, can't use vim or nano
#Can probably use sed magic
sudo nano extract-cd/README.diskdefines

#Remove old md5sum.txt and calculate new md5 sums
cd extract-cd
sudo rm md5sum.txt
find -type f -print0 | sudo xargs -0 md5sum | grep -v isolinux/boot.cat | sudo tee md5sum.txt

#Create the ISO image
sudo mkisofs -D -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../osgeo-live-${version}-mini.iso .

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


changed la

changed la

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


Added install script

Added install script

#!/bin/sh
# install - install a program, script, or datafile

scriptversion=2006-12-25.00

# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# 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
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.

nl='
'
IFS=" ""    $nl"

# set DOITPROG to echo to test this script

# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
  doit_exec=exec
else
  doit_exec=$doit
fi

# Put in absolute file names if you don't have them in your path;
# or use environment vars.

chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}

posix_glob='?'
initialize_posix_glob='
  test "$posix_glob" != "?" || {
    if (set -f) 2>/dev/null; then
      posix_glob=
    else
      posix_glob=:
    fi
  }
'

posix_mkdir=

# Desired mode of installed file.
mode=0755

chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=

src=
dst=
dir_arg=
dst_arg=

copy_on_change=false
no_target_directory=

usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
   or: $0 [OPTION]... SRCFILES... DIRECTORY
   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
   or: $0 [OPTION]... -d DIRECTORIES...

In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.

Options:
     --help     display this help and exit.
     --version  display version info and exit.

  -c            (ignored)
  -C            install only if different (preserve the last data modification time)
  -d            create directories instead of installing files.
  -g GROUP      $chgrpprog installed files to GROUP.
  -m MODE       $chmodprog installed files to MODE.
  -o USER       $chownprog installed files to USER.
  -s            $stripprog installed files.
  -t DIRECTORY  install into DIRECTORY.
  -T            report an error if DSTFILE is a directory.

Environment variables override the default commands:
  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
  RMPROG STRIPPROG
"

while test $# -ne 0; do
  case $1 in
    -c) ;;

    -C) copy_on_change=true;;

    -d) dir_arg=true;;

    -g) chgrpcmd="$chgrpprog $2"
    shift;;

    --help) echo "$usage"; exit $?;;

    -m) mode=$2
    case $mode in
      *' '* | *'    '* | *'
'*    | *'*'* | *'?'* | *'['*)
        echo "$0: invalid mode: $mode" >&2
        exit 1;;
    esac
    shift;;

    -o) chowncmd="$chownprog $2"
    shift;;

    -s) stripcmd=$stripprog;;

    -t) dst_arg=$2
    shift;;

    -T) no_target_directory=true;;

    --version) echo "$0 $scriptversion"; exit $?;;

    --) shift
    break;;

    -*) echo "$0: invalid option: $1" >&2
    exit 1;;

    *)  break;;
  esac
  shift
done

if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
  # When -d is used, all remaining arguments are directories to create.
  # When -t is used, the destination is already specified.
  # Otherwise, the last argument is the destination.  Remove it from $@.
  for arg
  do
    if test -n "$dst_arg"; then
      # $@ is not empty: it contains at least $arg.
      set fnord "$@" "$dst_arg"
      shift # fnord
    fi
    shift # arg
    dst_arg=$arg
  done
fi

if test $# -eq 0; then
  if test -z "$dir_arg"; then
    echo "$0: no input file specified." >&2
    exit 1
  fi
  # It's OK to call `install-sh -d' without argument.
  # This can happen when creating conditional directories.
  exit 0
fi

if test -z "$dir_arg"; then
  trap '(exit $?); exit' 1 2 13 15

  # Set umask so as not to create temps with too-generous modes.
  # However, 'strip' requires both read and write access to temps.
  case $mode in
    # Optimize common cases.
    *644) cp_umask=133;;
    *755) cp_umask=22;;

    *[0-7])
      if test -z "$stripcmd"; then
    u_plus_rw=
      else
    u_plus_rw='% 200'
      fi
      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
    *)
      if test -z "$stripcmd"; then
    u_plus_rw=
      else
    u_plus_rw=,u+rw
      fi
      cp_umask=$mode$u_plus_rw;;
  esac
fi

for src
do
  # Protect names starting with `-'.
  case $src in
    -*) src=./$src;;
  esac

  if test -n "$dir_arg"; then
    dst=$src
    dstdir=$dst
    test -d "$dstdir"
    dstdir_status=$?
  else

    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
    # might cause directories to be created, which would be especially bad
    # if $src (and thus $dsttmp) contains '*'.
    if test ! -f "$src" && test ! -d "$src"; then
      echo "$0: $src does not exist." >&2
      exit 1
    fi

    if test -z "$dst_arg"; then
      echo "$0: no destination specified." >&2
      exit 1
    fi

    dst=$dst_arg
    # Protect names starting with `-'.
    case $dst in
      -*) dst=./$dst;;
    esac

    # If destination is a directory, append the input filename; won't work
    # if double slashes aren't ignored.
    if test -d "$dst"; then
      if test -n "$no_target_directory"; then
    echo "$0: $dst_arg: Is a directory" >&2
    exit 1
      fi
      dstdir=$dst
      dst=$dstdir/`basename "$src"`
      dstdir_status=0
    else
      # Prefer dirname, but fall back on a substitute if dirname fails.
      dstdir=`
    (dirname "$dst") 2>/dev/null ||
    expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
         X"$dst" : 'X\(//\)[^/]' \| \
         X"$dst" : 'X\(//\)$' \| \
         X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
    echo X"$dst" |
        sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
           s//\1/
           q
         }
         /^X\(\/\/\)[^/].*/{
           s//\1/
           q
         }
         /^X\(\/\/\)$/{
           s//\1/
           q
         }
         /^X\(\/\).*/{
           s//\1/
           q
         }
         s/.*/./; q'
      `

      test -d "$dstdir"
      dstdir_status=$?
    fi
  fi

  obsolete_mkdir_used=false

  if test $dstdir_status != 0; then
    case $posix_mkdir in
      '')
    # Create intermediate dirs using mode 755 as modified by the umask.
    # This is like FreeBSD 'install' as of 1997-10-28.
    umask=`umask`
    case $stripcmd.$umask in
      # Optimize common cases.
      *[2367][2367]) mkdir_umask=$umask;;
      .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;

      *[0-7])
        mkdir_umask=`expr $umask + 22 \
          - $umask % 100 % 40 + $umask % 20 \
          - $umask % 10 % 4 + $umask % 2
        `;;
      *) mkdir_umask=$umask,go-w;;
    esac

    # With -d, create the new directory with the user-specified mode.
    # Otherwise, rely on $mkdir_umask.
    if test -n "$dir_arg"; then
      mkdir_mode=-m$mode
    else
      mkdir_mode=
    fi

    posix_mkdir=false
    case $umask in
      *[123567][0-7][0-7])
        # POSIX mkdir -p sets u+wx bits regardless of umask, which
        # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
        ;;
      *)
        tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
        trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0

        if (umask $mkdir_umask &&
        exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
        then
          if test -z "$dir_arg" || {
           # Check for POSIX incompatibilities with -m.
           # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
           # other-writeable bit of parent directory when it shouldn't.
           # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
           ls_ld_tmpdir=`ls -ld "$tmpdir"`
           case $ls_ld_tmpdir in
             d????-?r-*) different_mode=700;;
             d????-?--*) different_mode=755;;
             *) false;;
           esac &&
           $mkdirprog -m$different_mode -p -- "$tmpdir" && {
             ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
             test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
           }
         }
          then posix_mkdir=:
          fi
          rmdir "$tmpdir/d" "$tmpdir"
        else
          # Remove any dirs left behind by ancient mkdir implementations.
          rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
        fi
        trap '' 0;;
    esac;;
    esac

    if
      $posix_mkdir && (
    umask $mkdir_umask &&
    $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
      )
    then :
    else

      # The umask is ridiculous, or mkdir does not conform to POSIX,
      # or it failed possibly due to a race condition.  Create the
      # directory the slow way, step by step, checking for races as we go.

      case $dstdir in
    /*) prefix='/';;
    -*) prefix='./';;
    *)  prefix='';;
      esac

      eval "$initialize_posix_glob"

      oIFS=$IFS
      IFS=/
      $posix_glob set -f
      set fnord $dstdir
      shift
      $posix_glob set +f
      IFS=$oIFS

      prefixes=

      for d
      do
    test -z "$d" && continue

    prefix=$prefix$d
    if test -d "$prefix"; then
      prefixes=
    else
      if $posix_mkdir; then
        (umask=$mkdir_umask &&
         $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
        # Don't fail if two instances are running concurrently.
        test -d "$prefix" || exit 1
      else
        case $prefix in
          *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
          *) qprefix=$prefix;;
        esac
        prefixes="$prefixes '$qprefix'"
      fi
    fi
    prefix=$prefix/
      done

      if test -n "$prefixes"; then
    # Don't fail if two instances are running concurrently.
    (umask $mkdir_umask &&
     eval "\$doit_exec \$mkdirprog $prefixes") ||
      test -d "$dstdir" || exit 1
    obsolete_mkdir_used=true
      fi
    fi
  fi

  if test -n "$dir_arg"; then
    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
  else

    # Make a couple of temp file names in the proper directory.
    dsttmp=$dstdir/_inst.$$_
    rmtmp=$dstdir/_rm.$$_

    # Trap to clean up those temp files at exit.
    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0

    # Copy the file name to the temp name.
    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&

    # and set any options; do chmod last to preserve setuid bits.
    #
    # If any of these fail, we abort the whole thing.  If we want to
    # ignore errors from any of these, just make sure not to ignore
    # errors from the above "$doit $cpprog $src $dsttmp" command.
    #
    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&

    # If -C, don't bother to copy if it wouldn't change the file.
    if $copy_on_change &&
       old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
       new=`LC_ALL=C ls -dlL "$dsttmp"  2>/dev/null` &&

       eval "$initialize_posix_glob" &&
       $posix_glob set -f &&
       set X $old && old=:$2:$4:$5:$6 &&
       set X $new && new=:$2:$4:$5:$6 &&
       $posix_glob set +f &&

       test "$old" = "$new" &&
       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
    then
      rm -f "$dsttmp"
    else
      # Rename the file to the real destination.
      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||

      # The rename failed, perhaps because mv can't rename something else
      # to itself, or perhaps because mv is so ancient that it does not
      # support -f.
      {
    # Now remove or move aside any old file at destination location.
    # We try this two ways since rm can't unlink itself on some
    # systems and the destination file might be busy for other
    # reasons.  In this case, the final cleanup might fail but the new
    # file should still install successfully.
    {
      test ! -f "$dst" ||
      $doit $rmcmd -f "$dst" 2>/dev/null ||
      { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
        { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
      } ||
      { echo "$0: cannot unlink or rename $dst" >&2
        (exit 1); exit 1
      }
    } &&

    # Now rename the file to the real destination.
    $doit $mvcmd "$dsttmp" "$dst"
      }
    fi || exit 1

    trap '' 0
  fi
done

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

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


removes config for filemanager plugin which is not currently 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/chrisanthropic/PlexInTheCloud.git/'


Add licenses validation script

Add licenses validation script

#!/usr/bin/env bash
#
# Manually add android licenses acceptance
# source: https://discuss.bitrise.io/t/android-sdk-license-issue/97/2
#

mkdir -p $ANDROID_HOME/licenses
echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > $ANDROID_HOME/licenses/android-sdk-license
echo "d56f5187479451eabf01fb78af6dfcb131a6481e" >> $ANDROID_HOME/licenses/android-sdk-license

error: pathspec 'add-android-licenses-validation.sh' did not match any file(s) known to git


Adds helper script to set up classpath.

Adds helper script to set up classpath.

#! /usr/bin/env bash
#
# run.sh: helps executing the examples by setting up the Java CLASSPATH.
#

MVN="mvn"
if [ "$MAVEN_HOME" != "" ]; then
  MVN=${MAVEN_HOME}/bin/mvn
fi

# CLASSPATH initially contains $HBASE_CONF_DIR
CLASSPATH="${HBASE_CONF_DIR}"

# Need to generate classpath from maven pom. This is costly so generate it
# and cache it. Save the file into our target dir so a mvn clean will get
# clean it up and force us create a new one.
cpfile="target/cached_classpath.txt"
if [ ! -f "${cpfile}" ]
then
  ${MVN} -f "../pom.xml" dependency:build-classpath -Dmdep.outputFile="${cpfile}" &> /dev/null
fi
CLASSPATH=${CLASSPATH}:`cat "${cpfile}"`

if [ -d "target/classes" ]; then
  CLASSPATH=${CLASSPATH}:target/classes
fi

JAVA=$JAVA_HOME/bin/java
JAVA_HEAP_MAX=-Xmx512m

"$JAVA" $JAVA_HEAP_MAX -classpath "$CLASSPATH" "$@"

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


increased maximum heap space

increased maximum heap space

git-svn-id: 6d8f726e13e44a55f7989a189ac88f9e603c9e4b@10908 41e0724e-84da-11df-b2d6-0f76b6d44b92

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/Deutsche-Digitale-Bibliothek/ddb-backend.git/'


Adding major revision of program

Adding major revision of program

Adding Extract_homologs2.sh to repo

#!/bin/bash

### PROGRAM VARIABLES ###
DIAMOND=`which diamond`
CDHIT=`which cd-hit`
SELECT_CONTIGS=`find ~ select_contigs.pl | egrep -m 1 "select_contigs.pl"`
#INTERPROSCAN=`which interproscan.sh`
#########################

### MANDATORY INPUT FILES ###
NAMING_TEMPLATE=`echo "NULL"`
HOMOLOG_TARGETS=`echo "NULL"`
DATABASE=`echo "NULL"`
#############################

### OPTIONAL ARGUMENTS ###
SEQUENCES=`pwd`
THREADS=`echo "1"`
KEEP_INTERMEDIATE=`echo "FALSE"`
OUTPUT_DIRECTORY=`echo "Extract_homologs_output"`
##########################

### FLAG ENTRY ###
while getopts ":d:kn:o:s:S:t:T:h" opt; do
	case $opt in
		d)
			DATABASE=$OPTARG
			;;
		k)
			KEEP_INTERMEDIATE=`echo "TRUE"`
			;;
		h)
			printf "\n\tUSAGE\n\n"
			printf "\t-d\tPath to diamond database file [MANDATORY]\n\n"
			printf "\t-h\tHelp information and USAGE\n\n"
			printf "\t-k\tKeep temporary files !WARNING: Disk-space intensive! [OPTIONAL]\n\n"
			printf "\t-n\tNaming template [MANDATORY]\n\n"
			printf "\t-o\tOutput directory name [OPTIONAL]\n\n"
			printf "\t-s\tDirectory containing peptide sequence files [OPTIONAL, DEFAULT = pwd]\n\n"
			printf "\t-S\tPath to select_contigs.pl [OPTIONAL, DEFAULT = pwd]\n\n"
			printf "\t-t\tNumber of threads [DEFAULT = 1]\n\n"
			printf "\t-T\tList of target SwissProt protein homologs [MANDATORY]\n\n"
			exit 1
			;;
		n)
			NAMING_TEMPLATE=$OPTARG
			;;
		o)
			OUTPUT_DIRECTORY=$OPTARG
			;;
		s)
			SEQUENCES=$OPTARG
			;;
		S)
			SELECT_CONTIGS=$OPTARG
			;;
		t)
			THREADS=$OPTARG
			;;
		T)
			HOMOLOG_TARGETS=$OPTARG
			;;
		\?)
			echo "Invalid option: -$OPTARG"
			exit 1
			;;
		:)
			echo "Option -$OPTARG requires an argument."
			exit 1
			;;
	esac
done
######################

### CHECKING FOR MANDATORY FLAGS ###
if [[ $DATABASE == "NULL" ]]; then
	printf  "\n\tPath to diamond database [-d] not entered [MANDATORY].\n"
	ERROR=`echo "TRUE"`
fi

if [[ $NAMING_TEMPLATE == "NULL" ]]; then
	printf "\n\tNaming template [-n] not entered [MANDATORY].\n"
	ERROR=`echo "TRUE"`
fi

if [[ $HOMOLOG_TARGETS == "NULL" ]]; then
	printf "\n\tList of target SwissProt protein homologs [-T] not entered [MANDATORY].\n"
	ERROR=`echo "TRUE"`
fi

if [[ $ERROR == "TRUE" ]]; then
	printf "\n\tProvide [-h] flag for USAGE\n"
	printf "\tExiting...\n\n"
	exit 1
fi

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

### CREATE THE WORKING DIRECTORY ###
mkdir $OUTPUT_DIRECTORY
cd $OUTPUT_DIRECTORY
DIRECTORY_PATH=`pwd` #ABSOLUTE PATH VERSION OF $OUTPUT_DIRECTORY
cd ..
mkdir $DIRECTORY_PATH/Putative_homologs #MAKE FINAL OUTPUT DIRECTORY
####################################

### RENAMING FUNCTION ###
function rename_header { #OUTPUTS A NEW FILE CALLED ${NEW_ID}_${GENE}.fasta
    #PARAMETERS: 1 = RENAMING FILE (INPUT $1 ABOVE), 2 = HOMOLOGUE NAME (LINE IN INPUT $2 ABOVE), 3 = HOMOLOGUE FASTA

        TEMPLATE=`echo ${1}` #RENAMING TEMPLATE
        GENE=`echo ${2}` #HOMOLOGUE TO BE RENAMED AS
        F=`echo ${3}` #FASTA FILE CONTAINING HOMOLOGOUS SEQUENCES

        NEW_ID=`grep "${ID}" ${TEMPLATE} | awk '{print $2}'` # $ID COMES FROM ID VARIABLE CREATED IN MAIN

        awk '/^>/{print ">NEW_ID_GENE_" ++i; next}{print}' < ${F} > $DIRECTORY_PATH/${NEW_ID}_${GENE}.fasta
        sed -i "/>/s/NEW_ID/${NEW_ID}/" $DIRECTORY_PATH/${NEW_ID}_${GENE}.fasta
        sed -i "/>/s/GENE/${GENE}/" $DIRECTORY_PATH/${NEW_ID}_${GENE}.fasta
}
#########################

### LOOP CHECKS RENAMING TEMPLATE FOR LINES WITHOUT A PAIRED OLD-NEW NAMES ###
while read NAME
do
        COLUMN_NUMBER=`echo "${NAME}" | wc -w`
        if [ "${COLUMN_NUMBER}" -ne 2 ]; then
                printf "\n\tRenaming template contains a line without a "old-new" name pair\n\tExiting...\n\n"
                exit 1
        fi
done < $NAMING_TEMPLATE
##############################################################################

### INITIATING THE SCRIPT LOG ###
TIME_i=`date | awk '{print $2, $3, $6, $4, $5}'` #FOR TRACKING PROGRESS OF SCRIPT
printf "\n####VARIABLE INPUT CHECK#### \n" > $DIRECTORY_PATH/SCRIPT_LOG.txt
printf "Database set as:\t$DATABASE\n"  >> $DIRECTORY_PATH/SCRIPT_LOG.txt
printf "Sequences found in:\t$SEQUENCES\n"  >> $DIRECTORY_PATH/SCRIPT_LOG.txt
printf "Output directory:\t$DIRECTORY_PATH\n" >> $DIRECTORY_PATH/SCRIPT_LOG.txt
printf "Diamond:\t\t$DIAMOND\n"  >> $DIRECTORY_PATH/SCRIPT_LOG.txt
printf "cd-hit:\t\t\t$CDHIT\n"  >> $DIRECTORY_PATH/SCRIPT_LOG.txt
printf "select_contigs.pl:\t$SELECT_CONTIGS\n"  >> $DIRECTORY_PATH/SCRIPT_LOG.txt
printf "interproscan.sh:\t$INTERPROSCAN\n"  >> $DIRECTORY_PATH/SCRIPT_LOG.txt
printf "Threads:\t\t$THREADS\n" >> $DIRECTORY_PATH/SCRIPT_LOG.txt
printf "############################\n"  >> $DIRECTORY_PATH/SCRIPT_LOG.txt
printf "\n${TIME_i} - Beginning analysis....\n" >> $DIRECTORY_PATH/SCRIPT_LOG.txt
#################################

### INITIAL CLUSTERING ###
for FILE in $SEQUENCES*fasta #BEGINS THE LOOP THROUGH ALL THE FILES IN THE SPECIFIED DATASET DIRECTORY
do
	PEPTIDE_FILE=`echo "${FILE}" | awk -F"/" '{print $2}'` #VARIABLE EXLCUDES THE PATH-TO-THE FILE WHICH IS INCLUDED IN THE $FILE VARIABLE
        ID=`echo "${PEPTIDE_FILE}" | awk -F "." '{print $1}'` #CREATE AN ID FOR EACH PEPTIDE FILE - CORRESPONDS TO COLUMN ONE IN INPUT 1

        TIME_i=`date | awk '{print $2, $3, $6, $4, $5}'` #FOR TRACKING PROGRESS OF SCRIPT
        echo "${TIME_i} - Processing ${ID}. Beginning clustering." >> $DIRECTORY_PATH/SCRIPT_LOG.txt

        sed '/>/s/ .*//' $FILE > $DIRECTORY_PATH/${PEPTIDE_FILE}.clean_headers #CLEAN HEADERS
        $CDHIT -i $DIRECTORY_PATH/${PEPTIDE_FILE}.clean_headers -o $DIRECTORY_PATH/${PEPTIDE_FILE}.clean_headers.cd-hit100 -c 1.00 #CLUSTER SEQUENCES BY 100% IDENTITY TO REMOVE FRAGMENTS OF LARGER PROTEINS

	FILE=`ls $DIRECTORY_PATH | egrep "${PEPTIDE_FILE}.clean_headers.cd-hit100$"` #CHANGES FILE VARIABLE TO THE CLUSTERED DATASET

	if [[ $KEEP_INTERMEDIATE == "FALSE" ]]; then
		rm -f $DIRECTORY_PATH/${PEPTIDE_FILE}.clean_headers.cd-hit100.clstr
                rm -f $DIRECTORY_PATH/${PEPTIDE_FILE}.clean_headers
        fi

	TIME_i=`date | awk '{print $2, $3, $6, $4, $5}'`
        echo "${TIME_i} - Querying ${ID} against SwissProt database with Diamond BLASTp." >> $DIRECTORY_PATH/SCRIPT_LOG.txt

# FILTER .PEP FILE BY PRIMARY SEQUENCE HOMOLOGY (BLAST); MUST CHANGE PATH TO SWISSPROT BLASTDB #

	${DIAMOND} blastp --db ${DATABASE} --query ${DIRECTORY_PATH}/${FILE} --outfmt 6 --out ${DIRECTORY_PATH}/${ID}.blastp_vs_swissprot.outfmt6 --threads ${THREADS} #BLAST QUERY FILE AGAINST SWISSPROT DATABASE"

        TIME_i=`date | awk '{print $2, $3, $6, $4, $5}'`
        echo "${TIME_i} - Finished blastp on ${ID}. Proceeding with Diamond Blastp output filtering" >> $OUTPUT_DIRECTORY/SCRIPT_LOG.txt

        sort -k1,1 -k11,11g $DIRECTORY_PATH/${ID}.blastp_vs_swissprot.outfmt6 | sort -u -k1,1 > $DIRECTORY_PATH/${ID}.besthit_vs_swissprot.outfmt6 #PULL BEST HITS FROM THE BLAST OUTPUT
        awk '{print $1, $2, $11}' $DIRECTORY_PATH/${ID}.besthit_vs_swissprot.outfmt6 > $DIRECTORY_PATH/${ID}.seq_hit_evalue.blast_out #REDUCE BLAST OUTPUT TO THREE COLUMNS - QUERY ID, SUBJECT ID, AND E-VALUE

	if [[ $KEEP_INTERMEDIATE == "FALSE" ]]; then
		rm -f $DIRECTORY_PATH/${ID}.blastp_vs_swissprot.outfmt6
	        rm -f $DIRECTORY_PATH/${ID}.besthit_vs_swissprot.outfmt6
	fi

# GO THROUGH THE LIST OF GENES OF INTEREST ($2) AND PULL PUTATIVE HOMOLOGUES AND RENAME FOR EACH SEQUENCE; MUST CHANGE PATH TO SELECT_CONTIGS.PL #

        TIME_i=`date | awk '{print $2, $3, $6, $4, $5}'`
        echo "${TIME_i} - Creating fasta file of homologues of interest for ${ID}" >> $DIRECTORY_PATH/SCRIPT_LOG.txt

        while read PROT #PARSE, LINE BY LINE, A LIST OF PROTEINS HOMOLOGUES
        do
                if [ "${PROT}" == "" ]; then
                        echo "Empty line skipped"
                        continue
                fi
		grep "|${PROT}" $DIRECTORY_PATH/${ID}.seq_hit_evalue.blast_out | awk '{print $1}' > $DIRECTORY_PATH/${ID}.${PROT}.tmp_before_renaming #PULL QUERY SEQ HEADERS WITH BEST HIT TO PROTEINS OF INTEREST

		if [[ ! -s $DIRECTORY_PATH/${ID}.${PROT}.tmp_before_renaming ]]; then #LOOP CHECKS FOR EMPTY FILES; IF FILE IS EMPTY, PRINT USEFUL INFORMATION TO LOG FILE AND ITERATE ENCLOSING LOOP
			echo "${TIME_i} - No best hits for $PROT in $ID" >> $DIRECTORY_PATH/SCRIPT_LOG.txt
			continue 1
		fi

		$SELECT_CONTIGS -n $DIRECTORY_PATH/${ID}.${PROT}.tmp_before_renaming $DIRECTORY_PATH/${FILE} $DIRECTORY_PATH/${ID}.${PROT}.fasta.to_be_renamed #PULL CORRESPONDING SEQUENCES FROM .PEP FILE

		if [[ $KEEP_INTERMEDIATE == "FALSE" ]]; then
			rm -f $DIRECTORY_PATH/${ID}.${PROT}.tmp_before_renaming #CLEAN-UP
       		fi

		rename_header ${NAMING_TEMPLATE} ${PROT} $DIRECTORY_PATH/${ID}.${PROT}.fasta.to_be_renamed #RENAME SEQUENCES AND FILE TO INDICATE PROTEIN HOMOLOGY; ALSO CREATES $NEW_ID VARIABLE

		if [[ $KEEP_INTERMEDIATE == "FALSE" ]]; then
			rm -f $DIRECTORY_PATH/${ID}.${PROT}.fasta.to_be_renamed #CLEAN-UP
		fi

	done < $HOMOLOG_TARGETS

	if [[ $KEEP_INTERMEDIATE == "FALSE" ]]; then
	        rm -f $DIRECTORY_PATH/${ID}.seq_hit_evalue.blast_out
	fi

# CONSOLIDATE HOMOLOGUE FILES INTO ONE PER TAXON #

        TIME_i=`date | awk '{print $2, $3, $6, $4, $5}'`
        echo "${TIME_i} - Renamed ${ID} to ${NEW_ID} and consolidating sequences" >> $DIRECTORY_PATH/SCRIPT_LOG.txt

        ls $DIRECTORY_PATH | grep "${NEW_ID}.*fasta$" > $DIRECTORY_PATH/${NEW_ID}_homologs.txt #ASSEMBLE A FILE CONTAINING THE FILE NAMES FOR ALL PROTEINS PULLED FROM PROTEIN DATASET IN BLOCK ABOVE

	while read HOMOLOG_OUTPUT_FILE
        do
                cat $DIRECTORY_PATH/$HOMOLOG_OUTPUT_FILE >> $DIRECTORY_PATH/Putative_homologs/${NEW_ID}_putative_homologs.fasta #CONSOLIDATE ALL PUTATIVE HOMOLOGS INTO ONE FILE PER TAXON
        done < $DIRECTORY_PATH/${NEW_ID}_homologs.txt

	NUMBER_OF_SEQUENCES=`grep -c '>' $DIRECTORY_PATH/Putative_homologs/${NEW_ID}_putative_homologs.fasta`
	echo "${TIME_i} - Identified $NUMBER_OF_SEQUENCES putative homologs in $NEW_ID" >> $DIRECTORY_PATH/SCRIPT_LOG.txt

	if [[ $KEEP_INTERMEDIATE == "FALSE" ]]; then
	        rm -f $DIRECTORY_PATH/${NEW_ID}*.fasta #CLEAN-UP
        	rm -f $DIRECTORY_PATH/${NEW_ID}_homologs.txt #CLEAN-UP
        	rm -f $DIRECTORY_PATH/${FILE}
		find $DIRECTORY_PATH -empty -delete
	fi
done

# NOW WORKING WITH A CONSOLIDATED ALL-TAXA DATASET #

TIME_i=`date | awk '{print $2, $3, $6, $4, $5}'`
echo "${TIME_i} - Finished processing all datasets. Consolidating and annotating with Interproscan." >> $DIRECTORY_PATH/SCRIPT_LOG.txt

cat $DIRECTORY_PATH/Putative_homologs/*.fasta >> $DIRECTORY_PATH/Putative_homologs/Putative_homologs_from_all_taxa.fasta #CONCATONATE ALL FASTA FILES INTO ONE

# FINAL BLAST FOR CONSISE PRIMARY SEQUENCE HOMOLOGY FOR TARGET HOMOLOGS #

${DIAMOND} blastp --db ${DATABASE} --query ${DIRECTORY_PATH}/Putative_homologs/Putative_homologs_from_all_taxa.fasta --outfmt 6 \
--out ${DIRECTORY_PATH}/Putative_homologs/Putative_homologs_from_all_taxa.blastp_vs_swissprot.outfmt6 --threads ${THREADS}
sort -k1,1 -k11,11g $DIRECTORY_PATH/Putative_homologs/Putative_homologs_from_all_taxa.blastp_vs_swissprot.outfmt6 | sort -u -k1,1 > $DIRECTORY_PATH/Putative_homologs/Putative_homologs_from_all_taxa.besthit_vs_swissprot.outfmt6 #PULL BEST HITS FROM THE BLAST OUTPUT

# ANNOTATED WITH INTERPROSCAN - PFAM AND SMART #

######## ASC SPECIFIC #####################################################
module purge						  ###################
source /opt/asn/etc/asn-bash-profiles-special/modules.sh  #####################
module load interproscan/5.26-65.0			  #######################
INTERPROSCAN=`which interproscan.sh`			  #########################
######## ASC SPECIFIC ###############################################################

mkdir $DIRECTORY_PATH/tmp #TMP DIRECTORY FOR INTERPRO TMP FILES
sed 's/*//g' $DIRECTORY_PATH/Putative_homologs/Putative_homologs_from_all_taxa.fasta > $DIRECTORY_PATH/Putative_homologs/Putative_homologs_from_all_taxa.interpro #INTERPRO REQUIRES NO "*", THIS STEP REMOVES THEM FROM THE FASTA FILE
$INTERPROSCAN -appl SMART -appl PfamA -cpu ${THREADS} -T $DIRECTORY_PATH/tmp -d $DIRECTORY_PATH/Putative_homologs/ -i $DIRECTORY_PATH/Putative_homologs/Putative_homologs_from_all_taxa.interpro
rmdir $DIRECTORY_PATH/tmp

# FINAL CLEANUP #
if [[ $KEEP_INTERMEDIATE == "FALSE" ]]; then
	rm -f Putative_homologs_from_all_taxa.interpro
	rm -f $DIRECTORY_PATH/$FILE
fi

TIME_i=`date | awk '{print $2, $3, $6, $4, $5}'`
echo "${TIME_i} - Completed pipeline. Good Job." >> $DIRECTORY_PATH/SCRIPT_LOG.txt

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


A comment

A comment

#!/bin/bash

set -e

BUNDLE_VERSION=0.1

# OS Check. Put here because here is where we download the precompiled
# bundles that are arch specific.
UNAME=$(uname)
if [ "$UNAME" != "Linux" -a "$UNAME" != "Darwin" ] ; then
  echo "Sorry, this OS is not supported."
  exit 1
fi

# import all the environment
source $(dirname $0)/common_env.sh

command -v java >/dev/null 2>&1 || {
  if [ ${UNAME} == "Linux" ] ; then
    echo "Please install a Java JDK before running this command.";
    echo "Directions can be found at: http://openjdk.java.net/install/"
    echo ""

    #DISTRO=`lsb_release --id --short 2>/dev/null` || DISTRO=""
    PROCESSOR=`uname --processor 2>/dev/null` || PROCESSOR=""
    HAS_YUM=`yum --version 2>/dev/null` || HAS_YUM=""
    HAS_APT_GET=`apt-get --help 2>/dev/null` || HAS_APT_GET=""

    if [[ "${HAS_APT_GET}" != "" ]] ; then
      echo "You can install the JDK using:"
      echo "  apt-get install openjdk-7-jdk"

      if [[ "${PROCESSOR}" == "x86_64" ]] ; then
        echo ""
        echo "You will also need some 32-bit libraries:"
        echo "  apt-get install lib32z1 lib32stdc++6"
      fi
    fi

    if [[ "${HAS_YUM}" != "" ]] ; then
      echo "You can install the JDK using:"
      echo "  yum install -y java-1.7.0-openjdk-devel"

      if [[ "${PROCESSOR}" == "x86_64" ]] ; then
        echo ""
        echo "You will also need some 32-bit libraries:"
        echo "  yum install -y glibc.i686 zlib.i686 libstdc++.i686 ncurses-libs.i686"
      fi
    fi

  else
    echo "The android platform needs a Java JDK to be installed on your system."
    # This effectively does this...
    # open "http://www.oracle.com/technetwork/java/javase/downloads/index.html"
    java -version
  fi

  exit 1;
}

cd "$ORIG_DIR"

if [ -z "$USE_GLOBAL_ADK" ] ; then
  # not using global ADK
  true
else
  # using global ADK, check all utilities
  set -e
  trap "echo One of the required utilities wasn't found in global PATH: java javac ant android" EXIT

  which java
  which javac
  which ant
  which android

  trap - EXIT
  set +e
  exit 0
fi

install_android_bundle () {
  echo "Going to install Android Bundle (300M-400M)."
  echo "This might take a while, please hold on."

  set -e
  trap "echo Failed to install dependency kit." EXIT

  TARBALL="android_bundle_${UNAME}_${BUNDLE_VERSION}.tar.gz"
  DEST_DIR=$(dirname "$ANDROID_BUNDLE")
  BUNDLE_TMPDIR="$DEST_DIR/android_bundle.xxx"

  rm -rf "$BUNDLE_TMPDIR"
  mkdir "$BUNDLE_TMPDIR"

  ANDROID_BUNDLE_URL_ROOT="http://s3.amazonaws.com/android-bundle/"

  if [ -f "$DEST_DIR/$TARBALL" ] ; then
      echo "Skipping download and installing kit from $DEST_DIR/$TARBALL" >&2
      tar -xzf "$DEST_DIR/$TARBALL" -C "$BUNDLE_TMPDIR"
  else
      curl "$ANDROID_BUNDLE_URL_ROOT$TARBALL" | tar -xzf - -C "$BUNDLE_TMPDIR"
  fi

  # Delete old dev bundle and rename the new one on top of it.
  rm -rf "$DEST_DIR/android_bundle"
  mv "$BUNDLE_TMPDIR" "$DEST_DIR/android_bundle"

  echo "Installed dependency kit v${BUNDLE_VERSION} in android_bundle." >&2
  echo >&2

  trap - EXIT
  set +e;
}

if [ ! -d "$ANDROID_BUNDLE" ] ; then
  install_android_bundle
elif [ ! -f "$ANDROID_BUNDLE/.bundle_version.txt" ] ||
  # we might need an android bundle version?
  grep -qvx "$BUNDLE_VERSION" "$ANDROID_BUNDLE/.bundle_version.txt" ; then
  install_android_bundle
fi

command -v javac >/dev/null 2>&1 || {
  echo >&2 "To add the android platform, please install a JDK. Here are some directions: http://openjdk.java.net/install/"; exit 1;
}

set_config () {
  KEY=$1
  VALUE=$2

  CONFIG_FILE=${ANDROID_BUNDLE}/meteor_avd/config.ini

  TEMP_FILE=`mktemp -t tmp.XXXXXXXXXX`
  grep -v "^${KEY}=" ${CONFIG_FILE} > ${TEMP_FILE}
  echo "${KEY}=${VALUE}" >> ${TEMP_FILE}
  mv -f ${TEMP_FILE} ${CONFIG_FILE}
}

install_x86 () {
    echo "Android x86 System image not found.  Found targets:"
    android list target
    echo "Downloading x86 system image..."
    echo y | android update sdk -t sys-img-x86-android-19 --all -u > /dev/null 2>&1
}

# create avd if necessary
if [[ ! $("${ANDROID_BUNDLE}/android-sdk/tools/android" list avd | grep Name) ]] ; then
  #ABI="default/armeabi-v7a"
  ABI="default/x86"

  (android list target | grep ABIs | grep default/x86 > /dev/null) || install_x86

  # XXX if this command fails, it would be really hard to debug or understand
  # for the end user. But the output is also very misleading. Later we should
  # save the output to a log file and tell user where to find it in case of
  # failure.
  echo "
" | "${ANDROID_BUNDLE}/android-sdk/tools/android" create avd --target 1 --name meteor --abi ${ABI} --path ${ANDROID_BUNDLE}/meteor_avd/ > /dev/null 2>&1

  # Nice keyboard support
  set_config "hw.keyboard" "yes"
  set_config "hw.mainKeys" "no"

  # More RAM than the default
  set_config "hw.ramSize" "1024"
  set_config "vm.heapSize" "64"

  # These are the settings for a Nexus 4, but it's a bit big for some screens
  #  (and likely a bit slow without GPU & KVM/HAXM acceleration)
  #set_config "skin.dynamic" "yes"
  #set_config "hw.lcd.density" "320"
  #set_config "hw.device.name" "Nexus 4"
  #set_config "hw.device.manufacturer" "Google"

  # XXX: hw.gpu.enabled=yes ?

fi

#!/bin/bash

set -e

BUNDLE_VERSION=0.1

# OS Check. Put here because here is where we download the precompiled
# bundles that are arch specific.
UNAME=$(uname)
if [ "$UNAME" != "Linux" -a "$UNAME" != "Darwin" ] ; then
  echo "Sorry, this OS is not supported."
  exit 1
fi

# import all the environment
source $(dirname $0)/common_env.sh

command -v java >/dev/null 2>&1 || {
  if [ ${UNAME} == "Linux" ] ; then
    echo "Please install a Java JDK before running this command.";
    echo "Directions can be found at: http://openjdk.java.net/install/"
    echo ""

    #DISTRO=`lsb_release --id --short 2>/dev/null` || DISTRO=""
    PROCESSOR=`uname --processor 2>/dev/null` || PROCESSOR=""
    HAS_YUM=`yum --version 2>/dev/null` || HAS_YUM=""
    HAS_APT_GET=`apt-get --help 2>/dev/null` || HAS_APT_GET=""

    if [[ "${HAS_APT_GET}" != "" ]] ; then
      echo "You can install the JDK using:"
      echo "  apt-get install openjdk-7-jdk"

      if [[ "${PROCESSOR}" == "x86_64" ]] ; then
        echo ""
        echo "You will also need some 32-bit libraries:"
        echo "  apt-get install lib32z1 lib32stdc++6"
      fi
    fi

    if [[ "${HAS_YUM}" != "" ]] ; then
      echo "You can install the JDK using:"
      echo "  yum install -y java-1.7.0-openjdk-devel"

      if [[ "${PROCESSOR}" == "x86_64" ]] ; then
        echo ""
        echo "You will also need some 32-bit libraries:"
        echo "  yum install -y glibc.i686 zlib.i686 libstdc++.i686 ncurses-libs.i686"
      fi
    fi

  else
    echo "The android platform needs a Java JDK to be installed on your system."
    # This effectively does this...
    # open "http://www.oracle.com/technetwork/java/javase/downloads/index.html"
    java -version
  fi

  exit 1;
}

cd "$ORIG_DIR"

if [ -z "$USE_GLOBAL_ADK" ] ; then
  # not using global ADK
  true
else
  # using global ADK, check all utilities
  set -e
  trap "echo One of the required utilities wasn't found in global PATH: java javac ant android" EXIT

  which java
  which javac
  which ant
  which android

  trap - EXIT
  set +e
  exit 0
fi

install_android_bundle () {
  echo "Going to install Android Bundle (300M-400M)."
  echo "This might take a while, please hold on."

  set -e
  trap "echo Failed to install dependency kit." EXIT

  TARBALL="android_bundle_${UNAME}_${BUNDLE_VERSION}.tar.gz"
  DEST_DIR=$(dirname "$ANDROID_BUNDLE")
  BUNDLE_TMPDIR="$DEST_DIR/android_bundle.xxx"

  rm -rf "$BUNDLE_TMPDIR"
  mkdir "$BUNDLE_TMPDIR"

  ANDROID_BUNDLE_URL_ROOT="http://s3.amazonaws.com/android-bundle/"

  if [ -f "$DEST_DIR/$TARBALL" ] ; then
      echo "Skipping download and installing kit from $DEST_DIR/$TARBALL" >&2
      tar -xzf "$DEST_DIR/$TARBALL" -C "$BUNDLE_TMPDIR"
  else
      curl "$ANDROID_BUNDLE_URL_ROOT$TARBALL" | tar -xzf - -C "$BUNDLE_TMPDIR"
  fi

  # Delete old dev bundle and rename the new one on top of it.
  rm -rf "$DEST_DIR/android_bundle"
  mv "$BUNDLE_TMPDIR" "$DEST_DIR/android_bundle"

  echo "Installed dependency kit v${BUNDLE_VERSION} in android_bundle." >&2
  echo >&2

  trap - EXIT
  set +e;
}

if [ ! -d "$ANDROID_BUNDLE" ] ; then
  install_android_bundle
elif [ ! -f "$ANDROID_BUNDLE/.bundle_version.txt" ] ||
  # we might need an android bundle version?
  grep -qvx "$BUNDLE_VERSION" "$ANDROID_BUNDLE/.bundle_version.txt" ; then
  install_android_bundle
fi

command -v javac >/dev/null 2>&1 || {
  echo >&2 "To add the android platform, please install a JDK. Here are some directions: http://openjdk.java.net/install/"; exit 1;
}

set_config () {
  KEY=$1
  VALUE=$2

  CONFIG_FILE=${ANDROID_BUNDLE}/meteor_avd/config.ini

  TEMP_FILE=`mktemp -t tmp.XXXXXXXXXX`
  grep -v "^${KEY}=" ${CONFIG_FILE} > ${TEMP_FILE}
  echo "${KEY}=${VALUE}" >> ${TEMP_FILE}
  mv -f ${TEMP_FILE} ${CONFIG_FILE}
}

install_x86 () {
    echo "Android x86 System image not found.  Found targets:"
    android list target
    echo "Downloading x86 system image..."
    echo y | android update sdk -t sys-img-x86-android-19 --all -u > /dev/null 2>&1
}

# create avd if necessary
if [[ ! $("${ANDROID_BUNDLE}/android-sdk/tools/android" list avd | grep Name) ]] ; then
  #ABI="default/armeabi-v7a"
  ABI="default/x86"

  (android list target | grep ABIs | grep default/x86 > /dev/null) || install_x86

  echo "
" | "${ANDROID_BUNDLE}/android-sdk/tools/android" create avd --target 1 --name meteor --abi ${ABI} --path ${ANDROID_BUNDLE}/meteor_avd/ > /dev/null 2>&1

  # Nice keyboard support
  set_config "hw.keyboard" "yes"
  set_config "hw.mainKeys" "no"

  # More RAM than the default
  set_config "hw.ramSize" "1024"
  set_config "vm.heapSize" "64"

  # These are the settings for a Nexus 4, but it's a bit big for some screens
  #  (and likely a bit slow without GPU & KVM/HAXM acceleration)
  #set_config "skin.dynamic" "yes"
  #set_config "hw.lcd.density" "320"
  #set_config "hw.device.name" "Nexus 4"
  #set_config "hw.device.manufacturer" "Google"

  # XXX: hw.gpu.enabled=yes ?

fi


Remove aswrap.sh Python version is far better atm, and this... Well, this things looks like shit.

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/mradermaxlol/aswrapper.git/'


Use pipes for compiling

Use pipes for compiling

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/Kittyhacker101-Software/KatOS.git/'


Added Export to AWS

Added Export to AWS

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/tomprats/backup.git/'


Update check_m1000e.sh

Update check_m1000e.sh

Overhaul a few strings

#!/bin/bash
#
# ============================== SUMMARY =====================================
#
# Program : check_m1000e.sh
# Version : 0.1
# Date    : March 14 2014
# Author  : Dirk Doerflinger - dirk(at)doerflinger(dot)org
# Summary : This is a nagios plugin that checks the status M1000e blade chassis
#           using DELL racadm
#
# Licence : MIT
#
# =========================== PROGRAM LICENSE =================================
#
# Copyright (C) 2014 Dirk Doerflinger
#
# 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.
#
# ===================== INFORMATION ABOUT THIS PLUGIN =========================
#
# This plugin checks the status of fans, ambient temperature and power supplies
# of DELL blade enclosures with the type M1000E using racadm
# It will return OK, WARNING, ERROR or UNKNOWN together with the correspondig
# exit code 0, 1, 2, 3 in case of error.
# Fans are monitored if they provide an error state through racadm and also
# by calculating a percentage of actual RPMs vs. maximal RPMs defined by -w
# and -c parameters. Performance data consists of actual RPMs of each fan
# Ambient temperature is monitored if there is an error state through racadm and
# by comparing the actual value to given -w and -c parameters
# Power ist just checked if there is an error state as racadm doesn't return
# any actual performance data.
# There is a plugin called check_dell_bladechassis.pl by Trond H. Amundsen
# <t.h.amundsen@usit.uio.no> which uses SNMP to gain different values.
#
# This program is written and maintained by:
#   Dirk Doerflinger - dirk(at)doerflinger(dot)org
#
# ============================= SETUP NOTES ====================================
#
# Copy this file to your Nagios plugin folder, e.g. /usr/lib64/nagios/plugins/.
# Make sure it is executable for the nagios user
#
# You must have Dell OpenManage installed on the nagios server There must be a
# user on the CMC with at least guest status in order
# to query data
#
# ./check_m1000e.sh -H <host> -u <username> -p <password> -s <sensor>
#
# Where <sensor> is "fan", "pwr" or "temp"
#
# ========================= SETUP EXAMPLES ==================================
#
# define command{
#       command_name    check_m1000e
#       command_line    $USER1$/check_m1000e.sh -H $HOSTADDRESS$ -s $ARG1$ -u $ARG2$ -p $ARG3$ -w $ARG4$ -c $ARG5$
#       }
#
# define service{
#       use                     generic-service
#       host_name               DELL-SERVER-00
#       service_description     Dell M1000e fans
#       check_command           check_m1000e!fan!monitoruser!monitorpass!90!95
#       normal_check_interval   3
#       retry_check_interval    1
#       }
#
# define service{
#       use                     generic-service
#       host_name               DELL-SERVER-01
#       service_description     Dell M1000e temperature
#       check_command           check_m1000e!temp!monitoruser!monitorpass!30!35
#       normal_check_interval   3
#       retry_check_interval    1
#       }
#
# ================================ REVISION ==================================
#
# 0.1 Initial release
#
# ============================================================================
package=check_m1000e

# Path to racadm binary
racadm=/opt/dell/srvadmin/sbin/racadm

# default values for warnings and critical
warning=90
critical=95
warningtemp=25
criticaltemp=30

# initialize an exit code
exitcode=0

# parse parameters
while test $# -gt 0; do
    case "$1" in
        -h|--help)
            echo "$package - Check M1000e Rack health"
            echo " "
            echo "Needs racadm!"
            echo "Fans and temperature can get performance data, Power doesn't. Temp provides ambient temperature only."
            echo " "
            echo "ATTN: if run on a system which os not a physical DELL machine, line 12 in $racadm needs to be fixed, use a static SYSID_HEX, like 0x04DB"
            echo " "
            echo "$package -H [hostname] -s [fan|pwr|temp] [options]"
            echo " "
            echo "options:"
            echo "-h, --help                show brief help"
            echo "-H, --hostname            Host to check"
            echo "-u, --username            Username for racadm"
            echo "-p, --password            Password for racadm"
            echo "-s, --sensor              Sensor: fan, pwr, temp"
            echo "-w, --warning             Warning level for fan speed in percent. Default: $warning"
	    echo "-                         Warning level for temperature in °C. Default: $warning"
            echo "-c, --critical            Crtitical level for fan speed in percent. Default: $critical"
	    echo "                          Crtitical level for temperature in °C. Default: $critical"
            echo "-m, --maxtemp             Temp: Critical alert on maximum ambient temperature. Default: $maxtemp"
            exit 0
            ;;
        -H|--hostname)
            shift
            if test $# -gt 0; then
		export host=$1
            else
                echo "No hostname specified"
                exit 1
            fi
            shift
            ;;
        -u|--username)
            shift
            if test $# -gt 0; then
                export username=$1
            else
                echo "no username specified"
                exit 1
            fi
            shift
            ;;
        -p|--password)
            shift
            if test $# -gt 0; then
                export password=$1
            else
                echo "no password specified"
                exit 1
            fi
            shift
            ;;
        -w|--warning)
            shift
            if test $# -gt 0; then
                export warning=$1
                export warningtemp=$1
            else
                echo "no warning level specified, defaulting to $warning"
            fi
            shift
            ;;
        -c|--critical)
            shift
            if test $# -gt 0; then
                export critical=$1
                export criticaltemp=$1
            else
                echo "no critical level specified, defaulting to $critical"
            fi
            shift
            ;;
        -s|--sensor)
            shift
            if test $# -gt 0; then
                export sensor=$1
            else
                echo "no sensor specified"
                exit 1
            fi
            shift
            ;;
    esac
done

# make sure we have a hostname and a sensor type
if [[ -z "$host" ]]; then
    echo "UNKNOWN - hostname missing!"
    exit 3
fi
if [[ -z "$sensor" ]]; then
    echo "UNKNOWN - sensor missing"
    exit 3
fi

# Get data from racadm
# Output of racadm: FanSpeed
# senType Num sensorname status reading units lc uc
# Output of racadm: Temp
# senType Num sensorname status reading units lc uc
# Output of racadm: PWR
# senType Num sensorname status health

case $sensor in
fan)
	result=$( $racadm -r $host -u $username -p $password getsensorinfo 2>&1| grep FanSpeed | awk '{print $2","$4","$5","$8"|"}')
	;;
temp)
	result=$( $racadm -r $host -u $username -p $password getsensorinfo | grep Temp | awk '{print $2","$4","$5","$8"|"}')
	;;
pwr)
	result=$( $racadm -r $host -u $username -p $password getsensorinfo | grep PWR | awk '{print $2","$5",-1|"}')
	;;
esac

# Make sure we have a result. If we don't that usually means that the connection failed, e.g. wrom hostname or credentials
if [[ -z $result ]]; then
    echo "CRITICAL - No data, maybe no connection to $host"
    exit 2
fi

# Customize the Internal Field Separator to easily split
IFS="|"

# get data, make sure to remove all non printable chars
for i in $result; do
    case $sensor in
	fan)
	   #fan: compare rpms. Ratio results in compariosn between reading and uc
	    reading=$(echo $i|awk -F',' '{print $3 }' |tr -d '\001'-'\011''\013''\014''\016'-'\037''\200'-'\377'' ''\n')
	    max=$(echo $i|awk -F',' '{print $4 }' |tr -d '\001'-'\011''\013''\014''\016'-'\037''\200'-'\377'' ''\n')
	    ratio=$(echo "$reading $max" | awk '{printf "%.2f \n", ($1/$2)*100}')
	    if [ ${ratio/\.*} -gt $warning ]; then
		# Fan speed ratio above warn level
		exitcode=1
	    fi
	    if [ ${ratio/\.*} -gt $critical ]; then
		# Fan speed ratio above critical level!
		exitcode=2
	    fi
	    ;;
	temp)
	    #temp: compare to $maxtemp
	    reading=$(echo $i|awk -F',' '{print $3 }' |tr -d '\001'-'\011''\013''\014''\016'-'\037''\200'-'\377'' ''\n')
	    if [ $reading -gt $warningtemp ]; then
		exitcode=1
	    fi
	    if [ $reading -gt $criticaltemp ]; then
		exitcode=2
	    fi
	    ;;
    esac
    #check if we got anything else but 'OK'
    ok=$(echo $i | awk -F',' '{print $2 }' |tr -d '\001'-'\011''\013''\014''\016'-'\037''\200'-'\377'' ''\n')
    if [[ $ok != OK ]]; then
	# some error
	exitcode=2
    fi
    # create performance data
    no=$(echo $i | awk -F',' '{print $1}'|tr -d '\001'-'\011''\013''\014''\016'-'\037''\200'-'\377'' ''\n')
    val=$(echo $i | awk -F',' '{print $3}'|tr -d '\001'-'\011''\013''\014''\016'-'\037''\200'-'\377'' ''\n')
    perfdata=$(echo $perfdata$sensor$no'='$val', ')
    if [ $sensor = 'pwr' ]; then
	# Disable perfdata for power, no values
	perfdata=""
    fi
done

unset IFS

case $exitcode in
    0)
	echo "OK - Chassis Health| $perfdata"
	exit 0
	;;

    1)
	echo "WARNING - Chassis Health| $perfdata"
	exit 1
	;;

    2)
	echo "CRTITICAL - Health | $perfdata"
	exit 2
	;;
    *)
	echo "UNKNOWN - Weird health data"
	exit 3
	;;
esac

#EOF

#!/bin/bash
#
# ============================== SUMMARY =====================================
#
# Program : check_m1000e.sh
# Version : 0.1
# Date    : March 14 2014
# Author  : Dirk Doerflinger - dirk(at)doerflinger(dot)org
# Summary : This is a nagios plugin that checks the status M1000e blade chassis
#           using DELL racadm
#
# Licence : MIT
#
# =========================== PROGRAM LICENSE =================================
#
# Copyright (C) 2014 Dirk Doerflinger
#
# 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.
#
# ===================== INFORMATION ABOUT THIS PLUGIN =========================
#
# This plugin checks the status of fans, ambient temperature and power supplies
# of DELL blade enclosures with the type M1000E using racadm
# It will return OK, WARNING, ERROR or UNKNOWN together with the correspondig
# exit code 0, 1, 2, 3 in case of error.
# Fans are monitored if they provide an error state through racadm and also
# by calculating a percentage of actual RPMs vs. maximal RPMs defined by -w
# and -c parameters. Performance data consists of actual RPMs of each fan
# Ambient temperature is monitored if there is an error state through racadm and
# by comparing the actual value to given -w and -c parameters
# Power ist just checked if there is an error state as racadm doesn't return
# any actual performance data.
# There is a plugin called check_dell_bladechassis.pl by Trond H. Amundsen
# <t.h.amundsen@usit.uio.no> which uses SNMP to gain different values.
#
# This program is written and maintained by:
#   Dirk Doerflinger - dirk(at)doerflinger(dot)org
#
# ============================= SETUP NOTES ====================================
#
# Copy this file to your Nagios plugin folder, e.g. /usr/lib64/nagios/plugins/.
# Make sure it is executable for the nagios user
#
# You must have Dell OpenManage installed on the nagios server There must be a
# user on the CMC with at least guest status in order
# to query data
#
# ./check_m1000e.sh -H <host> -u <username> -p <password> -s <sensor>
#
# Where <sensor> is "fan", "pwr" or "temp"
#
# ========================= SETUP EXAMPLES ==================================
#
# define command{
#       command_name    check_m1000e
#       command_line    $USER1$/check_m1000e.sh -H $HOSTADDRESS$ -s $ARG1$ -u $ARG2$ -p $ARG3$ -w $ARG4$ -c $ARG5$
#       }
#
# define service{
#       use                     generic-service
#       host_name               DELL-SERVER-00
#       service_description     Dell M1000e fans
#       check_command           check_m1000e!fan!monitoruser!monitorpass!90!95
#       normal_check_interval   3
#       retry_check_interval    1
#       }
#
# define service{
#       use                     generic-service
#       host_name               DELL-SERVER-01
#       service_description     Dell M1000e temperature
#       check_command           check_m1000e!temp!monitoruser!monitorpass!30!35
#       normal_check_interval   3
#       retry_check_interval    1
#       }
#
# ================================ REVISION ==================================
#
# 0.1 Initial release
#
# ============================================================================
package=check_m1000e

# Path to racadm binary
racadm=/opt/dell/srvadmin/sbin/racadm

# default values for warnings and critical
warning=90
critical=95
warningtemp=25
criticaltemp=30

# initialize an exit code
exitcode=0

# parse parameters
while test $# -gt 0; do
    case "$1" in
        -h|--help)
            echo "$package - Check M1000e Rack health"
            echo " "
            echo "Needs racadm!"
            echo "Fans and temperature can get performance data, Power doesn't. Temp provides ambient temperature only."
            echo " "
            echo "ATTN: if run on a system which os not a physical DELL machine, line 12 in $racadm needs to be fixed, use a static SYSID_HEX, like 0x04DB"
            echo " "
            echo "$package -H [hostname] -s [fan|pwr|temp] [options]"
            echo " "
            echo "options:"
            echo "-h, --help                show brief help"
            echo "-H, --hostname            Host to check"
            echo "-u, --username            Username for racadm"
            echo "-p, --password            Password for racadm"
            echo "-s, --sensor              Sensor: fan, pwr, temp"
            echo "-w, --warning             Warning level for fan speed in percent. Default: $warning"
	    echo "-                         Warning level for temperature in °C. Default: $warning"
            echo "-c, --critical            Crtitical level for fan speed in percent. Default: $critical"
	    echo "                          Crtitical level for temperature in °C. Default: $critical"
            echo "-m, --maxtemp             Temp: Critical alert on maximum ambient temperature. Default: $maxtemp"
            exit 0
            ;;
        -H|--hostname)
            shift
            if test $# -gt 0; then
		export host=$1
            else
                echo "No hostname specified"
                exit 1
            fi
            shift
            ;;
        -u|--username)
            shift
            if test $# -gt 0; then
                export username=$1
            else
                echo "no username specified"
                exit 1
            fi
            shift
            ;;
        -p|--password)
            shift
            if test $# -gt 0; then
                export password=$1
            else
                echo "no password specified"
                exit 1
            fi
            shift
            ;;
        -w|--warning)
            shift
            if test $# -gt 0; then
                export warning=$1
                export warningtemp=$1
            else
                echo "no warning level specified, defaulting to $warning"
            fi
            shift
            ;;
        -c|--critical)
            shift
            if test $# -gt 0; then
                export critical=$1
                export criticaltemp=$1
            else
                echo "no critical level specified, defaulting to $critical"
            fi
            shift
            ;;
        -s|--sensor)
            shift
            if test $# -gt 0; then
                export sensor=$1
            else
                echo "no sensor specified"
                exit 1
            fi
            shift
            ;;
    esac
done

# make sure we have a hostname and a sensor type
if [[ -z "$host" ]]; then
    echo "hostname has not been given"
    exit 1
fi
if [[ -z "$sensor" ]]; then
    echo "sensor has not been given"
    exit 1
fi

# Get data from racadm
# Output of racadm: FanSpeed
# senType Num sensorname status reading units lc uc
# Output of racadm: Temp
# senType Num sensorname status reading units lc uc
# Output of racadm: PWR
# senType Num sensorname status health

case $sensor in
fan)
	result=$( $racadm -r $host -u $username -p $password getsensorinfo 2>&1| grep FanSpeed | awk '{print $2","$4","$5","$8"|"}')
	;;
temp)
	result=$( $racadm -r $host -u $username -p $password getsensorinfo | grep Temp | awk '{print $2","$4","$5","$8"|"}')
	;;
pwr)
	result=$( $racadm -r $host -u $username -p $password getsensorinfo | grep PWR | awk '{print $2","$5",-1|"}')
	;;
esac

# Make sure we have a result. If we don't that usually means that the connection failed, e.g. wrom hostname or credentials
if [[ -z $result ]]; then
    echo "CRITICAL - No data, maybe no connection to $host"
    exit 2
fi

# Customize the Internal Field Separator to easily split
IFS="|"

# get data, make sure to remove all non printable chars
for i in $result; do
    case $sensor in
	fan)
	   #fan: compare rpms. Ratio results in compariosn between reading and uc
	    reading=$(echo $i|awk -F',' '{print $3 }' |tr -d '\001'-'\011''\013''\014''\016'-'\037''\200'-'\377'' ''\n')
	    max=$(echo $i|awk -F',' '{print $4 }' |tr -d '\001'-'\011''\013''\014''\016'-'\037''\200'-'\377'' ''\n')
	    ratio=$(echo "$reading $max" | awk '{printf "%.2f \n", ($1/$2)*100}')
	    if [ ${ratio/\.*} -gt $warning ]; then
		# Fan speed ratio above warn level
		exitcode=1
	    fi
	    if [ ${ratio/\.*} -gt $critical ]; then
		# Fan speed ratio above critical level!
		exitcode=2
	    fi
	    ;;
	temp)
	    #temp: compare to $maxtemp
	    reading=$(echo $i|awk -F',' '{print $3 }' |tr -d '\001'-'\011''\013''\014''\016'-'\037''\200'-'\377'' ''\n')
	    if [ $reading -gt $warningtemp ]; then
		exitcode=1
	    fi
	    if [ $reading -gt $criticaltemp ]; then
		exitcode=2
	    fi
	    ;;
    esac
    #check if we got anything else but 'OK'
    ok=$(echo $i | awk -F',' '{print $2 }' |tr -d '\001'-'\011''\013''\014''\016'-'\037''\200'-'\377'' ''\n')
    if [[ $ok != OK ]]; then
	# some error
	exitcode=2
    fi
    # create performance data
    no=$(echo $i | awk -F',' '{print $1}'|tr -d '\001'-'\011''\013''\014''\016'-'\037''\200'-'\377'' ''\n')
    val=$(echo $i | awk -F',' '{print $3}'|tr -d '\001'-'\011''\013''\014''\016'-'\037''\200'-'\377'' ''\n')
    perfdata=$(echo $perfdata$sensor$no'='$val', ')
    if [ $sensor = 'pwr' ]; then
	# Disable perfdata for power, no values
	perfdata=""
    fi
done

unset IFS

case $exitcode in
    0)
	echo "OK - Chassis Health| $perfdata"
	exit 0
	;;

    1)
	echo "WARNING - Chassis Health| $perfdata"
	exit 1
	;;

    2)
	echo "CRTITICAL - Health | $perfdata"
	exit 2
	;;
    *)
	echo "UNKNOWN - Weird health data"
	exit 3
	;;
esac

#EOF


Stop after writing the status file unless there is an email address to send the graph to

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/B-LUC/AdminTools.git/'


By default send email every 8 hours, i.e. at midnight, 8am and 4pm


Corrected description in header

Corrected description in header

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/B-LUC/logstash-rule-webui.git/'


dont delete in rsync

dont delete in rsync

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/sleepbusorg/sleepbus.org.git/'


Tag last good build

Tag last good build

#!/bin/bash

# Error on 1'st failure
set -e

tag=last-green-build
revision=$(git rev-parse HEAD)

echo "Tagging $commit as $tag"
git tag -f $tag $commit
git pull origin master
git push --tags origin master

error: pathspec 'tag-ok-build.sh' did not match any file(s) known to git


Add problems

Add problems

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/codefury/psets.git/'


Added: server pid, reload if running

Added: server pid, reload if running

# === {{CMD}} start
# === {{CMD}} pid    # prints pid number. Exits 1 if no pid found.
# === {{CMD}} reload
# === {{CMD}} quit   # (graceful shutdown)
server () {
  local CONF="$PWD/config/nginx.conf"
  local CMD="nginx/sbin/nginx -c "$CONF""
  case "$1" in
    start)
      $CMD -t

      if ! $0 server pid >/dev/null; then
        $CMD
        return 0
      fi

      bash_setup BOLD "=== Restarting {{NGINX}}"
      server reload
      ;;

    pid)
      found=""
      while read FILE; do
        cat "$FILE"
        found="yes"
      done < <(find nginx -type f -iname "*.pid" ! -size 0)

      if [[ -z "$found" ]]; then
        exit 1
      fi
      ;;

    reload)
      $CMD  -s reload
      ;;

    quit)
      $CMD  -s quit
      ;;

    *)
      bash_setup RED "!!! Unknown server command: {{$@}}"
      exit 1
  esac
} # === end function

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


script to get a sorted list of all shard SHAs from PHYLESYSTEM_ROOT

#!/bin/sh
if test -z $PHYLESYSTEM_ROOT
then
    echo PHYLESYSTEM_ROOT must be set
    exit 1
fi
cd "${PHYLESYSTEM_ROOT}" || exit
TMPF="/tmp/shard-shas.tmp"
rm -f "${TMPF}"
for f in $(ls -d shards/phylesystem-*)
do
    cd $f || exit
    git rev-parse HEAD >> "${TMPF}"
    cd - >/dev/null 2>&1
done
cat "${TMPF}" | sort
rm "${TMPF}"

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


はてブクローラー。記事名とURL抽出まで作成

はてブクローラー。記事名とURL抽出まで作成

#!/bin/bash
################################
# Author: Rum Coke
# Data  : 2015/04/19
# Ver   : 0.9
################################

##################
# Web Croller
##################

# Web Page Crolling.
function WebCroller()
{
	# Web Page Download.
	wget -q ${URL} -O ${FILE}

	# Web Page Analyze
	HtmlAnalyze

	# Diff Check
	#HtmlDiffCheck
}

# Hatebu News Page Analyze
function HtmlAnalyze()
{
	# Old News Page Moving
	mv ${FILE_TEMP_NEW} ${FILE_TEMP_OLD}

	# Convert to News Title and URL
	grep 'class="hb-entry-link-container"' hatebu-it.html \
	| awk -Fdata-entryrank=\" {'print $1}' \
	| awk -Fclass=\"entry-link\" '{print $2 $1 }' \
	| sed -E 's/[[:space:]]+title="//g' \
	| sed -E 's/\"[[:space:]]+<h3.*href="/ /g' \
	| sed -e 's/\" $//g' \
	> ${FILE_TEMP_NEW}
}

# Hatebu News Page Diff Check
#function HtmlDiffCheck()
#{
	# Diff Check
#}

##################
# Main Function
##################
# Path Setting
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# Target URL.
URL='http://b.hatena.ne.jp/hotentry/it'

# Temp Files.
FILE='/tmp/hatebu-it.html'
FILE_TEMP_NEW='/tmp/hatebu.html.new'
FILE_TEMP_OLD='/tmp/hatebu.html.old'

# WebCroll.
WebCroller

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


1) config update

1) config update

#!/bin/bash
#
# Copyright 2016-09 brett.chaldecott@gmail.com
#
# 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.
#
#
# Responsible for LXD config setup
#

# this function is called to register servers
function lxd_config_register_servers {
	local servers=${yml_lstack_servers_names[@]}
	if [ -z "${servers[@]}" ] ; then
		echo_std_out "Must provide the lstack_server_names configuration"
		exit -1
	fi
	local password=${yml_lstack_lxd_password[0]:-}
	if [ -z "${password}" ] ; then
		echo_std_out "Must provide the password"
		exit -1
	fi

	# configure lxd to expose the management port and set the password
	for lxd_config_register_server in ${servers[@]} ; do
		local server_name=`lxd_config_get_server_name "${lxd_config_register_server}"`
		if [ ! $? ] ; then
			echo_std_out "Failed to retrieve the server name for ${lxd_config_register_server}"
			continue
		fi
		# set the port
		cli_execute_command "${server_name}" "sudo lxc config set core.https_address [::]"
		# set the password
		cli_execute_command "${server_name}" "sudo lxc config set core.trust_password \"${password}\""
	done

	# register the servers so the interconnects work between them
	for lxd_config_register_server in ${servers[@]} ; do
		local server_name=`lxd_config_get_server_name "${lxd_config_register_server}"`
		if [ ! $? ] ; then
			echo_std_out "Failed to retrieve the server name for ${lxd_config_register_server}"
			continue
		fi
		# loop through the target servers for the management server
		local targets_servers=(${yml_lstack_servers_names[@]})
		for lxd_config_target_server in ${targets_servers[@]} ; do
			if [ "${lxd_config_register_server}" == "${lxd_config_target_server}" ] ; then
				continue
			fi
			# retrieve the target ip addresses
			eval "declare -a lxd_config_target_server_ip=(`get_yaml_config_var servers "${lxd_config_target_server}" ip`)"
			if [ ! $? ] ; then
				echo_std_out "Failed to retrieve the ip for ${lxd_config_target_server}"
				continue
			fi

			# add the remote server
			cli_execute_command "${server_name}" "sudo lxc remote add ${lxd_config_target_server} ${lxd_config_target_server_ip} --accept-certificate --password=\"${password}\""
		done
	done
}

# this function will clear all the profiles on the network
function lxd_config_de_register_servers {
	local servers=${yml_lstack_servers_names[@]}
	if [ -z "${servers[@]}" ] ; then
		echo_std_out "Must provide the lstack_server_names configuration"
		exit -1
	fi

	# setup lxc profiles for networks
	for lxd_config_de_register_server in ${servers[@]} ; do
		local server_name=`lxd_config_get_server_name "${lxd_config_de_register_server}"`
		if [ ! $? ] ; then
			echo_std_out "Failed to retrieve the server name for ${lxd_config_de_register_server}"
			continue
		fi
		local targets_servers=(${yml_lstack_servers_names[@]})
		for lxd_config_target_server in ${targets_servers[@]} ; do
			if [ "${lxd_config_register_server}" == "${lxd_config_target_server}" ] ; then
				continue
			fi

			cli_execute_command "${server_name}" "sudo lxc remote remove ${lxd_config_target_server}"
		done
	done

}

# function to get the server name for the provided server
function lxd_config_get_server_name {
	# validate import
	if [ "$#" -ne 1 ]; then
		echo_std_out "Illegal number of parameters"
		echo_std_out "arguments <server_name>"
		exit -1
	fi

	local server=$1

	# retrieve the server configuration
	local yaml_name_var_name="yml_lstack_servers_${server}_name"[@]
	local yaml_name_var=(${!yaml_name_var_name})
	if [ -z "${yaml_name_var[@]}" ] ; then
		echo_std_out "No name information for the server [${server}]"
		exit -1
	fi
	echo "${yaml_name_var[0]}"
	return 0
}

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