SM-Storage: added check for livemnfs image

Closes-Bug: #1436614

Changes:
1. Added check for livemnfs image to check if glance image has been ACTIVE
2. add a sync after writing /tmp/data.txt. This is to ensure data.txt has
   been written to disk.

Test:
Provisioned a 5 node cluster and verfied no provsion has been completed.

Change-Id: I2d0c83e6dffa80c41ae564ffcd8e2d088819b22c

#!/bin/sh

set -x
RETVAL=0
## TODO: change arguments from positional to options
## server-ip is required to download live-migration QCOW2 image.
SERVER_IP=$1
## nova host is where NFS VM for Live-Migration is spawned
NOVA_HOST=$2
## number of OSDs configured by admin. this is check if all the OSDs
## has came up. else we will wait for them to come-up
NUM_TARGET_OSD=$3

OPENSTACK_IPADDRESS=$4
ip addr | grep -q ${OPENSTACK_IPADDRESS}
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "I am not the storage-master"
  exit 0
fi

LIVEMNFS_IP=192.168.101.3
LIVEMNFS_NETWORK=192.168.101.0/24

## check if all the OSDs configured are in and up. This is required as we
## need to create 15% of total available space as volume for NFS VM
## for Live-Migration
## TODO: this may give wrong output if ceph -s failed. change this to
## TODO: multiple lines/commands. and check for failures
NUM_CURR_OSD=` ceph -s | grep "osdmap" | awk '{printf $7}'`
echo "current-osd : ${NUM_CURR_OSD}, target: ${NUM_TARGET_OSD}"
if [ "x${NUM_CURR_OSD}" != "x${NUM_TARGET_OSD}" ]
then
    echo "not all OSDs are up"
    exit 1
fi

## Check if we are able to resolve ip address of nova-host
host ${NOVA_HOST}
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "host resolution failed"
  exit 1
fi

## Get the ip address of nova-host.
## NOTE: we already checked about the ip resolution. so awk must
## NOTE: give correct results
NOVA_HOST_IP=`host ${NOVA_HOST} | awk '{printf $4}'`

## GET the UIDs/GIDs of required users/groups. we generate a file out of it.
nova_uid=`id -u nova`
dnsmasq_uid=`id -u libvirt-dnsmasq`
qemu_uid=`id -u libvirt-qemu`
nova_gid=`getent group nova | awk -F: '{printf $3}'`
kvm_gid=`getent group kvm| awk -F: '{printf $3}'`
virtd_gid=`getent group libvirtd| awk -F: '{printf $3}'`

## generate the file to be fed to nova boot for NFS VM
cat > /tmp/data.txt << EOF
# data.txt info that has to be passed to nova boot - This will enable the auto configure of the VM.
# The following is sample data.txt
# The UID/GID for nova/libvirt/kvm should be taken from one of the
# compute nodes.
#NFS VM configuration
#ver 1.0
[DEFAULT]
auto_configure_nfs_services=1
[PASSWD_ENTRIES]
nova=${nova_uid}
libvirt-qemu=${qemu_uid}
libvirt-dnsmasq=${dnsmasq_uid}
[GROUP_ENTRIES]
nova=${nova_gid}
kvm=${kvm_gid}
libvirtd=${virtd_gid}
#end of file
EOF

sync

. /etc/contrail/openstackrc
## Check if we have already created the image
## TODO: 1. break command to check failures.
## TODO: 2. check for complete name of livemnfs. currently it may match
## TODO:    with livemnfs-not-me
NUM_IMAGE_LIVEMNFS=`nova image-list | grep livemnfs | wc -l`

## check if we need to download the qcow2 image again ?
if [ ${NUM_IMAGE_LIVEMNFS} -eq 1 ]
then
  DOWNLOAD_REQD=0
## checking if we have multiple livemnfs matches.
## TODO: this should not have happened, and it should be handled appropriately.
elif [ ${NUM_IMAGE_LIVEMNFS} -gt 1 ]
then
  DOWNLOAD_REQD=0
else
  DOWNLOAD_REQD=1
fi

if [ ${DOWNLOAD_REQD} -eq 1 ]
then
  #if [ -f /tmp/livemnfs.qcow2.gz ]
  #then
    #MD5SUM=`md5sum /tmp/livemnfs.qcow2.gz| awk '{printf $1}'`
    #wget -q http://${SERVER_IP}/contrail/images/livemnfs.qcow2.gz.md5sum -O /tmp/livemnfs.qcow2.gz.md5sum
    #RETVAL=$?
    #if [ ${RETVAL} -ne 0 ]
    #then
      #echo "wget failed"
    #exit 1
    #fi
    #MD5SUM_LATEST=`cat /tmp/livemnfs.qcow2.gz.md5sum  |  awk '{print $1}'`
    #if [ "x${MD5SUM}" = "x${MD5SUM_LATEST}" ]
    #then
      #echo "MD5 same, no changes in FILE"
      #DOWNLOAD_REQD=0
    #else
      #echo "MD5SUM diff : existing ${MD5SUM}, new: ${MD5SUM_LATEST}"
      #DOWNLOAD_REQD=1
    #fi
  #fi

  ## Download the qcow2-gzipped image
  wget -q http://${SERVER_IP}/contrail/images/livemnfs.qcow2.gz -O /tmp/livemnfs.qcow2.gz
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "wget failed"
    exit 1
  fi
  ## remove old qcow2 image, if any
  if [ -f /tmp/livemnfs.qcow2 ]
  then
    unlink /tmp/livemnfs.qcow2
  fi
  gunzip /tmp/livemnfs.qcow2.gz
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "gunzip failed"
    exit 1
  fi
  ## create image using newly doownloaded image.
  glance image-create --name livemnfs --disk-format qcow2 --container-format ovf --file /tmp/livemnfs.qcow2 --is-public True
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "Glance image create failed"
    exit 1
  fi
fi

NOVA_IMAGE_STATUS=`nova image-list | grep livemnfs | awk -F '|' '{print $4}' | tr -d ' '`
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "nova image-list failed"
  exit 1
fi

if [ "x${NOVA_IMAGE_STATUS}"  = "xACTIVE" ]
then
  echo "nova image livemnfs is ACTIVE"
else
  echo "nova image livemnfs is not ACTIVE"
  exit 2
fi

## create network for livemnfs
## TODO: check for complete livemnfs only.
## TODO: break command to check return status of commands
LIVE_MIGRATE_NETWORK_NUM=`neutron net-list | grep livemnfs | wc -l `
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "neutron net-list failed"
  exit 1
fi

## get the uuid of livemnfs network
LIVE_MIGRATE_NETWORK=`neutron net-list | grep livemnfs | awk '{ print $2 }'`
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "neutron net-list failed"
  exit 1
fi

## Though it is not possible, still checking for error case.
## we can't have multiple netwrok with livemnfs as name
if [ ${LIVE_MIGRATE_NETWORK_NUM} -gt 1 ]
then
  echo "more than 1 livemnfs networks"
  exit 1
fi

echo "LM netowrk ${LIVE_MIGRATE_NETWORK} ${LIVE_MIGRATE_NETWORK_NUM}"
## if don't have network, then create it.
if [ -z ${LIVE_MIGRATE_NETWORK} ]
then
  neutron net-create livemnfs
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "neutron net-create failed"
    exit 1
  fi
fi

## Check for livemnfs subnet
LIVE_MIGRATE_SUBNET=`neutron subnet-list | grep livemnfs | awk '{ print $2 }'`
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "neutron subnet-list failed"
  exit 1
fi

echo "subnet ${LIVE_MIGRATE_SUBNET}"
if [ -z ${LIVE_MIGRATE_SUBNET} ]
then
  ## as of now, we have fixed subnet to 192.168.101.0/24.
  ## TODO: take subnet as argument
  neutron subnet-create --name livemnfs livemnfs ${LIVEMNFS_NETWORK}
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "neutron subnet-create failed"
    exit 1
  fi
fi

## checking if host for NFS VM is a compute or not.
## TODO: break into multiple commands to check individual comand return status
nova-manage host list | grep -w ${NOVA_HOST} | awk '{print $2}' | grep -q nova
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "nova-manage host list doesn't have host/nova"
  exit 1
fi

## check if we have booted the livemnfs image or not
LM_IMAGE_NUM=`nova list | grep livemnfs | wc -l `
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "nova list for NUM failed"
  exit 1
fi

echo "livemnfs num: ${LM_IMAGE_NUM}"
## its error to have multiple livemnfs instances
if [ ${LM_IMAGE_NUM} -gt 1 ]
then
  echo "multiple livemnfs instances : ${LM_IMAGE_NUM}"
  exit 1
fi

## get the livemnfs network UUID for booting the image
## TODO: break the command
## TODO: check for complete name
LIVE_MIGRATE_NETWORK=`neutron net-list | grep livemnfs | awk '{ print $2 }'`
if [ ${LM_IMAGE_NUM} -lt 1 ]
then
  ## boot the image
  ## TODO: using fixed flavor right now. fab created a new flavor
  ## TODO:  based on hardware specs.
  nova boot --image livemnfs --flavor 3 --nic net-id=${LIVE_MIGRATE_NETWORK} livemnfs --availability-zone nova:${NOVA_HOST} --meta storage_scope=local --user-data /tmp/data.txt
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "nova boot failed"
    exit 1
  fi
fi

## get the current status of livemnfs instance.
NOVA_BOOT_STATUS=`nova list | grep livemnfs | awk -F '|' '{print $4}'`
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "nova list failed"
  exit 1
fi

if [ "x${NOVA_BOOT_STATUS}"  = "x ACTIVE" ]
then
  echo "nova livemnfs is ACTIVE"
fi

## we need to create route for NFS VM ip address.
## checking if route is already present ?
## TODO: we are using FIXED ip address right now. move this to
## TODO: dynamic ip address.
netstat -nr | grep ${LIVEMNFS_IP} | grep -q ${NOVA_HOST_IP}
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "route check failed"
  ## add the route
  route add ${LIVEMNFS_IP} gw ${NOVA_HOST_IP}
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "route add failed"
    exit 1
  fi
fi

## Check if route is added to startup scripts. this is required
## to bring-up route on system start-up
grep -q "up route add ${LIVEMNFS_IP} gw ${NOVA_HOST_IP}" /etc/network/interfaces
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "route not there in net-interfaces"
  echo "up route add ${LIVEMNFS_IP} gw ${NOVA_HOST_IP}" >> /etc/network/interfaces
fi

ADMIN_TENANT_ID=`keystone tenant-list |grep " admin" | awk '{print $2}'`
## calculating 15% of total available disk space (in GBs)
RADOS_SPACE=`rados df | grep 'total avail' | awk '{printf $3}'`
NFS_VOLUME_SIZE=$(((${RADOS_SPACE} * 15) / (1024 * 1024 * 100)))
echo $NFS_VOLUME_SIZE
# TODO: this check should more with existing quota instead of 1000
if [ ${NFS_VOLUME_SIZE} -gt 1000 ]
then
  echo "${NFS_VOLUME_SIZE} is more than 1000"
  cinder quota-update --gigabytes=${NFS_VOLUME_SIZE} ${ADMIN_TENANT_ID}
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "cinder quota-update failed"
    exit 1
  fi
fi

## get the number of livemnfsvol
## TODO: break command
## TODO: check for livemnfsvol only
CINDER_NUM=`cinder list | grep livemnfsvol | wc -l`
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "cinder list failed"
  exit 1
fi

## if we don't have livemnfsvol, create it
if [ ${CINDER_NUM} -eq 0 ]
then
  cinder create --display-name livemnfsvol --volume-type ocs-block-disk ${NFS_VOLUME_SIZE}
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "cinder volume create failed"
    exit 1
  fi
## its error to have multiple  livemnfsvol
elif [ ${CINDER_NUM} -gt 1 ]
then
  echo "more than 1 livemnfs volumes: ${CINDER_NUM}"
  exit 1
else
  echo " Only single volume"
fi

## get the livemnfs instance UUID, this is required for attaching volume to it
NFS_VM_ID=`nova list | grep livemnfs | awk '{printf $2}'`
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "nova list failed"
  exit 1
fi

## get the livemnfsvol UUID, it is required for attaching to instance
NFS_VOLUME_ID=`cinder list | grep livemnfsvol | awk '{print $2}'`
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "cinder list failed"
  exit 1
fi

## get the status of livemnfs volume, ensure it is active
CINDER_OUTPUT=`cinder list | grep livemnfsvol  | awk -F '|' '{printf $8}'| tr -d ' '`
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "cinder list failed"
  exit 1
fi

## Wait for 20 seconds, and keep checking for instance status
## TODO: break command
ITER=0
while [ $ITER -lt 10 ]
do
  ITER=`expr $ITER + 1`
  NOVA_BOOT_STATUS=`nova list | grep livemnfs | awk -F '|' '{print $4}' | tr -d ' '`
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "nova list failed"
    exit 1
  fi
  ## if instance becomes ACTIVE, break out of loop.
  if [ "x${NOVA_BOOT_STATUS}"  = "xACTIVE" ]
  then
    echo "nova livemnfs is ACTIVE"
    break
  fi
  sleep 2
done

## Attach livemnfsvol volume to livemnfs instance.
## TODO: Check the nova instance status again, in case VM is still not active.
if [ -z ${CINDER_OUTPUT} ]
then
  echo "livemnfs-volume not attached to any instance"
  nova volume-attach ${NFS_VM_ID} ${NFS_VOLUME_ID} /dev/vdb
elif [ "x${CINDER_OUTPUT}" != "x${NFS_VM_ID}" ]
then
  echo "nova and volumes are already attached but to different ids"
  exit 1
else
  echo "nova and volume are associated to each-other"
fi

#!/bin/sh

set -x
RETVAL=0
## TODO: change arguments from positional to options
## server-ip is required to download live-migration QCOW2 image.
SERVER_IP=$1
## nova host is where NFS VM for Live-Migration is spawned
NOVA_HOST=$2
## number of OSDs configured by admin. this is check if all the OSDs
## has came up. else we will wait for them to come-up
NUM_TARGET_OSD=$3

OPENSTACK_IPADDRESS=$4
ip addr | grep -q ${OPENSTACK_IPADDRESS}
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "I am not the storage-master"
  exit 0
fi

LIVEMNFS_IP=192.168.101.3
LIVEMNFS_NETWORK=192.168.101.0/24

## check if all the OSDs configured are in and up. This is required as we
## need to create 15% of total available space as volume for NFS VM
## for Live-Migration
## TODO: this may give wrong output if ceph -s failed. change this to
## TODO: multiple lines/commands. and check for failures
NUM_CURR_OSD=` ceph -s | grep "osdmap" | awk '{printf $7}'`
echo "current-osd : ${NUM_CURR_OSD}, target: ${NUM_TARGET_OSD}"
if [ "x${NUM_CURR_OSD}" != "x${NUM_TARGET_OSD}" ]
then
    echo "not all OSDs are up"
    exit 1
fi

## Check if we are able to resolve ip address of nova-host
host ${NOVA_HOST}
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "host resolution failed"
  exit 1
fi

## Get the ip address of nova-host.
## NOTE: we already checked about the ip resolution. so awk must
## NOTE: give correct results
NOVA_HOST_IP=`host ${NOVA_HOST} | awk '{printf $4}'`

## GET the UIDs/GIDs of required users/groups. we generate a file out of it.
nova_uid=`id -u nova`
dnsmasq_uid=`id -u libvirt-dnsmasq`
qemu_uid=`id -u libvirt-qemu`
nova_gid=`getent group nova | awk -F: '{printf $3}'`
kvm_gid=`getent group kvm| awk -F: '{printf $3}'`
virtd_gid=`getent group libvirtd| awk -F: '{printf $3}'`

## generate the file to be fed to nova boot for NFS VM
cat > /tmp/data.txt << EOF
# data.txt info that has to be passed to nova boot - This will enable the auto configure of the VM.
# The following is sample data.txt
# The UID/GID for nova/libvirt/kvm should be taken from one of the
# compute nodes.
#NFS VM configuration
#ver 1.0
[DEFAULT]
auto_configure_nfs_services=1
[PASSWD_ENTRIES]
nova=${nova_uid}
libvirt-qemu=${qemu_uid}
libvirt-dnsmasq=${dnsmasq_uid}
[GROUP_ENTRIES]
nova=${nova_gid}
kvm=${kvm_gid}
libvirtd=${virtd_gid}
#end of file
EOF

. /etc/contrail/openstackrc
## Check if we have already created the image
## TODO: 1. break command to check failures.
## TODO: 2. check for complete name of livemnfs. currently it may match
## TODO:    with livemnfs-not-me
NUM_IMAGE_LIVEMNFS=`nova image-list | grep livemnfs | wc -l`

## check if we need to download the qcow2 image again ?
if [ ${NUM_IMAGE_LIVEMNFS} -eq 1 ]
then
  DOWNLOAD_REQD=0
## checking if we have multiple livemnfs matches.
## TODO: this should not have happened, and it should be handled appropriately.
elif [ ${NUM_IMAGE_LIVEMNFS} -gt 1 ]
then
  DOWNLOAD_REQD=0
else
  DOWNLOAD_REQD=1
fi

if [ ${DOWNLOAD_REQD} -eq 1 ]
then
  #if [ -f /tmp/livemnfs.qcow2.gz ]
  #then
    #MD5SUM=`md5sum /tmp/livemnfs.qcow2.gz| awk '{printf $1}'`
    #wget -q http://${SERVER_IP}/contrail/images/livemnfs.qcow2.gz.md5sum -O /tmp/livemnfs.qcow2.gz.md5sum
    #RETVAL=$?
    #if [ ${RETVAL} -ne 0 ]
    #then
      #echo "wget failed"
    #exit 1
    #fi
    #MD5SUM_LATEST=`cat /tmp/livemnfs.qcow2.gz.md5sum  |  awk '{print $1}'`
    #if [ "x${MD5SUM}" = "x${MD5SUM_LATEST}" ]
    #then
      #echo "MD5 same, no changes in FILE"
      #DOWNLOAD_REQD=0
    #else
      #echo "MD5SUM diff : existing ${MD5SUM}, new: ${MD5SUM_LATEST}"
      #DOWNLOAD_REQD=1
    #fi
  #fi

  ## Download the qcow2-gzipped image
  wget -q http://${SERVER_IP}/contrail/images/livemnfs.qcow2.gz -O /tmp/livemnfs.qcow2.gz
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "wget failed"
    exit 1
  fi
  ## remove old qcow2 image, if any
  if [ -f /tmp/livemnfs.qcow2 ]
  then
    unlink /tmp/livemnfs.qcow2
  fi
  gunzip /tmp/livemnfs.qcow2.gz
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "gunzip failed"
    exit 1
  fi
  ## create image using newly doownloaded image.
  glance image-create --name livemnfs --disk-format qcow2 --container-format ovf --file /tmp/livemnfs.qcow2 --is-public True
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "Glance image create failed"
    exit 1
  fi
fi

## create network for livemnfs
## TODO: check for complete livemnfs only.
## TODO: break command to check return status of commands
LIVE_MIGRATE_NETWORK_NUM=`neutron net-list | grep livemnfs | wc -l `
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "neutron net-list failed"
  exit 1
fi

## get the uuid of livemnfs network
LIVE_MIGRATE_NETWORK=`neutron net-list | grep livemnfs | awk '{ print $2 }'`
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "neutron net-list failed"
  exit 1
fi

## Though it is not possible, still checking for error case.
## we can't have multiple netwrok with livemnfs as name
if [ ${LIVE_MIGRATE_NETWORK_NUM} -gt 1 ]
then
  echo "more than 1 livemnfs networks"
  exit 1
fi

echo "LM netowrk ${LIVE_MIGRATE_NETWORK} ${LIVE_MIGRATE_NETWORK_NUM}"
## if don't have network, then create it.
if [ -z ${LIVE_MIGRATE_NETWORK} ]
then
  neutron net-create livemnfs
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "neutron net-create failed"
    exit 1
  fi
fi

## Check for livemnfs subnet
LIVE_MIGRATE_SUBNET=`neutron subnet-list | grep livemnfs | awk '{ print $2 }'`
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "neutron subnet-list failed"
  exit 1
fi

echo "subnet ${LIVE_MIGRATE_SUBNET}"
if [ -z ${LIVE_MIGRATE_SUBNET} ]
then
  ## as of now, we have fixed subnet to 192.168.101.0/24.
  ## TODO: take subnet as argument
  neutron subnet-create --name livemnfs livemnfs ${LIVEMNFS_NETWORK}
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "neutron subnet-create failed"
    exit 1
  fi
fi

## checking if host for NFS VM is a compute or not.
## TODO: break into multiple commands to check individual comand return status
nova-manage host list | grep -w ${NOVA_HOST} | awk '{print $2}' | grep -q nova
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "nova-manage host list doesn't have host/nova"
  exit 1
fi

## check if we have booted the livemnfs image or not
LM_IMAGE_NUM=`nova list | grep livemnfs | wc -l `
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "nova list for NUM failed"
  exit 1
fi

echo "livemnfs num: ${LM_IMAGE_NUM}"
## its error to have multiple livemnfs instances
if [ ${LM_IMAGE_NUM} -gt 1 ]
then
  echo "multiple livemnfs instances : ${LM_IMAGE_NUM}"
  exit 1
fi

## get the livemnfs network UUID for booting the image
## TODO: break the command
## TODO: check for complete name
LIVE_MIGRATE_NETWORK=`neutron net-list | grep livemnfs | awk '{ print $2 }'`
if [ ${LM_IMAGE_NUM} -lt 1 ]
then
  ## boot the image
  ## TODO: using fixed flavor right now. fab created a new flavor
  ## TODO:  based on hardware specs.
  nova boot --image livemnfs --flavor 3 --nic net-id=${LIVE_MIGRATE_NETWORK} livemnfs --availability-zone nova:${NOVA_HOST} --meta storage_scope=local --user-data /tmp/data.txt
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "nova boot failed"
    exit 1
  fi
fi

## get the current status of livemnfs instance.
NOVA_BOOT_STATUS=`nova list | grep livemnfs | awk -F '|' '{print $4}'`
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "nova list failed"
  exit 1
fi

if [ "x${NOVA_BOOT_STATUS}"  = "x ACTIVE" ]
then
  echo "nova livemnfs is ACTIVE"
fi

## we need to create route for NFS VM ip address.
## checking if route is already present ?
## TODO: we are using FIXED ip address right now. move this to
## TODO: dynamic ip address.
netstat -nr | grep ${LIVEMNFS_IP} | grep -q ${NOVA_HOST_IP}
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "route check failed"
  ## add the route
  route add ${LIVEMNFS_IP} gw ${NOVA_HOST_IP}
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "route add failed"
    exit 1
  fi
fi

## Check if route is added to startup scripts. this is required
## to bring-up route on system start-up
grep -q "up route add ${LIVEMNFS_IP} gw ${NOVA_HOST_IP}" /etc/network/interfaces
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "route not there in net-interfaces"
  echo "up route add ${LIVEMNFS_IP} gw ${NOVA_HOST_IP}" >> /etc/network/interfaces
fi

ADMIN_TENANT_ID=`keystone tenant-list |grep " admin" | awk '{print $2}'`
## calculating 15% of total available disk space (in GBs)
RADOS_SPACE=`rados df | grep 'total avail' | awk '{printf $3}'`
NFS_VOLUME_SIZE=$(((${RADOS_SPACE} * 15) / (1024 * 1024 * 100)))
echo $NFS_VOLUME_SIZE
# TODO: this check should more with existing quota instead of 1000
if [ ${NFS_VOLUME_SIZE} -gt 1000 ]
then
  echo "${NFS_VOLUME_SIZE} is more than 1000"
  cinder quota-update --gigabytes=${NFS_VOLUME_SIZE} ${ADMIN_TENANT_ID}
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "cinder quota-update failed"
    exit 1
  fi
fi

## get the number of livemnfsvol
## TODO: break command
## TODO: check for livemnfsvol only
CINDER_NUM=`cinder list | grep livemnfsvol | wc -l`
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "cinder list failed"
  exit 1
fi

## if we don't have livemnfsvol, create it
if [ ${CINDER_NUM} -eq 0 ]
then
  cinder create --display-name livemnfsvol --volume-type ocs-block-disk ${NFS_VOLUME_SIZE}
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "cinder volume create failed"
    exit 1
  fi
## its error to have multiple  livemnfsvol
elif [ ${CINDER_NUM} -gt 1 ]
then
  echo "more than 1 livemnfs volumes: ${CINDER_NUM}"
  exit 1
else
  echo " Only single volume"
fi

## get the livemnfs instance UUID, this is required for attaching volume to it
NFS_VM_ID=`nova list | grep livemnfs | awk '{printf $2}'`
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "nova list failed"
  exit 1
fi

## get the livemnfsvol UUID, it is required for attaching to instance
NFS_VOLUME_ID=`cinder list | grep livemnfsvol | awk '{print $2}'`
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "cinder list failed"
  exit 1
fi

## get the status of livemnfs volume, ensure it is active
CINDER_OUTPUT=`cinder list | grep livemnfsvol  | awk -F '|' '{printf $8}'| tr -d ' '`
RETVAL=$?
if [ ${RETVAL} -ne 0 ]
then
  echo "cinder list failed"
  exit 1
fi

## Wait for 20 seconds, and keep checking for instance status
## TODO: break command
ITER=0
while [ $ITER -lt 10 ]
do
  ITER=`expr $ITER + 1`
  NOVA_BOOT_STATUS=`nova list | grep livemnfs | awk -F '|' '{print $4}' | tr -d ' '`
  RETVAL=$?
  if [ ${RETVAL} -ne 0 ]
  then
    echo "nova list failed"
    exit 1
  fi
  ## if instance becomes ACTIVE, break out of loop.
  if [ "x${NOVA_BOOT_STATUS}"  = "xACTIVE" ]
  then
    echo "nova livemnfs is ACTIVE"
    break
  fi
  sleep 2
done

## Attach livemnfsvol volume to livemnfs instance.
## TODO: Check the nova instance status again, in case VM is still not active.
if [ -z ${CINDER_OUTPUT} ]
then
  echo "livemnfs-volume not attached to any instance"
  nova volume-attach ${NFS_VM_ID} ${NFS_VOLUME_ID} /dev/vdb
elif [ "x${CINDER_OUTPUT}" != "x${NFS_VM_ID}" ]
then
  echo "nova and volumes are already attached but to different ids"
  exit 1
else
  echo "nova and volume are associated to each-other"
fi


Some updates to start.sh

Some updates to start.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/addrummond/nodeibexfarm.git/'


memory profiling: export lots_of_vhosts.sh (#1472)

#!/bin/bash
#
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: morlovich@google.com (Maksim Orlovich)
#
# Helpers for doing experiments with lots of vhosts.
#
# usage:
#   scripts/lots_of_vhosts.sh --config | --traffic
#
# You can also set envvar NUM_VHOSTS to configure how many hosts to use.

set -e  # exit script if any command returns an error
set -u  # exit the script if any variable is uninitialized

NUM_VHOSTS=${NUM_VHOSTS:-10000}

function usage {
  cat <<EOF >&2
 Usage:
   scripts/lots_of_vhosts.sh --config | --traffic

   --config generates a suffix for pagespeed.conf
   --traffic generates a list of URLs for trace_stress_test.sh
   You can also set environment variable NUM_VHOSTS to control the number of
   virtual hosts produced.

 See also https://github.com/pagespeed/mod_pagespeed/wiki/Memory-Profiling
EOF
}

function config {
  echo "NameVirtualHost *:8080"
  for i in $(seq 0 $NUM_VHOSTS); do
    echo "<VirtualHost *:8080>"
    echo "  DocumentRoot $HOME/apache2/htdocs/"
    echo "  ServerName vhost"$i".example.com"
    echo "  ModPagespeed on"
    echo "  ModPagespeedFileCachePath \"/tmp/vhost\""
    echo "  ModPagespeedBlockingRewriteKey \"foo"$i"\""
    echo "</VirtualHost>"
  done
}

function traffic {
  for i in $(seq 0 $NUM_VHOSTS); do
    echo "http://vhost"$i".example.com/mod_pagespeed_example/"
  done
}

if [ $# -ne 1 ]; then
  usage
  exit 1
fi

case $1 in
  --config)
    config;;
  --traffic)
    traffic;;
  *)
    usage
    exit 1
    ;;
esac

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


[#137374301] gives full path to task resources bosh.io dload

Signed-off-by: anwar chirakkattil <7cb5ef61da66b1dc08c9907356ef31750a339f41@pivotal.io>

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/pvsone/pcf-pipelines.git/'


script/mergeindexes.sh: convenience for running lucene IndexMergeTool

#!/bin/bash

exec `dirname $0`/java.sh org.apache.lucene.misc.IndexMergeTool $@

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


Change efi bin file location

Change efi bin file location

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/chris18890/netboot.xyz.git/'


adds test checking: enabling/disabling project scheduled affect scheduling

#!/bin/bash

#test /api/jobs/import

DIR=$(cd `dirname $0` && pwd)
source $DIR/include.sh
args="echo hello there"

projectName=""
jobName=""
jobId=""

generate_projectName_and_jobName(){
    projectName="project-$(date "+%s")"
    jobName="job-$(date "+%s")"
}

create_proj_and_job(){
    projname=$1
    jobname=$2

    xmlproj=$($XMLSTARLET esc "$projname")
    xmljob=$($XMLSTARLET esc "$jobname")

    cat > $DIR/proj_create.post <<END
<project>
    <name>$xmlproj</name>
    <description>description for $xmlproj</description>
    <config>
        <property key="test.property" value="test value"/>
    </config>
</project>
END

    runurl="${APIURL}/projects"

    # post (thus creating project)
    docurl -X POST -D $DIR/headers.out --data-binary @$DIR/proj_create.post -H Content-Type:application/xml ${runurl}?${params} > $DIR/curl.out
    if [ 0 != $? ] ; then
        errorMsg "ERROR: failed POST request"
        exit 2
    fi
    rm $DIR/proj_create.post
    assert_http_status 201 $DIR/headers.out

    cat > $DIR/job_create.post <<END
<joblist>
   <job>
      <name>$xmljob</name>
      <group>api-test</group>
      <description></description>
      <loglevel>INFO</loglevel>
      <context>
          <project>$xmlproj</project>
      </context>
      <dispatch>
        <threadcount>1</threadcount>
        <keepgoing>true</keepgoing>
      </dispatch>
      <schedule>
        <month month='*' />
        <time hour='23' minute='22' seconds='0' />
        <weekday day='MON,SUN,THU,TUE,WED' />
        <year year='*' />
      </schedule>
      <sequence>
        <command>
        <exec>echo hello there</exec>
        </command>
      </sequence>
   </job>
</joblist>
END

    # now submit req
    runurl="${APIURL}/project/$projname/jobs/import"
    params=""
    ulopts="-F xmlBatch=@$DIR/job_create.post"

    # get listing
    docurl $ulopts  ${runurl}?${params} > $DIR/curl.out
    if [ 0 != $? ] ; then
        errorMsg "ERROR: failed query request"
        exit 2
    fi

    jobId=$($XMLSTARLET sel -T -t -v "/result/succeeded/job/id" $DIR/curl.out)
    succount=$($XMLSTARLET sel -T -t -v "/result/succeeded/@count" $DIR/curl.out)

    if [ "1" != "$succount" -o "" == "$jobId" ] ; then
        errorMsg  "Upload was not successful."
        $XMLSTARLET sel -T -t -v "/result/failed" $DIR/curl.out
        exit 2
    fi
}

delete_proj(){
    projname=$1
    xmlproj=$($XMLSTARLET esc "$projname")

    runurl="${APIURL}/project/$projname"
    docurl -X DELETE  ${runurl} > $DIR/curl.out
    if [ 0 != $? ] ; then
        errorMsg "ERROR: failed DELETE request"
        exit 2
    fi
}

disable_schedule(){
    jobname=$1
    xmljob=$($XMLSTARLET esc "$jobname")

    runurl="${APIURL}/job/$jobname/schedule/disable"
    params=""

    docurl -X POST -H Content-Type:application/xml ${runurl}?${params} > $DIR/curl.out
    if [ 0 != $? ] ; then
        errorMsg "ERROR: failed POST request (disable execution)"
        exit 2
    fi
}

enable_schedule(){
    jobname=$1
    xmljob=$($XMLSTARLET esc "$jobname")

    runurl="${APIURL}/job/$jobname/schedule/enable"
    params=""

    docurl -X POST -H Content-Type:application/xml ${runurl}?${params} > $DIR/curl.out
    if [ 0 != $? ] ; then
        errorMsg "ERROR: failed POST request (disable execution)"
        exit 2
    fi
}

check_schedule_contents(){
    projname=$1
    xmlproj=$($XMLSTARLET esc "$projname")

    runurl="${APIURL}/jobs/export?project=${projname}&format=xml"
    params=""

    # get listing
    docurl ${runurl}?${params} > $DIR/curl.out || fail "failed request: ${runurl}"

    assert 1 $(xmlsel "count(/joblist/job/schedule/month)" $DIR/curl.out) "can't find tag job/schedule/month"
    assert 1 $(xmlsel "count(/joblist/job/schedule/time)" $DIR/curl.out) "can't find tag job/schedule/time"
    assert 1 $(xmlsel "count(/joblist/job/schedule/year)" $DIR/curl.out) "can't find tag job/schedule/year"
    assert 1 $(xmlsel "count(/joblist/job/schedule/weekday)" $DIR/curl.out) "can't find tag job/schedule/weekday"
}

####
# Test: when schedule is on, job does execute
####
echo "TEST: when schedule is flipped, job remains scheduled"
generate_projectName_and_jobName
create_proj_and_job $projectName $jobName
check_schedule_contents $projectName
disable_schedule $jobId
check_schedule_contents $projectName
enable_schedule $jobId
check_schedule_contents $projectName

delete_proj $projectName

exit 0

error: pathspec 'test/api/test-job-flip-scheduleEnabled-scheduler-bug.sh' did not match any file(s) known to git


Fix username

Fix username

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/impredicative/pyskeleton.git/'


external ip command

external ip command

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


📦 NEW: Initial script (not very tested)

📦 NEW: Initial script (not very tested)

#!/bin/bash
#
# Description : GemRB
# Version     : 0.8.7
# Author      : Jose Cerrejon Gonzalez (ulysess@gmail_dot._com)
# Version     : 1.0.0 (08/Oct/20)
# Compatible  : Raspberry Pi 4
# Repository  : https://github.com/gemrb/gemrb
# Help        : https://github.com/gemrb/gemrb/blob/master/INSTALL
#             : https://gemrb.org/Manpage.html
#
. ./scripts/helper.sh || . ./helper.sh || wget -q 'https://github.com/jmcerrejon/PiKISS/raw/master/scripts/helper.sh'
clear
check_board || { echo "Missing file helper.sh. I've tried to download it for you. Try to run the script again." && exit 1; }

readonly INSTALL_DIR="$HOME/games"
readonly PACKAGES=(libvorbisidec1 libopenal1 libsdl2-mixer-2.0-0 libpng12-0)
readonly PACKAGES_DEV=(cmake libsdl2-dev libvorbis-dev libopenal-dev libsdl2-mixer-dev libpng-dev libfontconfig1-dev libfreetype6-dev libglew-dev libgles2-mesa-dev)
readonly BINARY_URL=""
readonly SOURCE_CODE_URL="https://github.com/gemrb/gemrb"
readonly DATA_URL="http://download.fileplanet.com/ftp1/052006/bg2_fullinstall.zip?st=81cKF352XL2lgN76khYOcQ&e=1602242280"
readonly INPUT=/tmp/temp.$$

runme() {
    if [ ! -f "$INSTALL_DIR"/gemrb ]; then
        echo -e "\nFile does not exist.\n· Something is wrong.\n· Try to install again."
        exit_message
    fi
    read -p "Press [ENTER] to run the game..."
    cd "$INSTALL_DIR"/gemrb && ./gemrb
    exit_message
}

remove_files() {
    rm -rf "$INSTALL_DIR"/gemrb ~/.local/share/applications/gemrb.desktop
}

uninstall() {
    read -p "Do you want to uninstall GemRB (y/N)? " response
    if [[ $response =~ [Yy] ]]; then
        remove_files
        if [[ -e "$INSTALL_DIR"/gemrb ]]; then
            echo -e "I hate when this happens. I could not find the directory, Try to uninstall manually. Apologies."
            exit_message
        fi
        echo -e "\nSuccessfully uninstalled."
        exit_message
    fi
    exit_message
}

if [[ -d "$INSTALL_DIR"/gemrb ]]; then
    echo -e "GemRB already installed.\n"
    uninstall
fi

generate_icon() {
    echo -e "\nGenerating icon..."
    if [[ ! -e ~/.local/share/applications/gemrb.desktop ]]; then
        cat <<EOF >~/.local/share/applications/gemrb.desktop
[Desktop Entry]
Name=GemRB
Version=1.0
Type=Application
Comment=
Exec=${INSTALL_DIR}/gemrb/gemrb
Icon=${INSTALL_DIR}/gemrb/logo.png
Path=${INSTALL_DIR}/gemrb/
Terminal=false
Categories=Game;
EOF
    fi
}

end_message() {
    echo -e "\n\nDone!. You can play typing $INSTALL_DIR/gemrb/gemrb or opening the Menu > Games > GemRB.\n"
}

compile() {
    install_packages_if_missing "${PACKAGES_DEV[@]}"
    mkdir -p "$HOME/sc" && cd "$_"
    git clone "SOURCE_CODE_URL" gemrb && "$_"
    mkdir build && cd "$_"
    cmake .. -DSDL_BACKEND=SDL2 -DCMAKE_BUILD_TYPE=Release -DOPENGL_BACKEND=GLES -DDISABLE_WERROR=1
    make_with_all_cores "\nCompiling..."
    read -p "Do you want to install globally the app (y/N)? " response
    if [[ $response =~ [Yy] ]]; then
        sudo make install
    fi
    echo -e "\nDone!. Check the code at $HOME/sc/gemrb."
    exit_message
}

download_binaries() {
    echo -e "\nInstalling binary files..."
    download_and_extract "$BINARY_URL" "$INSTALL_DIR"
}

install() {
    install_packages_if_missing "${PACKAGES[@]}"
    download_binaries
    generate_icon
    echo
    read -p "Do you have an online copy of Baldur's Gate (y/N)? " response
    if [[ $response =~ [Yy] ]]; then
        download_data_files "$INSTALL_DIR/gemrb"
        end_message
        runme
    fi

    echo -e "\nCopy the data files inside $INSTALL_DIR/gemrb/UFO."
    install_packages_if_missing gemrb-baldurs-gate-2-data
    end_message
    exit_message
}

echo "
GemRB (Infinite Engine) v0.8.7 for Raspberry Pi
===============================================

 · Optimized for Raspberry Pi 4.
 · AKA Game Engine Made with preRendered Background.
 · Compatible games: Baldur's Gate I & II, Planetscape Torment.
 · GemRB comes with its own demo, but it is trivial.
"
read -p "Press [Enter] to continue..."

install

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


Update getIPAdress.sh

Update getIPAdress.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/liman/ldepo.git/'


Mac Installer updates for opencv

Mac Installer updates for opencv

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/rwgdrummer/maskgen.git/'


Turn off idiotic warning from rvm

Turn off idiotic warning from rvm

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


tidy up history

tidy up history

## Command history configuration
#
HISTFILE=$HOME/.zsh_history
HISTSIZE=5000
SAVEHIST=5000
setopt hist_ignore_dups # ignore duplication command history list
setopt share_history # share command history data

setopt hist_verify
setopt inc_append_history
setopt extended_history
setopt hist_expire_dups_first

# History stuff.
setopt HIST_VERIFY
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
setopt EXTENDED_HISTORY
setopt HIST_IGNORE_DUPS

## Command history configuration
#
HISTFILE=$HOME/.zsh_history
HISTSIZE=5000
SAVEHIST=5000
setopt hist_ignore_dups # ignore duplication command history list
setopt share_history # share command history data


Add pull script

Add pull script

#!/bin/sh

git pull origin master
git subtree pull --prefix=src/Pingpong/Widget git@github.com:pingpong-labs/widget.git master
git subtree pull --prefix=src/Pingpong/Shortcode git@github.com:pingpong-labs/shortcode.git master
git subtree pull --prefix=src/Pingpong/Menus git@github.com:pingpong-labs/menus.git master
git subtree pull --prefix=src/Pingpong/Presenters git@github.com:pingpong-labs/presenters.git master
git subtree pull --prefix=src/Pingpong/Modules git@github.com:pingpong-labs/modules.git master
git subtree pull --prefix=src/Pingpong/Testing git@github.com:pingpong-labs/testing.git master
git subtree pull --prefix=src/Pingpong/Generators git@github.com:pingpong-labs/generators.git master
git subtree pull --prefix=src/Pingpong/Validator git@github.com:pingpong-labs/validator.git master
git subtree pull --prefix=src/Pingpong/Oembed git@github.com:pingpong-labs/oembed.git master

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


Remove bastion IP CIDR script (unused)

Remove bastion IP CIDR script (unused)

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/lopopolo/hyperbola.git/'


- added script to auto generate all documentation

- tests will be executed to generate the coverage report

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


Added preliminary kat5200 script, still requires adding other consoles besides 5200. Still requires config file setup.

#!/usr/bin/env bash

# This file is part of The RetroPie Project
#
# The RetroPie Project is the legal property of its developers, whose names are
# too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source.
#
# See the LICENSE.md file at the top-level directory of this distribution and
# at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md
#

rp_module_id="kat5200"
rp_module_desc="Atari 5200/8-bit emulator"
rp_module_help="ROM Extensions: .7z .a52 .bin .zip .7Z .A52 .BIN .ZIP\n\nCopy your kat5200 games to $romdir/kat5200\n\nCopy your Atari 5200 roms to $romdir/atari5200 You need to copy the Atari 800/5200 BIOS files (5200.ROM, ATARIBAS.ROM, ATARIOSB.ROM and ATARIXL.ROM) to the folder $biosdir and then on first launch configure it to scan that folder for roms (F1 -> Emulator Configuration -> System Rom Settings)"
rp_module_licence="GPL http://kat5200.jillybunch.com/doc/index.html"
rp_module_section="exp"
rp_module_flags="!mali !kms"

function depends_kat5200() {
    getDepends libsqlite3-dev zlib1g zlib1g-dev libsdl2-dev libsdl2-image-dev libguichan-dev
}

function sources_kat5200() {
    wget -N -q -O- "http://kat5200.jillybunch.com/downloads/kat5200-0.7.1.tar.gz" | tar -xvz --strip-components=1
    # Disable F1 key debugger
    sed -i -e '230d' src/interface/ui.c
    # Allow Select and Start together to quit the program.
    sed -i '1221 a\
        if ((SDL_JoystickGetButton(g_pc_joy[0].joy_ptr,8) == SDL_PRESSED) && (SDL_JoystickGetButton(g_pc_joy[0].joy_ptr,9) == SDL_PRESSED)) return -1;' src/interface/sdl_if.c
}

function build_kat5200() {
    ./configure --prefix="$md_inst"
    make clean
    # Author forgot to include the kat5200.html documentation in the latest version so we'll fake it.
    mkdir doc/kat5200.html/
    touch doc/kat5200.html/deleteme.html
    make
    md_ret_require="$md_build/src/kat5200"
}

function install_kat5200() {
    make install
}

function configure_kat5200() {
    mkRomDir "atari5200"

    mkUserDir "$md_conf_root/kat5200"

    # move old config if exists to new location
    if [[ -f "$md_conf_root/kat5200.db3" ]]; then
        mv "$md_conf_root/kat5200.db3" "$md_conf_root/kat5200/kat5200.db3"
    fi
    moveConfigFile "$home/.kat5200/kat5200.db3" "$md_conf_root/kat5200/kat5200.db3"

    addEmulator 1 "kat5200" "atari5200" "$md_inst/bin/kat5200 %ROM%"
    addSystem "atari5200"
}

error: pathspec 'scriptmodules/emulators/kat5200.sh' did not match any file(s) known to git


添加jenkins部署脚本

添加jenkins部署脚本

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/yyssc/ssc30-admin.git/'


Create git-setup.sh

Create git-setup.sh

#!/bin/bash

mkdir ~/.ssh
cat <<EOF >> ~/.ssh/config
Host *
ConnectTimeout 5
EOF

GITIGNORE_GLOBAL=~/.gitignore_global
cat <<EOF > $GITIGNORE_GLOBAL
*~
.*.swp
.DS_Store
.idea
EOF

git config --global user.email "prime8@users.noreply.github.com"
git config --global user.name "prime8"
git config --global color.ui auto
git config --global core.editor vim
git config --global core.excludesfile $GITIGNORE_GLOBAL
git config --global push.default simple
git config --global merge.tool kdiff3

git config --list --global

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


Stop building components

Stop building components

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/demonchild2112/travis-test.git/'


Create a file for the tip of each branch.

Create a file of the form project-branch.tar.gz so that there is a
url that can be referenced for each projects that represents a proper
source sdist for the tip of the branch. That way, if someone (such as
ceilometer) needs to depend on tip of nova, they can put in:

http://nova.openstack.org/tarballs/nova-master.tar.gz

In their pip-requires file instead of a github zipball link (which does not
have all of the files in the manifest, since it's not a proper sdist.

Change-Id: I0228381894417a15655e7b684c5a65f98a2fc7ba

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/open-switch/infra_puppet-jenkins.git/'


Moves pushd and popd around git clone command

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


added script to create branches from github issues.

#!/bin/sh

ISSUE_NUMBER_INPUT=$1

if [ -z $ISSUE_NUMBER_INPUT ]; then
   echo 'usage: '$0' <issue-number>'
   exit 0
fi

JSON=$(curl -s https://api.github.com/repos/tilmanpotthof/angular-st-pagination/issues/15)

ISSUE_NUMBER=$(echo 'console.log('$JSON'.number)' | node)
ISSUE_NAME=$(echo 'console.log('$JSON'.title)' | node)
DASHED_ISSUE_NAME=$(echo $ISSUE_NAME | tr ' ' '-')

COMMAND='git checkout -b issue-'$ISSUE_NUMBER'/'$DASHED_ISSUE_NAME

while [[ ! $EXECUTE =~ ^[YyNn]$ ]]
do
  read -p "execute '${COMMAND}' [Y/N]: " -n 1 -r EXECUTE
  echo ""
done
if [[ $EXECUTE =~ ^[Nn]$ ]]
then
  exit 0
fi

eval $COMMAND

git status

error: pathspec 'scripts/create-branch-from-issue.sh' did not match any file(s) known to git


Adding script to create annotations index.

#!/usr/bin/env bash

echo 'creating dig-annotations index ...'
curl -XPUT localhost:9200/dig-annotations -d '
{
  "mappings" : {
    "annotation" : {
      "properties" : {
        "uri" : {
          "type" : "string",
          "index" : "not_analyzed"
        },
        "user" : {
          "type" : "string",
          "index": "not_analyzed"
        },
        "is_valuable" : {
          "type" : "boolean"
        },
        "free_text" : {
          "type" : "string",
          "index" : "not_analyzed"
        }
      }
    }
  }
}
';

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


fix typo in install script

fix typo in install script

#!/bin/sh

## USAGE: bash install.sh $INSTALL_DIR
##     $ bash install.sh $INSTALL_DIR

set -eu

# OS detection
KERNEL="$(uname -s | tr '[:upper:]' '[:lower:]')"

if [ "$KERNEL" = "darwin" ]; then
  PLATFORM='osx'
elif [ "$KERNEL" = "linux" ]; then
  ARCH=$(uname -m)
  if [ "$ARCH" = "x86_64" ]; then
    PLATFORM='linux-x86_64'
  else
    PLATFORM='linux-x86'
  fi
fi

# If there is an argument then there is where GV will installed
if [ "$0" = 'sh' ]; then
  # I.e. when piping from curl
  INSTALL_DIR=$PWD/genevalidator
elif [ "$0" = 'install.sh' ]; then
  # I.e. when running directly
  INSTALL_DIR=$PWD/genevalidator
else
  INSTALL_DIR="$0"
fi

GV_URL=$(curl -s https://api.github.com/repos/wurmlab/genevalidator/releases/latest \
  | grep browser_download_url \
  | grep -i $PLATFORM \
  | cut -d '"' -f 4)

echo >&2 "==> Installing GeneValidator to:"
echo >&2 "    ${INSTALL_DIR}"
echo >&2

mkdir "${INSTALL_DIR}"
curl -SL "$GV_URL" | tar zxf - -C "${INSTALL_DIR}" --strip-components 1

echo >&2
echo >&2 "==> GeneValidator successfully installed."

### Check which SHELL and then test different profile files
case $SHELL in
*/zsh)
  # assume Zsh
  if test -e "${HOME}/.zshrc"; then
    DOT_FILE=${HOME}/.zshrc
  elif test -e "${HOME}/.zprofile"; then
    DOT_FILE=${HOME}/.zprofile
  elif test -e "${HOME}/.profile"; then
    DOT_FILE=${HOME}/.profile
  fi
  ;;
*/bash)
  # assume Bash
  if test -e "${HOME}/.bashrc"; then
    DOT_FILE=${HOME}/.bashrc
  elif test -e "${HOME}/.bash_profile"; then
    DOT_FILE=${HOME}/.bash_profile
  elif test -e "${HOME}/.profile"; then
    DOT_FILE=${HOME}/.profile
  fi
  ;;
*)
  if test -e "${HOME}/.profile"; then
    DOT_FILE=${HOME}/.profile
  fi
esac

if [ -z ${DOT_FILE+x} ]; then
  # DOT File hasn't been set.
  echo >&2
  echo >&2 '==> No profile files were found.'
  echo >&2 '    Please create one and add the following line to that file:'
  echo >&2
  echo >&2 '    export PATH="'"${INSTALL_DIR}"'/bin:${PATH}"'
else
  echo >&2 'export PATH="'"${INSTALL_DIR}"'/bin:${PATH}"' >> "${DOT_FILE}"
  echo >&2
  echo >&2 "==> Added GeneValidator to your PATH in ${DOT_FILE}"
  echo >&2
  echo >&2 "==> Run \`genevalidator -h\` in a new window to get started."
fi

echo >&2

#!/bin/sh

## USAGE: bash install.sh $INSTALL_DIR
##     $ bash install.sh $INSTALL_DIR

set -eu

# OS detection
KERNEL="$(uname -s | tr '[:upper:]' '[:lower:]')"

if [ "$KERNEL" = "darwin" ]; then
  PLATFORM='osx'
elif [ "$KERNEL" = "linux" ]; then
  ARCH=$(uname -m)
  if [ "$ARCH" = "x86_64" ]; then
    PLATFORM='linux-x86_64'
  else
    PLATFORM='linux-x86'
  fi
fi

# If there is an argument then there is where GV will installed
if [ "$0" = 'sh' ]; then
  # I.e. when piping from curl
  INSTALL_DIR=$PWD/genevalidator
elif [ "$0" = 'install.sh' ]; then
  # I.e. when running directly
  INSTALL_DIR=${HOME}/.taxonkit
else
  INSTALL_DIR="$0"
fi

GV_URL=$(curl -s https://api.github.com/repos/wurmlab/genevalidator/releases/latest \
  | grep browser_download_url \
  | grep -i $PLATFORM \
  | cut -d '"' -f 4)

echo >&2 "==> Installing GeneValidator to:"
echo >&2 "    ${INSTALL_DIR}"
echo >&2

mkdir "${INSTALL_DIR}"
curl -SL "$GV_URL" | tar zxf - -C "${INSTALL_DIR}" --strip-components 1

echo >&2
echo >&2 "==> GeneValidator successfully installed."

### Check which SHELL and then test different profile files
case $SHELL in
*/zsh)
  # assume Zsh
  if test -e "${HOME}/.zshrc"; then
    DOT_FILE=${HOME}/.zshrc
  elif test -e "${HOME}/.zprofile"; then
    DOT_FILE=${HOME}/.zprofile
  elif test -e "${HOME}/.profile"; then
    DOT_FILE=${HOME}/.profile
  fi
  ;;
*/bash)
  # assume Bash
  if test -e "${HOME}/.bashrc"; then
    DOT_FILE=${HOME}/.bashrc
  elif test -e "${HOME}/.bash_profile"; then
    DOT_FILE=${HOME}/.bash_profile
  elif test -e "${HOME}/.profile"; then
    DOT_FILE=${HOME}/.profile
  fi
  ;;
*)
  if test -e "${HOME}/.profile"; then
    DOT_FILE=${HOME}/.profile
  fi
esac

if [ -z ${DOT_FILE+x} ]; then
  # DOT File hasn't been set.
  echo >&2
  echo >&2 '==> No profile files were found.'
  echo >&2 '    Please create one and add the following line to that file:'
  echo >&2
  echo >&2 '    export PATH="'"${INSTALL_DIR}"'/bin:${PATH}"'
else
  echo >&2 'export PATH="'"${INSTALL_DIR}"'/bin:${PATH}"' >> "${DOT_FILE}"
  echo >&2
  echo >&2 "==> Added GeneValidator to your PATH in ${DOT_FILE}"
  echo >&2
  echo >&2 "==> Run \`genevalidator -h\` in a new window to get started."
fi

echo >&2


initial commit to be able to add a workspace

#!/usr/bin/env bash
#===============================================================================
#
#          FILE: addWorkspace.sh
#
#         USAGE: ./addWorkspace.sh
#
#   DESCRIPTION: This script will add a new separation between applications by
#                adding a new workspace.  This way additional applicaiotns can
#                be associated with this workspace and they are separate from
#                other applications in other workspaces.
#
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Bob Lozano - bob@devops.center
#                Gregg Jensen - gjensen@devops.center
#  ORGANIZATION: devops.center
#       CREATED: 08/23/2018 10:50:48
#      REVISION:  ---
#
# Copyright 2014-2018 devops.center llc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#===============================================================================

#set -o nounset     # Treat unset variables as an error
#set -o errexit     # exit immediately if command exits with a non-zero status
#set -o verbose     # print the shell lines as they are executed
#set -x             # essentially debug mode

#---  FUNCTION  ----------------------------------------------------------------
#          NAME:  usage
#   DESCRIPTION:  function that gets called to show the user how this script should
#                 be called and what the arguments mean
#    PARAMETERS:
#       RETURNS:
#-------------------------------------------------------------------------------
usage ()
{
    echo -e "Usage: addWorkspace.sh -n newWorkspaceName -d destinationDirectory"
    echo
    echo -e "This script will add a workspace that you can use to separate an"
    echo -e "application from other applications.  This will create a parent"
    echo -e "directory that applications that will be associated with this workspace"
    echo -e "will be placed."
    echo -e "Note: this creates/adds to the baseDirectory file located in ~/.dcConfig"
    echo
    echo -e "Required arguments:"
    echo -e "-n  This is the name of the new workspace that you want to add"
    echo -e "    NOTE: do not put spaces in the name."
    echo -e "-d  This is the base directory where the parent directory with "
    echo -e "    the name of the workspace will be created."
    echo
}

#-------------------------------------------------------------------------------
# Make sure there are the exact number of arguments
#-------------------------------------------------------------------------------
if [[ $# -ne 4 ]]; then
    usage
    exit 1
fi

#-------------------------------------------------------------------------------
# Loop through the arguments and assign input args with the appropriate variables
#-------------------------------------------------------------------------------
NEW_WORKSPACE_NAME=""

while [[ $# -gt 0 ]]; do
    case ${1} in
      "-n" )   shift
             A_WORKSPACE_NAME="${1}"
             ;;
      "-d" )   shift
             DEST_DIR="${1}"
             ;;
      * )    usage
             exit 1
    esac
    shift
done

if [[ "${A_WORKSPACE_NAME}" == *[[:space:]]* ]]; then
    echo "Error: The workspace name can not contains spaces: ${A_WORKSPACE_NAME}"
    exit 1
fi

# make sure the workspace nane is uppercase
WORKSPACE_NAME_UPPERCASE=${A_WORKSPACE_NAME^^}
#echo ${WORKSPACE_NAME_UPPERCASE}
#echo "${DEST_DIR}"

varToAdd="_${WORKSPACE_NAME_UPPERCASE}_BASE_CUSTOMER_DIR="
dirToAdd="${DEST_DIR}/${A_WORKSPACE_NAME}"
lineToAdd="${varToAdd}${dirToAdd}"
theFile=$HOME/.dcConfig/baseDirectory

# see if it exists maybe this is the first time
if [[ ! -f "${theFile}" ]]; then
    # create it and make sure that this workspace is the current workspace
    echo "CURRENT_WORKSPACE=${WORKSPACE_NAME_UPPERCASE}" > "${theFile}"
    echo "##### WORKSPACES ######" >> "${theFile}"
    echo ${lineToAdd} >> "${theFile}"
    echo "##### BASE DIR CONSTRUCTION NO TOUCH ######" >> "${theFile}"
    echo 'CONSTRUCTED_BASE_DIR=_${CURRENT_WORKSPACE}_BASE_CUSTOMER_DIR' >> "${theFile}"
    echo 'BASE_CUSTOMER_DIR=${!CONSTRUCTED_BASE_DIR}' >> "${theFile}"
else
    # check to see if there is a value by that name already in the file
    if [[ ! $(grep -c ${varToAdd} ${theFile}) ]];then
        echo "A workspace with the same name exists: ${A_WORKSPACE_NAME}"
        exit 1
    fi

    # need to add a line into that file and we need to do it in a way that will
    # work for both linux and osx, since we can rely on the verion of sed they have
    cp "${theFile}" "${theFile}.ORIG"
    writeNewEntry="false"
    # we'll put all the new lines into a new file so we don't screw up the file
    # we are reading
    while read aLine; do
        if [[ $aLine == "CURRENT_WORKSPACE"* ]]; then
            echo "CURRENT_WORKSPACE=${WORKSPACE_NAME_UPPERCASE}" > "${theFile}.NEW"
            continue
        fi
        if [[ ${aLine} == "##### WORKSPACES ######"* ]]; then
            writeNewEntry="true"
        fi
        echo "${aLine}" >> $HOME/.dcConfig/baseDirectory.NEW
        if [[ ${writeNewEntry} == "true" ]]; then
            echo ${lineToAdd} >> "${theFile}.NEW"
            writeNewEntry="false"
        fi
    done < "${theFile}"
    # and now do some house cleaning
    mv "${theFile}.NEW" "${theFile}"
    rm "${theFile}.ORIG"
fi

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


Added script to produce report of switch ports with force-up enabled

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/lewisedge/useful-scripts.git/'


Added aliases for vscode backup and restore.

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


Add init.sh

Add init.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/micnncim/dotfiles.git/'


Add back deploy script.

Add back deploy script.

#!/bin/bash

cp .travis.settings.xml $HOME/.m2/settings.xml
mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$TRAVIS_TAG
mvn clean deploy -DSkipTests

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


Create deploy.sh

Create deploy.sh

#!/bin/bash

echo "${TRAVIS_PULL_REQUEST}"
echo "${TRAVIS_EVENT_TYPE}"

git clone https://github.com/1haodian/incubator-eagle.git eagle
cd eagle
git checkout master
git status

echo "Git remote..."
git remote add upstream https://github.com/apache/incubator-eagle.git
git remote set-url origin "https://${GH_TOKEN}@${GH_REF}"

echo "Set git id..."
git config  user.name "Travis-CI"
git config  user.email "travis@yhd.com"

echo "Fetch..."
git fetch upstream

echo "Rebase..."
git rebase upstream/master

echo "Pushing with force ..."
git push --force origin master > /dev/null 2>&1 || exit 1
echo "Pushed deployment successfully"

 # Is this not a build which was triggered by setting a new tag?
    if [ -z "$TRAVIS_TAG" ]; then
      echo -e "Starting to tag commit.\n"
      # Add tag and push to master.
      git tag -a eagle-v${TRAVIS_BUILD_NUMBER} -m "Travis build $TRAVIS_BUILD_NUMBER pushed a tag."
      git push origin --tags
      git fetch origin

      echo -e "Done magic with tags.\n"
  fi

exit 0


Bash colors

Bash colors

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


Automation makes the world go 'round

Automation makes the world go 'round

aws.exe s3 sync --include "*.htm" --exclude ".git/*" --exclude "LICENSE" --exclude "README.md" --exclude "deploy.sh" . s3://heavenlytouchdoula.com/


Added deployment script

Added deployment script

#!/bin/sh
npm run build
cd ./build
git add .
git commit -m 'push to gh-pages'
git push --force git@github.com:anvaka/npmrank.vis.git master:gh-pages


add requirejs

add requirejs

command_name="requirejs"
output=$(r.js -v 2>&1)
status=$?
version=$(echo "$output" | egrep -o "$SIMPLE_VERSIONING" | head -1)

_dq_report "$command_name" $status "$version"

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


Add mac dependencies script

Add mac dependencies script

#!/bin/bash

brew update

brew install \
    coreutils \
    git \
    python \
    python3 \
    tmux \
    tree \
    irssi \
    ack \
    wget \
    bash-completion \
    macvim \
    emacs \
    postgresql \
    z

if [ ! -d ~/sh ]; then
    echo "~/sh not found, creating..."
    mkdir -v ~/sh
fi

# rupa/z
if [ ! -f  ~/sh/z.sh ]; then
    echo "~/sh/z.sh not found, creating..."
    cp -v $(brew --prefix)/etc/profile.d/z.sh ~/sh/z.sh
fi

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


Adds teardown script for removing home-brew and starting fresh


New health check script

New health check script

#! /bin/bash
#
# Facilitates monitoring scheduled Arthur jobs by sending an HTTP GET request
# to a specified URI.
#
# This script is called near the beginning and end of Arthur data pipelines.
# The service that receives the GET request is expected to sound an alarm if
# it does not receive the second request within some configured amount of
# time.
#
# The script expects this environment variable to be set:
#   HEALTH_CHECK_URI - URI to the job-specific endpoint for monitoring
#
# The environment variable is usually set in the credentials.sh file. It may
# also be simply exported from the current shell, as an alternative.
#
# The HTTP endpoint is expected to handle requests to these three resources:
#   HEALTH_CHECK_URI - The bare URI itself, when the job completes
#   HEALTH_CHECK_URI/start - To indicate the job has started
#   HEALTH_CHECK_URI/fail - To explicitly indicate job failure

if [[ "$1" == "-h" || ("$1" != "" && "$1" != "start" && "$1" != "fail") ]]; then
    echo "Usage: $0 [ start | fail ]"
    exit 1
fi

set -e

FILENAME="/tmp/redshift_etl/config/credentials.sh"
echo "Attempting to read configuration environment variables from '$FILENAME'"
if [ -r "$FILENAME" ]; then
    source "$FILENAME"
else
    echo "Failed to find '$FILENAME'"
fi
if [ -z "$HEALTH_CHECK_URI" ]; then
    echo "Failed to find value in environment variable HEALTH_CHECK_URI, health checks disabled"
    exit 0
fi

# Status should be only one of: "", "start", or "fail"
status="$1"
if [ -n "$status" ]; then
    HEALTH_CHECK_URI="$HEALTH_CHECK_URI/$status"
fi

set -x
set -u

curl --connect-timeout 5 --max-time 60 --retry 5 "$HEALTH_CHECK_URI"
exit $?

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


Add a script which makes a dir suited to copy to the ec-earth repository.

#!/bin/bash
# Thomas Reerink
#
# This script produces the "ready to copy" ec-earth-cmip6-nemo-namelists for the ctrl/ directory in ec-earth3.
#
# This scripts requires no arguments
#
# Run example:
#  ./pack-for-test-branch.sh
#

if [ "$#" -eq 0 ]; then

 rm -rf ec-earth-cmip6-nemo-namelists

 ./generate-ec-earth-namelists.sh CMIP 1pctCO2      1 1
 ./generate-ec-earth-namelists.sh CMIP abrupt-4xCO2 1 1
 ./generate-ec-earth-namelists.sh CMIP amip         1 1
 ./generate-ec-earth-namelists.sh CMIP historical   1 1
 ./generate-ec-earth-namelists.sh CMIP piControl    1 1

 cd ec-earth-cmip6-nemo-namelists
 rm -rf cmip6-experiment-m=*/file_def-compact
 rm -f  cmip6-experiment-m=*/cmip6-file_def_nemo.xml

 sed -i -e 's/True\" field_ref=\"toce_pot/False\" field_ref=\"toce_pot/' cmip6-experiment-m=CMIP-e=amip-t=1-p=1/file_def_nemo-opa.xml
 sed -i -e 's/True\" field_ref=\"toce_pot/False\" field_ref=\"toce_pot/' cmip6-experiment-m=CMIP-e=1pctCO2-t=1-p=1/file_def_nemo-opa.xml
 sed -i -e 's/True\" field_ref=\"toce_pot/False\" field_ref=\"toce_pot/' cmip6-experiment-m=CMIP-e=abrupt-4xCO2-t=1-p=1/file_def_nemo-opa.xml
 sed -i -e 's/True\" field_ref=\"toce_pot/False\" field_ref=\"toce_pot/' cmip6-experiment-m=CMIP-e=piControl-t=1-p=1/file_def_nemo-opa.xml
 sed -i -e 's/True\" field_ref=\"toce_pot/False\" field_ref=\"toce_pot/' cmip6-experiment-m=CMIP-e=historical-t=1-p=1/file_def_nemo-opa.xml

else
    echo '  '
    echo '  This scripts requires no arguments'
    echo '  ' $0
    echo '  '
fi

error: pathspec 'ece2cmor3/scripts/pack-for-test-branch.sh' did not match any file(s) known to git


Adding docker-machine 0.8.2

Adding docker-machine 0.8.2

#! /bin/sh

TMP=`pwd`/tmp
BIN=$TMP/usr/local/bin
PACKAGE=docker-machine
VERSION=0.8.2
ARCH=`uname -m`

mkdir -p $BIN
wget -O ${BIN}/${PACKAGE} -L https://github.com/docker/machine/releases/download/v${VERSION}/docker-machine-`uname -s`-${ARCH}
chmod a+x ${BIN}/${PACKAGE}

DEB="${PACKAGE}_${VERSION}_${ARCH}.deb"
rm -f ${DEB}
fpm -s dir -t deb -C $TMP -n $PACKAGE -v $VERSION -a $ARCH \
  --description "Docker Machine is a tool that lets you install Docker Engine on virtual hosts, and manage the hosts with docker-machine commands." \
  --maintainer "Gonzalo Matheu <gonzalommj@gmail.com>" \
  --provides ${PACKAGE} \
  usr

rm -rf $TMP

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


Forgot a quote

Forgot a quote

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


centos6 install script

centos6 install script

#!/bin/sh
# =============================================================================
# jamiesun <jamiesun.net@gmail.com>
#
# CentOS-7, MySQL5.6, Python2.7, ToughRADIUS
#
# =============================================================================

depend()
{
    echo "install lib"
    yum update -y
    yum install -y wget git gcc python-devel python-setuptools tcpdump

    echo "python package"
    easy_install pip
    easy_install supervisor
    echo "install depend done!"
}

mysql5()
{
    echo "install mysql"
    yum install -y mysql-server mysql-devel
    echo "install mysql done!"
}

radius()
{
    echo "fetch ToughRADIUS latest"
    git clone https://github.com/talkincode/ToughRADIUS.git /opt/toughradius
    pip install -r /opt/toughradius/requirements.txt
    echo "fetch ToughRADIUS done!"
}

setup()
{
    echo "mkdir /var/toughradius"
    mkdir -p /var/toughradius
    mkdir -p /var/toughradius/mysql
    mkdir -p /var/toughradius/log

    cp /etc/my.cnf /etc/my.cnf.$((`date +%s`))
    yes | cp -f /opt/toughradius/docker/my.cnf /etc/my.cnf
    yes | cp -f /opt/toughradius/docker/radiusd.json /var/toughradius/radiusd.json
    yes | cp -f /opt/toughradius/docker/supervisord.conf /var/toughradius/supervisord.conf

    echo "starting install mysql database;"

    sleep 1s

    mysql_install_db

    chown -R mysql:mysql /var/toughradius/mysql

    /usr/bin/mysqld_safe &

    sleep 5s

    echo "GRANT ALL ON *.* TO admin@'%' IDENTIFIED BY 'radius' WITH GRANT OPTION; FLUSH PRIVILEGES" | mysql

    echo "setup toughradius database.."

    python /opt/toughradius/createdb.py -c /var/toughradius/radiusd.json -i=1

    echo "starting supervisord..."

    supervisord -c /var/toughradius/supervisord.conf

    sleep 3s

    echo "ToughRADIUS service status"

    supervisorctl status

    echo "setup done!"
}

unsetup()
{
    echo "shutdown mysql.."
    mysqladmin -uroot shutdown
    echo "shutdown supervisord"
    supervisorctl shutdown
    echo "/var/toughradius"
    rm -fr /var/toughradius
    echo 'unsetup done!'
}

upgrade()
{
    echo 'starting upgrade...'
    cd /opt/toughradius && git pull origin master
    supervisorctl restart all
    supervisorctl status
    echo 'upgrade done'
}

case "$1" in

  depend)
    depend
  ;;

  mysql5)
    mysql5
  ;;

  radius)
    radius
  ;;

  setup)
    setup
  ;;

  unsetup)
    unsetup
  ;;

  upgrade)
    upgrade
  ;;

  all)
    depend
    mysql5
    radius
    setup
  ;;

  *)
    echo "Usage: $0 {all|depend|mysql5|radius|setup|unsetup|upgrade}"
  ;;

esac

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