blob_id
stringlengths 40
40
| language
stringclasses 1
value | repo_name
stringlengths 4
115
| path
stringlengths 2
970
| src_encoding
stringclasses 28
values | length_bytes
int64 31
5.38M
| score
float64 2.52
5.28
| int_score
int64 3
5
| detected_licenses
listlengths 0
161
| license_type
stringclasses 2
values | text
stringlengths 31
5.39M
| download_success
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
eadd24468ae7ead199175405f1e281017c474ce4
|
Shell
|
Jhingun1/repo
|
/archlinuxcn/google-earth/googleearth.sh
|
UTF-8
| 601
| 2.765625
| 3
|
[] |
no_license
|
#!/bin/sh
# Always run Google Earth from this shell script and not directly!
# This script makes sure the app looks in the right place for libraries
# that might also reside elsewhere.
#
# Ryan C. Gordon, Thu Jul 20 14:32:33 PDT 2006
# We alredy know the path
cd /opt/google/earth/free
## Fix the coordinates regression:
## http://productforums.google.com/forum/#!msg/earth/dlzBfGl4eKM/723naNYBo30J
#export LC_NUMERIC=en_US.UTF-8
# Fix Panoramio along with certain crashes
LD_PRELOAD=/usr/lib/libfreeimage.so.3:./baifaao.so:/usr/lib/libpng15.so \
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./googleearth-bin "$@"
| true
|
391d3928966d9a2c2eeeaeb348d5e51a044cc2ed
|
Shell
|
GuoJiafeng/Blog
|
/kill.sh
|
UTF-8
| 397
| 3.234375
| 3
|
[] |
no_license
|
#!/bin/bash
#################################
## @author guojiafeng ##
#################################
pid=`ps -ef | grep run.sh | grep -v "grep" | awk '{print $2}'`
ishave=`ps -ef | grep Blog.jar | grep -v "grep" |wc -l`
if [ $ishave -le 0 ];then
echo "ๆฒกๆๆฎ็่ฟ็จ"
else
echo "ๆๆฎ็่ฟ็จ"
for id in $pid
do
kill -9 $id
echo "killed $id"
done
fi
| true
|
71c8e2110a37d19cce280179a6a4640877ba9292
|
Shell
|
aguther/wireshark-build
|
/wireshark-build.sh
|
UTF-8
| 537
| 3.265625
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
# defaults
WIRESHARK_VERSION_TAG=v2.4.6
WIRESHARK_BUILD_DIRECTORY=/tmp/wireshark
# ensure directory is not present
rm -rf ${WIRESHARK_BUILD_DIRECTORY}
# get git repository
git clone https://code.wireshark.org/review/wireshark ${WIRESHARK_BUILD_DIRECTORY}
# change to git repository
pushd ${WIRESHARK_BUILD_DIRECTORY}
# get tag
git checkout tags/${WIRESHARK_VERSION_TAG}
# generate build files
./autogen.sh
# configure
./configure --with-gtk=yes --with-qt=no
# build
make rpm-package
# restore directory
popd
| true
|
24f8489ee5237bf6eec4d09d79c8463ddd048943
|
Shell
|
Nebo15/mithril.api
|
/bin/hooks/pre-start.sh
|
UTF-8
| 216
| 2.6875
| 3
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
#!/bin/sh
# `pwd` should be /opt/mithril_api
APP_NAME="mithril_api"
if [ "${DB_MIGRATE}" == "true" ]; then
echo "[WARNING] Migrating database!"
./bin/$APP_NAME command "Elixir.Mithril.ReleaseTasks" migrate!
fi;
| true
|
b3ce318768388f79c1a932fabf596cf49fc5839e
|
Shell
|
lubiedo/lite-macos
|
/bundle_macos.sh
|
UTF-8
| 956
| 2.8125
| 3
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
#!/bin/bash
# macos release
./build.sh release macos
rm lite-macos.zip 2>/dev/null
rm โrf lite.app 2>/dev/null
mkdir -p lite.app/Contents/{Frameworks,MacOS,Resources}
# frameworks
cp -RH /Library/Frameworks/SDL2.framework lite.app/Contents/Frameworks/
rm -fr lite.app/Contents/Frameworks/SDL2.framework/Versions/A/Headers/
rm -fr lite.app/Contents/Frameworks/SDL2.framework/Headers
# resources
cp icon.icns lite.app/Contents/Resources/icon.icns
cp Info.plist lite.app/Contents/Info.plist
cp -R data lite.app/Contents/MacOS/data
# executable
cp lite lite.app/Contents/MacOS/lite
chmod +x lite.app/Contents/MacOS/lite
# relink
install_name_tool -change @rpath/SDL2.framework/Versions/A/SDL2 @executable_path/../Frameworks/SDL2.framework/Versions/A/SDL2 lite
install_name_tool -change @rpath/SDL2.framework/Versions/A/SDL2 @executable_path/../Frameworks/SDL2.framework/Versions/A/SDL2 lite.app/Contents/MacOS/lite
# zip
zip lite-macos.zip lite.app -r
| true
|
e88620024eef4f4a787b78695be6cda60db9d221
|
Shell
|
Patil-94/Assignment_shell
|
/While-statement/magicno.sh
|
UTF-8
| 574
| 3.703125
| 4
|
[] |
no_license
|
#! /bin/bash
read -p "enter the number between 1 and 100 " x
echo Think of any number between 1 and 100
low=1
high=100
while [ $low -lt $high ]
do
mid=$(( $(($low+$high))/2 ))
echo "press 1 if your value is mid=" $mid
echo "press 2 if your value is greater than mid"
echo "press 3 if your value is lesser than mid"
echo "your choice"
read n
case $n in
1)
break;
;;
2)
low=$mid
;;
3)
high=$mid
;;
*)
echo enter valid choice
;;
esac
done
echo "Your number is" $mid
| true
|
dbcab68663ce7f901a38528ffffa937019b057d8
|
Shell
|
datadevopscloud/sqlraytracer
|
/create.sh
|
UTF-8
| 965
| 3.484375
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/sh
PGHOST=localhost
PGPORT=5432
PGUSER=raytracer
PGDB=raytracer
PGPASSWORD=raytracer
export PGPASSWORD
# Creating this file overrides which scenes get rendered
scenelist_override=scenelist_override.txt
scenelist=scenelist.txt
psql \
--host=${PGHOST} \
--port=${PGPORT} \
--username=${PGUSER} \
--dbname=${PGDB} \
--file=setup.sql \
--file=raytracer.sql \
--command="\\timing" \
--command="\\copy (select scenename from scene) to './${scenelist}' csv"
test -e ${scenelist_override} && cp ${scenelist_override} ${scenelist}
while read scenename
do
echo ""
echo "Rendering scene ${scenename}"
psql \
--host=${PGHOST} \
--port=${PGPORT} \
--username=${PGUSER} \
--dbname=${PGDB} \
--command="UPDATE camera SET sceneid=(SELECT sceneid FROM scene WHERE scenename='${scenename}')" \
--command="\\timing" \
--command="\\copy (select * from ppm) to './${scenename}.ppm' csv"
xdg-open ${scenename}.ppm
done < ${scenelist}
| true
|
e32004edee370a0c91a682b9a33ed3f5eea19b0b
|
Shell
|
oda-hub/oda-dda-chart
|
/make.sh
|
UTF-8
| 907
| 2.71875
| 3
|
[] |
no_license
|
function create-secrets(){
kubectl -n staging-1-3 create secret generic dda-interface-token --from-file=./private/token.txt
# kubectl create secret generic odatests-tests-bot-password --from-file=./private/testbot-password.txt
# kubectl create secret generic odatests-secret-key --from-file=./private/secret-key.txt
# kubectl create secret generic minio-key --from-file=./private/minio-key.txt
# kubectl create secret generic jena-password --from-file=./private/jena-password.txt
# kubectl create secret generic logstash-entrypoint --from-file=./private/logstash-entrypoint.txt
}
function install() {
set -x
helm --name ${NAMESPACE:?}-dda-interface --namespace ${NAMESPACE:?} install . --set image.tag="$(cat dda-interface/image-tag)"
}
function upgrade() {
set -x
helm upgrade ${NAMESPACE:?}-dda-interface . --set image.tag="$(cat dda-interface/image-tag)"
}
$@
| true
|
ad83d0dac3af4da2661e87c2f3b61fb83b786eeb
|
Shell
|
maese18/imonet
|
/scripts/source-base-env.sh
|
UTF-8
| 1,148
| 3.03125
| 3
|
[] |
no_license
|
#!/bin/bash
# Import environment variables
printf "Loading environment variables from\n"
set -o allexport
printf "\t.env-${ENV}\n"
source ./.env-${ENV}
set +o allexport
# END IMPORT
export DEPLOYMENT=run-docker-services
export API_HOST_SCHEME=localhost # Allows WebApp to derive correct API url
# Calculate and set specific values to run with docker-compose with mapped ports
export WEBAPP_PORT=$(expr $PORT_RANGE_START + 61)
export DB_PORT=$(expr $PORT_RANGE_START + 21)
export DB_ADMIN_PORT=$(expr $PORT_RANGE_START + 22)
export DB_PORT_SERVICE=3306
export MONGO_DB_EXPOSED_PORT=$(expr $PORT_RANGE_START + 30)
export MONGO_EXPRESS_UI_EXPOSED_PORT=$(expr $PORT_RANGE_START + 31)
export API_MONGO_DB_PORT=$MONGO_EXPRESS_DB_PORT_SERVICE
export API_MONGO_HOST=mongo
export API_SERVER_PORT=3000 # Cannot be changed because docker-compose maps port 3000 to API-SERVER_PUBLIC_PORT
export API_SERVER_PUBLIC_PORT=$(expr $PORT_RANGE_START + 60) # Each customer has a specific port range
export API_DB_PORT=$DB_PORT
# UI env variables
export VUE_APP_API_URL=$API_SERVER_PROTOCOL://localhost:$API_SERVER_PUBLIC_PORT
| true
|
641cdf4f384a273e023a44d970b927c7efb62805
|
Shell
|
marakere/jubilant-temperature-data-logger
|
/src/app_build.sh
|
UTF-8
| 1,532
| 3.890625
| 4
|
[
"MIT"
] |
permissive
|
#!/usr/bin/bash
# $1 - project-dir
# $2 - api-name
# $3 - env-name
PROJECT_SRC=${PWD%/*}
PROJECT_SRC=${PROJECT_SRC}/src
API_NAME=$1
ENV_TYPE=$2
ENV_NAME=$3
echo $PROJECT_SRC
# By default - dev will be assigned
ENV_NAME=${ENV_NAME:=dev}
APP_NAME=recordtemperature
ASSET_BUCKET=REPLACE_WITH_AWS_BUCKETNAME
BUILD_DIR=${API_NAME}/build
function copy_project_dependencies() {
requirement=${API_NAME}/requirements.txt
if [ -f "$requirement" ]; then
echo "Installting packages into build directory"
pip install -r $requirement --upgrade -t $BUILD_DIR/
fi
cp -r ${API_NAME}/*.py $BUILD_DIR/
rsync -av --progress ${API_NAME}/** $BUILD_DIR/ --exclude build
}
function deploy_to_aws() {
cd ${API_NAME}
sam package --output-template-file packaged.yaml --s3-bucket $ASSET_BUCKET --s3-prefix serverless_lambda_package/${API_NAME}
STACK_NAME=$(echo "${API_NAME}" | sed -r 's/(^|_)([a-z])/\L\2/g')
STACK_NAME=${APP_NAME}-${ENV_NAME}-${STACK_NAME}
echo $STACK_NAME
aws cloudformation deploy --template-file packaged.yaml --parameter-overrides EnvName=${ENV_NAME} AppName=${APP_NAME} --stack-name ${STACK_NAME} --capabilities CAPABILITY_NAMED_IAM --region us-east-1
}
echo "Removing the existing build source and creating a new one"
rm -r $BUILD_DIR && mkdir -p $BUILD_DIR
# Invoke a method to install python dependencies and copy the required project source
copy_project_dependencies
if [ "${ENV_TYPE}" == "local" ]; then
cd ${API_NAME} && sam local start-api
elif [ "${ENV_TYPE}" == "aws" ]; then
deploy_to_aws
fi
| true
|
3324d2b69834569a12e0d706b0400439f622766d
|
Shell
|
janeyoung2018/symbolic-math
|
/cloud_setup.sh
|
UTF-8
| 711
| 2.71875
| 3
|
[] |
no_license
|
# Install requirements
sudo apt-get install -y build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev zlib1g-dev openssl libffi-dev python3-dev python3-setuptools wget
# Prepare to build
mkdir /tmp/Python36
cd /tmp/Python36
# Pull down Python 3.6.9, build, and install
wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tar.xz
tar xvf Python-3.6.9.tar.xz
cd /tmp/Python36/Python-3.6.9
./configure
sudo make altinstall
virtualenv -p python3.6 py_36_env
. py_36_env/bin/activate # if . does not work then use source py_36_env/bin/activate
pip install ipykernel
python -m ipykernel install --user --name=py_36_env
| true
|
d87f9c00320e317e45e16262ae2c23b55306fa80
|
Shell
|
CrisBogucki/cb-msc-env
|
/update.sh
|
UTF-8
| 2,379
| 3.03125
| 3
|
[] |
no_license
|
#!/usr/bin/env sh
set -eu
path_msc="microservices"
PRINT_BANNER() {
echo '
โโโโโโโโโโโโโโ โโโโ โโโโโโโโโโโโ โโโโโโโ โโโโโโโโโโโโ โโโโโโ โโโ
โโโโโโโโโโโโโโโโ โโโโโ โโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโ โโโ
โโโ โโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ โโโโโโ โโโโโโ โโโโโโ โโโ
โโโ โโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ โโโโโโ โโโโโโโโโโโโโโ โโโโ
โโโโโโโโโโโโโโโโ โโโ โโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโ โโโโโโ โโโโโโโ
โโโโโโโโโโโโโโ โโโ โโโโโโโโโโโ โโโโโโโ โโโโโโโโโโโ โโโโโ โโโโโ
'
}
DOWNLOAD() {
for msc in g-auth g-auth; do
echo "Downloading $msc microservice"
rm -rf ./$path_msc/$msc
mkdir ./$path_msc/$msc
cd ./$path_msc/$msc
git clone --recurse-submodules https://github.com/CrisBogucki/cb-msc-$msc.git .
cd ../..
done
clear
PRINT_BANNER
echo "Downloading microservices .......... done"
}
UPDATE() {
echo "Updating microservices ..............."
for msc in g-auth g-auth; do
echo "Updating $msc microservice"
cd ./$path_msc/$msc
clear
./update.sh
cd ../..
done
clear
PRINT_BANNER
echo "Updating microservices .......... done"
}
DEPLOY_BROCKER(){
sh ./deploy-brocker.sh
}
DEPLOY_MICROSERVICES() {
sh ./deploy-microservices.sh
}
PRINT_BANNER
DOWNLOAD
UPDATE
DEPLOY_BROCKER
DEPLOY_MICROSERVICES
| true
|
59427907d78388e4995b2f20998f46602c308147
|
Shell
|
bohyeon9888/Graduation_Thesis
|
/sample.sh
|
UTF-8
| 781
| 3.15625
| 3
|
[] |
no_license
|
#!/bin/bash
XSB_PATH=/home/stu1/XSBench/openmp-threading
FILEB_PATH=/home/stu1/filebench-1.5-alpha3/workloads
OUTPUT_ANON=Anon_usage.out
OUTPUT_ANONHUGE=Anonhuge_usage.out
TIME_SEQ=$(seq 0 300)
#THP enable
echo always > /sys/kernel/mm/transparent_hugepage/enabled
echo always > /sys/kernel/mm/transparent_hugepage/defrag
#execute bench
${XSB_PATH}/XSBench -t 4 -g 60000 -p 9000000 &
#log
for i in ${TIME_SEQ}
do
echo "time: ${i}s" >> ${OUTPUT_ANON}
echo "time: ${i}s" >> ${OUTPUT_ANONHUGE}
cat /proc/meminfo | grep AnonPage >> ${OUTPUT_ANON}
cat /proc/meminfo | grep AnonHuge >> ${OUTPUT_ANONHUGE}
sleep 1
done
#THP disable
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
#kill
sudo killall -9 XSBench
| true
|
0e9c38123cf7b7527453da94b7e050ecaf63cd9a
|
Shell
|
aleivag/pycon2018
|
/pycon/mon.sh
|
UTF-8
| 261
| 2.546875
| 3
|
[
"MIT"
] |
permissive
|
#/bin/bash
watch -n0.5 '
test -e /run/systemd/transient/mys.service &&
cat /run/systemd/transient/mys.service && echo ;
ps axf | tail -n 15 |grep -v "ps\|tail\|cat\|test\|watch";
systemctl -q is-active mys.service || systemctl reset-failed;
'
| true
|
a571c3d290376861d78f08daadd176ebf3849818
|
Shell
|
HPCToolkit/hpctoolkit-tests
|
/dyninst/mk-dyninst.sh
|
UTF-8
| 4,331
| 3.9375
| 4
|
[] |
no_license
|
#!/bin/sh
#
# Copyright (c) 2017, Rice University.
# See the file LICENSE for details.
#
# Mark W. Krentel
# March 2017
#
# This script uses an hpctoolkit-externals install directory to build
# a dyninst application. It adds the include and lib directories for
# binutils, boost, libelf, libdwarf, dyninst and zlib to the compile
# line.
#
# First, download and build externals. Then, run this script with
# the source file(s), any extra compiler options and the externals's
# install directory (prefix) as the last option.
#
# ./mk-dyninst.sh [options]... file.cpp ... ext-dir
#
# If the build succeeds, the script writes the file 'env.sh' with
# shell commands to set LD_LIBRARY_PATH.
#
# Note: please don't commit gratuitous changes to CXX and CXXFLAGS.
# If needed, edit the file for local systems (or put options on the
# command line), just don't push the changes to github.
#
CXX=g++
CXXFLAGS='-g -O -std=c++11'
environ=env.sh
#------------------------------------------------------------
die() {
if test "x$1" != x ; then
echo "error: $@"
fi
cat - <<EOF
usage: ./mk-dyninst.sh [options] ... file.cpp ... ext-dir
options = options added to the compile line
file.cpp = C++ source file(s)
ext-dir = path to externals install directory
EOF
exit 1
}
#------------------------------------------------------------
# Scan the command line for:
#
# 1. externals directory at the end of the list
# 2. first C++ source file, to set the output file name
# 3. whether the command line includes -o itself
if test "x$1" = x ; then
die
fi
marker='x-*-*-*-x'
EXTERNALS=
output=
has_dash_o=no
set -- "$@" "$marker"
while true
do
arg="$1"
shift
# externals directory at the end of the command line,
# delete it and the marker from the line
if test "x$1" = "x$marker" ; then
EXTERNALS="$arg"
shift
break
fi
# the first C++ source file sets the output file name
if test "x$output" = x ; then
case "$arg" in
*.cpp | *.cxx ) output=`expr "$arg" : '\(.*\)....'` ;;
*.cc ) output=`expr "$arg" : '\(.*\)...'` ;;
*.C ) output=`expr "$arg" : '\(.*\)..'` ;;
esac
fi
# see if the command line includes -o itself
if test "x$arg" = x-o ; then
has_dash_o=yes
fi
set -- "$@" "$arg"
done
if test ! -d "${EXTERNALS}/symtabAPI/include" \
|| test ! -d "${EXTERNALS}/symtabAPI/lib"
then
die "bad externals install directory: $EXTERNALS"
fi
EXTERNALS=`( cd "$EXTERNALS" && /bin/pwd )`
if test "x$output" = x ; then
die "missing source file(s)"
fi
#------------------------------------------------------------
# Make command line and compile.
BINUTILS_INC="${EXTERNALS}/binutils/include"
BINUTILS_LIB="${EXTERNALS}/binutils/lib"
BOOST_INC="${EXTERNALS}/boost/include"
BOOST_LIB="${EXTERNALS}/boost/lib"
ELF_INC="${EXTERNALS}/libelf/include"
ELF_LIB="${EXTERNALS}/libelf/lib"
DWARF_INC="${EXTERNALS}/libdwarf/include"
DWARF_LIB="${EXTERNALS}/libdwarf/lib"
S=/home/johnmc/pkgs-src/dyninst/INSTALL-dyninst
DYNINST_INC="${S}/include"
DYNINST_LIB="${S}/lib"
ZLIB_INC="${EXTERNALS}/zlib/include"
ZLIB_LIB="${EXTERNALS}/zlib/lib"
if test "$has_dash_o" = no ; then
set -- -o "$output" "$@"
fi
set -- \
$CXXFLAGS \
"$@" \
-I${BINUTILS_INC} \
-I${BOOST_INC} \
-I${ELF_INC} \
-I${DWARF_INC} \
-I${DYNINST_INC} \
-I${ZLIB_INC} \
${BINUTILS_LIB}/libbfd.a \
${BINUTILS_LIB}/libiberty.a \
${BINUTILS_LIB}/libopcodes.a \
-L${DYNINST_LIB} \
-lparseAPI -linstructionAPI -lsymtabAPI \
-ldynDwarf -ldynElf -lcommon \
-L${ELF_LIB} -lelf \
-L${DWARF_LIB} -ldwarf \
-L${ZLIB_LIB} -lz \
-ldl
echo $CXX $@
echo
$CXX "$@"
test $? -eq 0 || die "compile failed"
#------------------------------------------------------------
# If the program built ok, then write env.sh with shell commands to
# set LD_LIBRARY_PATH.
rm -f "$environ"
cat >"$environ" <<EOF
#
# Source me to set LD_LIBRARY_PATH
#
LD_LIBRARY_PATH="${BINUTILS_LIB}:\${LD_LIBRARY_PATH}"
LD_LIBRARY_PATH="${BOOST_LIB}:\${LD_LIBRARY_PATH}"
LD_LIBRARY_PATH="${ELF_LIB}:\${LD_LIBRARY_PATH}"
LD_LIBRARY_PATH="${DWARF_LIB}:\${LD_LIBRARY_PATH}"
LD_LIBRARY_PATH="${DYNINST_LIB}:\${LD_LIBRARY_PATH}"
LD_LIBRARY_PATH="${ZLIB_LIB}:\${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH
EOF
| true
|
0addb4ce384827a08b918c07cad32edd00888b0f
|
Shell
|
latifkabir/Computation_using_Fortran90
|
/cubpack/details.sh
|
UTF-8
| 563
| 3
| 3
|
[] |
no_license
|
#!/bin/bash
#
ar x $HOME/lib/$ARCH/libcubpack.a precision_model.mod
ar x $HOME/lib/$ARCH/libcubpack.a cui.mod
#
gfortran -c -g details.f90 >& compiler.txt
if [ $? -ne 0 ]; then
echo "Errors compiling details.f90"
exit
fi
rm compiler.txt
#
rm *.mod
#
gfortran details.o -L$HOME/lib/$ARCH -lcubpack
if [ $? -ne 0 ]; then
echo "Errors linking and loading details.o"
exit
fi
rm details.o
#
mv a.out details
./details > details.out
if [ $? -ne 0 ]; then
echo "Errors running details"
exit
fi
rm details
#
echo "The details test problem has been executed."
| true
|
b7194711d55e97ac1ca94518624dd6d52a0dd61a
|
Shell
|
salfter/bdarchiver
|
/settings-example.sh
|
UTF-8
| 442
| 3.15625
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
export MYSQL_HOST="MYSQL_SERVER_HOSTNAME"
export MYSQL_USER="MYSQL_USERNAME"
export MYSQL_PASSWD="MYSQL_PASSWORD"
export MYSQL_DB="backup_index"
eval `echo "select name, value from settings;" | mysql -h $MYSQL_HOST -u $MYSQL_USER --password=$MYSQL_PASSWD $MYSQL_DB | grep -Pv "name\tvalue" | sed "s/\t/=\"/;s/\$/\"/"`
PATHS=""
for i in $DIRS
do
PATHS="$PATHS $ROOTDIR/$i"
done
SEDROOTDIR="`echo $ROOTDIR | sed "s/\//\\\\\\\\\//g"`"
| true
|
a93d43fd20515474d3a7c5a0fb4d65efc04dae90
|
Shell
|
Toucher-F/deploy
|
/update/after_test.sh
|
UTF-8
| 3,181
| 3.3125
| 3
|
[] |
no_license
|
#/bin/bash
case $1 in
"30prod")
DTPATH=/media/sf_src
#for rewrite url
DT_URL="app.dprod.dealtap.ca"
#-------App-core config file argument start--------
ConfigAnalytics_SERVICE_URL="analytics.dprod.dealtap.ca"
AppFrontEnd_MAIN="http://app.dprod.dealtap.ca/"
AppFrontEnd_ALPHA="http://app.dprod.dealtap.ca/"
Config_URL_UI="http://app.dprod.dealtap.ca"
Config_URL_CORE="http://api.dprod.dealtap.ca"
#-------App-core config file argument end----------
#-------App-ui config file argument start----------
#ConfigApi_SOURCE=(ApiSource::CORE ApiSource::ANALYTICS)
ConfigApi_SOURCE=(http://api.dprod.dealtap.ca/api http://analytics.dprod.dealtap.ca/api)
#-------App-ui config file argument end------------
;;
"test30prod")
DTPATH=/media/sf_src
#for rewrite url
DT_URL="app.dprod.dealtap.ca"
#-------App-core config file argument start--------
ConfigAnalytics_SERVICE_URL="analytics.dprod.dealtap.ca"
AppFrontEnd_MAIN="http://app.dprod.dealtap.ca/"
AppFrontEnd_ALPHA="http://app.dprod.dealtap.ca/"
Config_URL_UI="http://app.dprod.dealtap.ca"
Config_URL_CORE="http://api.dprod.dealtap.ca"
#-------App-core config file argument end----------
#-------App-ui config file argument start----------
#ConfigApi_SOURCE=(ApiSource::CORE ApiSource::ANALYTICS)
ConfigApi_SOURCE=(http://api.dprod.dealtap.ca/api http://analytics.dprod.dealtap.ca/api)
#-------App-ui config file argument end------------
;;
*)
echo "please reset!"
exit 1
;;
esac
function modify-configuration {
#=========app-ui==========
if [ -e ${DTPATH}/app-ui/app/config/config.php ];then
cd ${DTPATH}/app-ui/app/config/
num=$(grep -in "ConfigApi::SOURCE" ./config.php | cut -d ":" -f 1)
j=0
for i in ${num[@]}
do
sed -i ''${i}'c\\t\t\tEnums\\ConfigApi::SOURCE => '\'${ConfigApi_SOURCE[$j]}\'',' ./config.php
((j++))
done
else
return 1
fi
#=========app-core==========
if [ -e ${DTPATH}/app-core/app/config/config.php ];then
cd ${DTPATH}/app-core/app/config/
sed -i '/Enums\\ConfigAnalytics::SERVICE_URL/c\\t\tEnums\\ConfigAnalytics::SERVICE_URL => '\'${ConfigAnalytics_SERVICE_URL}\'',' ./config.php
sed -i '/^\t*Enums\\AppFrontEnd::MAIN/,/^[\t]*],*$/c\\t\tEnums\\AppFrontEnd::MAIN => [\n\t\t\tEnums\\ConfigFrontEnd::URL_UI => '\'${AppFrontEnd_MAIN}\'',\n\t\t],' ./config.php
sed -i '/^\t*Enums\\AppFrontEnd::ALPHA/,/^[\t]*],*$/c\\t\tEnums\\AppFrontEnd::ALPHA => [\n\t\t\tEnums\\ConfigFrontEnd::URL_UI => '\'${AppFrontEnd_ALPHA}\'',\n\t\t]' ./config.php
sed -i '/Enums\\Config::URL_UI/c\\t\tEnums\\Config::URL_UI => '\'${Config_URL_UI}\'',' ./config.php
sed -i '/Enums\\Config::URL_CORE/c\\t\tEnums\\Config::URL_CORE => '\'${Config_URL_CORE}\'',' ./config.php
else
return 1
fi
}
function echo-status
{
echo "=====================$1 start $(date +%T)===================="
$1
if [ $? -eq 0 ]
then
echo "$1 success"
elif [ $? -eq 10 ];then
echo ""
else
echo "$1 faild"
sleep 10
exit 1
fi
echo "=====================$1 end $(date +%T)===================="
}
echo-status modify-configuration
sed -i '/if ($host ~ '\'${DT_URL}\'')/,/}$/d' /etc/nginx/sites-enabled/app-ui.conf
service nginx restart
| true
|
6c2bd6bd24b7d50f075fb67c9cc16bd2463eb5e3
|
Shell
|
leavesofgrass/rpi-stuff
|
/a11y-configs/alarmpi/console-espeakup/scripts/140-install-tclx.sh
|
UTF-8
| 575
| 3.5
| 4
|
[] |
no_license
|
#!/bin/bash
set -e
cd "${BUILD_PATH}"
echo '-- Checking to see if tclx is already installed...'
if [ $(which tclx) ]; then
echo "-- tclx is already installed"
exit 0
fi
echo '-- Installing tclx from the AUR...'
cower -d tclx
pushd tclx
echo "-- Adding 'armv6h' to the PKGBUILD architectures..."
sed -i-old "s:^arch=(\(.*\)):arch=(\1 'armv6h'):" PKGBUILD
makepkg -i --asroot --noconfirm --noprogressbar
echo '--Copying the omitted tclx library...'
cp -r pkg/usr/lib/tclx8.4/ /usr/lib
popd
echo '-- Finished installing tclx, tidying up...'
set +e
rm -rf tclx/
exit 0
| true
|
83377d2cd50572c623099a4b70840ab2d2a0b18b
|
Shell
|
rutsky/prometheus_bot
|
/t/curl.t
|
UTF-8
| 451
| 3.390625
| 3
|
[] |
no_license
|
#!/bin/bash
files=$(find testdata -name *.json)
echo "1..$(echo "$files"|wc -l)"
for file in $files
do
result="$(curl -sw '\n%{http_code}' --data-binary "@$file" 127.0.0.1:9087/alert/${TELEGRAM_CHATID})"
code=$(echo "$result"|tail -1)
responce=$(echo "$result"|head -n -1 )
test "$code" -eq 200 && msg="ok" || msg="not ok"
echo "$msg $((++i)) -" ${file#testdata/}
echo $responce|jq -C . 2>/dev/null| sed -E 's/^(.)/# \1/'
done
| true
|
9e222866fcff5af108fac7a478a1af9a0427f61d
|
Shell
|
interserver/vps_host_server
|
/vps_kvm_lvmcreate.sh
|
UTF-8
| 1,174
| 3.3125
| 3
|
[] |
no_license
|
#!/bin/bash
export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin"
name=$1
size=$2
IFS="
"
if [ $# -ne 2 ]; then
echo "Create a New LVM (non destructivly)"
echo "Syntax $0 [name] [size]"
echo " ie $0 windows1337 101000"
#check if vps exists
else
echo "Creating LVM ${name}"
if [ "$(lvdisplay |grep 'Allocated pool')" = "" ]; then
thin="no"
else
thin="yes"
fi
if [ "$size" = "all" ]; then
if [ "$(lvdisplay /dev/vz/$name)" = "" ]; then
#lvcreate -y -l +100%FREE -n${name} vz
lvcreate -y -L $(echo "($(pvdisplay -c|grep :vz: | cut -d: -f8,10| tr : "*"))-(1024*1024*4)"|bc)k -n${name} vz
else
echo "already exists, extending to 100%"
#lvextend -f -l +100%FREE /dev/vz/$name
lvextend -f -L +$(echo "($(pvdisplay -c|grep :vz: | cut -d: -f8,10| tr : "*"))-(1024*1024*4)"|bc)k /dev/vz/$name
fi
elif [ "$(lvdisplay /dev/vz/$name | grep "LV Size.*"$(echo "$size / 1024" | bc -l | cut -d\. -f1))" = "" ]; then
if [ "$thin" = "yes" ]; then
lvcreate -y -V${size} -T vz/thin -n${name}
else
lvcreate -y -L${size} -n${name} vz
fi
else
echo "already exists, skipping"
fi
fi
| true
|
bc0fbec646c13b1e00215f354f70c7c2e4415ac5
|
Shell
|
cdesaintleger/navigator
|
/hack/e2e.sh
|
UTF-8
| 15,295
| 3.484375
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
set -o xtrace
# Close stdin
exec 0<&-
: ${TEST_PREFIX:=""}
: ${NAVIGATOR_IMAGE_REPOSITORY:="quay.io/jetstack"}
: ${NAVIGATOR_IMAGE_TAG:="build"}
: ${NAVIGATOR_IMAGE_PULLPOLICY:="Never"}
export \
NAVIGATOR_IMAGE_REPOSITORY \
NAVIGATOR_IMAGE_TAG \
NAVIGATOR_IMAGE_PULLPOLICY
NAVIGATOR_NAMESPACE="navigator"
RELEASE_NAME="nav-e2e"
ROOT_DIR="$(git rev-parse --show-toplevel)"
SCRIPT_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
ARTIFACTS_DIR="${PWD}/_artifacts"
mkdir -p "${ARTIFACTS_DIR}"
source "${SCRIPT_DIR}/libe2e.sh"
# Override these variables in order change the repository and pull policy from
# if you've published test images to your own repository.
: ${CHART_VALUES:="${SCRIPT_DIR}/testdata/values.yaml"}
: ${CHART_VALUES_CASSANDRA:="${SCRIPT_DIR}/testdata/values_cassandra.yaml"}
# Save the cluster logs when the script exits (success or failure)
trap "dump_debug_logs ${ARTIFACTS_DIR}/dump_debug_logs" EXIT
helm delete --purge "${RELEASE_NAME}" || true
function debug_navigator_start() {
kubectl api-versions
kubectl get pods --all-namespaces
kubectl describe --namespace "${NAVIGATOR_NAMESPACE}" deploy
kubectl describe --namespace "${NAVIGATOR_NAMESPACE}" pod
}
function navigator_install() {
echo "Installing navigator..."
helm delete --purge "${RELEASE_NAME}" || true
kubectl delete --now namespace "${NAVIGATOR_NAMESPACE}" || true
retry not kubectl get namespace "${NAVIGATOR_NAMESPACE}"
kube_create_namespace_with_quota "${NAVIGATOR_NAMESPACE}"
if helm --debug install \
--namespace "${NAVIGATOR_NAMESPACE}" \
--wait \
--name "${RELEASE_NAME}" contrib/charts/navigator \
--values ${CHART_VALUES}
then
return 0
fi
return 1
}
# Retry helm install to work around intermittent API server availability.
# See https://github.com/jetstack/navigator/issues/118
if ! retry navigator_install; then
debug_navigator_start
echo "ERROR: Failed to install Navigator"
exit 1
fi
# Wait for navigator API to be ready
function navigator_ready() {
local replica_count_controller=$(
kubectl get deployment ${RELEASE_NAME}-navigator-controller \
--namespace "${NAVIGATOR_NAMESPACE}" \
--output 'jsonpath={.status.readyReplicas}' || true)
if [[ "${replica_count_controller}" -eq 0 ]]; then
return 1
fi
local replica_count_apiserver=$(
kubectl get deployment ${RELEASE_NAME}-navigator-apiserver \
--namespace "${NAVIGATOR_NAMESPACE}" \
--output 'jsonpath={.status.readyReplicas}' || true)
if [[ "${replica_count_apiserver}" -eq 0 ]]; then
return 1
fi
if ! kubectl api-versions | grep 'navigator.jetstack.io'; then
return 1
fi
# Even after the API appears in api-versions, it takes a short time for API
# server to recognise navigator API types.
if ! kubectl get esc; then
return 1
fi
if ! kube_event_exists "${NAVIGATOR_NAMESPACE}" \
"navigator-controller:Endpoints:Normal:LeaderElection"
then
return 1
fi
return 0
}
echo "Waiting for Navigator to be ready..."
if ! retry navigator_ready; then
debug_navigator_start
echo "ERROR: Timeout waiting for Navigator API"
exit 1
fi
TEST_ID="$(date +%s)-${RANDOM}"
function fail_test() {
echo "TEST FAILURE: $1"
exit 1
}
function test_general() {
echo "Testing General"
local namespace="${1}"
kube_create_namespace_with_quota "${namespace}"
local invalid_namespace="notarealnamespace"
echo "Ensuring NamespaceLifecycle admission controller blocks creation of resources in non-existent namespaces"
if kubectl create --namespace "${invalid_namespace}" -f "${SCRIPT_DIR}/testdata/testpilot.yaml"; then
fail_test "navigator-apiserver allowed creation of a resource in a namespace that does not exist"
fi
echo "Ensuring we can create resources in valid namespaces"
if ! kubectl create --namespace "${namespace}" -f "${SCRIPT_DIR}/testdata/testpilot.yaml"; then
fail_test "navigator-apiserver should allow creation of resources in namespaces that exist"
fi
}
GENERAL_TEST_NS="test-general-${TEST_ID}"
test_general "${GENERAL_TEST_NS}"
kube_delete_namespace_and_wait "${GENERAL_TEST_NS}"
function test_elasticsearchcluster() {
local namespace="${1}"
echo "Testing ElasticsearchCluster"
kube_create_namespace_with_quota "${namespace}"
if ! kubectl get esc; then
fail_test "Failed to use shortname to get ElasticsearchClusters"
fi
# Create and delete an ElasticSearchCluster
if ! kubectl create \
--namespace "${namespace}" \
--filename \
<(envsubst \
'$NAVIGATOR_IMAGE_REPOSITORY:$NAVIGATOR_IMAGE_TAG:$NAVIGATOR_IMAGE_PULLPOLICY' \
< "${SCRIPT_DIR}/testdata/es-cluster-test.template.yaml")
then
fail_test "Failed to create elasticsearchcluster"
fi
if ! kubectl get \
--namespace "${namespace}" \
ElasticSearchClusters; then
fail_test "Failed to get elasticsearchclusters"
fi
if ! retry kubectl get \
--namespace "${namespace}" \
service es-test; then
fail_test "Navigator controller failed to create elasticsearchcluster service"
fi
if ! retry kube_event_exists "${namespace}" \
"navigator-controller:ElasticsearchCluster:Normal:CreateNodePool"
then
fail_test "Navigator controller failed to create CreateNodePool event"
fi
# Wait for Elasticsearch pod to enter 'Running' phase
if ! retry TIMEOUT=300 stdout_equals "Running" kubectl \
--namespace "${namespace}" \
get pod \
"es-test-mixed-0" \
"-o=go-template={{.status.phase}}"
then
fail_test "Elasticsearch pod did not enter 'Running' phase"
fi
# A Pilot is elected leader
if ! retry TIMEOUT=300 kube_event_exists "${namespace}" \
"generic-pilot:ConfigMap:Normal:LeaderElection"
then
fail_test "Elasticsearch pilots did not elect a leader"
fi
# Ensure the Pilot updates the document count on the pilot resource
if ! retry TIMEOUT=300 stdout_gt 0 kubectl \
--namespace "${namespace}" \
get pilot \
"es-test-mixed-0" \
"-o=go-template={{.status.elasticsearch.documents}}"
then
fail_test "Elasticsearch pilot did not update the document count"
fi
# Ensure the Pilot reports the overall cluster health back to the API
if ! retry TIMEOUT=300 stdout_equals "Yellow" kubectl \
--namespace "${namespace}" \
get elasticsearchcluster \
"test" \
"-o=go-template={{.status.health}}"
then
fail_test "Elasticsearch cluster health status should reflect cluster state"
fi
}
if [[ "test_elasticsearchcluster" = "${TEST_PREFIX}"* ]]; then
ES_TEST_NS="test-elasticsearchcluster-${TEST_ID}"
test_elasticsearchcluster "${ES_TEST_NS}"
kube_delete_namespace_and_wait "${ES_TEST_NS}"
fi
function test_cassandracluster() {
echo "Testing CassandraCluster"
local namespace="${1}"
export CASS_NAME="test"
export CASS_NODEPOOL1_DATACENTER="region-1"
export CASS_NODEPOOL1_RACK="zone-a"
export CASS_NODEPOOL1_NAME="np-${CASS_NODEPOOL1_DATACENTER}-${CASS_NODEPOOL1_RACK}"
export CASS_REPLICAS=1
export CASS_CQL_PORT=9042
export CASS_VERSION="3.11.1"
kube_create_namespace_with_quota "${namespace}"
if ! kubectl get \
--namespace "${namespace}" \
CassandraClusters; then
fail_test "Failed to get cassandraclusters"
fi
if ! kubectl get \
--namespace "${namespace}" \
cassandra; then
fail_test "Failed to get cassandraclusters short name (cassandra)"
fi
if ! kubectl apply \
--namespace "${namespace}" \
--filename \
<(envsubst \
'$NAVIGATOR_IMAGE_REPOSITORY:$NAVIGATOR_IMAGE_TAG:$NAVIGATOR_IMAGE_PULLPOLICY:$CASS_NAME:$CASS_NODEPOOL1_DATACENTER:$CASS_NODEPOOL1_RACK:$CASS_NODEPOOL1_NAME:$CASS_REPLICAS:$CASS_VERSION' \
< "${SCRIPT_DIR}/testdata/cass-cluster-test.template.yaml")
then
fail_test "Failed to create cassandracluster"
fi
# A NodePool is created
if ! retry TIMEOUT=300 kube_event_exists "${namespace}" \
"navigator-controller:CassandraCluster:Normal:CreateNodePool"
then
fail_test "A CreateNodePool event was not recorded"
fi
# A Pilot is elected leader
if ! retry TIMEOUT=300 kube_event_exists "${namespace}" \
"generic-pilot:ConfigMap:Normal:LeaderElection"
then
fail_test "Cassandra pilots did not elect a leader"
fi
if ! retry TIMEOUT=300 \
stdout_equals "${CASS_VERSION}" \
kubectl --namespace "${namespace}" \
get pilots \
--output 'jsonpath={.items[0].status.cassandra.version}'
then
kubectl --namespace "${namespace}" get pilots -o yaml
fail_test "Pilots failed to report the expected version"
fi
# Wait 5 minutes for cassandra to start and listen for CQL queries.
if ! retry TIMEOUT=300 cql_connect \
"${namespace}" \
"cass-${CASS_NAME}-nodes" \
"${CASS_CQL_PORT}"; then
fail_test "Navigator controller failed to create cassandracluster service"
fi
if ! retry TIMEOUT=300 in_cluster_command \
"${namespace}" \
"alpine:3.6" \
/bin/sh -c "apk add --no-cache curl && curl -vv http://cass-${CASS_NAME}-nodes:8080"; then
fail_test "Pilot did not start Prometheus metric exporter"
fi
# Create a database
cql_connect \
"${namespace}" \
"cass-${CASS_NAME}-nodes" \
"${CASS_CQL_PORT}" \
--debug \
< "${SCRIPT_DIR}/testdata/cassandra_test_database1.cql"
# Insert a record
cql_connect \
"${namespace}" \
"cass-${CASS_NAME}-nodes" \
"${CASS_CQL_PORT}" \
--debug \
--execute="INSERT INTO space1.testtable1(key, value) VALUES('testkey1', 'testvalue1')"
# Delete the Cassandra pod and wait for the CQL service to become
# unavailable (readiness probe fails)
kubectl --namespace "${namespace}" delete pod "cass-${CASS_NAME}-${CASS_NODEPOOL1_NAME}-0"
retry \
not \
cql_connect \
"${namespace}" \
"cass-${CASS_NAME}-nodes" \
"${CASS_CQL_PORT}" \
--debug
# Kill the cassandra process gracefully which allows it to flush its data to disk.
# kill_cassandra_process \
# "${namespace}" \
# "cass-${CASS_NAME}-${CASS_NODEPOOL1_NAME}-0" \
# "cassandra" \
# "SIGTERM"
# Test that the data is still there after the Cassandra process restarts
#
# XXX: The first successful connection to the database should return the testvalue1.
# I.e. The `stdout_matches` should come before `retry`
# In practice I'm finding that `kubectl run cqlsh` sometimes succeeds,
# but does not relay the pod output.
# Maybe due to https://github.com/kubernetes/kubernetes/issues/27264
if ! retry TIMEOUT=300 \
stdout_matches "testvalue1" \
cql_connect \
"${namespace}" \
"cass-${CASS_NAME}-nodes" \
"${CASS_CQL_PORT}" \
--debug \
--execute='SELECT * FROM space1.testtable1'
then
fail_test "Cassandra data was lost"
fi
echo "Collecting events during scale out..."
# Get names of nodepool pods before the scale out (line separated)
local original_pods_file="${ARTIFACTS_DIR}/test_cassandra.scale_out_original_pods"
kubectl --namespace "${namespace}" get pods \
--selector="navigator.jetstack.io/cassandra-cluster-name=${CASS_NAME}" \
--output='jsonpath={range .items[*]}{.metadata.name}{"\n"}{end}' \
> "${original_pods_file}"
local events_file="${ARTIFACTS_DIR}/test_cassandra.scale_out_events"
kubectl --namespace "${namespace}" get events --watch-only > "${events_file}" &
local events_pid="${!}"
echo "Incrementing the replica count..."
export CASS_REPLICAS=2
kubectl apply \
--namespace "${namespace}" \
--filename \
<(envsubst \
'$NAVIGATOR_IMAGE_REPOSITORY:$NAVIGATOR_IMAGE_TAG:$NAVIGATOR_IMAGE_PULLPOLICY:$CASS_NAME:$CASS_NODEPOOL1_DATACENTER:$CASS_NODEPOOL1_RACK:$CASS_NODEPOOL1_NAME:$CASS_REPLICAS:$CASS_VERSION' \
< "${SCRIPT_DIR}/testdata/cass-cluster-test.template.yaml")
# The NodePool is scaled out
if ! retry TIMEOUT=300 kube_event_exists "${namespace}" \
"navigator-controller:CassandraCluster:Normal:ScaleOut"
then
fail_test "A ScaleOut event was not recorded"
fi
if ! retry TIMEOUT=300 stdout_equals 2 kubectl \
--namespace "${namespace}" \
get cassandracluster \
"${CASS_NAME}" \
"-o=jsonpath={ .status.nodePools['${CASS_NODEPOOL1_NAME}'].readyReplicas }"
then
fail_test "Second cassandra node did not become ready"
fi
echo "Checking original pods for 'Unhealthy' events during scale out..."
kill "${events_pid}"
if fgrep --file "${original_pods_file}" "${events_file}" | fgrep "Unhealthy"
then
fail_test "original pods were unhealthy during the scale out"
fi
rm -f "${events_file}" "${original_pods_file}"
# TODO: A better test would be to query the endpoints and check that only
# the `-0` pods are included. E.g.
# kubectl -n test-cassandra-1519754828-19864 get ep cass-cassandra-1519754828-19864-cassandra-seeds -o "jsonpath={.subsets[*].addresses[*].hostname}"
if ! stdout_equals "cass-${CASS_NAME}-${CASS_NODEPOOL1_NAME}-0" \
kubectl get pods --namespace "${namespace}" \
--selector=navigator.jetstack.io/cassandra-seed=true \
--output 'jsonpath={.items[*].metadata.name}'
then
fail_test "First cassandra node not marked as seed"
fi
if ! retry \
stdout_matches "testvalue1" \
cql_connect \
"${namespace}" \
"cass-${CASS_NAME}-nodes" \
"${CASS_CQL_PORT}" \
--debug \
--execute='CONSISTENCY ALL; SELECT * FROM space1.testtable1'
then
fail_test "Data was not replicated to second node"
fi
simulate_unresponsive_cassandra_process \
"${namespace}" \
"cass-${CASS_NAME}-${CASS_NODEPOOL1_NAME}-0"
if ! retry TIMEOUT=600 \
stdout_matches "testvalue1" \
cql_connect \
"${namespace}" \
"cass-${CASS_NAME}-nodes" \
"${CASS_CQL_PORT}" \
--debug \
--execute='CONSISTENCY ALL; SELECT * FROM space1.testtable1'
then
fail_test "Cassandra liveness probe failed to restart dead node"
fi
}
if [[ "test_cassandracluster" = "${TEST_PREFIX}"* ]]; then
CASS_TEST_NS="test-cassandra-${TEST_ID}"
for i in {1..2}; do
kube_create_pv "${CASS_TEST_NS}-pv${i}" 5Gi default
done
test_cassandracluster "${CASS_TEST_NS}"
kube_delete_namespace_and_wait "${CASS_TEST_NS}"
fi
| true
|
6699f96c1484410e9f4b73ad71201f8f1a9172be
|
Shell
|
EatShanZha/cpp-lsac
|
/deplibs/cryptopp/script/build.sh
|
UTF-8
| 244
| 2.84375
| 3
|
[
"BSL-1.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
#sh
# $1 source directory
# $2 libcryptopp.a cp directory
#
#
cd $1
#make disclean
#make clean
make
if [[ ! -f "libcryptopp.a" ]]; then
echo "build crptycpp error."
else
ehco "copy libcryptopp.a to $2"
cp "libcryptopp.a" $2
fi
| true
|
fb27addc9466a5de6fe6a67c71559a58cf209268
|
Shell
|
jbasem/mssk
|
/src/resources/project_template/base_files/deploy_ecr_to_ecs.sh
|
UTF-8
| 2,532
| 4.03125
| 4
|
[] |
no_license
|
#!/usr/bin/env bash
##############
#### NOTE ####
# Use this script to update an ECS service (defined by $ECS_CLUSTER_NAME and $ECS_SERVICE_NAME) with
# the ECR image defined in the task defenition. (i.e. the LATEST), without updating the task revision.
##############
set -eo pipefail
# more bash-friendly output for jq
JQ="jq --raw-output --exit-status"
deploy_cluster() {
ECS_CLUSTER_NAME=ms-app-dev
ECS_SERVICE_NAME=ms-app-main-dev
echo "Triggering ecs update-service"
DEPLOYMENT_REVISION=$(aws ecs update-service \
--cluster "${ECS_CLUSTER_NAME}" \
--service "${ECS_SERVICE_NAME}" \
--force-new-deployment \
--output text \
--query service.taskDefinition)
if [ "$DEPLOYMENT_REVISION" = "" ]; then
echo "Error updating service."
return 1
fi
echo "Current revision: $DEPLOYMENT_REVISION"
echo "Verifying service deployment.."
attempt=0
while [ "$attempt" -lt 20 ]
do
DEPLOYMENTS=$(aws ecs describe-services \
--cluster ${ECS_CLUSTER_NAME} \
--services ${ECS_SERVICE_NAME} \
--output text \
--query 'services[0].deployments[].[taskDefinition, status]')
NUM_DEPLOYMENTS=$(aws ecs describe-services \
--cluster ${ECS_CLUSTER_NAME} \
--services ${ECS_SERVICE_NAME} \
--output text \
--query 'length(services[0].deployments)')
READY_PRIMARY=$(aws ecs describe-services \
--cluster ${ECS_CLUSTER_NAME} \
--services ${ECS_SERVICE_NAME} \
--output text \
--query "services[0].deployments[?taskDefinition==\`$DEPLOYMENT_REVISION\` && runningCount == desiredCount && status == \`PRIMARY\`][taskDefinition]")
echo "Current deployments: $DEPLOYMENTS"
if [ "$NUM_DEPLOYMENTS" = "1" ] && [ "$READY_PRIMARY" = "$DEPLOYMENT_REVISION" ]; then
echo "The task definition revision $DEPLOYMENT_REVISION is the only deployment for the service and has attained the desired running task count."
echo "Deployment Succeeded!!"
return 0
else
echo "Waiting for revision $DEPLOYMENT_REVISION to be primary with desired running count / older revisions to be stopped.."
sleep 15
fi
attempt=$((attempt + 1))
done
echo "TIMEOUT: Stopped waiting for deployment to be stable - please check the status of deployment status on the AWS ECS console."
return 1
}
deploy_cluster
| true
|
b8452af6d54edf7726f2bbe6c308ef5b3a22e95a
|
Shell
|
ulloa/blockchairScrape
|
/combineBlockData.sh
|
UTF-8
| 515
| 3.859375
| 4
|
[] |
no_license
|
#!/bin/bash
OutFileName="fulldata.csv" # Fix the output name
i=0 # Reset a counter
for filename in ./data/*.csv; do
if [ "$filename" != "$OutFileName" ] ; # Avoid recursion
then
if [[ $i -eq 0 ]] ; then
head -1 $filename > $OutFileName # Copy header if it is the first file
fi
tail -n +2 $filename >> $OutFileName # Append from the 2nd line each file
i=$(( $i + 1 )) # Increase the counter
fi
done
| true
|
bbf9f58a9f29394cc81373b8cc397d1aa96f3f5e
|
Shell
|
fujin/dockerfiles
|
/etcd/start.sh
|
UTF-8
| 261
| 2.953125
| 3
|
[] |
no_license
|
#!/bin/sh
# Start etcd.
ETCD="/etcd/bin/etcd"
HOSTNAME=$(hostname)
IPADDRESS=$(
ip -o -4 addr show dev eth0 |
cut -d' ' -f7 |
cut -d'/' -f1
)
echo 127.0.0.1 $HOSTNAME > /etc/hosts
echo $IPADDRESS $HOSTNAME >> /etc/hosts
$ETCD -vv -h $IPADDRESS $@
| true
|
eac1c79f1430dafac2b04fe7ecc967cd5b15ffff
|
Shell
|
980venkat/costing
|
/tags/add_tag_snap.sh
|
UTF-8
| 425
| 3.296875
| 3
|
[] |
no_license
|
#!/bin/bash
for region in `aws ec2 describe-regions --output text | cut -f3`
do
echo -e "\nListing Instances in region:'$region'..."
aws ec2 describe-snapshots --region $region --query 'Snapshots[*].{ID:SnapshotId}' > $region-snp.json
jq -c '.[]' $region-snp.json | while read i;
do
SNAP_ID=$(jq -r '.ID' <<< "$i");
aws ec2 create-tags --resources $SNAP_ID --tags Key=,Value=
done
done
| true
|
539f2cf54100903e563100a54b4b6e1a9e81ce43
|
Shell
|
schaefer-dev/UNI-Mips-Project
|
/sorted/runtests
|
UTF-8
| 497
| 3.21875
| 3
|
[] |
no_license
|
#! /bin/sh
set -eu
SOURCES="testmain.asm util.asm sorted.asm"
NTEST=0
NFAIL=0
for I in tests/*.asm; do
NTEST=$(($NTEST + 1))
echo "===> $I"
if [ ! -f "${I%.asm}.ref" ]; then
echo "reference file missing"
elif RES=$(mars ae1 me nc sm 1000000 $SOURCES "$I"); then
if echo "$RES" | diff -u "${I%.asm}.ref" -; then
continue
fi
else
echo "MARS exited with status code $?"
fi
NFAIL=$(($NFAIL + 1))
done
echo '--------------------'
echo "===> $NFAIL/$NTEST failed"
[ "$NFAIL" -eq 0 ]
| true
|
f32900fb801f8ab527f1a3dcdfa54b7652fe88b6
|
Shell
|
tluck/OpsMgr
|
/k8s/deploy_Operator.bash
|
UTF-8
| 895
| 3.109375
| 3
|
[] |
no_license
|
#!/bin/bash
d=$( dirname "$0" )
cd "${d}"
source init.conf
# Optinal - Create the metrics server
#kubectl apply -f /opt/Source/metrics-server/components.yaml
# Create the namespace and context
kubectl create namespace ${namespace}
kubectl config set-context $(kubectl config current-context) --namespace=${namespace}
# Deploy the MongoDB Enterprise Operator
myoperator="${namespace}-myoperator.yaml"
kubectl apply -f crds.yaml
if [[ "${clusterType}" == "openshift" ]]
then
cat mongodb-enterprise-openshift.yaml | sed \
-e "s/namespace: mongodb/namespace: $namespace/" > "${myoperator}"
else
cat mongodb-enterprise.yaml | sed \
-e "s/namespace: mongodb/namespace: $namespace/" > "${myoperator}"
fi
kubectl apply -f "${myoperator}"
if [[ ${tls} == 1 ]]
then
certs/make_cert_issuer.bash ${namespace} ${issuerName} ${issuerVersion}
[[ $? != 0 ]] && exit 1
fi
exit 0
| true
|
d59354719d61763436a9199d31e5ce2d1a4efbf4
|
Shell
|
HexRabbit/clubfair_106_2
|
/magic_txt/mk.sh
|
UTF-8
| 118
| 2.734375
| 3
|
[] |
no_license
|
#!/bin/bash
for ((i=0; i<1000; i++)); do
zip flag.zip flag.txt
rm flag.txt
mv flag.zip flag.txt
echo $i
done
| true
|
1cfc14a46e8a60cb10799af5bce93d2e96379b30
|
Shell
|
Vectra130/vdr_scripts
|
/.scripte_sortieren.sh_all
|
UTF-8
| 9,347
| 3.53125
| 4
|
[] |
no_license
|
#!/bin/bash
# v1.14 all
#nur einmal ausfuehren!
sleep 1
[ $(pidof -x $(basename $0) | wc -w) -gt 2 ] && exit 0
if [ $(avahi-browse -ltk _VDR-Streaming-Bash._tcp | awk -F"|" '{ print $2 }' | grep scriptupdate | wc -l) != 0 ]; then
echo -e "\n\nEin anderes System aktualisiert gerade seine Skripte ... breche ab"
[ -e /etc/avahi/services/scriptupdate.service ] && rm /etc/avahi/services/scriptupdate.service
exit 2
fi
cat > /etc/avahi/services/scriptupdate.service <<EOF
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">|scriptupdate|%h|</name>
<service>
<type>_VDR-Streaming-Bash._tcp</type>
</service>
</service-group>
EOF
. /etc/vectra130/configs/sysconfig/.sysconfig
workDir=/nfs/vdr_files/VDR-script-versions
versionDir=$workDir/$HOSTNAME
scriptDir=/nfs/vdr_files/VDR-scripts
scriptBkpDir=$scriptDir/$HOSTNAME
if [ "$SYSTEMTYP" == "CLIENT" ]; then
TMP="$CLIENTTYP"
TMP2="SERVER"
if [ $(pidof -xs automount | wc -l) == 0 ]; then
. $SCRIPTDIR/.set_videodir
fi
else
TMP="$SYSTEMTYP"
TMP2="CLIENT"
if [ $(pidof -xs automount | wc -l) == 0 ]; then
start autofs
fi
fi
cd $SCRIPTDIR
writeVersions() {
tmpVers=$(cat $1 | grep -i "#.*v[0-9].[0-9].*$3" | grep -i -v "$4" | awk '{ print $2 }' | sed -e 's/^v//')
tmpVers1=$(echo $tmpVers | awk -F"." '{ print $1 }')
tmpVers2=$(echo $tmpVers | awk -F"." '{ print $2 }')
tmpVers3=$(echo $tmpVers | awk -F"." '{ print $3 }')
tmpVers=$[ tmpVers1*1000000 + tmpVers2*1000 + tmpVers3 ]
tmp=$(echo -n $1"|"; echo $tmpVers)
echo $tmp >> $versionDir/"$2"
[ ! -d ./"$2"/"$(dirname $1)" ] && mkdir -p ./"$2"/"$(dirname $1)"
[ ! -e ./"$2"/"$1" ] && ln -s ../"$1" ./"$2"/"$1"
}
copy_new_scripts() {
while read cpfile; do
cp $scriptDir/$cpfile $SCRIPTDIR/
cp $scriptDir/$cpfile $scriptBkpDir/
done < /tmp/.copy_changed_scripts
while read cpfile; do
cp $scriptDir/$cpfile $SCRIPTDIR/
cp $scriptDir/$cpfile $scriptBkpDir/
done < /tmp/.copy_new_scripts
#[ -e /etc/avahi/services/scriptupdate.service ] && rm /etc/avahi/services/scriptupdate.service
#exit 0
}
summary() {
echo -e "\n\n\n*** Zusammenfassung:"
if [ $(cat /tmp/.copy_new_scripts | wc -l) -gt 0 ]; then
echo -e "\n\nDiese Dateien sind neu und werden kopiert:"
while read tmp; do
echo " "$tmp
done < /tmp/.copy_new_scripts
fi
if [ $(cat /tmp/.copy_changed_scripts | wc -l) -gt 0 ]; then
echo -e "\n\nDiese Dateien haben eine neuere Version und werden kopiert:"
while read tmp; do
echo " "$tmp
done < /tmp/.copy_changed_scripts
fi
if [ $(cat /tmp/.diff_scripts | wc -l) -gt 0 ]; then
echo -e "\n\nDiese Dateien haben die selbe Version, sind aber unterschiedlich:"
while read tmp; do
echo " "$tmp
done < /tmp/.diff_scripts
fi
echo -e "\n\n"
}
list_script_versions() {
[ ! -e $versionDir ] && mkdir -p $versionDir
[ $(ls -a $versionDir/ | wc -w) -gt 2 ] && rm $versionDir/*
for rm in all_clients all_VDR test_scripts only_$TMP; do
[ -e ./"$rm" ] && rm -r ./"$rm"
done
echo -e "\n\tScripte werden katalogisiert ...\n"
for i in $(find ./ -type f | sed -e 's!^[.]/!!' | tr "\n" " "); do
echo -n "."
if [ $(grep -i "# v[0-9].[0-9].*all client" $i | wc -l) == 1 ]; then
echo -n "+"
writeVersions $i "all_clients" "all client" "NONE"
fi
if [ $(grep -i "# v[0-9].[0-9].*all" $i | grep -i -v client | wc -l) == 1 ]; then
echo -n "+"
writeVersions $i "all_VDR" "all" "client"
fi
if [ $(grep -i "# v[0-9].[0-9].*$TMP" $i | wc -l) == 1 ]; then
echo -n "+"
writeVersions $i only_$TMP $TMP "NONE"
fi
if [ $(grep -i "# v[0-9].[0-9].*test" $i | wc -l) == 1 ]; then
echo -n "+"
writeVersions $i "test_scripts" "test" "NONE"
fi
done
echo -e "\n----- unsortiert"
for i in $(find ./.* -maxdepth 0 -type f | sed -e 's![.]/!!' | tr "\n" " "); do
if [[ ! -e all_clients/$i && ! -e all_VDR/$i && ! -e only_$TMP/$i && ! -e test_scripts/$i ]]; then
echo $i
echo $i >> $versionDir/unsortiert
fi
done
}
save_scripts() {
[ -e $scriptBkpDir ] && rm -r $scriptBkpDir
mkdir -p $scriptBkpDir
echo -e "\n\tScripte werden gesichert ...\n"
cp -ra $SCRIPTDIR/* $scriptBkpDir/
cp -ra $SCRIPTDIR/.[a-zA-Z]* $scriptBkpDir/
}
check_versions() {
echo -e "\n\tVersionen abgleichen ...\n\n"
[ $(ls -a /tmp/ | grep ".diff" | wc -l) -gt 0 ] && rm /tmp/.*.diff
[ -e /tmp/.copy_new_scripts.tmp ] && rm /tmp/.copy_new_scripts.tmp
[ -e /tmp/.copy_changed_scripts ] && rm /tmp/.copy_changed_scripts
[ -e /tmp/.diff_scripts ] && rm /tmp/.diff_scripts
touch /tmp/.copy_changed_scripts
touch /tmp/.diff_scripts
touch /tmp/.copy_new_scripts.tmp
for otherDir in $(ls $workDir/ | grep -v "$HOSTNAME"); do
echo -en "\n[$(basename $otherDir)]"
#echo "--- otherDir: $otherDir"
for thisFile in $(ls $versionDir/ | grep -i -v unsortiert); do
#echo "--- thisFile: $thisFile"
while read this; do
thisName=$(echo $this | awk -F"|" '{ print $1 }')
thisVersion=$(echo $this | awk -F"|" '{ print $2 }')
thisVersion=$[ thisVersion+1-1 ]
for otherFile in $(ls $workDir/$otherDir/ | grep -v unsortiert | grep -v "$TMP2"); do
#echo "--- otherFile: $otherFile"
while read other; do
echo -en "."
neScript="0"
otherName=$(echo $other | awk -F"|" '{ print $1 }')
otherVersion=$(echo $other | awk -F"|" '{ print $2 }')
otherVersion=$[ otherVersion+1-1 ]
otherTestFile=$workDir/$otherDir/$otherFile/$otherName
otherScriptFile=$scriptDir/$otherDir/$otherName
thisTestFile=$versionDir/$thisFile/$thisName
thisScriptFile=$scriptBkpDir/$thisName
#identische Script Namen?
if [ "$thisName" == "$otherName" ]; then
#fremdes Script geeignet?
if ( [ $(cat $otherScriptFile | grep "# v[0-9].[0-9]" | wc -w) == 3 ] && [ $(cat $otherScriptFile | grep "# v[0-9].[0-9]" | awk '{ print $3 }' | grep -i -E "(all|$TMP|test)" | wc -l) == 1 ] ) || ( [ $(cat $otherScriptFile | grep "# v[0-9].[0-9]" | wc -w) == 4 ] && [ $(cat $otherScriptFile | grep "# v[0-9].[0-9]" | awk '{ print $4 }' | grep -i "$SYSTEMTYP" | wc -l) == 1 ] ); then
#fremdes Script neuer?
if [ $thisVersion -lt $otherVersion ]; then
echo -en "\e[33m<\e[0m"
diff -u $thisScriptFile $otherScriptFile > /tmp/.scripte_diff.tmp
cp /tmp/.scripte_diff.tmp /tmp/$(echo $thisName | sed 's/\//_/g')-${otherDir}.diff
diffPlus=$(cat /tmp/.scripte_diff.tmp | grep "^+" | grep -v "++" | wc -l)
diffMinus=$(cat /tmp/.scripte_diff.tmp | grep "^\-" | grep -v "\-\-" | wc -l)
# echo -e "\nGefunden:\t\t$thisName\nIst Version:\t\t$thisVersion\nVergleichVersion:\t$otherVersion\nVergleichsSystem:\t$otherDir\nKriterium:\t\t$(cat $otherScriptFile | grep '# v[0-9].[0-9]' | awk '{ print $3 " " $4 }')\nDifferenzen (+):\t$diffPlus\nDifferenzen (-):\t$diffMinus\n"
echo "$otherDir/$otherName" >> /tmp/.copy_changed_scripts
fi
if [ $thisVersion -gt $otherVersion ]; then
echo -en ">"
fi
if [ $thisVersion == $otherVersion ]; then
echo -en "\e[32m=\e[0m"
fi
#fremdes Script unterschiedlich?
if [[ "$thisName" == "$otherName" && $[ otherVersion - thisVersion ] == 0 ]]; then
diff -u $thisScriptFile $otherScriptFile > /tmp/.scripte_diff.tmp
diffPlus=$(cat /tmp/.scripte_diff.tmp | grep "^+" | grep -v "++" | wc -l)
diffMinus=$(cat /tmp/.scripte_diff.tmp | grep "^\-" | grep -v "\-\-" | wc -l)
if [ $(cat /tmp/.scripte_diff.tmp | wc -l) -gt 0 ]; then
echo -en "\e[31mx\e[0m"
# echo -e "\n***\nDifferenz gefunden:\t$thisName\nDifferenz System:\t$otherDir\nKriterium:\t\t$(cat $otherScriptFile | grep '# v[0-9].[0-9]' | awk '{ print $3 " " $4 }')\nDifferenzen (+):\t$diffPlus\nDifferenzen (-):\t$diffMinus\n"
cp /tmp/.scripte_diff.tmp /tmp/$(echo $thisName | sed 's/\//_/g')-${otherDir}.diff
echo -e "$otherDir/$otherName\t +${diffPlus}/-${diffMinus}" >> /tmp/.diff_scripts
fi
fi
fi
break
fi
#neues Script?
if [[ ! -e $SCRIPTDIR/$otherName && $(cat /tmp/.copy_new_scripts.tmp | grep "$otherName" | wc -l) == 0 ]]; then
#echo "[ ! -e $SCRIPTDIR/$otherName ] && cat $otherScriptFile | grep '# v[0-9].[0-9]'"
if ( [ $(cat $otherScriptFile | grep "# v[0-9].[0-9]" | wc -w) == 3 ] && [ $(cat $otherScriptFile | grep "# v[0-9].[0-9]" | awk '{ print $3 }' | grep -i -E "(all|$TMP|test)" | wc -l) == 1 ] ) || ( [ $(cat $otherScriptFile | grep "# v[0-9].[0-9]" | wc -w) == 4 ] && [ $(cat $otherScriptFile | grep "# v[0-9].[0-9]" | awk '{ print $4 }' | grep -i "$SYSTEMTYP" | wc -l) == 1 ] ); then
echo -en "\e[34m+\e[0m"
echo "$otherDir/$otherName" >> /tmp/.copy_new_scripts.tmp
break
fi
fi
done < $workDir/$otherDir/$otherFile
done
done < $versionDir/$thisFile
done
done
cat /tmp/.copy_new_scripts.tmp | sort | uniq > /tmp/.copy_new_scripts
summary
copy_new_scripts
}
case $1 in
step1)
list_script_versions
save_scripts
;;
step2)
check_versions
/etc/vectra130/scripts/.scripte_sortieren.sh step1 &
;;
list)
list_script_versions
;;
save)
save_scripts
;;
check)
check_versions
;;
all)
list_script_versions
save_scripts
check_versions
/etc/vectra130/scripts/.scripte_sortieren.sh step1 &
;;
*)
echo -e "\nusage: step1|step2|list|save|check|all"
;;
esac
echo -e "\n"
[ -e /etc/avahi/services/scriptupdate.service ] && rm /etc/avahi/services/scriptupdate.service
exit 0
| true
|
ffb7a77a2c5913e97506dea7b2cf77ea349c73b6
|
Shell
|
quequotion/mmug-qq
|
/glibc-git-multilib/PKGBUILD
|
UTF-8
| 8,284
| 2.953125
| 3
|
[] |
no_license
|
pkgbase=glibc-git-multilib
pkgname=({lib32-,}glibc-git)
_pkgname=glibc
pkgver=2.21.617.gd87630e
pkgrel=1
pkgdesc="GNU C Library"
arch=('x86_64')
url="http://www.gnu.org/software/libc"
license=('GPL' 'LGPL')
groups=('base')
depends=('linux-api-headers>=3.7' 'tzdata' 'filesystem>=2013.01')
makedepends=('gcc' 'git')
backup=(etc/gai.conf
etc/locale.gen
etc/nscd.conf)
options=('!strip')
install=glibc.install
source=(git://sourceware.org/git/glibc.git
nscd.service
nscd.tmpfiles
locale.gen.txt
locale-gen
lib32-glibc.conf
dtv-surplus.patch)
md5sums=('SKIP'
'c1e07c0bec0fe89791bfd9d13fc85edf'
'bccbe5619e75cf1d97312ec3681c605c'
'07ac979b6ab5eeb778d55f041529d623'
'476e9113489f93b348b21e144b6a8fcf'
'63709cb3900cc217294415769a35904c'
'7496f60f1cc97127a95d8970705d8255')
pkgver() {
cd "${srcdir}/${_pkgname}"
git describe --always | sed 's|-|.|g' | sed 's|glibc.||g'
}
build() {
cd "${srcdir}"
#Build native libraries
[[ -d build-x86_64 ]] || mkdir build-x86_64
pushd build-x86_64
echo "slibdir=/usr/lib" > configparms
echo "sbindir=/usr/bin" >> configparms
echo "rootsbindir=/usr/bin" >> configparms
CFLAGS=${CFLAGS/-fstack-protector-strong -fstack-protector-all/}
CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
"${srcdir}/${_pkgname}/configure" --prefix=/usr --lib{,exec}dir=/usr/lib \
--with-{headers=/usr/include,bugurl=https://bugs.archlinux.org/} \
--disable-profile \
--enable-{obsolete-rpc,bind-now,stackguard-randomization,lock-elision} \
--enable-{add-ons=libidn,kernel=3.18.0,multi-arch,lto}
echo "build-programs=no" >> configparms
make
# re-enable hardening for programs
sed -i "/build-programs=/s#no#yes#" configparms
echo "CC += -fstack-protector-strong -fstack-protector-all -D_FORTIFY_SOURCE=2" >> configparms
echo "CXX += -fstack-protector-strong -fstack-protector-all -D_FORTIFY_SOURCE=2" >> configparms
CFLAGS=${CFLAGS/-fno-stack-protector/}
make
# remove harding in preparation to run test-suite
sed -i '4,6d' configparms
CC=${CC/-fstack-protector-strong -fstack-protector-all -D_FORTIFY_SOURCE=2/}
CXX=${CXX/-fstack-protector-strong -fstack-protector-all -D_FORTIFY_SOURCE=2/}
popd
# Hack to work around dynamic loading limit for PCSX2 profiling
cd "${srcdir}/${_pkgname}"
patch -Np2 < $srcdir/dtv-surplus.patch
# Fix the source tree?
#make clean
#Build 32bit libraries
[[ -d build-i686 ]] || mkdir build-i686
pushd build-i686
#if [[ ${CARCH} = "i686" ]]; then
# Hack to fix NPTL issues with Xen, only required on 32bit platforms
# TODO: make separate glibc-xen package for i686
export CFLAGS+=" -mno-tls-direct-seg-refs"
#fi
echo "slibdir=/usr/lib32" > configparms
echo "sbindir=/usr/bin" >> configparms
echo "rootsbindir=/usr/bin" >> configparms
export CC="gcc -m32"
export CXX="g++ -m32"
export LDFLAGS+=" -m32"
CFLAGS=${CFLAGS/-fstack-protector-strong -fstack-protector-all/-fno-stack-protector}
CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
"${srcdir}/${_pkgname}/configure" --prefix=/usr --lib{,exec}dir=/usr/lib32 \
--with-{headers=/usr/include,bugurl=https://bugs.archlinux.org/} \
--disable-profile \
--enable-{obsolete-rpc,bind-now,stackguard-randomization,lock-elision} \
--enable-{add-ons=libidn,kernel=3.18.0,multi-arch,lto} \
--build=i686-pc-linux-gnu
# build libraries with hardening disabled
echo "build-programs=no" >> configparms
make
# re-enable hardening for programs
sed -i "/build-programs=/s#no#yes#" configparms
echo "CC += -fstack-protector-strong -fstack-protector-all -D_FORTIFY_SOURCE=2" >> configparms
echo "CXX += -fstack-protector-strong -fstack-protector-all -D_FORTIFY_SOURCE=2" >> configparms
CFLAGS=${CFLAGS/-fno-stack-protector/}
make
# remove harding in preparation to run test-suite
sed -i '4,6d' configparms
#CC=${CC/-fstack-protector-strong -fstack-protector-all -D_FORTIFY_SOURCE=2/}
#CXX=${CXX/-fstack-protector-strong -fstack-protector-all -D_FORTIFY_SOURCE=2/}
popd
}
check() {
# bug to file - the linker commands need to be reordered
LDFLAGS=${LDFLAGS/--as-needed,/}
CC=${CC/-m32/}
CXX=${CXX/-m32/}
LDFLAGS=${LDFLAGS/-m32/}
echo "Check native build"
cd ${srcdir}/build-x86_64
make check
export CC="gcc -m32"
export CXX="g++ -m32"
export LDFLAGS+=" -m32"
echo "Check i686 build"
cd ${srcdir}/build-i686
make check
}
package_glibc-git() {
optdepends+=('gd')
provides=(glibc{,-git}=${pkgver})
conflicts=('glibc')
cd ${srcdir}/build-x86_64
install -dm755 ${pkgdir}/etc
touch ${pkgdir}/etc/ld.so.conf
CC=${CC/-m32/}
CXX=${CXX/-m32/}
LDFLAGS=${LDFLAGS/-m32/}
make install_root=${pkgdir} install
rm -f ${pkgdir}/etc/ld.so.{cache,conf}
install -dm755 ${pkgdir}/usr/lib/{locale,systemd/system,tmpfiles.d}
install -m644 ${srcdir}/${_pkgname}/nscd/nscd.conf ${pkgdir}/etc/nscd.conf
install -m644 ${srcdir}/nscd.service ${pkgdir}/usr/lib/systemd/system
install -m644 ${srcdir}/nscd.tmpfiles ${pkgdir}/usr/lib/tmpfiles.d/nscd.conf
install -m644 ${srcdir}/${_pkgname}/posix/gai.conf ${pkgdir}/etc/gai.conf
install -m755 ${srcdir}/locale-gen ${pkgdir}/usr/bin
# temporary symlink
ln -s ../../sbin/ldconfig ${pkgdir}/usr/bin/ldconfig
# create /etc/locale.gen
install -m644 ${srcdir}/locale.gen.txt ${pkgdir}/etc/locale.gen
sed -e '1,3d' -e 's|/| |g' -e 's|\\| |g' -e 's|^|#|g' \
${srcdir}/glibc/localedata/SUPPORTED >> ${pkgdir}/etc/locale.gen
# Do not strip the following files for improved debugging support
# ("improved" as in not breaking gdb and valgrind...):
# ld-${pkgver}.so
# libc-${pkgver}.so
# libpthread-${pkgver}.so
# libthread_db-1.0.so
cd $pkgdir
strip $STRIP_BINARIES sbin/{ldconfig,sln} \
usr/bin/{gencat,getconf,getent,iconv,locale,localedef} \
usr/bin/{makedb,pcprofiledump,pldd,rpcgen,sprof} \
usr/lib/getconf/* \
usr/sbin/{iconvconfig,nscd}
[[ $CARCH = "i686" ]] && strip $STRIP_BINARIES usr/bin/lddlibc4
strip $STRIP_STATIC usr/lib/*.a
strip $STRIP_SHARED usr/lib/{libanl,libBrokenLocale,libcidn,libcrypt}-*.so \
usr/lib/libnss_{compat,db,dns,files,hesiod,nis,nisplus}-*.so \
usr/lib/{libdl,libm,libnsl,libresolv,librt,libutil}-*.so \
usr/lib/{libmemusage,libpcprofile,libSegFault}.so \
usr/lib/{audit,gconv}/*.so
}
package_lib32-glibc-git() {
optdepends+=('lib32-gd')
pkgdesc+=" (32-bit + DTVx2)"
provides=(lib32-glibc{,-git}=${pkgver})
conflicts=('lib32-glibc')
cd ${srcdir}/build-i686
export CC="gcc -m32"
export CXX="g++ -m32"
export LDFLAGS+=" -m32"
make install_root=${pkgdir} install
rm -rf ${pkgdir}/{etc,sbin,usr/{bin,sbin,share},var}
# We need one 32 bit specific header file
find ${pkgdir}/usr/include -type f -not -name stubs-32.h -delete
# Dynamic linker
mkdir ${pkgdir}/usr/lib
ln -s ../lib32/ld-linux.so.2 ${pkgdir}/usr/lib/
# Add lib32 paths to the default library search path
install -Dm644 "$srcdir/lib32-glibc.conf" "$pkgdir/etc/ld.so.conf.d/lib32-glibc.conf"
# Symlink /usr/lib32/locale to /usr/lib/locale
ln -s ../lib/locale "$pkgdir/usr/lib32/locale"
# remove the static libraries that have a shared counterpart
# libc, libdl, libm and libpthread are required for toolchain testsuites
# in addition libcrypt appears widely required
rm $pkgdir/usr/lib32/lib{anl,BrokenLocale,nsl,resolv,rt,util}.a
# Do not strip the following files for improved debugging support
# ("improved" as in not breaking gdb and valgrind...):
# ld-${pkgver}.so
# libc-${pkgver}.so
# libpthread-${pkgver}.so
# libthread_db-1.0.so
cd $pkgdir
strip $STRIP_BINARIES \
\
\
usr/lib32/getconf/*
strip $STRIP_STATIC usr/lib32/*.a
strip $STRIP_SHARED usr/lib32/{libanl,libBrokenLocale,libcidn,libcrypt}-*.so \
usr/lib32/libnss_{compat,db,dns,files,hesiod,nis,nisplus}-*.so \
usr/lib32/{libdl,libm,libnsl,libresolv,librt,libutil}-*.so \
usr/lib32/{libmemusage,libpcprofile,libSegFault}.so \
usr/lib32/{audit,gconv}/*.so
}
| true
|
d95e242ab1e284bd8201b600cac416533a2e97fd
|
Shell
|
thales17/dotfiles
|
/bin/podcast
|
UTF-8
| 981
| 3.421875
| 3
|
[
"BSD-3-Clause"
] |
permissive
|
#!/bin/bash
URL="play.pocketcasts.com"
WIN="ajr-pocketcasts"
start () {
wmctrl -a $WIN
if [ $? -eq 0 ]; then
return
fi
wmctrl -a "Firefox"
if [ $? -eq 1 ]; then
echo "Starting firefox"
firefox &
sleep 2
wmctrl -r "Firefox" -b add,maximized_vert,maximized_horz
wmctrl -r "Firefox" -t 1
fi
# Assumes you are logged in
firefox -new-window $URL
# Wait for the browser to open
sleep 1.5
wmctrl -r "Pocket Casts" -N $WIN
# Make sure the window is not maximized
wmctrl -r $WIN -b remove,maximized_horz,maximized_vert
# Set the size of the window to be small
wmctrl -r $WIN -e 0,0,10,320,480
# Wait for the JavaScript to load
sleep 1.5
wmctrl -a "Emacs"
}
toggle () {
# Raise the window
wmctrl -a $WIN
# Press space to start the podcasts
xdotool key "space"
# Minimize the window
wmctrl -r $WIN -b add,hidden
wmctrl -a "Firefox"
wmctrl -a "Emacs"
}
start
toggle
| true
|
c8255f5f93283a3bbac415c35448211c370e4ad5
|
Shell
|
vignat/vignat
|
/nf/testbed/hard/bench-all.sh
|
UTF-8
| 931
| 3.4375
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
# Initialize the machines, i.e. software+scripts
. ./init-machines.sh
# Clean first, just in case
. ./clean.sh
VNDS_PREFIX="$HOME/vnds/nf"
NOW=$(date +"%d.%m.%Y_%H_%M")
MIDDLEBOXES=("$VNDS_PREFIX/vignat" "$VNDS_PREFIX/unverified-nat" "$VNDS_PREFIX/nop")
SCENARIOS=("mg-new-flows-latency" "mg-existing-flows-latency" "mg-1p")
mkdir -p $NOW
for MIDDLEBOX in ${MIDDLEBOXES[@]}; do
# The second parameter should not matter (it doesn't for mg-* scenarios,
# but unfortunately it does for the old ones, so to not try this for those)
. ./init.sh $MIDDLEBOX "mg-1p"
for SCENARIO in ${SCENARIOS[@]}; do
. ./start-middlebox.sh $MIDDLEBOX $SCENARIO
CLEAN_APP_NAME=`echo "$MIDDLEBOX" | tr '/' '_'`
RESULTS_FILE="$NOW/$CLEAN_APP_NAME-$SCENARIO.results"
. ./run.sh $MIDDLEBOX $SCENARIO $RESULTS_FILE
. ./stop-middlebox.sh $MIDDLEBOX $SCENARIO
done
done
. ./clean.sh
| true
|
a65a80d1cd54e7292833c8ce49b5d369bca95103
|
Shell
|
cometsong/symlinks
|
/test/generate-rootfs.sh
|
UTF-8
| 4,675
| 3.4375
| 3
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
#
# Unit test for symlinks
# Generate artificial rootfs for testing purpose
#
SYMLINKS_BIN=../symlinks
ROOTFS_FOLDER=rootfs
TEST_FOLDER=$(dirname $0)
# create rootfs folder and cd into it
mkdir -p $TEST_FOLDER/$ROOTFS_FOLDER
cd $TEST_FOLDER/$ROOTFS_FOLDER
echo "* Creating artificial rootfs in $TEST_FOLDER/$ROOTFS_FOLDER"
###################################################################################################
# Create an example rootfs
###################################################################################################
mkdir -p usr \
lib \
etc \
opt \
usr/bin \
usr/sbin \
usr/share \
usr/lib \
usr/lib/toolchain/bin \
usr/lib/libsomething \
usr/lib/jvm/java-1.5-jdk-1.5.2/bin \
etc/alternatives \
lib/toolchain1/bin \
lib/toolchain2/bin
touch usr/lib/libsomething/libsomething.so.1.1.1 \
usr/lib/libsomething/libsomething.so.1.1.2 \
usr/lib/libsomething/libsomething.so.1.2.1 \
usr/lib/libsomething/libsomething.so.1.2.2 \
usr/lib/libsomething/libsomething.so.1.2.3 \
usr/lib/libsomething/libsomething.so.2.1.1 \
usr/lib/libsomething/libsomething.so.2.1.2 \
usr/lib/libsomething/libsomething.so.2.1.3 \
lib/toolchain1/bin/tool1 \
lib/toolchain1/bin/tool2 \
lib/toolchain2/bin/tool1 \
lib/toolchain2/bin/tool2 \
usr/lib/jvm/java-1.5-jdk-1.5.2/jdk-config \
usr/lib/jvm/java-1.5-jdk-1.5.2/bin/java
###################################################################################################
# Test case #1: normal chained / cascaded symlinks in the case of software versioning
#
# Expected Result: do nothing, everything is fine here!
###################################################################################################
ln -sf libsomething.so.1.1.2 \
usr/lib/libsomething/libsomething.so.1.1
ln -sf libsomething.so.1.2.3 \
usr/lib/libsomething/libsomething.so.1.2
ln -sf libsomething.so.1.2.3 \
usr/lib/libsomething/libsomething.so.1
ln -sf libsomething.so.2.1.3 \
usr/lib/libsomething/libsomething.so.2.1
ln -sf libsomething.so.2.1 \
usr/lib/libsomething/libsomething.so.2
ln -sf libsomething.so.2 \
usr/lib/libsomething/libsomething.so
ln -s java-1.5-jdk-1.5.2 \
usr/lib/jvm/java-1.5-jdk
###################################################################################################
# Test case #2: absolute symlinks
#
# Expected result: change absolute symlinks into relative ones
###################################################################################################
ln -sf /lib/toolchain2/bin/tool1 \
usr/lib/toolchain/bin/
ln -sf /lib/toolchain2/bin/tool2 \
usr/lib/toolchain/bin/
###################################################################################################
# Test case #3: detect dangling symlinks as in the case of messed up library versioning
#
# Expected result: detect and delete all symlinks which are involved
###################################################################################################
# now let's create a symlink to a target which doesn't exist
ln -sf libsomething.so.2.1.4 \
usr/lib/libsomething/libsomething.so.2.1
###################################################################################################
# Test case #4: recursive mess of absolute symlinks
#
# Expected result: resolve all symlinks, at least after second run!
###################################################################################################
ln -sf /usr/lib/toolchain/bin/tool1 \
etc/alternatives/
ln -sf /usr/lib/toolchain/bin/tool2 \
etc/alternatives/
ln -sf /usr/lib/jvm/java-1.5-jdk \
etc/alternatives/java-sdk
ln -sf /usr/lib/jvm/java-1.5-jdk/bin/java \
etc/alternatives/java
ln -sf /etc/alternatives/java \
usr/bin/
| true
|
0852bf614b4fee93e5a3654569a99e6976a42375
|
Shell
|
Cloudxtreme/snltd-monitor
|
/checks/hardware/check_link.sh
|
UTF-8
| 1,666
| 3.46875
| 3
|
[] |
no_license
|
#=============================================================================
#
# check_link.sh
# -------------
#
# Check to see if we have a consistent link speed on all our cabled ethernet
# ports. We've had some oddities with autoneg and changing speeds on the
# 10.10.4 network, so I thought it would be a good idea to monitor it.
#
# Now requires the followin in /etc/security/exec_attr
#
# snltd Monitor:solaris:cmd:::/sbin/dladm:privs=sys_net_config,net_rawaccess
#
# R Fisher 02/2009
#
# v1.0 Initial Release
#
# v1.1 Uses pfexec and RBAC. RDF 23/03/09
#
#=============================================================================
#-----------------------------------------------------------------------------
# VARIABLES
STATE_FILE="${DIR_STATE}/dladm.state"
#-----------------------------------------------------------------------------
# SCRIPT STARTS HERE
# We need dladm for this
can_has dladm \
|| exit 4
# dladm keeps changing. Do we need to use show-ether or show-dev?
pfexec dladm help 2>&1 | egrep -s "show-ether" \
&& DLARG="show-ether" \
|| DLARG="show-dev"
# All we're going to do is record what dladm tells us about the physical
# links, and compare it to what it told us last time. This may cause false
# positives if Sun continue to mess with dladm, but I'll write something
# more intelligent if I have to
pfexec dladm $DLARG >$TMPFILE
if [[ -f $STATE_FILE ]]
then
if ! cmp -s $STATE_FILE $TMPFILE
then
EXIT=2
if [[ -n $RUN_DIAG ]]
then
print "previous datalink information:\n"
cat $STATE_FILE
print "\ncurrent datalink information:\n"
cat $TMPFILE
fi
fi
fi
mv $TMPFILE $STATE_FILE
exit $EXIT
| true
|
516169a8c4ad944843d5eb231692dfa81d2ca4d4
|
Shell
|
julie777/user_environment
|
/dot_files/bashrc
|
UTF-8
| 1,371
| 3.390625
| 3
|
[] |
no_license
|
# ! #/bin/bash
### ~/.bashrc ###
# ~/.bashrc: executed by bash(1) for non-login shells.
# and executed by .bash_profile for login shells
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
echo 'Running .bashrc'
USER_ENV_DIR=$(dirname "$(readlink -f "${BASH_SOURCE}")")
. ${USER_ENV_DIR}/env.conf
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
echo 'Interactive shell'
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
################ ALIASES and other INCLUDES #################
# separate files makes maintanence cleaner
for i in ${USER_ENV_DIR}/bash/*.sh
do
echo "Loading bash include file: $i"
. $i
done
| true
|
00ed276ce0cf8a22dd44996d2b71e1c7c937747f
|
Shell
|
SnakeDoc/LiLiCompiler
|
/scripts/compiler/zlib.sh
|
UTF-8
| 884
| 3.375
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
# Install Zlib
set -e
set -u
. settings/config
. settings/toolchain
. scripts/utils/utils.sh
pkg_dir="$(locate_package 'zlib')"
. "${pkg_dir}/package.mk"
cd "${CLFS_SOURCES}/"
if [ ! -e "${CLFS_SOURCES}/${PKG_NAME}-${PKG_VERSION}.tar.gz" ]; then
wget --read-timeout=20 "${PKG_URL}"
fi
cd "${CLFS_SOURCES}/"
# cleanup
if [ -d "${CLFS_SOURCES}/${PKG_NAME}-${PKG_VERSION}" ]; then
rm -rf "${CLFS_SOURCES}/${PKG_NAME}-${PKG_VERSION}"
fi
# now get started
cd "${CLFS_SOURCES}/"
tar -zxvf "${PKG_NAME}-${PKG_VERSION}.tar.gz"
cd "${CLFS_SOURCES}/${PKG_NAME}-${PKG_VERSION}/"
cp configure{,.orig}
sed -e 's/-O3/-Os/g' configure.orig > configure
./configure --shared
make
# for minimal bloat; will be copied over with shared libs
make prefix="${CLFS_TOOLS}/${CLFS_TARGET}" install
# cleanup
cd "${CLFS_SOURCES}/"
rm -rf "${PKG_NAME}-${PKG_VERSION}"
exit 0
| true
|
6a0ed3f77559ac6b5465974b6da346399ba9d9c5
|
Shell
|
liudongfei/PythonExamples
|
/make.sh
|
UTF-8
| 939
| 2.953125
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
echo "ๅผๅงๅถไฝ้ๅ..."
image_tag=`date +%Y%m%d` #_%H%M
echo "ๅฝๅๆถ้ด๏ผ$image_tag"
docker build -t registry.cn-shanghai.aliyuncs.com/liudongfei/python:v${image_tag} .
echo "ๅถไฝ้ๅๆๅ!"
docker login --username=ๆนๅไธ็็็
็ -p=liudf110628 registry.cn-shanghai.aliyuncs.com
# push้ๅ
docker push registry.cn-shanghai.aliyuncs.com/liudongfei/python:v${image_tag}
echo "้ๅ็ๆฌไฟๅญ"
# ๅฐๆๆฐ็็ๆฌ็้ๅ้ๅฝๅไธบ๏ผlatest,ๅนถpush
docker tag registry.cn-shanghai.aliyuncs.com/liudongfei/python:v${image_tag} registry.cn-shanghai.aliyuncs.com/liudongfei/python:latest
docker push registry.cn-shanghai.aliyuncs.com/liudongfei/python:latest
echo "ๅ ้คๆฌๅฐ้ๅ"
docker rmi registry.cn-shanghai.aliyuncs.com/liudongfei/python:v${image_tag}
docker run -t --rm --name=hello registry.cn-shanghai.aliyuncs.com/liudongfei/python python -W ignore pandas_demo/pandas_test.py
| true
|
c096ada92d882ac7eb9a428d81285088f103528b
|
Shell
|
aiguy110/proto-mesh
|
/proto-mesh/channels/.eth/start.sh
|
UTF-8
| 387
| 3.078125
| 3
|
[] |
no_license
|
#!/bin/bash
# Make sure config exists
if [ ! -f ./.eth/config ]; then
echo 'WiFi config file not present! Please add one at "proto-mesh/channels/.wifi/config"'
echo 'Aborting...'
exit
fi
# Load config
source ./.eth/config
# Get our classic 802.11 ad-hoc network up
ip link set down dev $IFACE
ip link set up dev $IFACE
# Add it as a batman interface
batctl if add $IFACE
| true
|
15a4cec2b3d5674cc7a5e60dea3861422ddafb41
|
Shell
|
matcls/holberton-system_engineering-devops
|
/0x0F-load_balancer/1-install_load_balancer
|
UTF-8
| 810
| 2.765625
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
# Install and configure HAproxy on a server.
apt -y update
apt -y install haproxy
cp /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.backup3
sed -i 's/ENABLED=0/ENABLED=1/' /etc/default/haproxy
cp /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.backup4
#sed -i "$ a\listen webapp 0.0.0.0:80\n\tmode http\n\tbalance roundrobin\n\toption httpclose\n\toption forwardfor\n\tserver gc-1512-web-01-1607317797 34.75.39.5:80 check\n\tserver gc-1512-web-02-1608527503 34.74.147.195:80 check" /etc/haproxy/haproxy.cfg
echo "frontend web
bind *:80
mode http
default_backend webapp
backend webapp
balance roundrobin
server 1512-web-01 34.75.39.5:80 check
server 1512-web-02 34.74.147.195:80 check" >> /etc/haproxy/haproxy.cfg
service haproxy restart
| true
|
d6dbd049bdda79fab44b0a415fd6cfcbcc5693dc
|
Shell
|
zgdkik/myops
|
/่ชๅจๅ่ฟ็ปด/ansible/ๅฎๆๆกไพ/ๅบไบansibleๅฎ็ฐ็ๅบ็จๅๅธ้จ็ฝฒๆนๆก/jenkins_deploy/lx-passport/shell/scripts/template/tomcat/bak/check_captcha_url
|
UTF-8
| 613
| 3.546875
| 4
|
[] |
no_license
|
#!/bin/bash
#description: check tomcat url...
TOMCAT_DIR=/usr/local/tomcat/webapps
for APP in $(ls -1 ${TOMCAT_DIR}/*.war | sed -r "s#(.*/)(.*)#\2#g" | sed "s#.war##g")
do
x=1
while((x<=10))
do
URL="http://127.0.0.1:8080/$(echo ${APP/\#/\/})"
RETURN_CODE=$(curl -I -m 5 --retry 3 --connect-timeout 5 -o /dev/null -s -w %{http_code} $URL)
if [ x"$RETURN_CODE" = x"200" -o x"$RETURN_CODE" = x"302" ];then
echo -e "${APP} ็ฌฌ${x}ๆฌก่ฎฟ้ฎๆๅ..."
break
else
echo -e "${APP} ็ฌฌ${x}ๆฌก่ฎฟ้ฎๅคฑ่ดฅ..."
fi
let x++
sleep 3
done
done
| true
|
b4860c0b19fe62b869c3ad177b50ccfca651fee1
|
Shell
|
ShellShoccar-jpn/Open-usp-Tukubai
|
/COMMANDS.SH/yarr
|
UTF-8
| 2,422
| 3.75
| 4
|
[
"MIT"
] |
permissive
|
#! /bin/sh
# designed by Nobuaki Tounaka
# written by 321516
# print the usage and exit
print_usage_and_exit () {
cat <<-__USAGE 1>&2
Usage : ${0##*/} [-<n>] [-d[<string>]] [num=<n>] <file>
Version : Wed Sep 23 17:33:47 JST 2015
: Open usp Tukubai (POSIX.1 Bourne Shell/POSIX.1 commands)
__USAGE
exit 1
}
# Initialize
set -u
umask 0022
PATH='/usr/bin:/bin'
IFS=$(printf ' \t\n_'); IFS=${IFS%_}
export IFS LANG=C LC_ALL=C PATH
# parse the arguments
n=-1
dopt=' '
numopt=0
file=''
n_is_set=0
dopt_is_set=0
numopt_is_set=0
case $# in [!0]*)
i=0
for arg in "$@"; do
i=$((i+1))
case $arg in
-[0-9]*)
printf '%s\n' "${arg#-}" | grep -q '^[0-9]\{1,\}$'
[ $? -eq 0 ] || print_usage_and_exit
if [ $n_is_set -eq 0 ]; then
n=${arg#-}
n_is_set=1
continue
fi
;;
num=[0-9]*)
printf '%s\n' "${arg#num=}" | grep -q '^[0-9]\{1,\}$'
[ $? -eq 0 ] || print_usage_and_exit
if [ $numopt_is_set -eq 0 ]; then
numopt=${arg#num=}
numopt_is_set=1
continue
fi
;;
-d*)
if [ $dopt_is_set -eq 0 ]; then
dopt=${arg#-d}
dopt_is_set=1
continue
fi
;;
-h|--help|--version)
print_usage_and_exit
;;
esac
[ $i -eq $# ] || print_usage_and_exit
file=$arg
done
;;
esac
[ -n "$file" ] || file='-'
# validate the file arguments
[ $n -ne 0 ] || print_usage_and_exit
if [ \( ! -r "$file" \) -a \( "_$file" != '_-' \) ]; then
printf '%s: Cannot open the file\n' "${0##*/}" 1>&2
exit 1
fi
case "$file" in ''|-|/*|./*|../*) :;; *) file="./$file";; esac
# main
export v1=$n
export v2=$numopt
export v3="$dopt"
exec awk '
BEGIN {
n = ENVIRON["v1"];
num = ENVIRON["v2"];
d = ENVIRON["v3"];
ORS = "";
idx0 = " ";
idx = "";
dlmr = "";
}
{
# ===== make the index string ====================================
#
if (num > 0) {
idx = "";
for (i=1; i<=num; i++) {
idx = idx $i OFS;
}
}
if (idx != idx0) {
cnt = n;
idx0 = idx;
}
# ===== YARRing ==================================================
#
for (i=1+num; i<=NF; i++) {
if (cnt == n) {
print dlmr idx;
dlm = "";
}
dlmr = "\n";
print dlm $i;
dlm = d;
cnt--;
if (cnt == 0) {
cnt = n;
}
}
}
END {
print dlmr;
}
' "$file"
| true
|
d2716e4537fb1f6aa96c659226866f9c01a150c6
|
Shell
|
aravindkarri/Shell-Programming
|
/Day6/Day6Prob3/checkPalindrome.sh
|
UTF-8
| 462
| 3.84375
| 4
|
[] |
no_license
|
#!/bin/bash -x
read -p "Enter a number : " num
reverse=0
temp=$num
function checkPalindrome()
{
while [ $num -ne 0 ]
do
remainder=$(($num%10))
reverse=$((($reverse*10)+$remainder))
num=$(($num/10))
done
if [ $temp -eq $reverse ]
then
echo "$temp is palindrome"
else
echo "$temp is not a palindrome"
fi
}
checkPalindrome $num
| true
|
1aa1e1e5433521eba8b5cd4a76c3251193a78374
|
Shell
|
test-mass-forker-org-1/implementation-patterns
|
/diagnostics-log-analytics/components/diag.subscription.sh
|
UTF-8
| 1,220
| 2.9375
| 3
|
[
"MIT",
"LicenseRef-scancode-generic-cla"
] |
permissive
|
#!/bin/bash
# Params
subscription_id=""
location=""
log_analytics_resource_group_name=""
log_analytics_workspace_name=""
# Get LA resource ID, needed for az monitor command
log_analytics_resource_id="$(az monitor log-analytics workspace show --subscription "$subscription_id" -g "$log_analytics_resource_group_name" -n "$log_analytics_workspace_name" -o tsv --query "id")"
echo "Create diagnostic setting"
az monitor diagnostic-settings subscription create --subscription "$subscription_id" --location "$location" --verbose \
--name "sub-diag-eastus2" --workspace "$log_analytics_resource_id" \
--logs '[
{
"category": "Administrative",
"enabled": true
},
{
"category": "Alert",
"enabled": true
},
{
"category": "Autoscale",
"enabled": true
},
{
"category": "Policy",
"enabled": true
},
{
"category": "Recommendation",
"enabled": true
},
{
"category": "ResourceHealth",
"enabled": true
},
{
"category": "Security",
"enabled": true
},
{
"category": "ServiceHealth",
"enabled": true
}
]'
echo "Verify diagnostic setting"
az monitor diagnostic-settings subscription show --subscription "$subscription_id" --name "sub-diag-""$location"
| true
|
51391d687f6e0feb1361959f2f30c78e7b20fe3d
|
Shell
|
ak352/melanomics
|
/genome/fasd/snp_fasd_woCheck.sh
|
UTF-8
| 1,385
| 2.90625
| 3
|
[] |
no_license
|
#!/bin/bash --login
OUT_DIR="${SCRATCH}/fasd_genome"
mkdir ${OUT_DIR}
reference="/work/projects/melanomics/data/NCBI/Homo_sapiens/NCBI/build37.2/Sequence/WholeGenomeFasta/genome.fa"
pileup()
{
sample=$1
input="/work/projects/melanomics/analysis/genome/${sample}/bam/${sample}.bam"
output="${OUT_DIR}/${sample}.pileup"
oarsub -lwalltime=120 -n ${sample}_pileup "./run_samtools_mpileup.sh ${reference} ${input} ${output}"
}
SNP_detection()
{
sample=$1
input="${SCRATCH}/fasd_genome/${sample}.pileup"
cores=12
output="${OUT_DIR}/${sample}.fasd.vcf"
oarsub -l /nodes=1/core=${cores},walltime=120 -n ${sample}_fasd "./run_fasd.sh ${input} ${cores} ${output}"
#oarsub -t bigmem -l/nodes=1/core=${cores},walltime=120 -n ${sample}_fasd "./run_fasd.sh ${input} ${cores} ${output}"
}
#SNP_detection $1
#for k in NHEM
# do
# pileup $k
# done
for k in test_120mn_deleted_patient_8_PM #patient_8_PM #patient_7_PM #patient_5_PM patient_8_PM patient_8_NS NHEM patient_7_PM patient_4_NS NHEM
do
SNP_detection $k
done
# finished pileup for patient_5_PM patient_2_NS patient_8_NS patient_4_NS patient_5_NS patient_6_NS patient_7_NS patient_2_PM patient_4_PM patient_6_PM patient_7_PM patient_8_PM
#finished SNP detection for patient_2_NS patient_4_NS patient_2_PM patient_5_NS patient_4_PM patient_6_NS patient_6_PM patient_7_NS
| true
|
edc1ac02c9aae646e5e68934b7bd0d8e6d02e6ac
|
Shell
|
elguapo1611/monorepo
|
/examples/scala/restapi/e2e_test.sh
|
UTF-8
| 1,222
| 3.765625
| 4
|
[] |
no_license
|
#! /bin/bash
set -euo pipefail
finish() {
echo "Stopping the server and returning $1"
echo "Finish status: $2"
ps ax | grep -v grep | grep run.*restapi | awk '{print $1}' | xargs kill
exit $1
}
if [ ! -f WORKSPACE ] ; then
finish 1 "Error, run this from the top level monorepo folder"
fi
echo "Starting server"
bazel run //examples/scala/restapi:scala_rest &
# Wait for the server to start
SUCCESS=false
for R in $(seq 10) ; do
sleep 5s
if curl -s localhost:8080/ | grep "Hello World" ; then
SUCCESS=true
break
else
echo "Server is not up yet"
fi
done
if [ "$SUCCESS" = "false" ] ; then
finish 1 "Server health check did not succeed quickly enough"
fi
echo "Simple test"
if [ "Hello unnamed" != "$(curl -s localhost:8080/hi)" ] ; then
finish 1 "Simple test failed"
fi
echo "Param test"
if [ "Hello foo" != "$(curl -s localhost:8080/hi?name=foo)" ] ; then
finish 1 "Param test failed"
fi
echo "Json test"
if [ "{\"fullGreeting\":\"Greetings of type hello for test\"}" != "$(curl -s -H "Content-Type: application/json" localhost:8080/greeting -d '{"greeting": "hello", "name": "test"}')" ] ; then
finish 1 "Json test failed"
fi
finish 0 "Test looks successful"
| true
|
1a4543eec0c476be02b6f95b3b38653c9cf3b601
|
Shell
|
8yt3r/tno-pki-m
|
/auto/config
|
UTF-8
| 602
| 2.671875
| 3
|
[] |
no_license
|
#!/bin/sh
# --debootstrap-options "--variant=minbase" \ This command generates a Kernel Panic.
# --apt-indices false \
# --apt-recommends false \
# Adding 'vga=37' to the bootappend-live option gives more lines in a test VM to catch errors
set -e
lb config noauto \
--architectures i386 \
--bootappend-live "boot=live consoleblank=0 components hostname=tno-pki-m noeject nopersistance username=mikpont" \
--linux-flavours 686-pae \
--iso-application "TNO PKI Manager" \
--iso-preparer "Serge Tensen sergetensen@protonmail.com" \
--iso-publisher "Serge Tensen sergetensen@protonmail.com" \
--iso-volume "TNO-PKI-M" \
--memtest none \
"${@}"
| true
|
1bd544383d8ce3613c2f850e99244765dacab8e0
|
Shell
|
rikdev/archinstall
|
/3_post_installation.d/03_booting.sh
|
UTF-8
| 1,632
| 2.984375
| 3
|
[
"MIT"
] |
permissive
|
# https://wiki.archlinux.org/index.php/General_recommendations#Booting
source common.sh
print_section "Booting"
# https://wiki.archlinux.org/index.php/GRUB#Generate_the_main_configuration_file
print_subsection "GRUB config"
sed --in-place '
# https://wiki.archlinux.org/index.php/GRUB/Tips_and_tricks#Multiple_entries
# https://wiki.archlinux.org/index.php/GRUB/Tips_and_tricks#Disable_submenu
/^#\s*GRUB_DISABLE_SUBMENU=/ s/#//
# https://wiki.archlinux.org/index.php/GRUB/Tips_and_tricks#Recall_previous_entry
s/^GRUB_DEFAULT=.*/GRUB_DEFAULT=saved/
/^#\s*GRUB_SAVEDEFAULT=/ s/#//
' /etc/default/grub || die "Couldn't patch '/etc/default/grub'."
grub-mkconfig --output=/boot/grub/grub.cfg \
|| die "Couldn't make '/boot/grub/grub.cfg'."
# https://wiki.archlinux.org/index.php/General_recommendations#Hardware_auto-recognition
print_subsection "Hardware auto-recognition"
# https://wiki.archlinux.org/index.php/PC_speaker#Globally
echo 'blacklist pcspkr' > /etc/modprobe.d/nobeep.conf
rmmod pcspkr 2>/dev/null || true
# https://wiki.archlinux.org/index.php/Udisks
pacman_sync udisks2 || die "Couldn't install 'udisks2'."
# https://wiki.archlinux.org/index.php/Systemd#Temporary_files
readonly MEDIA_CONF_FILE_PATH=/etc/tmpfiles.d/create-media-symlink.conf
cat <<'EOF' > "${MEDIA_CONF_FILE_PATH}"
#Type Path Mode UID GID Age Argument
d /run/media - - - 0 -
L /media - - - - /run/media
EOF
systemd-tmpfiles --create "${MEDIA_CONF_FILE_PATH}" \
|| die "Couldn't apply '${MEDIA_CONF_FILE_PATH}'."
# Alternative: https://wiki.archlinux.org/index.php/Udisks#Mount_to_.2Fmedia_.28udisks2.29
| true
|
afd33e75adee53f6de3f5307c81268fe02845949
|
Shell
|
egnappahz/ReverseShell
|
/reverseshell_configmaker_minimal.sh
|
UTF-8
| 2,126
| 3.96875
| 4
|
[] |
no_license
|
#!/bin/bash
BRED="\033[1;31m"
BYELLOW='\033[1;93m'
BORANGE='\033[01;38;5;214m'
BGREEN='\033[1;92m'
NOCOLOR='\033[0m'
installdir=~/.ReverseShell #Local only
if [ "$1" == "-h" ] || [ "$1" == "--h" ] || [ "$1" == "--help" ] || [ "$1" == "-help" ]; then
echo "this script creates the configs for diffrent hosts where you want to 'steal' a shell from without using ssh in the config dir $installdir"
echo "just run this script to get a wizard to write a config, which you can use later with the reverseshell_activator.sh <configname> script."
fi
read -p "How would you like to name this config [$(hostname)]: " cname
if [ "$cname" == "" ]; then
cname=$(hostname)
fi
mkdir -p $installdir/$cname
rm -f $installdir/$cname/$cname.cfg 2> /dev/null
read -p "To what remote IP would you like to redirect your shell?: " rhost
redirecthost_IP=$1
read -p "To what remote port would you like to redirect your shell?: " rport
read -p "What is the remote ssh port of that remote location? [22]: " sshport
if [ "$sshport" == "" ]; then
sshport=22
fi
read -p "What is the sshuser of that remote location? [root]: " sshuser
if [ "$sshuser" == "" ]; then
sshuser="root"
fi
echo "cname=$cname" >> $installdir/$cname/$cname.cfg
echo "rhost=$rhost" >> $installdir/$cname/$cname.cfg
echo "rport=$rport" >> $installdir/$cname/$cname.cfg
echo "sshport=$sshport" >> $installdir/$cname/$cname.cfg
echo "sshuser=$sshuser" >> $installdir/$cname/$cname.cfg
echo -e "${$YELLOW}creating SSL certs on remote/listening host!${NOCOLOR}"
ssh -p $sshport -l $sshuser $rhost "mkdir -p ~/.ReverseShell/$cname;cd ~/.ReverseShell/$cname;yes '' | openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes" || echo "ssh connection FAILED, please start again!!!"
echo -e "${$YELLOW}backing up config to central listening server..${NOCOLOR}"
scp -P $sshport ~/.ReverseShell/$cname/$cname.cfg $sshuser@$rhost:~/.ReverseShell/$cname/$cname.cfg
echo -e "config $cname has been stored in ${$YELLOW}$installdir/$cname/$cname.cfg${NOCOLOR} !"
echo -e "run \"${$YELLOW}reverseshell_activator.sh $cname${NOCOLOR}\" to activate this profile!"
| true
|
5448ed334916710323303e0257322ad166094435
|
Shell
|
SpicyGarlicAlbacoreRoll/AI_Water
|
/fix_negative_res.sh
|
UTF-8
| 382
| 3.015625
| 3
|
[] |
no_license
|
# https://gis.stackexchange.com/a/352944
# fix negative resolution
for file in *.tif;
# https://gis.stackexchange.com/questions/108673/using-gdal-command-line-to-copy-projections
PROJ=$(gdalsrsinfo -o wkt $file)
do echo "$PROJ"
# adjust NS resolution
# do echo "$file"; gdalwarp -t_srs $PROJ -overwrite "$file" "mosaic/$(basename "$file" .tif).tif"
done
| true
|
f18a1b54f6f3e552e3cd8e0af2df3fecd537050b
|
Shell
|
ZengGroup/Corcoran_et_al_2017
|
/great_tit/get_mapping_stats.sh
|
UTF-8
| 1,205
| 3.625
| 4
|
[] |
no_license
|
#!/bin/bash
set -u
set -e
if [ "$1" == -h ]; then
echo ""
echo "This script call samtools flagstat command to get a summary of
the percentage reads mapped and unmapped"
echo ""
echo ""
echo ""
echo "The first command line argument is a text file listing the full
paths to the BAM files to be analysed on each row:"
echo ""
echo ""
echo "Example usage:"
echo ""
echo "sh get_mapping_stats.sh bamfile_list.txt"
echo ""
exit 1
fi
MAPPING_METRICS=/data/bo1pgc/parus_reseq/bgi_reseq/samtools_flagstat #path where mapping metrics will be written
QSUB_PATH=/fastdata/bo1pgc/parus_reseq/bgi_reseq/qsub_out/samtools_flagstat
if [ ! -d "$MAPPING_METRICS" ]; then
mkdir $MAPPING_METRICS
fi
if [ ! -d "$QSUB_PATH" ]; then
mkdir $QSUB_PATH
fi
bam_files=$1
cut -f1 $bam_files | while read i;
do
bam_id="$(basename $i .dedup.real.recal.bam)"
samtools_flagstat="samtools flagstat $i > $MAPPING_METRICS/$bam_id.flagstat.txt"
qsub -b y -N mapping_metric.$bam_id -l mem=6G -l rmem=6G -l arch=intel* \
-l h_rt=8:00:00 -e $QSUB_PATH/mapping_metric.$bam_id.e \
-o $QSUB_PATH/mapping_metric.$bam_id.o -cwd $samtools_flagstat
done
| true
|
763d3886f7c0bfa3333f64df6129fb73873f4c68
|
Shell
|
swoodford/raspberrypi
|
/install-air-pi.sh
|
UTF-8
| 926
| 3.25
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
# This script will install the Shairport Airplay emulator for Raspberry Pi
# Install deps
sudo apt-get install -y git libao-dev libssl-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl avahi-utils libmodule-build-perl libavahi-client-dev libasound2-dev libpulse-dev
# Install perl net sdp
git clone https://github.com/njh/perl-net-sdp.git perl-net-sdp
cd perl-net-sdp
perl Build.PL
sudo ./Build
sudo ./Build test
sudo ./Build install
cd ~
# Install shairport
git clone git@github.com:abrasive/shairport.git
cd shairport
./configure
make
# Optionally install it to run at boot
sudo make install
cp shairport.init.sample /etc/init.d/shairport
cd /etc/init.d
chmod a+x shairport
update-rc.d shairport defaults
echo "change DAEMON_ARGS to -w \$PIDFILE -a AirPi"
read -p "Press any key to continue..."
sudo nano shairport
# Start up Airplay
./shairport -a AirPi &
echo "Airplay started as device: AirPi"
| true
|
411fe12841db41ba4262139d7c24dc3f1d14a06c
|
Shell
|
ckarthik17/common-scripts
|
/counter.sh
|
UTF-8
| 327
| 3.796875
| 4
|
[] |
no_license
|
#!/bin/sh
if [ $# -eq 0 ]; then
echo "Please pass the counter name"
exit 1
fi
counter=$1
path=/usr/local/counter
mkdir -p ${path}
file_name=${path}/${counter}.dat
if [ ! -f "${file_name}" ] ; then
value=0
else
value=`cat ${file_name}`
fi
value=`expr ${value} + 1`
echo "${value}"
echo "${value}" > ${file_name}
| true
|
548be6ba94f18b11a30e33dfd0c4a2596386060b
|
Shell
|
gshakir/aws-price-api
|
/ansible/scripts/sns-subscribe.sh
|
UTF-8
| 556
| 2.5625
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
# set -o xtrace
account_id=$1
lambda_function=$2
aws lambda add-permission --function-name ${lambda_function} \
--statement-id ${lambda_function} \
--action lambda:InvokeFunction \
--principal sns.amazonaws.com \
--source-arn arn:aws:sns:us-east-1:278350005181:price-list-api
aws sns subscribe --topic-arn arn:aws:sns:us-east-1:278350005181:price-list-api \
--protocol lambda \
--notification-endpoint arn:aws:lambda:us-east-1:${account_id}:function:${lambda_function}
| true
|
1c84b6f9a24369bfcabeaba7c51bf6d85716fe87
|
Shell
|
xfangfang/studyShell
|
/changeMAC.sh
|
UTF-8
| 611
| 3.546875
| 4
|
[] |
no_license
|
#!/usr/bin/env bash
argv=$#
u=$(id -u)
if [[ u -ne 0 ]]; then
echo permission denied
else
if [[ $argv = 2 ]]; then
ifconfig $1 ether $2
ifconfig $1 down
ifconfig $1 up
echo $1 "has changed it's mac address to "$2
elif [[ $argv = 1 ]]; then
mac=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
ifconfig $1 ether $mac
ifconfig $1 down
ifconfig $1 up
echo $1 "has changed it's mac address to "$mac
else
echo "sudo camc <interface> <mac>"
echo "imput such like this"
echo "cmac en0 aa:bb:cc:dd:ee:ff"
echo "or"
echo "sudo cmac en0"
fi
fi
| true
|
6d692c12539232ac25a243e8e59397f79cd385f4
|
Shell
|
xtofl/gitrebase
|
/script.sh
|
UTF-8
| 1,172
| 3.328125
| 3
|
[] |
no_license
|
rm -rf rebasing_repo1
rm -rf rebasing_repo2
mkdir rebasing_repo1
pushd rebasing_repo1
git init
echo "a tool to demonstrate rebasing" > readme.txt
git add readme.txt
git commit -m "create initial repo"
git branch development
git checkout development
git branch feature2
git checkout feature2
echo > feature2.txt
git add feature2.txt
git commit -m "create feature2"
git checkout development
git branch feature1
git checkout feature1
echo "feature1" > feature1.txt
git add feature1.txt
git commit -m "implemented feature1"
echo "fix feature1" >> feature1.txt
git add feature1.txt
git commit -m "fix feature1"
popd
git clone rebasing_repo1 rebasing_repo2
pushd rebasing_repo2
# the wrong path...
git checkout development
echo "feature 1.b" >> feature1b.txt
git add feature1b.txt
git commit -m "create feature 1.b"
echo "fix" >> feature1b.txt
git add feature1b.txt
git commit -m "fix feature 1.b"
# now, we have committed feature 1.b onto branch
# 'development' while it should have been on 'feature1'...
#attempt 1
# git rebase feature1
# => my development branch will point to latest commit
#attempt 2
git checkout feature1
git rebase development
gitk --all
| true
|
8bb0c5544e62a7d7db3a2c49d218483e2e35b321
|
Shell
|
kubernetes-sigs/image-builder
|
/images/capi/scripts/ci-ova.sh
|
UTF-8
| 4,394
| 3.1875
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
# Copyright 2020 The Kubernetes Authors.
#
# 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 errexit # exits immediately on any unexpected error (does not bypass traps)
set -o nounset # will error if variables are used without first being defined
set -o pipefail # any non-zero exit code in a piped command causes the pipeline to fail with that code
CAPI_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
cd "${CAPI_ROOT}" || exit 1
export ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}"
TARGETS=("ubuntu-2004" "ubuntu-2204" "photon-3" "photon-4" "photon-5" "rockylinux-8" "flatcar")
on_exit() {
#Cleanup VMs
cleanup_build_vm
# kill the VPN
docker kill vpn
}
cleanup_build_vm() {
# Setup govc to delete build VM after
wget https://github.com/vmware/govmomi/releases/download/v0.30.5/govc_Linux_x86_64.tar.gz
tar xf govc_Linux_x86_64.tar.gz
chmod +x govc
mv govc /usr/local/bin/govc
for target in ${TARGETS[@]};
do
govc vm.power -off -force -wait /${GOVC_DATACENTER}/vm/${FOLDER}/capv-ci-${target}-${TIMESTAMP} || true
govc object.destroy /${GOVC_DATACENTER}/vm/${FOLDER}/capv-ci-${target}-${TIMESTAMP}
done
}
trap on_exit EXIT
export PATH=${PWD}/.local/bin:$PATH
export PATH=${PYTHON_BIN_DIR:-"/root/.local/bin"}:$PATH
export GC_KIND="false"
export TIMESTAMP="$(date -u '+%Y%m%dT%H%M%S')"
export GOVC_DATACENTER="SDDC-Datacenter"
export GOVC_INSECURE=true
export FOLDER="Workloads/ci/imagebuilder"
cat << EOF > packer/ova/vsphere.json
{
"vcenter_server":"${GOVC_URL}",
"insecure_connection": "${GOVC_INSECURE}",
"username":"${GOVC_USERNAME}",
"password":"${GOVC_PASSWORD}",
"datastore":"WorkloadDatastore",
"datacenter":"${GOVC_DATACENTER}",
"cluster": "Cluster-1",
"network": "sddc-cgw-network-8",
"folder": "${FOLDER}"
}
EOF
# Since access to esxi is blocked due to firewall rules,
# `export`, `post-processor` sections from `packer-node.json` are removed.
cat packer/ova/packer-node.json | jq 'del(.builders[] | select( .name == "vsphere" ).export)' > packer/ova/packer-node.json.tmp && mv packer/ova/packer-node.json.tmp packer/ova/packer-node.json
cat packer/ova/packer-node.json | jq 'del(.builders[] | select( .name == "vsphere-clone" ).export)' > packer/ova/packer-node.json.tmp && mv packer/ova/packer-node.json.tmp packer/ova/packer-node.json
cat packer/ova/packer-node.json | jq 'del(."post-processors"[])' > packer/ova/packer-node.json.tmp && mv packer/ova/packer-node.json.tmp packer/ova/packer-node.json
# Run the vpn client in container
docker run --rm -d --name vpn -v "${HOME}/.openvpn/:${HOME}/.openvpn/" \
-w "${HOME}/.openvpn/" --cap-add=NET_ADMIN --net=host --device=/dev/net/tun \
gcr.io/cluster-api-provider-vsphere/extra/openvpn:latest
# Tail the vpn logs
docker logs vpn
# install deps and build all images
make deps-ova
declare -A PIDS
for target in ${TARGETS[@]};
do
export PACKER_VAR_FILES="ci-${target}.json scripts/ci-disable-goss-inspect.json"
if [[ "${target}" == 'photon-'* || "${target}" == 'rockylinux-8' || "${target}" == 'ubuntu-2204' ]]; then
cat << EOF > ci-${target}.json
{
"build_version": "capv-ci-${target}-${TIMESTAMP}",
"linked_clone": "true",
"template": "base-${target}"
}
EOF
make build-node-ova-vsphere-clone-${target} > ${ARTIFACTS}/${target}.log 2>&1 &
else
cat << EOF > ci-${target}.json
{
"build_version": "capv-ci-${target}-${TIMESTAMP}"
}
EOF
make build-node-ova-vsphere-${target} > ${ARTIFACTS}/${target}.log 2>&1 &
fi
PIDS["${target}"]=$!
done
# need to unset errexit so that failed child tasks don't cause script to exit
set +o errexit
exit_err=false
for target in "${!PIDS[@]}"; do
wait "${PIDS[$target]}"
if [[ $? -ne 0 ]]; then
exit_err=true
echo "${target}: FAILED. See logs in the artifacts folder."
else
echo "${target}: SUCCESS"
fi
done
set -o errexit
if [[ "${exit_err}" = true ]]; then
exit 1
fi
| true
|
8f893dc75f6dd6b47e9a73fc41404e2925ff23d2
|
Shell
|
xajler/voidrice
|
/.bashrc
|
UTF-8
| 3,312
| 2.640625
| 3
|
[] |
no_license
|
stty -ixon
export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]"
shopt -s autocd #Allows you to cd into directory merely by typing the directory name.
#Generic shortcuts:
alias music="ncmpcpp"
alias clock="ncmpcpp -s clock"
alias visualizer="ncmpcpp -s visualizer"
alias email="mutt"
alias files="ranger"
alias chat="weechat"
alias audio="ncpamixer"
alias calender="calcurse"
#Some aliases
alias v="vim"
alias ka="killall"
alias sv="sudo vim"
alias r="ranger"
alias ls='ls -hN --color=auto --group-directories-first'
alias g="git"
alias gitup="git push origin master"
alias mkdir="mkdir -pv"
alias crep="grep --color=always"
alias p="sudo pacman"
alias sdn="sudo shutdown now"
alias yt="youtube-dl -ic"
alias yta="youtube-dl -xic"
alias nf="clear && neofetch"
alias newnet="sudo systemctl restart NetworkManager"
alias tuctime="sudo timedatectl set-timezone Europe/Zagreb && i3 restart"
alias youtube="youtube-viewer"
alias YT="youtube-viewer"
alias syt="youtube-viewer"
alias TC='texclear'
alias ethspeed="speedometer -r enp0s25"
alias wifispeed="speedometer -r wlp2s0"
alias bars="bash ~/.config/polybar/launch.sh"
alias lsc="screen.sh l"
alias vsc="screen.sh v"
alias dsc="screen.sh d"
alias bw="wal -i ~/.config/wall.png"
alias ir="i3-msg restart"
#Music
alias pause="mpc toggle"
alias next="mpc next"
alias prev="mpc prev"
alias trupause="mpc pause"
alias beg="mpc seek 0%"
alias lilbak="mpc seek -10"
alias lilfor="mpc seek +10"
alias bigbak="mpc seek -120"
alias bigfor="mpc seek +120"
#My own stuff, feel free to delete.
alias sup="webupdate"
alias sync-movies="rsync -avr --rsh='ssh -p443' /home/Shared/Videos/Movies/ $DESKIP:/home/Shared/Videos/Movies"
alias sync-tv="rsync -avr --rsh='ssh -p443' /home/Shared/Videos/Television/ $DESKIP:/home/Shared/Videos/Television"
alias pingme="ping ksphoto.me"
#Check the weather:
weath() { curl wttr.in/$1 ;}
#Install an AUR package manually (for Parabola to get AUR access):
aurinstall() { curl -O https://aur.archlinux.org/cgit/aur.git/snapshot/$1.tar.gz && tar -xvf $1.tar.gz && cd $1 && makepkg --noconfirm -si && cd .. && rm -rf $1 $1.tar.gz ;}
desksync() { rsync -avr --rsh='ssh -p443' $(realpath $1)/ $DESKIP:$(realpath $1);}
deskget() { rsync -avr --rsh='ssh -p443' $DESKIP:$(realpath $1) $(realpath $1)/;}
vrs() { rsync $(realpath $1) $(realpath $1 | sed 's/\/luke\//\/luke\/Repos\/voidrice\//g');}
bl() { convert $@ -resize 1440x1080\> bl_$@ ;}
CF() { cd ~/.config/$1 && ls ;}
#Directory Shortcuts:
alias h="cd ~ && ls -a"
alias d="cd ~/Documents && ls -a"
alias D="cd ~/Downloads && ls -a"
alias p="cd ~/Pictures && ls -a"
alias m="cd ~/Music && ls -a"
alias r="cd / && ls -a"
alias cf="cd ~/.config && ls -a"
alias cfr="vim ~/.config/ranger/rc.conf.base"
alias cfi="vim ~/.config/i3/config"
alias cfq="vim ~/.config/qutebrowser/keys.conf.base"
alias cfQ="vim ~/.config/qutebrowser/qutebrowser.conf"
alias cfM="vim ~/.config/moc/keymap"
alias cfp="vim ~/.config/polybar/config"
alias cfd="vim ~/.Xdefaults"
alias dv="setxkbmap dvorak"
alias la="ls -al"
alias fake="mono /home/x/src/qualtrak/Fake/tools/FAKE.exe"
export PATH=~/.npm-global/bin:$PATH
set -o vi
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
| true
|
4d01d06743f56066b4ed5ed1776f5cb49bff205c
|
Shell
|
stSoftwareAU/acme-cluster
|
/sync.sh
|
UTF-8
| 253
| 2.671875
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
send_files(){
SERVER=$1
#echo "send files to $SERVER"
rsync -rtpqu ~/certs $SERVER:
rsync -rtpqu ~/challenges $SERVER:
rsync -rtpqu ~/csr $SERVER:
rsync -rtpqu ~/sites $SERVER:
rsync -rtpqu ~/keys $SERVER:
}
#send_files www2
| true
|
f5e114ba0264ae5a81632dbee41c2a55a4b14596
|
Shell
|
SirJson/Springbok
|
/generate_emscripten.sh
|
UTF-8
| 262
| 2.59375
| 3
|
[] |
no_license
|
#!/bin/bash
EMSCRIPTEN=/home/sirjson/projects/emscripten
if [ -d "build" ]; then
rm -rf build
fi
mkdir build
cd build
cmake -DHTML5BUILD=ON -DCMAKE_TOOLCHAIN_FILE=$EMSCRIPTEN/cmake/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Debug -G "Unix Makefiles" ../
| true
|
5a30ab3e4bc328e60b72b77e60f470594160bc8d
|
Shell
|
framallo/framallo-blog
|
/thumb.sh
|
UTF-8
| 354
| 2.734375
| 3
|
[] |
no_license
|
#!/bin/bash
# Example
# ./thumb.sh videos/2011-06-25.m4v
V=$1
# filename without extension
B=${V##*/}
F=${B%.*}
vlc -I dummy --video-filter scene -V dummy --no-audio \
--scene-format=jpg --scene-replace \
--start-time=6 --stop-time=7 \
--scene-prefix=$F \
--scene-path='videos' $V vlc://quit
| true
|
9d6a4f4da73b96d9431fd20aeaec8d5ea2b42618
|
Shell
|
ulm/gentoo-historical
|
/src/patchsets/gpm/make-tarball.sh
|
UTF-8
| 320
| 3.46875
| 3
|
[] |
no_license
|
#!/bin/bash
if [[ $# -ne 2 ]] ; then
echo "Usage: $0 <ver> <patch ver>"
exit 1
fi
gver=$1
pver=$2
tar=gpm-${gver}-patches-${pver}.tar.bz2
rm -rf tmp
rm -f ${tar}
mkdir -p tmp/patch
cp -r $gver/*.patch tmp/patch/ || exit 1
cp ../README* tmp/patch/
tar -jcf ${tar} \
-C tmp patch || exit 1
rm -r tmp
du -b ${tar}
| true
|
d8a59ec927e8b655ef3b50b2783b0a9d9d8f6007
|
Shell
|
UTNuclearRoboticsPublic/project-crunch
|
/release.sh
|
UTF-8
| 1,260
| 4.40625
| 4
|
[] |
no_license
|
#!/usr/bin/env bash
# This script reads in a version number, creates a build directory
# and freezes both the launcher/app fbs project and the installer
# fbs project. It links to the created executables and creates a
# tar.
# Print usage
if [ $# -lt 2 ];
then
echo "Usage:"
echo "\tbash release.sh <-v|--version version number of release>"
exit 1
fi
# Parse args
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-v|--version)
VERSION="$2"
shift # past argument
shift # past value
;;
esac
done
RELEASE_NAME=project-crunch-$VERSION
# Create build dir to hold our stuff
rm -rf build
mkdir -p build
mkdir -p build/Project-Crunch
mkdir -p build/Project-Crunch/Project-Crunch
mkdir -p build/Project-Crunch/Install
# Freeze both fbs projects and create links to the executables
cd app
fbs freeze
cd ..
mv app/target/ build/Project-Crunch/Project-Crunch/target
cd build/Project-Crunch/Project-Crunch
ln -s target/Project-Crunch/Project-Crunch Project-Crunch.run
cd ../../../
cd installer
fbs freeze
cd ..
mv installer/target/ build/Project-Crunch/Install/target
cd build/Project-Crunch
ln -s Install/target/Install/Install Install.run
cd ../../
# Create tar in build folder
cd build
tar -cvf $RELEASE_NAME.tar.gz Project-Crunch
| true
|
4f66c656bb80a9074fe5393a068e02b73293f1a9
|
Shell
|
nlphacker/mosesdecoder
|
/irstlm/install
|
UTF-8
| 1,378
| 3.8125
| 4
|
[] |
no_license
|
#! /bin/sh
#set machine type for compilation
if [ -z $MACHTYPE ];then
echo "MACHTYPE is actually undefined"
echo "Set environment variable MACHTYPE with \"uname -m\""
MACHTYPE=`uname -m`
fi
#set operating system for compilation
if [ -z $OSTYPE ];then
echo "OSTYPE is actually undefined"
echo "Set environment variable OSTYPE with \"uname -s\""
OSTYPE=`uname -s`
fi
echo CREATING DIRECTORIES
mkdir -p bin/$MACHTYPE lib/$MACHTYPE > /dev/null 2>&1
if [ ! -d bin/$MACHTYPE -o ! -d lib/$MACHTYPE ]; then
echo "THERE WAS A PROBLEM WHILE CREATING bin/$MACHTYE and lib/$MACHTYPE"
exit;
fi
echo CREATING ALIASES FOR OTHER MACHINE TYPES
if [ $MACHTYPE = "x86_64" ] ; then
for dir in bin lib ; do
( cd $dir ; \
ln -s x86_64 x86_64-redhat-linux-gnu )
done
elif [ $MACHTYPE = "i386" ] ; then
for dir in bin lib ; do
( cd $dir ; \
ln -s i386 i686-redhat-linux-gnu ;\
ln -s i386 i386-redhat-linux-gnu )
done
fi
export MACHTYPE
export OSTYPE
echo COMPILING CODE
( cd src ;\
make clean;make all )
#installing include dir
echo INSTALLING INCLUDE DIR
mkdir -p include
cp ./src/*.h include/
#installing scripts
echo INSTALLING SCRIPTS
cp scripts/*.sh bin
cp scripts/*.pl bin
#installing wrappers
echo INSTALLING ARCHITECTURE-INDEPENDENT WRAPPERS
for file in dict ngt compile-lm quantize-lm prune-lm; do
cp scripts/wrapper bin/$file
chmod 755 bin/$file
done
| true
|
e12d43cbe27c9cd0b9596d81155cf8ae6b9a57c4
|
Shell
|
jamesandariese/dotnix
|
/nixme.sh
|
UTF-8
| 2,355
| 3.203125
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
cd "$HOME"
echo "BOOTSTRAPPING... one sec"
sudo yum -y install xz
curl -L https://nixos.org/nix/install | sh
. ./.nix-profile/etc/profile.d/nix.sh
# pass this AWK_CMD into nix-shell to produce the width/height to use. perdy darn convoluted, huh?
export AWK_CMD='{printf("MAXH=%s\nMAXW=%s", $2, $3);}'
# also AWK_FS
export AWK_FS='[, ]+'
eval `nix-shell -p dialog --run 'dialog --stdout --print-maxsize' | nix-shell -p gawk --run 'awk -F "$AWK_FS" "$AWK_CMD"'`
PADDING=3
export PADW=$(( MAXW - PADDING - PADDING ))
export PADH=$(( MAXH - PADDING - PADDING ))
(
exec 2>&1
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
rm ~/.bash{rc,_profile}
mkdir -p .config/nixpkgs
echo '{ pkgs, ... }:
{
home.packages = with pkgs;[
htop
fortune
nixops
];
home.sessionVariables = {
LC_ALL = "C";
AWS_EXECUTION_ENV = "CloudShell";
};
programs.bash = {
enable = true;
initExtra = '"''"'
[ -e /etc/bashrc ] && . /etc/bashrc
complete -C '"'"'/usr/local/bin/aws_completer'"'"' aws
'"''"';
profileExtra = '"''"'
if [ -e /home/cloudshell-user/.nix-profile/etc/profile.d/nix.sh ]; then . /home/cloudshell-user/.nix-profile/etc/profile.d/nix.sh; fi # added by nix installer
'"''"';
};
home.sessionPath = [
"$HOME/.local/bin"
"$HOME/bin"
];
programs.emacs = {
enable = true;
extraPackages = epkgs: [
epkgs.nix-mode
epkgs.magit
];
};
programs.firefox = {
enable = true;
profiles = {
myprofile = {
settings = {
"general.smoothScroll" = false;
};
};
};
};
services.gpg-agent = {
enable = true;
defaultCacheTtl = 1800;
enableSshSupport = true;
};
programs.home-manager = {
enable = true;
};
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
};
}' > .config/nixpkgs/home.nix
nix-shell -p home-manager --run 'home-manager switch'
echo
echo
echo -----------------------------------------------------------------------
echo
echo 'Logout and back in and everything should be good to go.'
echo 'For cloudshell, just logout and hit enter.'
echo
echo
echo "Done."
echo
echo
) | nix-shell -p dialog --run 'dialog --progressbox "Configuring nix and home manager" $PADH $PADW'
| true
|
e9b9558a70c1b9629f47ccc5d819ca612977e808
|
Shell
|
whl1729/note
|
/tool/linux/setup_ubuntu.sh
|
UTF-8
| 1,484
| 2.78125
| 3
|
[] |
no_license
|
#!/bin/bash
set -x
sudo apt install vim
sudo apt install vim-gnome
sudo apt install git
sudo apt install curl
sudo apt install ctags
git config --global user.name "along"
git config --global user.email "wuhl6@mail2.sysu.edu.cn"
git config --global push.default simple
git config --global core.editor "vim"
sudo apt install xclip
ssh-keygen -t rsa -b 4096 -C "wuhl6@mail2.sysu.edu.cn"
xclip -sel clip < ~/.ssh/id_rsa.pub
# install shadowsocks-qt5
sudo add-apt-repository ppa:hzwhuang/ss-qt5
sudo mv /etc/apt/sources.list.d/hzwhuang-ubuntu-ss-qt5-bionic.list /etc/apt/sources.list.d/hzwhuang-ubuntu-ss-qt5-artful.list
sed -i "s/bionic/artful/g" /etc/apt/sources.list.d/hzwhuang-ubuntu-ss-qt5-artful.list
sudo apt update
sudo apt install shadowsocks-qt5
# install tools for js
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sed -i "s/https/http/g" /etc/apt/sources.list.d/nodesource.list
sudo apt update
sudo apt-get install -y nodejs
# install tools for python
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
source ~/.bashrc
pyenv install 3.8.3
pyenv global 3.8.3
pip install ipython
| true
|
b8477ddb2855471ac4ac1d99a9555addf712cfda
|
Shell
|
gregga/iot-sdks-e2e-fx
|
/scripts/create-new-edgehub-device.sh
|
UTF-8
| 837
| 2.953125
| 3
|
[
"MIT",
"LicenseRef-scancode-generic-cla"
] |
permissive
|
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
echo $(dirname "$0")
python3 $(dirname "$0")/../pyscripts/create_new_edgehub_device.py $1
[ $? -eq 0 ] || { echo "create_new_edgehub_device.py failed"; exit 1; }
python3 $(dirname "$0")/../pyscripts/deploy_test_containers.py
[ $? -eq 0 ] || { echo "deploy_test_containers.py failed"; exit 1; }
echo "restarting iotedge"
sudo systemctl restart iotedge
if [ $? -eq 0 ]; then
echo "iotedge restart complete"
else
echo "restart iotedge failed"
echo "This is OK to ignore if running as part of a VSTS job."
echo "It looks like iotedge has a back-off on restart and it's"
echo "unable to restart right now. It will restart on its own"
echo "once it's ready."
fi
| true
|
13bf9d5cb708325b9ed5402e5c4e6958c5b94fd9
|
Shell
|
lwllvyb/dotfiles
|
/1_karabiner/setup.sh
|
UTF-8
| 236
| 3.1875
| 3
|
[] |
no_license
|
#!/bin/bash
DIR=$(dirname "$0")
cd "$DIR"
. ../scripts/functions.sh
SOURCE="$(realpath ./)"
APP="karabiner"
info "Setting up $APP..."
rm -rf ~/.config/karabiner
ln -s $SOURCE ~/.config/karabiner
success "Finished setting up $APP."
| true
|
8de305f0667e6d0b5ae629b01e41a51755c07f4b
|
Shell
|
brunocampos-ssa/zabbixzone
|
/mysql-restore-backup.sh
|
UTF-8
| 678
| 3.296875
| 3
|
[] |
no_license
|
#!/bin/bash
#
# mysql-restore-backup.sh
# v0.1 - 20140910
#
# Restore Full Backup for Zabbix w/MySQL
#
# Author: Bruno Campos (bruno.campos at bemobi.com.br)
#
MYSQLUSER="bkpuser"
MYSQLPASS="p@ssw0rd"
MYSQLCNF="/etc/mysql/my.cnf"
MYSQLDIR="/var/lib/mysql"
BASEDIR="/var/lib/xtrabackup"
BKPDIR="${BASEDIR}/mysql-zabbix-full"
MYSQL_SERVICE="/etc/init.d/mysql"
INNOBACKUPEX="/usr/bin/innobackupex"
RM="/bin/rm"
CP="/bin/cp"
CHOWN="/bin/chown"
# Stoping Service
${MYSQL_SERVICE} stop
# restoring
${RM} -fR ${MYSQLDIR}/*
${INNOBACKUPEX} --copy-back ${BKPDIR}
${CP} -pf ${BKPDIR}/my.cnf ${MYSQLCNF}
${CHOWN} -R mysql:mysql ${MYSQLDIR}
# Starting service
${MYSQL_SERVICE} start
| true
|
335e567b58b4de7596039618e7903a06b79d8cfb
|
Shell
|
alexeilebedev/orgfile
|
/bin/gcache-install
|
UTF-8
| 185
| 2.703125
| 3
|
[] |
no_license
|
#!/bin/sh
echo "setting up gcache..."
mkdir -p /tmp/gcache
chmod -R 0775 /tmp/gcache
# inheric group writable flag
find /tmp/gcache -type d -exec chmod g+s {} \;
gcache-use
echo "done"
| true
|
c21df630bf4a17915b3bd0c0748f3ef7c2b54866
|
Shell
|
columbia/crane
|
/eval-container/configs/mongoose.sh
|
UTF-8
| 2,525
| 2.78125
| 3
|
[] |
no_license
|
# Setups for mongoose
source configs/default-options.sh
app="mg-server" # app name appears in process list
# evaluation options.
xtern=1 # 1 use xtern, 0 otherwise
proxy=1 # 1 use proxy, 0 otherwise
sch_paxos=1 # 1 xtern will schedule with paxos, 0 otherwise
sch_dmt=1 # 1 libevent_paxos will schedule with DMT, 0 otherwise
enable_lxc="yes"
dmt_log_output=0
leader_elect=0 # 1 enable leader election demo, 0 otherwise
checkpoint=0 # 1 use checkpoint on relicas, 0 otherwise
checkpoint_period=5 # period of CRIU checkpoint, e.g. 10 seconds
msmr_root_client=`echo $MSMR_ROOT` # root dir for m-smr
msmr_root_server=`echo $MSMR_ROOT`
input_url="127.0.0.1" # url for client to query
analysis_tools="" # for executing analysis tools (e.g., analysis_tools="--worker1=helgrind")
num_req=1000
num_thd=8
if [ $1"X" != "X" ]; then
if [ $1"X" == "joint_schedX" ]; then
use_joint_scheduling_plan;
enable_lxc="yes"; # Heming: enable_lxc is tested.
elif [ $1"X" == "separate_schedX" ]; then
use_separate_scheduling_plan;
elif [ $1"X" == "xtern_onlyX" ]; then
use_xtern_only_plan;
elif [ $1"X" == "proxy_onlyX" ]; then
use_proxy_only_plan;
elif [ $1"X" == "origX" ]; then
use_orig_plan;
fi
echo "The plan to run is: $1";
else
echo "No plan specified. The default plan to run is: proxy_only";
use_proxy_only_plan;
fi
sleep 1
if [ $proxy -eq 1 ]
then
if [ $leader_elect -eq 1 ]
then
client_cmd="${msmr_root_client}/apps/apache/install/bin/ab -n ${num_req} -c ${num_thd} http://${primary_ip}:9000/test.php"
else
client_cmd="${msmr_root_client}/apps/apache/install/bin/ab -n ${num_req} -c ${num_thd} http://${primary_ip}:9000/test.php"
fi
else
client_cmd="${msmr_root_client}/apps/apache/install/bin/ab -n ${num_req} -c ${num_thd} http://${primary_ip}:7000/test.php"
fi
# command to start the clients
server_cmd="'${msmr_root_server}/apps/mongoose/mg-server -I /usr/bin/php-cgi -p 7000 -t 8 &>./server-out.txt &'"
# command to start the real server
| true
|
7bddf5e0d29ec01333ee627155c3c3b0fa43162d
|
Shell
|
ChaosTong/RainReminder
|
/scripts/travis/testflight.sh
|
UTF-8
| 1,243
| 3.046875
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/sh
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
echo "This is a pull request. No deployment will be done."
exit 0
fi
if [[ "$TRAVIS_BRANCH" != "master" ]]; then
echo "Testing on a branch other than master. No deployment will be done."
exit 0
fi
# Thanks @djacobs https://gist.github.com/djacobs/2411095
PROVISIONING_PROFILE="$HOME/Library/MobileDevice/Provisioning Profiles/$PROFILE_UUID.mobileprovision"
RELEASE_DATE=`date '+%Y-%m-%d %H:%M:%S'`
OUTPUTDIR="$PWD/build/Release-iphoneos"
echo "********************"
echo "* Signing *"
echo "********************"
xcrun -log -sdk iphoneos PackageApplication "$OUTPUTDIR/$APPNAME.app" -o "$OUTPUTDIR/$APPNAME.ipa" -sign "$DEVELOPER_NAME" -embed "$PROVISIONING_PROFILE"
RELEASE_NOTES="Build: $TRAVIS_BUILD_NUMBER\nUploaded: $RELEASE_DATE"
zip -r -9 "$OUTPUTDIR/$APPNAME.app.dSYM.zip" "$OUTPUTDIR/$APPNAME.app.dSYM"
echo "********************"
echo "* Uploading *"
echo "********************"
curl http://testflightapp.com/api/builds.json \
-F file="@$OUTPUTDIR/$APPNAME.ipa" \
-F dsym="@$OUTPUTDIR/$APPNAME.app.dSYM.zip" \
-F api_token="$API_TOKEN" \
-F team_token="$TEAM_TOKEN" \
-F distribution_lists='Internal' \
-F notes="$RELEASE_NOTES" -v
| true
|
74296160434846cfb94298535c5f53a5ec26e619
|
Shell
|
w0rng/knowlage-base
|
/scripts/np
|
UTF-8
| 312
| 2.5625
| 3
|
[] |
no_license
|
#!/bin/bash
mkdir $PWD/$1
mkdir $PWD/$1/Temp
mkdir $PWD/$1/Temp/Notes
mkdir $PWD/$1/Temp/Sketches
mkdir $PWD/$1/Resources
mkdir $PWD/$1/Source
cd $PWD/$1/
python3 -m venv .venv
touch README.md
echo ".gitignore\n Temp/\n .venv/\n *pyc" > .gitignore
git init
git add .
git commit -m "ะะพะฒัะน ะฟัะพะตะบั"
| true
|
f4021f45d95a38244958af2ec1c9e9640fd82c2e
|
Shell
|
pavelexpertov/dotfiles
|
/installation_scripts/install_fasd.sh
|
UTF-8
| 102
| 2.75
| 3
|
[
"MIT"
] |
permissive
|
if [[ -z "`type -P fasd`" ]]
then
sudo apt-get install fasd
else
echo "fasd is installed"
fi
| true
|
ddd066e08700fe4e1f7d33bdeed9651553c6a67e
|
Shell
|
LaraPruna/gestion_virtualbox_script
|
/libreria.sh
|
UTF-8
| 102,120
| 4.03125
| 4
|
[] |
no_license
|
#!/bin/bash
#Esta funciรณn comprueba si eres root.
#No acepta argumentos
#Devuelve 0 si eres root y 1 si no lo eres.
function f_eres_root {
if [[ $(whoami) = 'root' ]]
then
return 0
else
return 1
fi
}
#Mediante esta funciรณn, comprobamos la existencia de un directorio.
#Devuelve un 0 si el directorio existe y 1 si no existe.
#Acepta un argumento, que es el directorio que se quiera comprobar.
function f_existe_directorio {
if [[ -d $1 ]]
then
return 0
else
return 1
fi
}
#Esta funciรณn comprueba si un paquete estรก instalado o no.
#Acepta como argumento el nombre del paquete.
#Devuelve 0 si estรก instalado y 1 si no lo estรก.
function f_esta_instalado {
if [[ $(dpkg -l | egrep -i $1) ]]
then
return 0
else
return 1
fi
}
#Esta funciรณn instala el paquete Virtualbox en Debian 10.
#No acepta argumentos de entrada, y necesitas ser root para ejecutarla.
#Devuelve 0 una vez instalado el paquete de virtualbox, 1 si no eres root, 2 si virtualbox ya estรก instalado,
#y 3 si ha habido algรบn error en la instalaciรณn.
function f_instalar_virtualbox {
if [[ $(f_eres_root;echo $?) = 0 ]]; then
if [[ $(f_esta_instalado virtualbox;echo $?) = 1 ]]; then
echo 'Aรฑadiendo repositorio...'
sed -i '$a deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian buster contrib' /etc/apt/sources.list
if [[ $(f_esta_instalado gnupg2;echo $?) = 1 ]]; then
echo 'Actualizando repositorios...'
apt update -y &> /dev/null && apt upgrade -y &> /dev/null
echo 'Instalando gnupg2...'
apt-get install -y gnupg2 &> /dev/null
fi
echo 'Aรฑadiendo claves de Oracle...'
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - &> /dev/null
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add - &> /dev/null
echo 'Instalando virtualbox...'
echo 'La instalaciรณn puede durar varios minutos.'
apt-get install -y virtualbox-6.0 &> /dev/null
if [[ $(f_esta_instalado virtualbox;echo $?) = 0 ]]; then
echo 'Paquete instalado.'
return 0
else
echo 'No se pudo instalar el paquete.'
return 3
fi
else
echo 'Virtualbox ya estรก instalado.'
return 2
fi
else
echo 'No eres root.'
return 1
fi
}
#Esta funciรณn muestra informaciรณn general sobre las mรกquinas virtuales registradas y la configuraciรณn
#de VirtualBox. Mediante un menรบ guardado en otro fichero y mostrado a travรฉs de esta funciรณn,
#el usuario podrรก elegir el tipo de informaciรณn que busca en particular.
#No acepta argumentos de entrada.
function f_vmsinfo {
cat ./menus/info.txt
read opcion
while [[ $opcion != 16 ]]; do
if [[ $opcion = 1 ]]; then
if [[ $(vboxmanage list vms | wc -l) = 0 ]]; then
echo 'No tienes ninguna mรกquina virtual registrada.'
else
echo 'Mรกquinas virtuales registradas:'
vboxmanage list vms
fi
elif [[ $opcion = 2 ]]; then
if [[ $(vboxmanage list runningvms | wc -l) = 0 ]]; then
echo 'No se estรก ejecutando ninguna mรกquina virtual en este momento.'
else
echo 'Mรกquinas virtuales en ejecuciรณn:'
vboxmanage list runningvms
fi
elif [[ $opcion = 3 ]]; then
echo 'Sistemas operativos disponibles en Virtualbox:'
vboxmanage list ostypes
elif [[ $opcion = 4 ]]; then
if [[ $(vboxmanage list intnets | wc -l) = 0 ]]; then
echo 'No se ha encontrado ninguna red interna.'
else
echo 'Redes internas:'
vboxmanage list intnets
fi
elif [[ $opcion = 5 ]]; then
if [[ $(vboxmanage list bridgedifs | wc -l) = 0 ]]; then
echo 'No se ha encontrado ninguna interfaz con adaptador puente disponible.'
else
echo 'Interfaces con adaptador puente:'
vboxmanage list bridgedifs
fi
elif [[ $opcion = 6 ]]; then
if [[ $(vboxmanage list hostonlyifs | wc -l) = 0 ]]; then
echo 'No se ha encontrado ninguna interfaz de solo anfitriรณn disponible.'
else
echo 'Interfaces de solo anfitriรณn:'
vboxmanage list hostonlyifs
fi
elif [[ $opcion = 7 ]]; then
if [[ $(vboxmanage list natnets | wc -l) = 0 ]]; then
echo 'No se ha encontrado ninguna interfaz con NAT.'
else
echo 'Interfaces con NAT:'
vboxmanage list natnets
fi
elif [[ $opcion = 8 ]]; then
if [[ $(vboxmanage list dhcpservers | wc -l) = 0 ]]; then
echo 'No se ha encontrado ningรบn servidor DHCP disponible.'
else
echo 'Servidores DHCP:'
vboxmanage list dhcpservers
fi
elif [[ $opcion = 9 ]]; then
echo 'Informaciรณn sobre el host:'
vboxmanage list hostinfo
elif [[ $opcion = 10 ]]; then
if [[ $(vboxmanage list hdds | wc -l) = 0 ]]; then
echo 'No estรกs utilizando ningรบn disco duro en este momento.'
else
echo 'Discos duros en uso:'
vboxmanage list hdds
fi
elif [[ $opcion = 11 ]]; then
if [[ $(vboxmanage list dvds | wc -l) = 0 ]]; then
echo 'No estรกs utilizando ningรบn disco de DVD en este momento.'
else
echo 'Discos de DVD en uso:'
vboxmanage list dvds
fi
elif [[ $opcion = 12 ]]; then
if [[ $(vboxmanage list usbhost | egrep '<none>') ]]; then
echo 'No hay ningรบn dispositivo USB conectado al host en este momento.'
else
echo 'Dispositivos USB conectados al host:'
vboxmanage list usbhost
fi
elif [[ $opcion = 13 ]]; then
echo 'Configuraciรณn general de Virtualbox:'
vboxmanage list systemproperties
elif [[ $opcion = 14 ]]; then
if [[ $(vboxmanage list extpacks | egrep 'Extension Packs: 0') ]]; then
echo 'No tienes instalado ningรบn paquete de extensiรณn en Virtualbox.'
else
echo 'Paquetes de extensiรณn instalados:'
vboxmanage list extpacks
fi
elif [[ $opcion = 15 ]]; then
if [[ $(vboxmanage list groups | wc -l) = 0 ]]; then
echo 'No tienes ningรบn grupo de mรกquinas virtuales creado.'
else
echo 'Grupos de mรกquinas virtuales:'
vboxmanage list groups
fi
else
echo 'Error. Introduce una opciรณn del menรบ.'
fi
cat ./menus/info.txt
read opcion
done
}
#Esta funciรณn muestra informaciรณn sobre una mรกquina virtual en particular.
#Acepta como argumento de entrada el nombre o la UUID de la mรกquina virtual.
#Devuelve 0 al mostrar la informaciรณn y 1 si no se encuentra la mรกquina.
function f_vminfo {
if [[ $(vboxmanage showvminfo $1 &> /dev/null; echo $?) = 0 ]]; then
vboxmanage showvminfo $1
else
echo 'Esa mรกquina no se encuentra registrada.'
fi
}
#Esta funciรณn crea una mรกquina virtual a partir de la informaciรณn introducida por el usuario
#mediante un cuestionario.
#No acepta argumentos de entrada.
function f_crearvm {
echo 'ยฟCรณmo quieres llamar a la mรกquina?'
read nombre
echo 'Introduce la ruta del directorio donde quieres guardarla (por defecto, ~/VirtualBox VMs/):'
read ruta
if [[ $ruta != $null ]]; then
while [[ $(cd $ruta;echo $?) = 1 ]]; do
echo 'Ese directorio no existe. Introduce otra ruta:'
read ruta
if [[ $ruta = $null ]]; then
ruta="/home/$USER/VirtualBox\ VMs/"
fi
done
fi
while [[ $(cd $ruta;echo $?) = 1 ]]; do
echo 'Ese directorio no existe. Introduce otra ruta:'
read ruta
if [[ $ruta = $null ]]; then
ruta="/home/$USER/VirtualBox\ VMs/"
fi
done
echo 'Introduce el nombre del grupo que quieras asignarle a la mรกquina (por defecto "/"):'
read grupo
if [[ $grupo != $null ]]; then
while [[ $(vboxmanage list groups | egrep $grupo; echo $?) = 1 ]]; do
echo 'No hay ningรบn grupo con ese nombre. Introduce otro:'
read grupo
if [[ $grupo = $null ]]; then
continue
fi
done
fi
echo 'ยฟQuรฉ sistema operativo quieres asignarle a la mรกquina? (L para mostrar los sistemas operativos disponibles)'
read os
if [[ $os = 'L' ]]; then
vboxmanage list ostypes
echo 'ยฟQuรฉ sistema operativo quieres asignarle a la mรกquina? (L para mostrar los sistemas operativos disponibles)'
read os
fi
while [[ $(vboxmanage list ostypes | egrep $os; echo $?) = 1 ]]; do
echo 'No hay ningรบn sistema operativo disponible con ese nombre.'
echo 'Introduce otro sistema operativo (L para mostrar los sistemas operativos disponibles):'
read os
if [[ $os = 'L' ]]; then
vboxmanage list ostypes
fi
done
echo 'ยฟQuieres registrar la nueva mรกquina virtual en Virtualbox? (s/n)'
read reg
echo 'Creando mรกquina virtual...'
if [[ $reg = 's' ]]; then
if [[ $grupo = $null ]]; then
vboxmanage createvm --name $nombre --basefolder "$ruta" --ostype $os --register
else
vboxmanage createvm --name $nombre --basefolder "$ruta" --group $grupo --ostype $os --register
fi
echo 'La mรกquina virtual se ha creado con el hardware mรญnimo. Puedes configurarla desde el menรบ principal.'
else
if [[ $grupo = $null ]]; then
vboxmanage createvm --name $nombre --basefolder "$ruta" --ostype $os
else
vboxmanage createvm --name $nombre --basefolder "$ruta" --group $grupo --ostype $os
fi
echo 'La mรกquina virtual se ha creado con el hardware mรญnimo. Puedes registrarla y configurarla desde el menรบ principal.'
fi
}
#Esta funciรณn registra una mรกquina virtual en Virtualbox.
#No acepta argumentos de entrada.
#Devuelve 0 al registrar la mรกquina virtual, 1 si no se ha encontrado la ruta,
#2 si se ha introducido una opciรณn incorrecta y 3 si ha habido algรบn error durante el registro.
function f_registrarvm {
echo 'ยฟLa mรกquina virtual se ha guardado en la ruta por defecto o en otro directorio?'
echo '1) Ruta por defecto'
echo '2) Otro directorio'
echo 'Opciรณn:'
read opcion
if [[ $opcion = 1 ]]; then
echo 'Introduce el nombre de la mรกquina virtual:'
read vm
if [[ $(f_existe_directorio /home/$USER/VirtualBox\ VMs/$vm;echo $?) = 0 ]]; then
vboxmanage registervm /home/$USER/VirtualBox\ VMs/$vm/$vm.vbox
if [[ $(vboxmanage showvminfo $vm &> /dev/null;echo $?) = 0 ]]; then
echo 'Mรกquina registrada.'
return 0
else
echo 'Error. Mรกquina no registrada.'
return 3
fi
else
echo 'Mรกquina no encontrada. Vuelve a intentarlo.'
return 1
fi
elif [[ $opcion = 2 ]]; then
echo 'Introduce la ruta absoluta de la mรกquina virtual:'
read vm
if [[ $(f_existe_directorio $vm;echo $?) = 0 ]]; then
vboxmanage registervm $vm
if [[ $(vboxmanage showvminfo $vm &> /dev/null;echo $?) = 0 ]]; then
echo 'Mรกquina registrada.'
return 0
else
echo 'Error. Mรกquina no registrada.'
return 3
fi
else
echo 'Ruta no encontrada. Vuelve a intentarlo.'
return 1
fi
else
echo 'Opciรณn incorrecta.'
return 2
fi
}
#Esta funciรณn elimina el registro de una mรกquina virtual en Virtualbox.
#No acepta argumentos de entrada.
function f_eliminar_registro_vm {
echo 'Introduce el nombre de la mรกquina virtual:'
read vm
if [[ $(vboxmanage showvminfo $vm &> /dev/null; echo $?) = 1 ]]; then
echo 'No hay ninguna mรกquina virtual registrada con ese nombre.'
else
cat ./menus/registros/elimreg.txt
read res
if [[ $res = 's' ]]; then
vboxmanage unregistervm $vm --delete &> /dev/null
else
vboxmanage unregistervm $vm &> /dev/null
fi
echo 'Registro de mรกquina eliminado.'
fi
}
#Esta funciรณn mueve una mรกquina virtual a otro directorio.
#No acepta argumentos de entrada.
#Devuelve 0 al mover la mรกquina de directorio, 1 si no se introduce un nombre de mรกquina incorrecto,
#2 si se introduce una ruta incorrecta y 3 si ocurre algรบn error durante el intento de desplazamiento.
function f_movervm {
echo 'Introduce el nombre de la mรกquina virtual:'
read vm
if [[ $(vboxmanage showvminfo $vm &> /dev/null;echo $?) = 0 ]]; then
echo 'Introduce la ruta relativa o absoluta del nuevo directorio (por defecto, ~/VirtualBox VMs/):'
read dir
if [[ $dir = $null ]]; then
vboxmanage movevm $vm --type basic --folder /home/$USER/VirtualBox\ VMs/ &> /dev/null
if [[ $(f_existe_directorio /home/$USER/VirtualBox\ VMs/$vm;echo $?) = 0 ]]; then
echo 'Desplazamiento realizado correctamente.'
return 0
else
echo 'Error. No se ha podido mover la mรกquina de directorio.'
return 3
fi
else
if [[ $(f_existe_directorio $dir;echo $?) = 0 ]]; then
vboxmanage movevm $vm --type basic --folder $dir &> /dev/null
if [[ $(f_existe_directorio $dir/$vm;echo $?) = 0 ]]; then
echo 'Desplazamiento realizado correctamente.'
return 0
else
echo 'Error. No se ha podido mover la mรกquina de directorio.'
return 3
fi
else
echo 'Directorio no encontrado.'
return 2
fi
fi
else
echo 'No hay ninguna mรกquina registrada con ese nombre.'
return 1
fi
}
#Esta funciรณn modifica los ajustes bรกsicos de una mรกquina virtual.
#Acepta como argumento el nombre de la mรกquina virtual.
#En determinadas opciones, devuelve los siguientes cรณdigos:
#- Nombre: 0 si se ha cambiado el nombre y 1 si no se ha cambiado.
#- Grupo: 0 si se ha cambiado el grupo, 1 si no se ha podido cambiar y 2 si se ha introducido un grupo incorrecto.
#- Fichero de icono: 0 si se ha cambiado y 1 si se ha introducido una ruta incorrecta.
#- Directorio de instantรกneas: 0 si se ha cambiado la ruta, 1 si no se ha podido cambiar y 2 si se ha introducido una ruta incorrecta.
function f_config_general {
cat ./menus/vmconfig/general.txt
read opcion
while [[ $opcion != 9 ]]; do
if [[ $opcion = 1 ]]; then
echo 'Introduce el nuevo nombre de la mรกquina:'
read nombre
vboxmanage modifyvm $1 --name $nombre
if [[ $(vboxmanage showvminfo $nombre &> /dev/null; echo $?) = 0 ]]; then
echo 'Nombre cambiado. Ve al menรบ principal y vuelve a entrar para seguir configurando la mรกquina.'
return 0
else
echo 'Error. Nombre no cambiado.'
return 1
fi
elif [[ $opcion = 2 ]]; then
echo 'ยฟCuรกntos grupos quieres introducir?'
read num
for i in {1..$num}; do
echo "Grupo:"
read grupo
if [[ $(vboxmanage list groups | egrep $grupo) ]]; then
vboxmanage modifyvm $1 --groups $grupo
if [[ $(vboxmanage showvminfo $1 | egrep Groups | egrep $grupo) ]]; then
echo 'Mรกquina aรฑadida al grupo.'
return 0
else
echo 'Error. La mรกquina no se ha aรฑadido al grupo.'
return 1
fi
else
echo 'No hay ningรบn grupo registrado con ese nombre.'
return 2
fi
done
echo 'La mรกquina se encuentra ahora en los siguientes grupos:'
vboxmanage showvminfo $1 | egrep Groups | awk '{print $2}'
elif [[ $opcion = 3 ]]; then
echo 'Introduce la nueva descripciรณn:'
read descripcion
vboxmanage modifyvm $1 --description "$descripcion"
echo 'Descripciรณn modificada.'
elif [[ $opcion = 4 ]]; then
echo 'Introduce el nuevo sistema operativo (L para ver la lista de sistemas operativos disponibles):'
read os
while [[ $os = 'L' ]]; do
vboxmanage list ostypes
echo 'Introduce el nuevo sistema operativo (L para ver la lista de sistemas operativos disponibles):'
read os
done
if [[ $(vboxmanage list ostypes | egrep $os) ]]; then
vboxmanage modifyvm $1 --ostype $os
echo 'Sistema operativo modificado.'
else
echo 'No hay disponible ningรบn sistema operativo con ese nombre.'
return 2
fi
elif [[ $opcion = 5 ]]; then
echo 'Introduce la ruta de la imagen:'
read ruta
if [[ -e $ruta ]]; then
vboxmanage modifyvm $1 --iconfile "$ruta"
echo 'Icono cambiado.'
return 0
else
echo 'La ruta introducida no existe.'
return 1
fi
elif [[ $opcion = 6 ]]; then
echo 'Introduce la nueva ruta (INTRO si quieres selecccionar la ruta por defecto):'
read ruta
if [[ $ruta = $null ]]; then
vboxmanage modifyvm $1 --snapshotfolder default
echo 'Ruta de instantรกneas modificada.'
return 0
else
if [[ $(f_existe_directorio $ruta;echo $?) ]]; then
vboxmanage modifyvm $1 --snapshotfolder "$ruta"
if [[ $(vboxmanage modifyvm $1 | egrep Snapshot | awk '{print $3}') = $ruta ]]; then
echo 'Ruta de instantรกneas modificada.'
return 0
else
echo 'Error. Ruta no modificada.'
return 1
fi
else
echo 'Ruta no encontrada.'
return 2
fi
fi
elif [[ $opcion = 7 ]]; then
cat ./menus/vmconfig/clipdrag.txt
read opcion2
if [[ $opcion2 = 1 ]]; then
vboxmanage modifyvm $1 --clipboard disabled
elif [[ $opcion2 = 2 ]]; then
vboxmanage modifyvm $1 --clipboard hosttoguest
elif [[ $opcion2 = 3 ]]; then
vboxmanage modifyvm $1 --clipboard guesttohost
elif [[ $opcion2 = 4 ]]; then
vboxmanage modifyvm $1 --clipboard bidirectional
fi
elif [[ $opcion = 8 ]]; then
cat ./menus/vmconfig/clipdrag.txt
read opcion2
if [[ $opcion2 = 1 ]]; then
vboxmanage modifyvm $1 --draganddrop disabled
elif [[ $opcion2 = 2 ]]; then
vboxmanage modifyvm $1 --draganddrop hosttoguest
elif [[ $opcion2 = 3 ]]; then
vboxmanage modifyvm $1 --draganddrop guesttohost
elif [[ $opcion2 = 4 ]]; then
vboxmanage modifyvm $1 --draganddrop bidirectional
fi
else
echo 'Opciรณn incorrecta. Introduce una opciรณn del menรบ.'
fi
cat ./menus/vmconfig/general.txt
read opcion
done
}
#Esta funciรณn configura la pestaรฑa de sistema de una mรกquina virtual en VirtualBox.
#Las distintas opciones que aparecen en esta funciรณn se corresponden con las de los diferentes menรบs
#invocados en el script, y cuyos ficheros de texto se encuentran en el directorio ./menus/.
#Acepta como argumento el nombre de la mรกquina virtual.
function f_config_sistema {
cat ./menus/vmconfig/sistema/sistema.txt
read opcion
while [[ $opcion != 10 ]]; do
if [[ $opcion = 1 ]]; then
echo 'Introduce el tamaรฑo de memoria en MB (debe ser igual o mayor que 4):'
read size
vboxmanage modifyvm $1 --memory $size
if [[ $(vboxmanage showvminfo $1 | egrep Memory | awk '{print $3}' | egrep "$size") ]]; then
echo 'Memoria modificada.'
else
echo 'Error. Memoria no modificada.'
fi
elif [[ $opcion = 2 ]]; then
echo 'Introduce el orden (un nรบmero entre 1 y 4):'
read orden
if [[ $orden > 0 && $orden < 5 ]]; then
echo "ยฟQuรฉ dispositivo quieres arrancar en $ordenยบ lugar?"
cat ./menus/vmconfig/sistema/orden_arranque.txt
read opcion2
if [[ $opcion2 = 1 ]]; then
vboxmanage modifyvm $1 --boot$orden disk
echo "Disco duro establecido en $ordenยบ lugar."
elif [[ $opcion2 = 2 ]]; then
vboxmanage modifyvm $1 --boot$orden dvd
echo "รptica establecida en $ordenยบ lugar."
elif [[ $opcion2 = 3 ]]; then
vboxmanage modifyvm $1 --boot$orden net
echo "Red establecida en $ordenยบ lugar."
elif [[ $opcion2 = 4 ]]; then
vboxmanage modifyvm $1 --boot$orden floppy
echo "Disquete establecido en $ordenยบ lugar."
elif [[ $opcion2 = 5 ]]; then
vboxmanage modifyvm $1 --boot$orden none
echo "Ningรบn dispositivo establecido en $ordenยบ lugar"
else
echo 'Opciรณn incorrecta.'
fi
else
echo 'Orden incorrecta.'
fi
elif [[ $opcion = 3 ]]; then
echo 'Selecciona un chipset de los siguientes:'
echo ''
echo '1) PIIX3'
echo '2) ICH9'
echo ''
echo 'Opciรณn:'
read opcion2
if [[ $opcion2 = 1 ]]; then
vboxmanage modifyvm $1 --chipset piix3
echo 'Se ha seleccionado el chipset PIIX3.'
elif [[ $opcion2 = 2 ]]; then
vboxmanage modifyvm $1 --chipset ich9
echo 'Se ha seleccionado el chipset ICH9.'
else
echo 'Opciรณn incorrecta.'
fi
elif [[ $opcion = 4 ]]; then
cat ./menus/vmconfig/sistema/apuntador.txt
read opcion2
if [[ $opcion2 = 1 ]]; then
vboxmanage modifyvm $1 --mouse ps2
echo 'Se ha seleccionado el ratรณn PS/2 como apuntador.'
elif [[ $opcion2 = 2 ]]; then
vboxmanage modifyvm $1 --mouse usb
echo 'Se ha seleccionado el ratรณn USB como apuntador.'
elif [[ $opcion2 = 3 ]]; then
vboxmanage modifyvm $1 --mouse usbtablet
echo 'Se ha seleccionado la tableta USB como apuntador.'
elif [[ $opcion2 = 4 ]]; then
vboxmanage modifyvm $1 --mouse usbmultitouch
echo 'Se ha seleccionado la tableta multitรกctil USB como apuntador.'
else
echo 'Opciรณn incorrecta.'
fi
elif [[ $opcion = 5 ]]; then
cat ./menus/vmconfig/sistema/placabase.txt
read opcion2
while [[ $opcion2 != 5 ]]; do
if [[ $opcion2 = 1 ]]; then
echo '(H)abilitar (D)eshabilitar'
read opcion3
if [[ $opcion3 = 'H' ]]; then
vboxmanage modifyvm $1 --ioapic on
echo 'I/O APIC habilitado.'
elif [[ $opcion3 = 'D' ]]; then
vboxmanage modifyvm $1 --ioapic off
echo 'I/O APIC deshabilitado.'
else
echo 'Opciรณn incorrecta.'
fi
elif [[ $opcion2 = 2 ]]; then
echo '(H)abilitar (D)eshabilitar'
read opcion3
if [[ $opcion3 = 'H' ]]; then
vboxmanage modifyvm $1 --acpi on
echo 'ACPI habilitado.'
elif [[ $opcion3 = 'D' ]]; then
vboxmanage modifyvm $1 --acpi off
echo 'ACPI deshabilitado.'
else
echo 'Opciรณn incorrecta.'
fi
elif [[ $opcion2 = 3 ]]; then
echo '(H)abilitar (D)eshabilitar'
read opcion3
if [[ $opcion3 = 'H' ]]; then
vboxmanage modifyvm $1 --firmware efi
echo 'ACPI habilitado.'
elif [[ $opcion3 = 'D' ]]; then
vboxmanage modifyvm $1 --firmware bios
echo 'ACPI deshabilitado.'
else
echo 'Opciรณn incorrecta.'
fi
elif [[ $opcion2 = 4 ]]; then
echo 'ยฟQuieres establecer el reloj en tiempo UTC? (s/n)'
read opcion3
if [[ $opcion3 = 's' ]]; then
vboxmanage modifyvm $1 --rtcuseutc on
echo 'Reloj establecido en UTC.'
elif [[ $opcion3 = 'n' ]]; then
vboxmanage modifyvm $1 --rtcuseutc off
echo 'Reloj no establecido en UTC.'
else
echo 'Opciรณn incorrecta.'
fi
else
echo 'Opciรณn incorrecta.'
fi
cat ./menus/vmconfig/sistema/placabase.txt
read opcion2
done
elif [[ $opcion = 6 ]]; then
echo 'ยฟCuรกntos nรบcleos del procesador fรญsico quieres que use la mรกquina?'
read numproc
if [[ $numproc < $(cat /proc/cpuinfo | egrep processor | wc -l) || $numproc = $(cat /proc/cpuinfo | egrep processor | wc -l) ]]; then
vboxmanage modifyvm $1 --cpus $numproc
if [[ $(vboxmanage showvminfo $1 | egrep CPUs | awk '{print $4}') = $numproc ]]; then
echo "Nรบmero de CPUs establecido: $numproc"
else
echo 'Error. El nรบmero de CPUs no se ha modificado.'
fi
else
echo 'Error. El nรบmero de CPUs introducido sobrepasa la cantidad permitida.'
fi
elif [[ $opcion = 7 ]]; then
echo 'Introduce el porcentaje de ejecuciรณn del procesador fรญsico para tareas de virtualizaciรณn (1-100):'
read porcentaje
if [[ $porcentaje > 0 && $porcentaje < 101 ]]; then
vboxmanage modifyvm $1 --cpuexecutioncap $porcentaje
if [[ $(vboxmanage showvminfo $1 | egrep exec | awk '{print $4}') = "$porcentaje%" ]]; then
echo 'Lรญmite de ejecuciรณn modificado.'
else
echo 'Error. Lรญmite de ejecuciรณn no modificado.'
fi
else
echo 'Respuesta no vรกlida.'
fi
elif [[ $opcion = 8 ]]; then
cat ./menus/vmconfig/sistema/procesador.txt
read opcion2
while [[ $opcion2 != 3 ]]; do
if [[ $opcion2 = 1 ]]; then
echo 'ยฟQuieres habilitar PAE? (s/n)'
read opcion3
if [[ $opcion3 = 's' ]]; then
vboxmanage modifyvm $1 --pae on
echo 'PAE habilitado.'
elif [[ $opcion3 = 'n' ]]; then
vboxmanage modifyvm $1 --pae off
echo 'PAE deshabilitado.'
else
echo 'Opciรณn incorrecta.'
fi
elif [[ $opcion2 = 2 ]]; then
echo 'ยฟQuieres habilitar las extensiones de virtualizaciรณn VT-x/AMD-V anidado?'
read opcion3
if [[ $opcion3 = 's' ]]; then
vboxmanage modifyvm $1 --hwvirtex on
echo 'VT-x/AMD-V anidado habilitado.'
elif [[ $opcion3 = 'n' ]]; then
vboxmanage modifyvm $1 --hwvirtex off
echo 'VT-x/AMD-V anidado deshabilitado.'
else
echo 'Opciรณn incorrecta.'
fi
else
echo 'Opciรณn incorrecta.'
fi
cat ./menus/vmconfig/sistema/procesador.txt
read opcion2
done
elif [[ $opcion = 9 ]]; then
cat ./menus/vmconfig/sistema/aceleracion.txt
read opcion2
while [[ $opcion2 != 3 ]]; do
if [[ $opcion2 = 1 ]]; then
cat ./menus/vmconfig/sistema/intparavt.txt
read opcion3
if [[ $opcion3 = 1 ]]; then
vboxmanage modifyvm $1 --paravirtprovider none
echo 'Interfaz deshabilitada.'
elif [[ $opcion3 = 2 ]]; then
vboxmanage modifyvm $1 --paravirtprovider default
echo 'Interfaz seleccionada: determinada.'
elif [[ $opcion3 = 3 ]]; then
vboxmanage modifyvm $1 --paravirtprovider legacy
echo 'Interfaz seleccionada: heredada.'
elif [[ $opcion3 = 4 ]]; then
vboxmanage modifyvm $1 --paravirtprovider minimal
echo 'Interfaz seleccionada: mรญnima.'
elif [[ $opcion3 = 5 ]]; then
vboxmanage modifyvm $1 --paravirtprovider hyperv
echo 'Interfaz seleccionada: Hyper-V.'
elif [[ $opcion3 = 6 ]]; then
vboxmanage modifyvm $1 --paravirtprovider kvm
echo 'Interfaz seleccionada: KVM.'
else
echo 'Opciรณn incorrecta.'
fi
elif [[ $opcion2 = 2 ]]; then
echo 'ยฟQuieres habilitar la paginaciรณn anidada? (s/n)'
read opcion3
if [[ $opcion3 = 's' ]]; then
vboxmanage modifyvm $1 --nestedpaging on
echo 'Paginaciรณn anidada habilitada.'
elif [[ $opcion3 = 'n' ]]; then
vboxmanage modifyvm $1 --nestedpaging off
echo 'Paginaciรณn anidada deshabilitada.'
else
echo 'Opciรณn incorrecta.'
fi
else
echo 'Opciรณn incorrecta.'
fi
cat ./menus/vmconfig/sistema/aceleracion.txt
read opcion2
done
else
echo 'Opciรณn incorrecta.'
fi
cat ./menus/vmconfig/sistema/sistema.txt
read opcion
done
}
#Esta funciรณn permite configurar las distintas opciones que se ven en la pestaรฑa Pantalla
#de la ventana de configuraciรณn de una mรกquina virtual en VirtualBox. Para ello, se toma como referencia
#los diferentes menรบs alojados en ./menus/pantalla/.
#Acepta como argumento de entrada el nombre de la mรกquina virtual.
function f_config_pantalla {
cat ./menus/vmconfig/pantalla/pantalla.txt
read opcion
while [[ $opcion != 7 ]]; do
if [[ $opcion = 1 ]]; then
echo 'Introduce el tamaรฑo de memoria de vรญdeo en MB:'
read size
vboxmanage modifyvm $1 --vram $size
if [[ $(vboxmanage showvminfo $1 | egrep VRAM | egrep $size) ]]; then
echo 'Tamaรฑo de memoria de vรญdeo modificado.'
else
echo 'Error. Tamaรฑo no modificado.'
fi
elif [[ $opcion = 2 ]]; then
echo 'Introduce el nรบmero de monitores que quieres asignar a la mรกquina:'
read num
vboxmanage modifyvm $1 --monitorcount $num
if [[ $(vboxmanage showvminfo $1 | egrep Monitor | awk '{print $3}') = $num ]]; then
echo 'Nรบmero de monitores modificado.'
else
echo 'Error. Nรบmero de monitores no modificado.'
fi
elif [[ $opcion = 3 ]]; then
cat ./menus/vmconfig/pantalla/controlador.txt
read opcion2
if [[ $opcion2 = 1 ]]; then
vboxmanage modifyvm $1 --graphicscontroller none
echo 'Controlador seleccionado: ninguno'
elif [[ $opcion2 = 2 ]]; then
vboxmanage modifyvm $1 --graphicscontroller vboxvga
echo 'Controlador seleccionado: VBoxVGA'
elif [[ $opcion2 = 3 ]]; then
vboxmanage modifyvm $1 --graphicscontroller vmsvga
echo 'Controlador seleccionado: VMSVGA'
elif [[ $opcion2 = 4 ]]; then
vboxmanage modifyvm $1 --graphicscontroller vboxsvga
echo 'Controlador seleccionado: VBoxSVGA'
else
echo 'Opciรณn incorrecta.'
fi
elif [[ $opcion = 4 ]]; then
echo 'ยฟQuieres habilitar la aceleraciรณn 3D? (s/n)'
read opcion2
if [[ $opcion2 = 's' ]]; then
vboxmanage modifyvm $1 --accelerate3d on
echo 'Aceleraciรณn 3D habilitada.'
elif [[ $opcion2 = 'n' ]]; then
vboxmanage modifyvm $1 --accelerate3d off
echo 'Aceleraciรณn 3D deshabilitada.'
fi
elif [[ $opcion = 5 ]]; then
echo 'ยฟQuieres tener habilitada la pantalla remota? (s/n)'
read res1
if [[ $res1 = 's' ]]; then
vboxmanage modifyvm $1 --vrde on
echo 'Pantalla remota habilitada.'
echo 'ยฟQuieres modificar las opciones de pantalla remota? (s/n)'
read res2
if [[ $res2 = 's' ]]; then
cat ./menus/vmconfig/pantalla/remota.txt
read opcion2
while [[ $opcion2 != 5 ]]; do
if [[ $opcion2 = 1 ]]; then
echo 'ยฟQuieres que el puerto sea el predeterminado (3389)? (s/n)'
read res3
if [[ $res3 = 's' ]]; then
vboxmanage modifyvm $1 --vrdeport default
echo 'Puerto seleccionado: 3389'
elif [[ $res3 = 'n' ]]; then
echo 'Introduce el nรบmero de puerto:'
read puerto
vboxmanage modifyvm $1 --vrdeport $puerto
if [[ $(vboxmanage showvminfo $1 | egrep 'VRDE' | awk '{print $5}') = $puerto ]]; then
echo "Puerto establecido: $puerto"
else
echo 'Error. Puerto no establecido.'
fi
fi
elif [[ $opcion2 = 2 ]]; then
echo 'ยฟIPv4, IPv6 o ambos? (4/6)'
read res3
if [[ $res3 = 4 ]]; then
echo 'Introduce una direcciรณn IPv4 (por defecto, 0.0.0.0):'
read ip
if [[ $ip = $null ]]; then
vboxmanage modifyvm $1 --vrdeaddress "0.0.0.0"
echo 'Se ha establecido la IPv4 por defecto.'
else
vboxmanage modifyvm $1 --vrdeaddress $ip
if [[ $(vboxmanage showvminfo $1 | egrep 'VRDE' | awk '{print $4}') = "$ip," ]]; then
echo "Direcciรณn IPv4 establecida: $ip"
else
echo 'Error. Direcciรณn IP no establecida.'
fi
fi
elif [[ $res3 = 6 ]]; then
echo 'Introduce una direcciรณn IPv6 (por defecto, ::):'
read ip
if [[ $ip = $null ]]; then
vboxmanage modifyvm $1 --vrdeaddress "::"
echo 'Se ha establecido la IPv6 por defecto.'
else
vboxmanage modifyvm $1 --vrdeaddress $ip
if [[ $(vboxmanage showvminfo $1 | egrep 'VRDE' | awk '{print $4}') = "$ip," ]]; then
echo "Direcciรณn IPv6 establecida: $ip"
else
echo 'Error. Direcciรณn IP no establecida.'
fi
fi
fi
elif [[ $opcion2 = 3 ]]; then
cat ./menus/vmconfig/pantalla/rvauth.txt
read opcion3
if [[ $opcion3 = 1 ]]; then
vboxmanage modifyvm $1 --vrdeauthtype null
echo 'Tipo de autenticaciรณn seleccionada: nulo'
elif [[ $opcion3 = 2 ]]; then
vboxmanage modifyvm $1 --vrdeauthtype external
echo 'Tipo de autenticaciรณn seleccionada: externo'
elif [[ $opcion3 = 3 ]]; then
vboxmanage modifyvm $1 --vrdeauthtype guest
echo 'Tipo de autenticaciรณn seleccionada: invitado'
else
echo 'Opciรณn incorrecta.'
fi
elif [[ $opcion2 = 4 ]]; then
echo 'ยฟQuieres permitir mรบltiples conexiones? (s/n)'
read res3
if [[ $res3 = 's' ]]; then
vboxmanage modifyvm $1 --vrdemulticon on
echo 'Ahora se permiten mรบltiples conexiones.'
elif [[ $res3 = 'n' ]]; then
vboxmanage modifyvm $1 --vrdemulticon off
echo 'Ahora no se permiten mรบltiples conexiones.'
fi
else
echo 'Opciรณn incorrecta.'
fi
cat ./menus/vmconfig/pantalla/remota.txt
read opcion2
done
fi
elif [[ $res1 = 'n' ]]; then
vboxmanage modifyvm $1 --vrde off
echo 'Pantalla remota deshabilitada.'
fi
elif [[ $opcion = 6 ]]; then
echo 'ยฟQuieres tener habilitada la grabaciรณn de sesiones en la mรกquina? (s/n)'
read res1
if [[ $res1 = 's' ]]; then
vboxmanage modifyvm $1 --recording on
echo 'Grabaciรณn habilitada.'
echo 'ยฟQuieres modificar las opciones de grabaciรณn? (s/n)'
read res2
if [[ $res2 = 's' ]]; then
cat ./menus/vmconfig/pantalla/grabacion.txt
read opcion2
while [[ $opcion2 != 8 ]]; do
if [[ $opcion2 = 1 ]]; then
echo 'ยฟQuieres grabar todas las pantallas o solo una? (1/n)'
read res3
if [[ $res3 = 1 ]]; then
echo 'Introduce el identificador de la pantalla:'
read pantalla
vboxmanage modifyvm $1 --recordingscreens $pantalla
echo "Pantalla seleccionada: $pantalla"
elif [[ $res3 = 'n' ]]; then
vboxmanage modifyvm $1 --recordingscreens all
echo 'Se han seleccionado todas las pantallas.'
fi
elif [[ $opcion2 = 2 ]]; then
echo "Introduce la ruta del archivo de grabaciรณn (por defecto, ~/VirtualBox VMs/$1/):"
read ruta
if [[ $ruta = $null ]]; then
ruta="/home/$USER/VirtualBox VMs/$1"
vboxmanage modifyvm $1 --recordingfile "$ruta/$1.webm"
if [[ $(vboxmanage showvminfo $1 | egrep 'Capture file' | egrep "$ruta") ]]; then
echo 'Ruta modificada.'
else
echo 'Error. Ruta no modificada.'
fi
else
if [[ $(f_existe_directorio "$ruta";echo $?) = 0 ]]; then
vboxmanage modifyvm $1 --recordingfile "$ruta/$1.webm"
if [[ $(vboxmanage showvminfo $1 | egrep 'Capture file' | egrep "$ruta") ]]; then
echo 'Ruta modificada.'
else
echo 'Error. Ruta no modificada.'
fi
else
echo 'Ruta no encontrada.'
fi
fi
elif [[ $opcion2 = 3 ]]; then
echo 'Introduce el tamaรฑo mรกximo del archivo en MB:'
read size
vboxmanage modifyvm $1 --recordingmaxsize $size
echo "Tamaรฑo mรกximo establecido: $sizeMB"
elif [[ $opcion2 = 4 ]]; then
echo 'Introduce el tiempo mรกximo de grabaciรณn en segundos:'
read tiempo
vboxmanage modifyvm $1 --recordingmaxtime $tiempo
if [[ $tiempo -gt 3600 || $tiempo = 3600 ]]; then
let horas=$tiempo/3600
let segundos=$tiempo%3600
if [[ $segundos -gt 60 || $segundos = 60 ]]; then
let minutos=$segundos/60
let segundos=$segundos%60
echo "Tiempo mรกximo de grabaciรณn: $horas hora(s), $minutos minuto(s) y $segundos segundo(s)."
else
echo "Tiempo mรกximo de grabaciรณn: $horas hora(s) y $segundos segundo(s)."
fi
elif [[ $tiempo -gt 60 || $tiempo = 60 ]]; then
let minutos=$tiempo/60
let segundos=$tiempo%60
echo "Tiempo mรกximo de grabaciรณn: $minutos minuto(s) y $segundos segundo(s)."
fi
elif [[ $opcion2 = 5 ]]; then
echo 'Introduce un nรบmero mรกximo de fps:'
read fps
vboxmanage modifyvm $1 --recordingvideofps $fps
echo "Nรบmero mรกximo de fps establecido: $fps"
elif [[ $opcion2 = 6 ]]; then
echo 'Introduce una tasa de bits por segundo en kilobits:'
read kb
vboxmanage modifyvm $1 --recordingvideorate $kb
echo "Tasa establecida: $kb kilobits"
elif [[ $opcion2 = 7 ]]; then
echo 'Introduce la anchura en pรญxeles:'
read anchura
echo 'Introduce la altura en pรญxeles:'
read altura
vboxmanage modifyvm $1 --recordingvideores "$anchura"x"$altura"
if [[ $(vboxmanage showvminfo prueba | egrep 'Capture dimensions' | egrep "$anchura"x"$altura") ]]; then
echo 'Resoluciรณn cambiada correctamente.'
else
echo 'Error. Resoluciรณn no modificada.'
fi
else
echo 'Opciรณn incorrecta.'
fi
cat ./menus/vmconfig/pantalla/grabacion.txt
read opcion2
done
fi
elif [[ $res1 = 'n' ]]; then
vboxmanage modifyvm $1 --recording off
echo 'Grabaciรณn deshabilitada.'
fi
else
echo 'Opciรณn incorrecta.'
fi
cat ./menus/vmconfig/pantalla/pantalla.txt
read opcion
done
}
#Esta funciรณn aรฑade un nuevo controlador de almacenamiento a una determinada mรกquina virtual en Virtualbox.
#En el programa vboxmanager.sh, se emplea como parte de la funciรณn de configuraciรณn de almacenamiento (f_config_almacenamiento).
#Acepta como argumento de entrada el nombre o la UUID de la mรกquina virtual.
#Devuelve 0 al aรฑadir el controlador en la mรกquina virtual, y 1 si no se ha podido aรฑadir.
function f_aรฑadecontrolador {
echo 'ยฟQuรฉ nombre quieres darle al nuevo controlador?'
read nombre
if [[ $(vboxmanage showvminfo $1 | egrep 'Storage Controller Name' | grep $nombre) ]]; then
echo 'Ya existe un controlador con ese nombre en la mรกquina.'
else
cat ./menus/vmconfig/almacenamiento/busessistema.txt
read opcion
while [[ $opcion < 1 || $opcion > 7 ]]; do
echo 'Opciรณn incorrecta.'
cat ./menus/vmconfig/almacenamiento/busessistema.txt
read opcion2
done
if [[ $opcion = 1 ]]; then
bus="ide"
elif [[ $opcion = 2 ]]; then
bus="sata"
elif [[ $opcion = 3 ]]; then
bus="scsi"
elif [[ $opcion = 4 ]]; then
bus="floppy"
elif [[ $opcion = 5 ]]; then
bus="sas"
elif [[ $opcion = 6 ]]; then
bus="usb"
else
bus="pcie"
fi
chipset=false
echo 'ยฟQuieres elegir un chipset en particular? (s/n)'
read res
if [[ $res = 's' ]]; then
chipset=true
cat ./menus/vmconfig/almacenamiento/chipsets.txt
read opcion2
if [[ $opcion2 = 1 ]]; then
tipo="PIIX4"
elif [[ $opcion2 = 2 ]]; then
tipo="PIIX3"
elif [[ $opcion2 = 3 ]]; then
tipo="ICH6"
elif [[ $opcion2 = 4 ]]; then
tipo="IntelAhci"
elif [[ $opcion2 = 5 ]]; then
tipo="LSILogic"
elif [[ $opcion2 = 6 ]]; then
tipo="BusLogic"
elif [[ $opcion2 = 7 ]]; then
tipo="I82078"
elif [[ $opcion2 = 8 ]]; then
tipo="LSILogic SAS"
elif [[ $opcion2 = 9 ]]; then
tipo="USB"
elif [[ $opcion2 = 10 ]]; then
tipo="NVMe"
elif [[ $opcion2 = 11 ]]; then
tipo="VirtIO"
else
echo 'Opciรณn incorrecta.'
fi
fi
numpuertos=false
if [[ $opcion = 2 || $opcion = 5 ]]; then
echo 'ยฟQuieres especificar una cantidad de puertos? (s/n)'
read res
if [[ $res = 's' ]]; then
numpuertos=true
echo 'Introduce una cantidad entre 1 y 30:'
read num
while [[ $num -lt 1 || $num -gt 30 ]]; do
echo 'Cantidad incorrecta.'
echo 'Introduce una cantidad entre 1 y 30:'
read num
done
fi
fi
cache=false
echo 'ยฟQuieres usar la cachรฉ de E/S del anfitriรณn? (s/n)'
read res
if [[ $res = 's' ]]; then
cache=true
fi
arrancable=false
echo 'ยฟQuieres que sea arrancable?'
read res
if [[ $res = 's' ]]; then
arrancable=true
fi
if [[ $chipset = true ]]; then
if [[ $numpuertos = true ]]; then
if [[ $cache = true ]]; then
if [[ $arrancable = true ]]; then
vboxmanage storagectl $1 --name $nombre --add $bus --controller $tipo --portcount $num --hostiocache on --bootable on
else
vboxmanage storagectl $1 --name $nombre --add $bus --controller $tipo --portcount $num --hostiocache on --bootable off
fi
else
if [[ $arrancable = true ]]; then
vboxmanage storagectl $1 --name $nombre --add $bus --controller $tipo --portcount $num --hostiocaache off --bootable on
else
vboxmanage storagectl $1 --name $nombre --add $bus --controller $tipo --portcount $num --hostiocache off --bootable off
fi
fi
else
if [[ $cache = true ]]; then
if [[ $arrancable = true ]]; then
vboxmanage storagectl $1 --name $nombre --add $bus --controller $tipo --hostiocache on --bootable on
else
vboxmanage storagectl $1 --name $nombre --add $bus --controller $tipo --hostiocache on --bootable off
fi
else
if [[ $arrancable = true ]]; then
vboxmanage storagectl $1 --name $nombre --add $bus --controller $tipo --hostiocache off --bootable on
else
vboxmanage storagectl $1 --name $nombre --add $bus --controller $tipo --hostiocache off --bootable off
fi
fi
fi
else
if [[ $numpuertos = true ]]; then
if [[ $cache = true ]]; then
if [[ $arrancable = true ]]; then
vboxmanage storagectl $1 --name $nombre --add $bus --portcount $num --hostiocache on --bootable on
else
vboxmanage storagectl $1 --name $nombre --add $bus --portcount $num --hostiocache on --bootable off
fi
else
if [[ $arrancable = true ]]; then
vboxmanage storagectl $1 --name $nombre --add $bus --portcount $num --hostiocache off --bootable on
else
vboxmanage storagectl $1 --name $nombre --add $bus --portcount $num --hostiocache off --bootable off
fi
fi
else
if [[ $cache = true ]]; then
if [[ $arrancable = true ]]; then
vboxmanage storagectl $1 --name $nombre --add $bus --hostiocache on --bootable on
else
vboxmanage storagectl $1 --name $nombre --add $bus --hostiocache on --bootable off
fi
else
if [[ $arrancable = true ]]; then
vboxmanage storagectl $1 --name $nombre --add $bus --hostiocache off --bootable on
else
vboxmanage storagectl $1 --name $nombre --add $bus --hostiocache off --bootable off
fi
fi
fi
fi
if [[ $(vboxmanage showvminfo $1 | egrep 'Storage Controller Name' | egrep $nombre) ]]; then
echo "Controlador $nombre creado."
return 0
else
echo 'Error. Controlador no creado.'
return 1
fi
fi
}
#Esta funciรณn elimina un controlador existente en una mรกquina virtual dada.
#Acepta como argumento de entrada el nombre de la mรกquina virtual en la que se quiere eliminar un controlador.
#Devuelve 0 despuรฉs de eliminar el controlador, 1 si no hay ningรบn controlador en la mรกquina con ese nombre
#y 2 si dicho controlador se encuentra en la mรกquina pero no se ha podido eliminar.
#Esta funciรณn se emplea como una de las opciones en la funciรณn de configuraciรณn f_config_almacenamiento.
function f_eliminar_controlador {
echo "Controladores de $1:"
vboxmanage showvminfo $1 | egrep 'Storage Controller Name' | awk '{print $5}'
echo 'Introduce el nombre del controlador que quieres eliminar:'
read controlador
if [[ $(vboxmanage showvminfo $1 | egrep 'Storage Controller Name' | egrep $controlador) ]]; then
vboxmanage storagectl $1 --name $controlador --remove
if [[ $(vboxmanage showvminfo $1 | egrep 'Storage Controller Name' | egrep $controlador) ]]; then
echo 'Error. Controlador no eliminado.'
return 2
else
echo "Controlador $controlador eliminado."
return 0
fi
else
echo "No hay ningรบn controlador en $1 con ese nombre."
return 1
fi
}
#Esta funciรณn modifica un atributo concreto de un controlador de almacenamiento en una determinada mรกquina virtual.
#Acepta como argumento de entrada el nombre de la mรกquina virtual.
#Esta funciรณn se emplea como una de las opciones de la funciรณn de configuraciรณn f_config_almacenamiento.
function f_modificar_controlador_almacenamiento {
echo "Controladores de $1:"
vboxmanage showvminfo $1 | egrep 'Storage Controller Name' | awk '{print $5}'
echo 'Introduce el nombre del controlador que quieras modificar:'
read controlador
if [[ $(vboxmanage showvminfo $1 | egrep 'Storage Controller Name'| grep "$nombre") ]]; then
cat ./menus/vmconfig/almacenamiento/controlmod.txt
read opcion
if [[ $opcion = 1 ]]; then
echo 'Introduce el nuevo nombre del controlador:'
read nuevo
vboxmanage storagectl $1 --name $controlador --rename $nuevo
if [[ $(vboxmanage showvminfo $1 | egrep 'Storage Controller Name' | grep "$nombre") ]]; then
echo 'Nombre modificado.'
else
echo 'Error. No se ha cambiado el nombre.'
fi
elif [[ $opcion = 2 ]]; then
cat ./menus/vmconfig/almacenamiento/chipsets.txt
read opcion2
if [[ $opcion2 = 1 ]]; then
tipo="PIIX4"
elif [[ $opcion2 = 2 ]]; then
tipo="PIIX3"
elif [[ $opcion2 = 3 ]]; then
tipo="ICH6"
elif [[ $opcion2 = 4 ]]; then
tipo="IntelAhci"
elif [[ $opcion2 = 5 ]]; then
tipo="LSILogic"
elif [[ $opcion2 = 6 ]]; then
tipo="BusLogic"
elif [[ $opcion2 = 7 ]]; then
tipo="I82078"
elif [[ $opcion2 = 8 ]]; then
tipo="LSILogic SAS"
elif [[ $opcion2 = 9 ]]; then
tipo="USB"
elif [[ $opcion2 = 10 ]]; then
tipo="NVMe"
elif [[ $opcion2 = 11 ]]; then
tipo="VirtIO"
else
echo 'Opciรณn incorrecta.'
fi
vboxmanage storagectl $1 --name $controlador --controller $tipo
if [[ $(vboxmanage showvminfo $1 | egrep 'Storage Controller Type' | grep "$tipo") ]]; then
echo "Nuevo chipset de $controlador: $tipo"
else
echo 'Error. Chipset no cambiado.'
fi
elif [[ $opcion = 3 ]]; then
index=$(vboxmanage showvminfo $1 | egrep 'Storage Controller Name' | grep "$controlador" | awk '{print $4}')
echo 'Introduce un nuevo nรบmero de puertos:'
echo "Nรบmero mรกximo de puertos: $(vboxmanage showvminfo $1 | egrep 'Max Port Count' | grep $index | awk '{print $7}')"
read numpuertos
max=$(vboxmanage showvminfo $1 | egrep 'Max Port Count' | grep "$index" | awk '{print $7}')
if [[ $numpuertos -lt $max || $numpuertos -eq $max ]]; then
vboxmanage storagectl $1 --name $controlador --portcount $numpuertos
num=$(vboxmanage showvminfo $1 | egrep 'Controller Port Count' | grep "$index" | awk '{print $6}')
if [[ $num = $numpuertos ]]; then
echo 'Nรบmero de puertos modificado.'
else
echo 'Error. Nรบmero de puertos no modificado.'
fi
else
echo 'El nรบmero de puertos sobrepasa el mรกximo permitido.'
fi
elif [[ $opcion = 4 ]]; then
echo 'ยฟQuieres habilitar el uso de la cachรฉ de E/S del anfitriรณn? (s/n)'
read res
if [[ $res = 's' ]]; then
vboxmanage storagectl $1 --name $controlador --hostiocache on
echo 'Uso de la cachรฉ habilitada.'
elif [[ $res = 'n' ]]; then
vboxmanage storagectl $1 --name $controlador --hostiocache off
echo 'Uso de la cachรฉ deshabilitada.'
fi
elif [[ $opcion = 5 ]]; then
echo 'ยฟQuieres que el controlador sea arrancable? (s/n)'
read res
if [[ $res = 's' ]]; then
vboxmanage storagectl $1 --name $controlador --bootable on
echo 'El controlador ahora es arrancable.'
elif [[ $res = 'n' ]]; then
vboxmanage storagectl $1 --name $controlador --bootable off
echo 'El controlador ya no es arrancable.'
fi
else
echo 'Opciรณn incorrecta.'
fi
else
echo 'No se encuentra ningรบn controlador con ese nombre.'
fi
}
#Esta funciรณn agrega o modifica una nueva conexiรณn de almacenamiento a una determinada mรกquina de Virtualbox.
#Los atributos configurados en la funciรณn son los justos y necesarios para agregar la conexiรณn.
#Acepta como argumento de entrada el nombre de la mรกquina virtual.
function f_modificar_conexion_almacenamiento {
echo "Controladores de $1:"
vboxmanage showvminfo $1 | egrep 'Storage Controller Name' | awk '{print $5}'
echo 'Introduce el nombre del controlador:'
read controlador
index=$(vboxmanage showvminfo $1 | egrep 'Controller Name' | egrep $controlador | awk '{print $4}')
if [[ $(vboxmanage showvminfo $1 | egrep 'Controller Port Count' | grep "$index" | awk '{print $7}') != 1 ]]; then
tipo=$(vboxmanage showvminfo $1 | egrep 'Storage Controller Type' | grep "$index" | awk '{print $5}')
puerto=$(vboxmanage showvminfo $1 | egrep "^$controlador" | awk '{print $2}')
dispositivo=$(vboxmanage showvminfo $1 | egrep "^$controlador" | awk '{print $3}')
if [[ $tipo = 'PIIX4' || $tipo = 'PIIX3' || $tipo = 'ICH6' ]]; then
echo "Nรบmero de puertos de $controlador: $(vboxmanage showvminfo $1 | egrep 'Port Count' | grep $index | awk '{print $7}')"
echo 'Introduce el puerto en el que quieres conectar el dispositivo:'
read numpuerto
if [[ $numpuerto -gt $(vboxmanage showvminfo $1 | egrep 'Max Port Count' | grep "$index" | awk '{print $7}') ]]; then
echo 'Ese puerto no existe.'
else
echo 'Introduce un nรบmero de dispositivo en ese puerto (0/1):'
read numdispositivo
cat ./menus/vmconfig/almacenamiento/medioconexion.txt
read opcion
if [[ $opcion = 1 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --device $numdispositivo --medium none
elif [[ $opcion = 2 ]]; then
cat ./menus/vmconfig/almacenamiento/tipoconexion.txt
read opcion2
if [[ $opcion2 = 2 ]]; then
echo 'Tipo de conexiรณn no permitida.'
else
if [[ $opcion2 = 1 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --device $numdispositivo --type dvddrive --medium emptydrive
elif [[ $opcion2 = 3 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --device $numdispositivo --type fdd --medium emptydrive
fi
fi
elif [[ $opcion = 3 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --device $numdispositivo --medium additions
elif [[ $opcion = 4 ]]; then
cat ./menus/vmconfig/almacenamiento/tipoconexion.txt
read opcion2
if [[ $opcion2 = 1 ]]; then
if [[ $(vboxmanage list dvds | egrep '(^UUID|^Location)') ]]; then
echo 'Introduce una UUID de la siguiente lista:'
vboxmanage list dvds | egrep '(^UUID|^Location)'
echo 'UUID:'
read uuid
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --device $numdispositivo --type dvddrive --medium $uuid
else
echo 'No tienes ninguna unidad de DVD en Virtualbox.'
fi
elif [[ $opcion2 = 2 ]]; then
if [[ $(vboxmanage list hdds | egrep '(^UUID|^Location)') ]]; then
echo 'Introduce una UUID de la siguiente lista:'
vboxmanage list hdds | egrep '(^UUID|^Location)'
echo 'UUID:'
read uuid
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --device $numdispositivo --type hdd --medium $uuid
else
echo 'No tienes ningรบn disco duro en Virtualbox.'
fi
elif [[ $opcion2 = 3 ]]; then
if [[ $(vboxmanage list floppies | egrep '(^UUID|^Location)') ]]; then
echo 'Introduce una UUID de la siguiente lista:'
vboxmanage list floppies | egrep '(^UUID|^Location)'
echo 'UUID:'
read uuid
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --device $numdispositivo --type fdd --medium $uuid
else
echo 'No tienes ninguna unidad de disquete en Virtualbox.'
fi
fi
elif [[ $opcion = 5 ]]; then
echo 'Introduce la ruta del fichero:'
cat ./menus/vmconfig/almacenamiento/tipoconexion.txt
read opcion2
if [[ $opcion2 ]]; then
echo "Rutas de unidades de DVD guardadas en Virtualbox:"
vboxmanage list dvds | egrep '(^Location)'
read ruta
if [[ -e $ruta ]]; then
echo 'Ruta no encontrada.'
else
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --device $numdispositivo --type dvddrive --medium $ruta
fi
elif [[ $opcion2 ]]; then
echo "Rutas de discos duros guardados en Virtualbox:"
vboxmanage list hdds | egrep '(^Location)'
read ruta
if [[ -e $ruta ]]; then
echo 'Ruta no encontrada.'
else
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --device $numdispositivo --type hdd --medium $ruta
fi
elif [[ $opcion2 ]]; then
echo "Rutas de unidades de disquete guardadas en Virtualbox:"
vboxmanage list floppies | egrep '(^Location)'
read ruta
if [[ -e $ruta ]]; then
echo 'Ruta no encontrada.'
else
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --device $numdispositivo --type fdd --medium $ruta
fi
fi
elif [[ $opcion = 6 ]]; then
echo 'Introduce la unidad de mรกquina anfitriรณn que quieras usar:'
read unidad
cat ./menus/vmconfig/almacenamiento/tipoconexion.txt
read opcion2
if [[ $opcion2 = 2 ]]; then
echo 'Tipo de conexiรณn no permitida.'
else
if [[ $opcion2 = 1 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --device $numdispositivo --type dvddrive --medium $unidad
elif [[ $opcion2 = 3 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --device $numdispositivo --type fdd --medium $unidad
fi
fi
fi
fi
elif [[ $tipo = 'IntelAhci' || $tipo = 'LsiLogicSas' ]]; then
echo "Nรบmero de puertos de $controlador: $(vboxmanage showvminfo $1 | egrep 'Controller Port Count' | grep $index | awk '{print $6}')"
echo 'Introduce el puerto en el que quieres conectar el dispositivo:'
read numpuerto
if [[ $numpuerto -gt $(vboxmanage showvminfo $1 | egrep 'Max Port Count' | grep $index | awk '{print $7}') ]]; then
echo 'Ese puerto no existe.'
else
cat ./menus/vmconfig/almacenamiento/medioconexion.txt
read opcion
if [[ $opcion = 1 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --medium none
elif [[ $opcion = 2 ]]; then
cat ./menus/vmconfig/almacenamiento/tipoconexion.txt
read opcion2
if [[ $opcion2 = 2 ]]; then
echo 'Tipo de conexiรณn no permitida.'
else
if [[ $opcion2 = 1 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --type dvddrive --medium emptydrive
elif [[ $opcion2 = 3 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --type fdd --medium emptydrive
fi
fi
elif [[ $opcion = 3 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --medium additions
elif [[ $opcion = 4 ]]; then
cat ./menus/vmconfig/almacenamiento/tipoconexion.txt
read opcion2
if [[ $opcion2 = 1 ]]; then
if [[ $(vboxmanage list dvds | egrep '(^UUID|^Location)') ]]; then
echo 'Introduce una UUID de la siguiente lista:'
vboxmanage list dvds | egrep '(^UUID|^Location)'
echo 'UUID:'
read uuid
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --type dvddrive --medium $uuid
else
echo 'No tienes ninguna unidad de DVD en Virtualbox.'
fi
elif [[ $opcion2 = 2 ]]; then
if [[ $(vboxmanage list hdds | egrep '(^UUID|^Location)') ]]; then
echo 'Introduce una UUID de la siguiente lista:'
vboxmanage list hdds | egrep '(^UUID|^Location)'
echo 'UUID:'
read uuid
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --type hdd --medium $uuid
else
echo 'No tienes ningรบn disco duro en Virtualbox.'
fi
elif [[ $opcion2 = 3 ]]; then
if [[ $(vboxmanage list floppies | egrep '(^UUID|^Location)') ]]; then
echo 'Introduce una UUID de la siguiente lista:'
vboxmanage list floppies | egrep '(^UUID|^Location)'
echo 'UUID:'
read uuid
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --type fdd --medium $uuid
else
echo 'No tienes ninguna unidad de disquete en Virtualbox.'
fi
fi
elif [[ $opcion = 5 ]]; then
cat ./menus/vmconfig/almacenamiento/tipoconexion.txt
read opcion2
if [[ $opcion2 ]]; then
echo "Rutas de unidades de DVD guardadas en Virtualbox:"
vboxmanage list dvds | egrep '(^Location)'
read ruta
if [[ -e $ruta ]]; then
echo 'Ruta no encontrada.'
else
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --type dvddrive --medium $ruta
fi
elif [[ $opcion2 ]]; then
echo "Rutas de discos duros guardadas en Virtualbox:"
vboxmanage list hdds | egrep '(^Location)'
read ruta
if [[ -e $ruta ]]; then
echo 'Ruta no encontrada.'
else
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --type hdd --medium $ruta
fi
elif [[ $opcion2 ]]; then
echo "Rutas de unidades de disquete guardadas en Virtualbox:"
vboxmanage list floppies | egrep '(^Location)'
read ruta
if [[ -e $ruta ]]; then
echo 'Ruta no encontrada.'
else
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --type fdd --medium $ruta
fi
fi
elif [[ $opcion = 6 ]]; then
echo 'Introduce la unidad de mรกquina anfitriรณn que quieras usar:'
read unidad
cat ./menus/vmconfig/almacenamiento/tipoconexion.txt
read opcion2
if [[ $opcion2 = 2 ]]; then
echo 'Tipo de conexiรณn no permitida.'
else
if [[ $opcion2 = 1 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --type dvddrive --medium $unidad
elif [[ $opcion2 = 3 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --port $numpuerto --type fdd --medium $unidad
fi
fi
fi
fi
else
cat ./menus/vmconfig/almacenamiento/medioconexion.txt
read opcion
if [[ $opcion = 1 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --medium none
elif [[ $opcion = 2 ]]; then
cat ./menus/vmconfig/almacenamiento/tipoconexion.txt
read opcion2
if [[ $opcion2 = 2 ]]; then
echo 'Tipo de conexiรณn no permitida.'
else
if [[ $opcion2 = 1 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --type dvddrive --medium emptydrive
elif [[ $opcion2 = 3 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --type fdd --medium emptydrive
fi
fi
elif [[ $opcion = 3 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --medium additions
elif [[ $opcion = 4 ]]; then
cat ./menus/vmconfig/almacenamiento/tipoconexion.txt
read opcion2
if [[ $opcion2 = 1 ]]; then
if [[ $(vboxmanage list dvds | egrep '(^UUID|^Location)') ]]; then
echo 'Introduce una UUID de la siguiente lista:'
vboxmanage list dvds | egrep '(^UUID|^Location)'
echo 'UUID:'
read uuid
vboxmanage storageattach $1 --storagectl $controlador --type dvddrive --medium $uuid
else
echo 'No tienes ninguna unidad de DVD en Virtualbox.'
fi
elif [[ $opcion2 = 2 ]]; then
if [[ $(vboxmanage list hdds | egrep '(^UUID|^Location)') ]]; then
echo 'Introduce una UUID de la siguiente lista:'
vboxmanage list dvds | egrep '(^UUID|^Location)'
echo 'UUID:'
read uuid
vboxmanage storageattach $1 --storagectl $controlador --type hdd --medium $uuid
else
echo 'No tienes ningรบn disco duro en Virtualbox.'
fi
elif [[ $opcion2 = 3 ]]; then
if [[ $(vboxmanage list floppies | egrep '(^UUID|^Location)') ]]; then
echo 'Introduce una UUID de la siguiente lista:'
vboxmanage list floppies | egrep '(^UUID|^Location)'
echo 'UUID:'
read uuid
vboxmanage storageattach $1 --storagectl $controlador --type fdd --medium $uuid
else
echo 'No tienes ninguna unidad de disquete en Virtualbox.'
fi
fi
elif [[ $opcion = 5 ]]; then
cat ./menus/vmconfig/almacenamiento/tipoconexion.txt
read opcion2
if [[ $opcion2 ]]; then
echo "Rutas de unidades de DVD guardadas en Virtualbox:"
vboxmanage list dvds | egrep '(^Location)'
read ruta
if [[ -e $ruta ]]; then
echo 'Ruta no encontrada.'
else
vboxmanage storageattach $1 --storagectl $controlador --type dvddrive --medium $ruta
fi
elif [[ $opcion2 ]]; then
echo "Rutas de discos duros guardadas en Virtualbox:"
vboxmanage list hdds | egrep '(^Location)'
read ruta
if [[ -e $ruta ]]; then
echo 'Ruta no encontrada.'
else
vboxmanage storageattach $1 --storagectl $controlador --type hdd --medium $ruta
fi
elif [[ $opcion2 ]]; then
echo "Rutas de unidades de disquete guardadas en Virtualbox:"
vboxmanage list floppies | egrep '(^Location)'
read ruta
if [[ -e $ruta ]]; then
echo 'Ruta no encontrada.'
else
vboxmanage storageattach $1 --storagectl $controlador --type fdd --medium $ruta
fi
fi
elif [[ $opcion = 6 ]]; then
echo 'Introduce la unidad de mรกquina anfitriรณn que quieras usar:'
read unidad
cat ./menus/vmconfig/almacenamiento/tipoconexion.txt
read opcion2
if [[ $opcion2 = 2 ]]; then
echo 'Tipo de conexiรณn no permitida.'
else
if [[ $opcion2 = 1 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --type dvddrive --medium $unidad
elif [[ $opcion2 = 3 ]]; then
vboxmanage storageattach $1 --storagectl $controlador --type fdd --medium $unidad
fi
fi
fi
fi
else
echo "No hay ningรบn controlador en la mรกquina $1 con ese nombre."
fi
if [[ $numdispositivo = $null ]]; then
if [[ $(vboxmanage showvminfo $1 | grep "$controlador ($numpuerto, 0)") ]]; then
echo 'Conexiรณn aรฑadida.'
else
echo 'Error. Conexiรณn no aรฑadida.'
fi
else
if [[ $(vboxmanage showvminfo $1 | grep "$controlador ($numpuerto, $numdispositivo)") ]]; then
echo 'Conexiรณn aรฑadida.'
else
echo 'Error. Conexiรณn no aรฑadida.'
fi
fi
}
#Esta funciรณn configura las opciones de almacenamiento de una mรกquina virtual en Virtualbox.
#Para ello, se toma como referencia los diferentes menรบs alojados en ./menus/almacenamiento/.
#Acepta como argumento de entrada el nombre de la mรกquina virtual.
function f_config_almacenamiento {
cat ./menus/vmconfig/almacenamiento/almacenamiento.txt
read opcion
while [[ $opcion != 5 ]]; do
if [[ $opcion = 1 ]]; then
f_aรฑadecontrolador $1
elif [[ $opcion = 2 ]]; then
f_eliminar_controlador $1
elif [[ $opcion = 3 ]]; then
f_modificar_conexion_almacenamiento $1
elif [[ $opcion = 4 ]]; then
f_modificar_controlador_almacenamiento $1
else
echo 'Opciรณn incorrecta.'
fi
cat ./menus/vmconfig/almacenamiento/almacenamiento.txt
read opcion
done
}
#Esta funciรณn configura la pestaรฑa de audio en la configuraciรณn de una mรกquina virtual en Virtualbox.
#Acepta como argumento de entrada el nombre de la mรกquina virtual.
function f_config_audio {
echo "ยฟQuieres habilitar el audio en la mรกquina $1? (s/n)"
read res
if [[ $res = 's' ]]; then
cat ./menus/vmconfig/audio/ctlanfitrion.txt
read opcion
if [[ $opcion = 1 ]]; then
audio='null'
elif [[ $opcion = 2 ]]; then
audio='oss'
elif [[ $opcion = 3 ]]; then
audio='alsa'
elif [[ $opcion = 4 ]]; then
audio='pulse'
elif [[ $opcion = 5 ]]; then
audio='coreaudio'
else
echo 'Opciรณn incorrecta.'
fi
if [[ $audio != $null ]]; then
echo 'ยฟQuieres modificar otros atributos? (s/n)'
read res2
if [[ $res2 = 's' ]]; then
cat ./menus/vmconfig/audio/opc_audio.txt
read opcion2
while [[ $opcion2 != 4 ]]; do
if [[ $opcion2 = 1 ]]; then
cat ./menus/vmconfig/audio/ctlaudio.txt
read opcion3
if [[ $opcion3 = 1 ]]; then
ctl='ac97'
elif [[ $opcion3 = 2 ]]; then
ctl='sb16'
elif [[ $opcion3 = 3 ]]; then
ctl='hda'
fi
elif [[ $opcion2 = 2 ]]; then
echo 'ยฟQuieres habilitar la salida de audio? (s/n)'
read res3
if [[ $res3 = 's' ]]; then
salida='on'
elif [[ $res3 = 'n' ]]; then
salida='off'
fi
elif [[ $opcion2 = 3 ]]; then
echo 'ยฟQuieres habilitar la entrada de audio? (s/n)'
read res3
if [[ $res3 = 's' ]]; then
entrada='on'
elif [[ $res3 = 'n' ]]; then
entrada='off'
fi
else
echo 'Opciรณn incorrecta.'
fi
cat ./menus/vmconfig/audio/opc_audio.txt
read opcion2
done
if [[ $ctl = $null && $entrada = $null && $salida = $null ]]; then
vboxmanage modifyvm $1 --audio $audio
echo 'Audio habilitado.'
elif [[ $ctl = $null && $salida = $null ]]; then
vboxmanage modifyvm $1 --audio $audio --audioin $entrada
echo 'Audio habilitado.'
elif [[ $ctl = $null && $entrada = $null ]]; then
vboxmanage modifyvm $1 --audio $audio --audioout $salida
echo 'Audio habilitado.'
elif [[ $entrada = $null && $salida = $null ]]; then
vboxmanage modifyvm $1 --audio $audio --audiocontroller $ctl
echo 'Audio habilitado.'
elif [[ $ctl = $null ]]; then
vboxmanage modifyvm $1 --audio $audio --audioin $entrada --audioout $salida
echo 'Audio habilitado.'
elif [[ $entrada = $null ]]; then
vboxmanage modifyvm $1 --audio $audio --audiocontroller $ctl --audioout $salida
echo 'Audio habilitado.'
elif [[ $salida = $null ]]; then
vboxmanage modifyvm $1 --audio $audio --audiocontroller $ctl --audioin $entrada
echo 'Audio habilitado.'
else
vboxmanage modifyvm $1 --audio $audio --audiocontroller $ctl --audioin $entrada --audioout $salida
echo 'Audio habilitado.'
fi
else
vboxmanage modifyvm $1 --audio $audio
echo 'Audio habilitado.'
fi
fi
else
vboxmanage modifyvm --audio none
echo 'Audio deshabilitado.'
fi
}
#Esta funciรณn configura la pestaรฑa de red en la configuraciรณn de una mรกquina virtual en Virtualbox.
#Acepta como argumento de entrada el nombre de la mรกquina virtual.
function f_config_red {
echo 'Introduce el nรบmero de adaptador que quieras configurar:'
read num
echo 'ยฟQuรฉ tipo de red quieres asignarle al adaptador?'
cat ./menus/vmconfig/red/adaptadores.txt
read opcion
if [[ $opcion = 1 ]]; then
vboxmanage modifyvm $1 --nic$num none
elif [[ $opcion = 2 ]]; then
vboxmanage modifyvm $1 --nic$num null
elif [[ $opcion = 3 ]]; then
vboxmanage modifyvm $1 --nic$num nat
elif [[ $opcion = 4 ]]; then
vboxmanage modifyvm $1 --nic$num natnetwork
elif [[ $opcion = 5 ]]; then
vboxmanage modifyvm $1 --nic$num bridged
elif [[ $opcion = 6 ]]; then
vboxmanage modifyvm $1 --nic$num intnet
elif [[ $opcion = 7 ]]; then
vboxmanage modifyvm $1 --nic$num hostonly
elif [[ $opcion = 8 ]]; then
vboxmanage modifyvm $1 --nic$num generic
else
echo 'Opciรณn incorrecta.'
fi
if [[ $opcion != $null && $opcion != 1 ]]; then
cat ./menus/vmconfig/red/opc_red.txt
read opcion2
while [[ $opcion2 != 8 ]]; do
if [[ $opcion2 = 1 ]]; then
if [[ $opcion = 2 || $opcion = 3 ]]; then
echo 'Esta opciรณn no estรก disponible para el tipo de red seleccionado.'
else
if [[ $opcion = 4 ]]; then
echo 'Introduce el nombre de la interfaz:'
read nombre
vboxmanage modifyvm $1 --nat-network$num $nombre
if [[ $(vboxmanage showvminfo $1 | egrep "NIC $num:" | awk '{print $8}' | grep "$nombre") ]]; then
echo 'Nombre modificado.'
else
echo 'Error. Nombre no modificado.'
fi
elif [[ $opcion = 5 ]]; then
vboxmanage modifyvm $1 --bridgeadapter$num $nombre
if [[ $(vboxmanage showvminfo $1 | egrep "NIC $num:" | awk '{print $8}' | grep "$nombre") ]]; then
echo 'Nombre modificado.'
else
echo 'Error. Nombre no modificado.'
fi
elif [[ $opcion = 6 ]]; then
vboxmanage modifyvm $1 --intnet$num $nombre
if [[ $(vboxmanage showvminfo $1 | egrep "NIC $num:" | awk '{print $8}' | grep "$nombre") ]]; then
echo 'Nombre modificado.'
else
echo 'Error. Nombre no modificado.'
fi
elif [[ $opcion = 7 ]]; then
vboxmanage modifyvm $1 --hostonlyadapter$num $nombre
if [[ $(vboxmanage showvminfo $1 | egrep "NIC $num:" | awk '{print $8}' | grep "$nombre") ]]; then
echo 'Nombre modificado.'
else
echo 'Error. Nombre no modificado.'
fi
elif [[ $opcion = 8 ]]; then
vboxmanage modifyvm $1 --nicgenericdrv$num $nombre
if [[ $(vboxmanage showvminfo $1 | egrep "NIC $num:" | awk '{print $8}' | grep "$nombre") ]]; then
echo 'Nombre modificado.'
else
echo 'Error. Nombre no modificado.'
fi
fi
fi
elif [[ $opcion2 = 2 ]]; then
cat ./menus/vmconfig/red/tiposadaptador.txt
read opcion3
if [[ $opcion3 = 1 ]]; then
tipo='Am79C970A'
vboxmanage modifyvm $1 --nictype$num Am79C970A
elif [[ $opcion3 = 2 ]]; then
tipo='Am79C973'
vboxmanage modifyvm $1 --nictype$num Am79C973
elif [[ $opcion3 = 3 ]]; then
tipo='82540EM'
vboxmanage modifyvm $1 --nictype$num 82540EM
elif [[ $opcion3 = 4 ]]; then
tipo='82543GC'
vboxmanage modifyvm $1 --nictype$num 82543GC
elif [[ $opcion3 = 5 ]]; then
tipo='82545EM'
vboxmanage modifyvm $1 --nictype$num 82545EM
elif [[ $opcion3 = 6 ]]; then
tipo='virtio'
vboxmanage modifyvm $1 --nictype$num virtio
fi
echo "Tipo de adaptador seleccionado: $tipo"
elif [[ $opcion2 = 3 ]]; then
if [[ $opcion = 2 || $opcion = 3 || $opcion = 8 ]]; then
echo 'Esta opciรณn no estรก disponible para el tipo de red seleccionado.'
else
cat ./menus/vmconfig/red/modopromiscuo.txt
read opcion3
if [[ $opcion3 = 1 ]]; then
vboxmanage modifyvm $1 --nicpromisc$num deny
echo 'Modo promiscuo denegado.'
elif [[ $opcion3 = 2 ]]; then
vboxmanage modifyvm $1 --nicpromisc$num allow-vms
echo 'Modo promiscuo permitido para todas las VM.'
elif [[ $opcion3 = 3 ]]; then
vboxmanage modifyvm $1 --nicpromisc$num allow-all
echo 'Modo promiscuo permitido siempre.'
fi
fi
elif [[ $opcion2 = 4 ]]; then
echo 'ยฟQuieres generar la MAC de manera automรกtica? (s/n)'
read res
if [[ $res = 's' ]]; then
vboxmanage modifyvm $1 --macaddress$num auto
macfinal=$(vboxmanage showvminfo $1 | grep "NIC $num:" | awk '{print $4}' | egrep -o '[0-9A-Z]*')
echo "Nueva MAC: $macfinal"
elif [[ $res = 'n' ]]; then
echo 'Introduce la nueva MAC:'
read mac
vboxmanage modifyvm $1 --macaddress$num $mac
macfinal=$(vboxmanage showvminfo $1 | grep "NIC $num:" | awk '{print $4}' | egrep -o '[0-9A-Z]*')
echo "Nueva MAC: $macfinal"
fi
elif [[ $opcion2 = 5 ]]; then
echo 'ยฟQuieres habilitar la opciรณn de cable conectado? (s/n)'
read res
if [[ $res = 's' ]]; then
vboxmanage modifyvm $1 --cableconnected$num on
echo 'Cable conectado.'
elif [[ $res = 'n' ]]; then
vboxmanage modifyvm $1 --cableconnected$num off
echo 'Cable desconectado.'
fi
elif [[ $opcion2 = 6 ]]; then
if [[ $opcion = 3 ]]; then
echo 'ยฟQuieres (a)รฑadir o (e)liminar una regla?'
read res
if [[ $res = 'a' ]]; then
echo 'Dale un nombre a la nueva regla:'
read nombre
echo 'ยฟ(tcp) o (udp)?'
read protocolo
if [[ $protocolo != 'tcp' && $protocolo != 'udp' ]]; then
echo 'Respuesta errรณnea.'
else
echo 'Puerto del host:'
read hport
echo 'Puerto de la mรกquina virtual:'
read gport
echo 'ยฟQuieres especificar la IP del host? (s/n)'
read res2
if [[ $res2 = 's' ]]; then
echo 'IP del host:'
read iphost
fi
echo 'ยฟQuieres especificar la IP de la mรกquina virtual? (s/n)'
read res2
if [[ $res2 = 's' ]]; then
echo 'IP de la mรกquina virtual:'
read ipguest
fi
if [[ $iphost = $null && $ipguest = $null ]]; then
vboxmanage modifyvm $1 --natpf$num $nombre,$protocolo,,$hport,,$gport
elif [[ $iphost = $null ]]; then
vboxmanage modifyvm $1 --natpf$num $nombre,$protocolo,,$hport,$ipguest,$gport
elif [[ $ipguest = $null ]]; then
vboxmanage modifyvm $1 --natpf$num $nombre,$protocolo,$iphost,$hport,,$gport
else
vboxmanage modifyvm $1 --natpf$num $nombre,$protocolo,$iphost,$hport,$ipguest,$gport
fi
if [[ $(vboxmanage showvminfo $1 | egrep "name = $nombre") ]]; then
echo 'Regla aรฑadida.'
else
echo 'Error. Regla no aรฑadida.'
fi
fi
elif [[ $res = 'e' ]]; then
echo 'Introduce el nombre de la regla que quieres eliminar:'
read nombre
vboxmanage modifyvm $1 --natpf$num delete $nombre
echo 'Regla eliminada.'
fi
else
echo 'Esta opciรณn no estรก disponible para el tipo de red seleccionado.'
fi
elif [[ $opcion2 = 7 ]]; then
if [[ $opcion = 8 ]]; then
echo 'Parรกmetro:'
read par
echo 'Valor del parรกmetro:'
read valor
vboxmanage modifyvm $1 --nicproperty$num $par="$valor"
echo 'Parรกmetros aรฑadido.'
else
echo 'Esta opciรณn no estรก disponible para el tipo de red seleccionado.'
fi
else
echo 'Opciรณn incorrecta.'
fi
cat ./menus/vmconfig/red/opc_red.txt
read opcion2
done
fi
}
#Esta funciรณn configura las carpetas compartidas de una mรกquina virtual en Virtualbox.
#Acepta como argumento de entrada el nombre de la mรกquina virtual.
function f_config_compartida {
cat ./menus/vmconfig/compartida.txt
read opcion
while [[ $opcion != 3 ]]; do
if [[ $opcion = 1 ]]; then
echo 'Nombre de la nueva carpeta compartida:'
read nombre
echo 'Ruta de la carpeta compartida en el anfitriรณn:'
read ruta
if [[ $(f_existe_directorio $ruta; echo $?) = 0 ]]; then
echo 'ยฟQuieres que la carpeta compartida sea transitoria (se crearรก al encenderse la VM y se perderรก al apagarse)? (s/n)'
read res1
echo 'ยฟQuieres que los ficheros de la carpeta compartida sean de solo lectura? (s/n)'
read res2
echo 'ยฟMontar automรกticamente la carpeta compartida (la ruta serรญa /media/USER/sf_nombre-carpeta o /media/sf_nombre-carpeta)? (s/n)'
read res3
if [[ $res1 = 's' && $res2 = 's' && $res3 = 's' ]]; then
vboxmanage sharedfolder add $1 --name $nombre --hostpath $ruta --transient --readonly --automount
elif [[ $res1 = 's' && $res2 = 's' ]]; then
vboxmanage sharedfolder add $1 --name $nombre --hostpath $ruta --transient --readonly
elif [[ $res1 = 's' && $res3 = 's' ]]; then
vboxmanage sharedfolder add $1 --name $nombre --hostpath $ruta --transient --automount
elif [[ $res2 = 's' && $res3 = 's' ]]; then
vboxmanage sharedfolder add $1 --name $nombre --hostpath $ruta --readonly --automount
elif [[ $res1 = 's' ]]; then
vboxmanage sharedfolder add $1 --name $nombre --hostpath $ruta --transient
elif [[ $res2 = 's' ]]; then
vboxmanage sharedfolder add $1 --name $nombre --hostpath $ruta --readonly
elif [[ $res3 = 's' ]]; then
vboxmanage sharedfolder add $1 --name $nombre --hostpath $ruta --automount
else
vboxmanage sharedfolder add $1 --name $nombre --hostpath $ruta
fi
if [[ $(vboxmanage showvminfo $1 | egrep $ruta) ]]; then
echo 'Carpeta compartida aรฑadida.'
else
echo 'Error. Carpeta no aรฑadida.'
fi
else
echo 'Ruta no encontrada.'
fi
elif [[ $opcion = 2 ]]; then
echo 'Introduce el nombre de la carpeta compartida:'
read nombre
vboxmanage sharedfolder remove $1 --name $nombre
echo 'Carpeta retirada.'
else
echo 'Opciรณn incorrecta.'
fi
cat ./menus/vmconfig/compartida.txt
read opcion
done
}
#Esta funciรณn inicia una mรกquina virtual de Virtualbox.
#Acepta como argumento de entrada el nombre de la mรกquina virtual.
function f_iniciar_maquina {
echo 'ยฟQuieres especificar un tipo de inicio en particular (por defecto, se iniciarรก con una interfaz grรกfica)? (s/n)'
read res
if [[ $res = 's' ]]; then
cat ./menus/inicio.txt
read opcion
if [[ $opcion = 1 ]]; then
vboxmanage startvm $1 --type gui
elif [[ $opcion = 2 ]]; then
vboxmanage startvm $1 --type headless
elif [[ $opcion = 3 ]]; then
vboxmanage startvm $1 --type separate
fi
elif [[ $res = 'n' ]]; then
vboxmanage startvm $1
fi
}
#Esta funciรณn permite cambiar el estado de una mรกquina virtual de Virtualbox
#que estรฉ ejecutรกndose en ese momento. Entre otras acciones, se podrรก
#pausar, reanudar, reiniciar, realizar un apagado brusco o suave y guardar el estado.
#Recibe como parรกmetro de entrada el nombre de la mรกquina virtual.
function f_controlar_vm {
cat ./menus/controlvm.txt
read opcion
while [[ $opcion != 7 ]]; do
if [[ $opcion = 1 ]]; then
echo 'Esta opciรณn pausa temporalmente la mรกquina virtual.'
echo 'Para reanudarla, seleccione la opciรณn 2 del menรบ anterior.'
vboxmanage controlvm $1 pause
echo 'Mรกquina pausada.'
elif [[ $opcion = 2 ]]; then
vboxmanage controlvm $1 resume
echo 'Mรกquina reanudada.'
elif [[ $opcion = 3 ]]; then
echo 'Esta opciรณn es equivalente a pulsar el botรณn de reinicio en una mรกquina real.'
echo 'El estado de la mรกquina no se guarda de antemano, por lo que podrรญas perder datos.'
echo 'ยฟSeguro que quieres continuar? (s/n)'
read res
if [[ $res = 's' ]]; then
echo 'Reiniciando mรกquina...'
vboxmanage controlvm $1 reset
fi
elif [[ $opcion = 4 ]]; then
echo 'Esta opciรณn es equivalente a desenchufar el cable de alimentaciรณn de una mรกquina real.'
echo 'El estado de la mรกquina no se guarda de antemano, por lo que podrรญas perder datos.'
echo 'ยฟSeguro que quieres continuar? (s/n)'
read res
if [[ $res = 's' ]]; then
echo 'Apagando mรกquina...'
vboxmanage controlvm $1 poweroff
fi
elif [[ $opcion = 5 ]]; then
echo 'Esta opciรณn envรญa una seรฑal de apagado ACPI, equivalente a pulsar el botรณn de apagado/encendido'
echo 'de una mรกquina real. A diferencia que el apagado brusco, esta opciรณn realiza un cierre ordenado.'
echo 'ยฟSeguro que quieres continuar? (s/n)'
read res
if [[ $res = 's' ]]; then
echo 'Apagando mรกquina...'
vboxmanage controlvm $1 acpipowerbutton
fi
elif [[ $opcion = 6 ]]; then
echo 'Esta opciรณn guarda el estado actual de la mรกquina y la detiene. Al volver a iniciar la mรกquina,'
echo 'se encontrarรก en el mismo estado que antes.'
echo 'ยฟSeguro que quieres continuar? (s/n)'
read res
if [[ $res = 's' ]]; then
echo 'Apagando mรกquina...'
vboxmanage controlvm $1 savestate
fi
else
echo 'Opciรณn incorrecta.'
fi
cat ./menus/controlvm.txt
read opcion
done
}
#Esta funciรณn gestiona las instantรกneas de una mรกquina virtual en Virtualbox.
#Recibe como argumento de entrada el nombre de la mรกquina virtual. Permite tomar, listar,
#editar y eliminar instantรกneas, restaurar una mรกquina o una instantรกnea con el estado de otra
#instantรกnea y mostrar informaciรณn detallada sobre una instantรกnea en concreto.
function f_gestionar_instantaneas {
cat ./menus/instantaneas.txt
read opcion
while [[ $opcion != 8 ]]; do
if [[ $opcion = 1 ]]; then
echo 'ยฟQuรฉ nombre quieres darle a la instantรกnea?'
read nombre
echo 'ยฟQuieres aรฑadirle una descripciรณn? (s/n)'
read res
if [[ $res = 's' ]]; then
echo 'Introduce la descripciรณn:'
read descripcion
fi
echo 'ยฟLa mรกquina de la que quieres sacar la instantรกnea estรก encendida? (s/n)'
read res2
if [[ $descripcion != $null && $res2 = 's' ]]; then
vboxmanage snapshot $1 take $nombre --description="$descripcion" --live
elif [[ $descripcion != $null ]]; then
vboxmanage snapshot $1 take $nombre --description="$descripcion"
elif [[ $res2 = 's' ]]; then
vboxmanage snapshot $1 take $nombre --live
else
vboxmanage snapshot $1 take $nombre
fi
elif [[ $opcion = 2 ]]; then
vboxmanage snapshot $1 list
echo 'Introduce el nombre de la instantรกnea:'
read nombre
vboxmanage snapshot $1 delete $nombre
if [[ $(vboxmanage snapshot $1 list | egrep $nombre) ]]; then
echo 'Error. Instantรกnea no borrada.'
else
echo 'Instantรกnea borrada.'
fi
elif [[ $opcion = 3 ]]; then
vboxmanage snapshot $1 list
echo 'Introduce el nombre de la instantรกnea:'
read nombre
vboxmanage snapshot $1 restore $nombre
echo 'Mรกquina restaurada.'
elif [[ $opcion = 4 ]]; then
vboxmanage snapshot $1 restorecurrent
echo 'Instantรกnea restaurada.'
elif [[ $opcion = 5 ]]; then
echo 'Introduce el nombre de la instantรกnea:'
read inst
echo 'ยฟQuieres cambiar el (n)ombre, la (d)escripciรณn o (a)mbas cosas? (n/d/a)'
read res
if [[ $res = 'n' ]]; then
echo 'Introduce el nuevo nombre:'
read nombre
vboxmanage snapshot $1 edit $inst --name=$nombre
echo 'Nombre modificado.'
elif [[ $res = 'd' ]]; then
echo 'Introduce la nueva descripciรณn:'
read descripcion
vboxmanage snapshot $1 edit $inst --description="$descripcion"
echo 'Descripciรณn modificada.'
elif [[ $res = 'a' ]]; then
echo 'Introduce el nuevo nombre:'
read nombre
echo 'Introduce la nueva descripciรณn:'
read descripcion
vboxmanage snapshot $1 edit $inst --description="$descripcion" --name=$nombre
echo 'Nombre y descripciรณn modificados.'
fi
elif [[ $opcion = 6 ]]; then
echo "Instantรกneas de $1:"
vboxmanage snapshot $1 list --details
if [[ $(echo $?) = 1 ]]; then
echo 'Esa mรกquina no dispone de ninguna instantรกnea.'
fi
elif [[ $opcion = 7 ]]; then
vboxmanage snapshot $1 list
if [[ $(echo $?) = 1 ]]; then
echo 'Esa mรกquina no dispone de ninguna instantรกnea.'
else
echo 'Introduce el nombre de la instantรกnea:'
read inst
vboxmanage snapshot $1 showvminfo $inst
fi
else
echo 'Opciรณn incorrecta.'
fi
cat ./menus/instantaneas.txt
read opcion
done
}
#Esta funcion permite gestionar los dispositivos de almacenamiento en virtualbox.
#No recibe ningรบn argumento de entrada.
function f_gestionar_medios {
cat ./menus/medios/medios.txt
read opcion
while [[ $opcion != 6 ]]; do
if [[ $opcion = 1 ]]; then
echo 'Introduce una ruta absoluta para el nuevo medio:'
read ruta
echo 'ยฟQuieres especificar el tamaรฑo en MB o en bytes? (MB/B)'
read medida
if [[ $medida = 'MB' ]]; then
echo 'Introduce el tamaรฑo en MB:'
read size
elif [[ $medida = 'B' ]]; then
echo 'Introduce el tamaรฑo en bytes:'
read size
fi
echo 'ยฟQuieres especificar un formato para el medio (por defecto, VDI)? (s/n)'
read res2
if [[ $res2 = 's' ]]; then
echo 'ยฟ(VDI), (VMDK) o (VHD)?'
read formato
if [[ $medida = 'MB' ]]; then
vboxmanage createmedium --filename $ruta --size $size --format $formato
elif [[ $medida = 'B' ]]; then
vboxmanage createmedium --filename $ruta --sizebyte $size --format $formato
fi
else
if [[ $medida = 'MB' ]]; then
vboxmanage createmedium --filename $ruta --size $size
elif [[ $medida = 'B' ]]; then
vboxmanage createmedium --filename $ruta --sizebyte $size
fi
fi
elif [[ $opcion = 2 ]]; then
echo 'ยฟQuรฉ tipo de medio quieres retirar (hdd/dvd/disquete)?'
read tipo
if [[ $tipo = 'hdd' ]]; then
vboxmanage list hdds | egrep '(UUID|Location)'
elif [[ $tipo = 'dvd' ]]; then
vboxmanage list dvds | egrep '(UUID|Location)'
elif [[ $tipo = 'disquete' ]]; then
vboxmanage list floppies | egrep '(UUID|Location)'
fi
echo 'Introduce la UUID o la localizaciรณn del medio:'
read medio
echo 'ยฟQuieres eliminar tambiรฉn el fichero del medio? (s/n)'
read res
if [[ $res = 's' ]]; then
vboxmanage closemedium $medio --delete
echo 'Medio retirado de Virtualbox y eliminado.'
else
vboxmanage closemedium $medio
echo 'Medio retirado de Virtualbox.'
fi
elif [[ $opcion = 3 ]]; then
echo 'ยฟQuรฉ tipo de medio quieres ver (hdd/dvd/disquete)?'
read tipo
if [[ $tipo = 'hdd' ]]; then
vboxmanage list hdds | egrep '(UUID|Location)'
elif [[ $tipo = 'dvd' ]]; then
vboxmanage list dvds | egrep '(UUID|Location)'
elif [[ $tipo = 'disquete' ]]; then
vboxmanage list floppies | egrep '(UUID|Location)'
fi
echo 'Introduce la UUID o la localizaciรณn del medio:'
read medio
vboxmanage showmediuminfo $medio
elif [[ $opcion = 4 ]]; then
echo 'ยฟQuรฉ tipo de medio quieres modificar (hdd/dvd/disquete)?'
read tipo
if [[ $tipo = 'hdd' ]]; then
vboxmanage list hdds | egrep '(UUID|Location)'
elif [[ $tipo = 'dvd' ]]; then
vboxmanage list dvds | egrep '(UUID|Location)'
elif [[ $tipo = 'disquete' ]]; then
vboxmanage list floppies | egrep '(UUID|Location)'
fi
echo 'Introduce la UUID o la localizaciรณn del medio:'
read medio
f_modificar_medio $medio
elif [[ $opcion = 5 ]]; then
echo 'ยฟQuรฉ tipo de medio quieres clonar (hdd/dvd/disquete)?'
read tipo
if [[ $tipo = 'hdd' ]]; then
vboxmanage list hdds | egrep '(UUID|Location)'
elif [[ $tipo = 'dvd' ]]; then
vboxmanage list dvds | egrep '(UUID|Location)'
elif [[ $tipo = 'disquete' ]]; then
vboxmanage list floppies | egrep '(UUID|Location)'
fi
echo 'Introduce la UUID o la localizaciรณn del medio que quieres clonar:'
read medioorigen
echo 'Introduce la UUID o la localizaciรณn del medio de destino:'
read mediodestino
echo 'ยฟEl medio de destino ya existe? (s/n)'
read res
if [[ $res = 's' ]]; then
vboxmanage clonemedium $medioorigen $mediodestino --existing
else
vboxmanage clonemedium $medioorigen $mediodestino
fi
echo 'Medio clonado.'
else
echo 'Opciรณn incorrecta.'
fi
cat ./menus/medios/medios.txt
read opcion
done
}
#Esta funciรณn modifica un medio de almacenamiento en Virtualbox.
#Acepta como argumento el nombre o la uuid del medio.
function f_modificar_medio {
cat ./menus/medios/modmedio.txt
read opcion
while [[ $opcion != 7 ]]; do
if [[ $opcion = 1 ]]; then
cat ./menus/medios/modoescritura.txt
read opcion2
if [[ $opcion2 = 1 ]]; then
vboxmanage modifymedium $1 --type normal
elif [[ $opcion2 = 2 ]]; then
vboxmanage modifymedium $1 --type writethrough
elif [[ $opcion2 = 3 ]]; then
vboxmanage modifymedium $1 --type shareable
elif [[ $opcion2 = 4 ]]; then
vboxmanage modifymedium $1 --type immutable
elif [[ $opcion2 = 5 ]]; then
vboxmanage modifymedium $1 --type multiattach
elif [[ $opcion2 = 6 ]]; then
vboxmanage modifymedium $1 --type readonly
fi
echo 'Modo de escritura modificada.'
elif [[ $opcion = 2 ]]; then
echo 'ยฟQuieres habilitar el autoreseteo? (s/n)'
read res
if [[ $res = 's' ]]; then
vboxmanage modifymedium $1 --autoreset on
echo 'Autoreseteo activado.'
elif [[ $res = 'n' ]]; then
vboxmanage modifymedium $1 --autoreset off
echo 'Autoreseteo desactivado.'
fi
elif [[ $opcion = 3 ]]; then
vboxmanage modifymedium $1 --compact
echo 'Disco compactado.'
elif [[ $opcion = 4 ]]; then
echo 'ยฟQuieres especificar el tamaรฑo en MB o en bytes? (MB/B)'
read medida
if [[ $medida = 'MB' ]]; then
echo 'Introduce el tamaรฑo en MB:'
read size
vboxmanage modifymedium $1 --resize $size
elif [[ $medida = 'B' ]]; then
echo 'Introduce el tamaรฑo en bytes:'
read size
vboxmanage modifymedium $1 --resizebyte $size
fi
echo 'Tamaรฑo modificado.'
elif [[ $opcion = 5 ]]; then
echo 'Introduce la ruta relativa o absoluta de la nueva ruta:'
read ruta
if [[ $(f_existe_directorio $ruta;echo $?) = 0 ]]; then
vboxmanage modifymedium $1 --move $ruta
echo "Medio movido a $ruta. Recuerda cambiar la localizaciรณn del medio en la opciรณn 6 del menรบ."
else
echo 'Ruta no modificada.'
fi
elif [[ $opcion = 6 ]]; then
echo 'Introduce la nueva ruta del medio (con el nombre del medio incluido):'
read ruta
if [[ -e $ruta ]]; then
vboxmanage modifymedium $1 --setlocation $ruta
echo 'Localizaciรณn modificada.'
else
echo 'Medio no encontrado.'
fi
else
echo 'Opciรณn incorrecta.'
fi
cat ./menus/medios/modmedio.txt
read opcion
done
}
| true
|
0a51538adb1c3a8e918ba95ae59a161d12847595
|
Shell
|
lazarcamelia/OperatingSystems
|
/maxLengthString.sh
|
UTF-8
| 228
| 3.546875
| 4
|
[] |
no_license
|
#!/bin/bash
declare -i maxim=0
maximString=""
while [ $1 ];
do
length=`echo -n $1 | wc -m`
if [ $length -gt $maxim ];
then
maxim=$length
maximString=$1
fi
shift
done
echo "String-ul maxim e: $maximString"
| true
|
e7f9f49cd23432db75b51bc0b0a4745d4208716f
|
Shell
|
Arturzl/SHELL-SCRIPT
|
/Exerciciod.sh
|
UTF-8
| 145
| 3.109375
| 3
|
[] |
no_license
|
#!/bin/bash
echo 'Digite o nome do arquivo'
read arq
if [ -e "$arq" ] ; then
echo "o arquivo ja existe"
else
touch $arq
chmod 4 $arq
fi
| true
|
d9940847f7da3f447513d14dd9d245393e144818
|
Shell
|
ravikumarwaghmare/shellscripting
|
/basic_create_file_folder_if_not_present.ksh
|
UTF-8
| 568
| 3.21875
| 3
|
[] |
no_license
|
#!/bin/bash
##Create folder if not present. Create FIle if not present
if [ -d /home/ravi/basic_shell_scripting/folder1 ];then
echo "Folder exist.. /home/ravi/basic_shell_scripting/folder1"
else
mkdir /home/ravi/basic_shell_scripting/folder1
chmod 777 /home/ravi/basic_shell_scripting/folder1
fi
if [ -f /home/ravi/basic_shell_scripting/test.out ]; then
echo "File present.. /home/ravi/basic_shell_scripting/test.out"
else
touch /home/ravi/basic_shell_scripting/test.out
chmod 777 /home/ravi/basic_shell_scripting/test.out
fi
| true
|
5977a94aa744c112045760c3583bc55130a90162
|
Shell
|
mybigman/dots-1
|
/.local/bin/etc/volume
|
UTF-8
| 1,110
| 3.25
| 3
|
[
"CC0-1.0"
] |
permissive
|
#!/usr/bin/env sh
color="#F7E599'>"
col="<span color='"
end="</span>"
FULL="โข"
EMPTY="โ"
value="${3:-10}"
case $1 in
alsa)
send_notification() {
vol=$(amixer get Master | awk '/Left:/{gsub(/[[:punct:]]/,"",$5);left=$5}
/Right:/{gsub(/[[:punct:]]/,"",$5);right=$5}
END {print left}')
barFull=$(seq -s "$FULL" $((vol / 5)) | sed 's/[0-9]//g')
barEmpty=$(seq -s "$EMPTY" $((20 - vol / 5)) | sed 's/[0-9]//g')
dunstify -t 5000 -r 2593 -u normal "ALSA Volume $vol%" "$col$color$barFull$end$barEmpty"
}
case $2 in
up)
amixer sset Master $value%+
send_notification
;;
down)
amixer sset Master $value%-
send_notification
;;
esac
;;
mpc)
send_notification() {
vol=$(mpc volume | awk -F "\t|%|:" '{ print $2 }' | tr -d " ")
barFull=$(seq -s "$FULL" $((vol / 5)) | sed 's/[0-9]//g')
barEmpty=$(seq -s "$EMPTY" $((20 - vol / 5)) | sed 's/[0-9]//g')
dunstify -t 1000 -r 2593 -u normal "MPD Volume $vol%" "$col$color$barFull$end$barEmpty"
}
case $2 in
up)
mpc volume +$value
send_notification
;;
down)
mpc volume -$value
send_notification
;;
esac
;;
esac
| true
|
28b09b941419bba0f8693164355e4829c8e54eaf
|
Shell
|
rhynix/portcheck
|
/portcheck
|
UTF-8
| 1,481
| 4.3125
| 4
|
[
"Unlicense"
] |
permissive
|
#!/bin/sh
set -eu
echo_v() {
if [ "${verbose}" = true ]; then
echo "${1}"
fi
}
fail() {
echo "${1}"
exit 1
}
red() {
tput setaf 1; printf "%s" "${1}"
tput sgr0
}
green() {
tput setaf 2; printf "%s" "${1}"
tput sgr0
}
valid_commit_ref() {
git rev-parse --verify --quiet "${1}^{commit}" > /dev/null
}
verbose=false
while getopts "v?" flag; do
case "${flag}" in
v) verbose=true ;;
*) exit 1 ;;
esac
done
shift $((OPTIND-1))
source_ref="${1}"
target_ref="${2:-"HEAD"}"
if [ -z "${1}" ]; then
fail "usage: ${0} [-v] <source-ref> [<target-ref>]"
fi
if ! valid_commit_ref "${source_ref}"; then
fail "not a valid commit ref: ${source_ref}"
fi
if ! valid_commit_ref "${target_ref}"; then
fail "not a valid commit ref: ${target_ref}"
fi
base=$(git merge-base "${source_ref}" "${target_ref}")
commits=$(git log --no-merges --pretty=format:%H "${base}..${source_ref}")
for ref in ${commits}; do
short_ref=$(git rev-parse --short "${ref}")
ports=$(git log \
--regexp-ignore-case \
--grep="^(ported from commit ${ref})$" \
--grep="^(cherry picked from commit ${ref})$" \
--pretty=format:%h \
"${base}..${target_ref}")
for port in ${ports}; do
echo_v "$(green "+") ${short_ref} (port: ${port})"
done
if [ -z "${ports}" ]; then
echo "$(red "-") ${short_ref} (no port)"
exit_code=1
fi
done
exit "${exit_code:-0}"
| true
|
435cd338450f268082ed4c6b2dbad5688dbeb2ca
|
Shell
|
regnerjr/DotFiles
|
/.zshrc
|
UTF-8
| 4,627
| 2.59375
| 3
|
[] |
no_license
|
echo "loaded zshrc"
# show possible completions (not just a beep)
setopt autolist
# If LOCAL_OPTIONS is set in a function (or was already set before the
# function, and not unset inside it), then any options which are changed inside
# the function will be put back the way they were when the function finishes
setopt local_options
# Configure history
HISTSIZE=2000
SAVEHIST=2000
HISTFILE=~/.zsh_history
setopt inc_append_history
setopt share_history
setopt extended_history
setopt hist_ignore_dups
setopt hist_expire_dups_first
setopt hist_find_no_dups
setopt hist_reduce_blanks
setopt hist_ignore_space
setopt hist_no_store
setopt hist_no_functions
# Other nice things
setopt no_beep
setopt auto_cd
setopt correct
setopt no_case_glob
# path array should be kept unique
typeset -U path
# Setup the completion system
# The following lines were added by compinstall
zstyle ':completion:*' completer _extensions _complete _approximate
zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=** r:|=**' 'l:|=* r:|=*'
zstyle ':completion:*' max-errors 3
zstyle ':completion:*' prompt '%e'
zstyle ':completion:*' substitute 1
zstyle ':completion:*' verbose true
zstyle ':completion:*' menu select
zstyle ':completion:*:*:*:*:descriptions' format '%F{green}-- %d --%f'
zstyle ':completion:*:messages' format ' %F{purple} -- %d --%f'
zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f'
zstyle :compinstall filename '/Users/j0r010l/.zshrc'
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
autoload -Uz compinit
compinit
# show first match right away
setopt menu_complete
# load the colors function?
autoload -Uz colors && colors
# Color LS output
export CLICOLOR=1
# Initialize the prompt system promptinit
autoload -Uz promptinit
# use nVim as the visual editor
export VISUAL=nvim
export EDITOR=$VISUAL
# From Modern Vim by Drew Niel
export VIMCONFIG=~/.config/nvim
export VIMDATA=~/.local/share/nvim
export LANG=en_US.UTF-8
autoload -U edit-command-line
zle -N edit-command-line
bindkey '^x^e' edit-command-line
# Git integration that I do not understand
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:*' actionformats '[%b|%a] %c%u '
zstyle ':vcs_info:*' formats '[%b] %c%u '
precmd () { vcs_info }
setopt prompt_subst
# PROMPT
# show current path, and % prompt or # if root.
PS1='%~ ${vcs_info_msg_0_} %# '
# Show green next, or red question mark and error code number
RPS1='%(?.%F{green}โฉ๏ธ.%F{red}?%?)%f'
fpath=(~/.zsh-functions /usr/local/share/zsh-completions $fpath)
autoload -Uz delete_branches
autoload -Uz new-worktree
autoload -Uz tab
if [[ -r ~/.aliasrc ]]; then
. ~/.aliasrc
fi
cdpath=(.. ../.. dev)
export GPG_TTY
# Setup NVM
export NVM_DIR="${HOME}/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
#setup rbenv
eval "$(rbenv init - zsh)"
compdef g='git'
function g {
if [[ $# > 0 ]]; then
git $@
else
git status --short --branch
fi
}
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_COMMAND='ag -g ""'
# Load brew completions
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh-completions:$FPATH
fi
function tab {
# Must not have trailing semicolon, for iTerm compatibility
local command="cd \\\"$PWD\\\"; clear"
(( $# > 0 )) && command="${command}; $*"
# Discarding stdout to quash "tab N of window id XXX" output
osascript >/dev/null <<EOF
tell application "System Events"
tell process "Terminal" to keystroke "t" using command down
end tell
tell application "Terminal" to do script "${command}" in front window
EOF
}
function new-worktree {
local project_root="$HOME/Developer/glass-app"
local worktree_path="$HOME/Developer/glass-app-worktrees"
pushd $project_root
# get latest development to put our worktree on
git fetch origin development:development
git worktree add -b john/$1 $worktree_path/$1 origin/development
popd
# Get the worktree ready to use.
pushd $worktree_path/$1
tab "glass environment setup; ./scripts/resolve-swift-packages.sh; xc"
popd
}
alias vpnc='node /Users/j0r010l/Developer/walmart-vpn-cli-1.1/index.js'
alias vpnx='node /Users/j0r010l/Developer/walmart-vpn-cli-1.1/disconnect.js'
export PATH=$HOME/.mint/bin:$PATH
# setup pyenv
if command -v pyenv 1>/dev/null 2>&1; then
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
fi
# GPG
export GPG_TTY=$(tty)
| true
|
5baa705d51476bc3b980ca3697b41bb7e45c804c
|
Shell
|
2017212212228/homework
|
/2017212212109/็ฌฌไบๆฌกไฝไธ_adduser.sh
|
UTF-8
| 341
| 3.25
| 3
|
[] |
no_license
|
#!bin/bash
prefix = 'user'
for(i=0;i<10;i++)
do
USER_NAME=${prefix}${i}
PASSWORD=$(date +%s%N$ | sha256sum | head -c3)$(echo '!@#$%^&*()_+=' | fold -w1 | shuf | head -c1)$(date +%s%N$ | sha256sum | head -c3)$(echo '!@#$%^&*()_+=' | fold -w1 | shuf | head -c1)
useradd -g users -p ${PASSWORD} ${USER_NAME}
done
exho 'done'
| true
|
7e4c6aef9703c5b22a8f0cf8e4266e5dfb2f6d55
|
Shell
|
greflm13/configs
|
/.bashrc
|
UTF-8
| 10,391
| 3.03125
| 3
|
[] |
no_license
|
#
# ~/.bashrc
#
[[ $- != *i* ]] && return
screenfetch
colors() {
local fgc bgc vals seq0
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
# foreground colors
for fgc in {30..37}; do
# background colors
for bgc in {40..47}; do
fgc=${fgc#37} # white
bgc=${bgc#40} # black
vals="${fgc:+$fgc;}${bgc}"
vals=${vals%%;}
seq0="${vals:+\e[${vals}m}"
printf " %-9s" "${seq0:-(default)}"
printf " ${seq0}TEXT\e[m"
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
done
echo; echo
done
}
colorpanes() {
f=3 b=4
for j in f b; do
for i in {0..7}; do
printf -v $j$i %b "\e[${!j}${i}m"
done
done
d=$'\e[1m'
t=$'\e[0m'
v=$'\e[7m'
cat << EOF
$f0โโโโ$dโ$t $f1โโโโ$dโ$t $f2โโโโ$dโ$t $f3โโโโ$dโ$t $f4โโโโ$dโ$t $f5โโโโ$dโ$t $f6โโโโ$dโ$t $f7โโโโ$dโ$t
$f0โโโโ$dโ$t $f1โโโโ$dโ$t $f2โโโโ$dโ$t $f3โโโโ$dโ$t $f4โโโโ$dโ$t $f5โโโโ$dโ$t $f6โโโโ$dโ$t $f7โโโโ$dโ$t
$f0โโโโ$dโ$t $f1โโโโ$dโ$t $f2โโโโ$dโ$t $f3โโโโ$dโ$t $f4โโโโ$dโ$t $f5โโโโ$dโ$t $f6โโโโ$dโ$t $f7โโโโ$dโ$t
$d$f0 โโโโ $d$f1 โโโโ $f2โโโโ $f3โโโโ $f4โโโโ $f5โโโโ $f6โโโโ $f7โโโโ$t
EOF
}
colorpacman() {
f=3 b=4
for j in f b; do
for i in {0..7}; do
printf -v $j$i %b "\e[${!j}${i}m"
done
done
bld=$'\e[1m'
rst=$'\e[0m'
inv=$'\e[7m'
cat << EOF
$rst
$f3 โโโโโโโโโ $f1 โโโโโโโโ $f2 โโโโโโโโ $f4 โโโโโโโโ $f5 โโโโโโโโ $f6 โโโโโโโโ
$f3โโโโโโโโโโโโ $f1โ$f7โโโ$f1โโ$f7โโโ$f1โโโ $f2โโ$f7โโโ$f2โโ$f7โโโ$f2โโ $f4โโ$f7โโโ$f4โโ$f7โโโ$f4โโ $f5โโ$f7โโโ$f5โโ$f7โโโ$f5โโ $f6โโโ$f7โโโ$f6โโ$f7โโโ$f6โ
$f3โโโโโโโโ $f7โโ โโ โโ $f1โ$f7โโโ$f1โโ$f7โโโ$f1โโโ $f2โโ$f7โ โ$f2โโ$f7โ โ$f2โโ $f4โโ$f7โ โ$f4โโ$f7โ โ$f4โโ $f5โโ$f7โ โ$f5โโ$f7โ โ$f5โโ $f6โโโ$f7โโโ$f6โโ$f7โโโ$f6โ
$f3โโโโโโโโ $f7โโ โโ โโ $f1โโโโโโโโโโโโ $f2โโโโโโโโโโโโ $f4โโโโโโโโโโโโ $f5โโโโโโโโโโโโ $f6โโโโโโโโโโโโ
$f3โโโโโโโโโโโโ $f1โโโโโโโโโโโโ $f2โโโโโโโโโโโโ $f4โโโโโโโโโโโโ $f5โโโโโโโโโโโโ $f6โโโโโโโโโโโโ
$f3 โโโโโโโโโ $f1โ โ โ โ $f2โ โ โ โ $f4โ โ โ โ $f5โ โ โ โ $f6โ โ โ โ
$bld
$f3 โโโโโโโโโ $f1 โโโโโโโโ $f2 โโโโโโโโ $f4 โโโโโโโโ $f5 โโโโโโโโ $f6 โโโโโโโโ
$f3โโโโโโโโโโโโ $f1โ$f7โโโ$f1โโ$f7โโโ$f1โโโ $f2โโ$f7โ โ$f2โโ$f7โ โ$f2โโ $f4โโ$f7โ โ$f4โโ$f7โ โ$f4โโ $f5โโ$f7โ โ$f5โโ$f7โ โ$f5โโ $f6โโโ$f7โโโ$f6โโ$f7โโโ$f6โ
$f3โโโโโโโโ $f7โโ โโ โโ $f1โ$f7โโโ$f1โโ$f7โโโ$f1โโโ $f2โโ$f7โโโ$f2โโ$f7โโโ$f2โโ $f4โโ$f7โโโ$f4โโ$f7โโโ$f4โโ $f5โโ$f7โโโ$f5โโ$f7โโโ$f5โโ $f6โโโ$f7โโโ$f6โโ$f7โโโ$f6โ
$f3โโโโโโโโ $f7โโ โโ โโ $f1โโโโโโโโโโโโ $f2โโโโโโโโโโโโ $f4โโโโโโโโโโโโ $f5โโโโโโโโโโโโ $f6โโโโโโโโโโโโ
$f3โโโโโโโโโโโโ $f1โโโโโโโโโโโโ $f2โโโโโโโโโโโโ $f4โโโโโโโโโโโโ $f5โโโโโโโโโโโโ $f6โโโโโโโโโโโโ
$f3 โโโโโโโโโ $f1โ โ โ โ $f2โ โ โ โ $f4โ โ โ โ $f5โ โ โ โ $f6โ โ โ โ
$rst
EOF
}
colorbars() {
T='gYw' # The test text
echo -e "\n 40m 41m 42m 43m\
44m 45m 46m 47m";
for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \
'1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \
' 36m' '1;36m' ' 37m' '1;37m';
do FG=${FGs// /}
echo -en " $FGs \033[$FG $T "
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
do echo -en "$EINS \033[$FG\033[$BG $T \033[0m";
done
echo;
done
echo
}
colortext() {
echo -e "\033[0mNC (No color)"
echo -e "\033[1;37mWHITE\t\033[0;30mBLACK"
echo -e "\033[0;34mBLUE\t\033[1;34mLIGHT_BLUE"
echo -e "\033[0;32mGREEN\t\033[1;32mLIGHT_GREEN"
echo -e "\033[0;36mCYAN\t\033[1;36mLIGHT_CYAN"
echo -e "\033[0;31mRED\t\033[1;31mLIGHT_RED"
echo -e "\033[0;35mPURPLE\t\033[1;35mLIGHT_PURPLE"
echo -e "\033[0;33mYELLOW\t\033[1;33mLIGHT_YELLOW"
echo -e "\033[1;30mGRAY\t\033[0;37mLIGHT_GRAY"
}
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
# Change the window title of X terminals
case ${TERM} in
xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"'
;;
screen*)
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"'
;;
esac
use_color=true
# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS. Try to use the external file
# first to take advantage of user additions. Use internal bash
# globbing instead of external grep binary.
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \
&& type -P dircolors >/dev/null \
&& match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
if ${use_color} ; then
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
fi
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] '
else
PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] '
fi
alias ls='ls --color=auto'
alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
alias ll='ls -hall'
alias fuck='sudo $(fc -ln -1)'
alias please='sudo'
else
if [[ ${EUID} == 0 ]] ; then
# show root@ when we don't have colors
PS1='\u@\h \W \$ '
else
PS1='\u@\h \w \$ '
fi
fi
unset use_color safe_term match_lhs sh
alias cp="cp -i" # confirm before overwriting something
alias df='df -h' # human-readable sizes
alias free='free -m' # show sizes in MB
alias np='nano -w PKGBUILD'
alias more=less
xhost +local:root > /dev/null 2>&1
complete -cf sudo
# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control. #65623
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize
shopt -s expand_aliases
# export QT_SELECT=4
# Enable history appending instead of overwriting. #139609
shopt -s histappend
shopt -s extglob
extract() {
local c e i
(($#)) || return
for i; do
c=''
e=1
if [[ ! -r $i ]]; then
echo "$0: file is unreadable: \`$i'" >&2
continue
fi
case $i in
*.t@(gz|lz|xz|b@(2|z?(2))|a@(z|r?(.@(Z|bz?(2)|gz|lzma|xz)))))
c=(bsdtar xvf);;
*.7z) c=(7z x);;
*.Z) c=(uncompress);;
*.bz2) c=(bunzip2);;
*.exe) c=(cabextract);;
*.gz) c=(gunzip);;
*.rar) c=(unrar x);;
*.xz) c=(unxz);;
*.zip) c=(unzip);;
*) echo "$0: unrecognized file extension: \`$i'" >&2
continue;;
esac
command "${c[@]}" "$i"
((e = e || $?))
done
return "$e"
}
mkcd() {
mkdir "$1" && cd "$1"
}
dc() {
local dir="$1"
local dir="${dir:=$HOME}"
if [[ -d "$dir" ]]; then
cd "$dir" >/dev/null; ls -l --color=auto
else
echo "bash: cl: $dir: Directory not found"
fi
}
ipif() {
if grep -P "(([1-9]\d{0,2})\.){3}(?2)" <<< "$1"; then
curl ipinfo.io/"$1"
else
ipawk=($(host "$1" | awk '/address/ { print $NF }'))
curl ipinfo.io/${ipawk[1]}
fi
echo
}
note () {
# if file doesn't exist, create it
if [[ ! -f $HOME/.notes ]]; then
touch "$HOME/.notes"
fi
if ! (($#)); then
# no arguments, print file
cat "$HOME/.notes"
elif [[ "$1" == "-c" ]]; then
# clear file
printf "%s" > "$HOME/.notes"
else
# add all arguments to file
printf "%s\n" "$*" >> "$HOME/.notes"
fi
}
NPM_PACKAGES="${HOME}/.npm-packages"
export PATH="$PATH:$NPM_PACKAGES/bin"
source ~/pureline/pureline ~/.pureline.conf
# Preserve MANPATH if you already defined it somewhere in your config.
# Otherwise, fall back to `manpath` so we can inherit from `/etc/manpath`.
export MANPATH="${MANPATH-$(manpath)}:$NPM_PACKAGES/share/man"
| true
|
d3f8ef27742744d070858da8de92b2a88c44c6f3
|
Shell
|
zRrrGet/OS-Course
|
/week10/ex3.sh
|
UTF-8
| 459
| 2.75
| 3
|
[] |
no_license
|
echo "Mikhail" > _ex3.txt
chmod ugo-x _ex3.txt
ls -l _ex3.txt > ex3.txt
chmod uo+rwx _ex3.txt >> ex3.txt
ls -l _ex3.txt >> ex3.txt
chmod g=u _ex3.txt
ls -l _ex3.txt >> ex3.txt
echo "660 means that owner and group members can write and read the file, others can't" >> ex3.txt
echo "775 means owner have all permissions, group members have all permisions, others can read and execute" >> ex3.txt
echo "777 means everybody has all permissions" >> ex3.txt
| true
|
051ab6bafa0350f4fe2274752107dbac17fbd2c3
|
Shell
|
ralevn/shell_scripts
|
/AIX/aixerrlog.sh
|
UTF-8
| 1,554
| 3.125
| 3
|
[] |
no_license
|
#!/bin/bash
out_dir="$(pwd)"
out_html_filename="lpar_errlog.htm"
TIMEOUT=10
CMD="errpt|sed -e 's/ \{1,\}/,/1' -e 's/ \{1,\}/,/1' -e 's/ \{1,\}/,/1' -e 's/ \{1,\}/,/1' -e 's/ \{1,\}/,/1'"
# HTML meta info
cat <<_EOF > ${out_dir}/${out_html_filename}
<!doctype html>
<html>
<head>
<style>
table, th, td {
font-family: courier new;
font-size: 90%;
border: 1px solid grey;
border-collapse: collapse;
padding: 4px;
}
p {
font-family: Verdana;
font-size: 90%;
h3 {
font-family: Verdana;
font-size: 95%;
}
h4 {
font-family: Verdana;
font-size: 91%;
}
</style>
</head>
<body>
<h3>Server Errors</h3>
<p>date: $(date '+ %B %d, %Y')</p>
<table>
_EOF
### produce csv file with lparsErrpt.csv
echo -n "" > lparsErrpt.csv
for srv in $(awk -F , '/Running/ {print $2}' lpars1.csv)
do
sudo ssh -o ConnectTimeout=$TIMEOUT ibmssh@$srv $CMD |while IFS=, read errID errTS errTY errCL errRN errDESC
do
if [ $? != 0 ]; then
echo -e "No Connection to $srv"
fi
echo $srv,$errID,$errTS,$errTY,$errCL,$errRN,$errDESC >> lparsErrpt.csv
done
done
##########################################
# clear table and import new data from csv file
# print out joint view
##########################################
sqlite3 lpars.db "delete from lparserr"
sqlite3 lpars.db << _EOF
.mode csv
.import lparsErrpt.csv lparserr
_EOF
sqlite3 lpars.db << _EOF >> ${out_dir}/${out_html_filename}
.mode html
.header on
select * from lparserr;
_EOF
# HTML closing data
cat <<'EOF' >> ${out_dir}/${out_html_filename}
</table>
</body>
</html>
EOF
| true
|
81c41cf1f487104d8b52d450bde75079327833e1
|
Shell
|
jimbopants/Metagenomics_assembly
|
/bash_scripts/annotate/batch_annotate.sh
|
UTF-8
| 758
| 2.8125
| 3
|
[] |
no_license
|
#!/bin/bash
#MSUB -N annotate_BINS.sh
#MSUB -A b1042
#MSUB -q genomics
#MSUB -m ae
#MSUB -M jamesgriffin2013@u.northwestern.edu
#MSUB -l nodes=1:ppn=24
#MSUB -l walltime=48:00:00
#MSUB -o /projects/b1042/Wells/Jim/Wells01/logs/annotate_BINS.o
#MSUB -e /projects/b1042/Wells/Jim/Wells01/logs/annotate_BINS.e
# PATHS
#maxbin_bins = "/projects/b1042/Wells/Jim/Wells01/binning/maxbin_bins/final_bins"
BINS="/projects/b1042/Wells/Jim/Wells01/binning/metabat2_bins/final_bins"
BASE_OUT="/projects/b1042/Wells/Jim/Wells01/binning/metabat2_bins/annotations/"
EXT=".fa" # change when running maxbin
mkdir -p $BASE_DIR
source activate env_prokka
cd $BINS
for f in *$EXT; do
g=${BASE_OUT}$(basename -s .fasta $f);
echo $g
mkdir -p $g;
prokka --outdir $g --metagenome --cpus=0 $f;
done
| true
|
1e7db673adda1b57b7929175d6e8fd09368739bd
|
Shell
|
greymd/teip
|
/tests/test_without_teip.sh
|
UTF-8
| 440
| 2.71875
| 3
|
[
"MIT",
"CC-BY-NC-4.0",
"Unlicense"
] |
permissive
|
#!/bin/bash
set -u
# smart version
# grep -n -C 3 admin < test_secure | awk -F '[-:]' '{print $1}' | awk NF | awk '{ do{ for(s=e=$1; (r=getline)>0 && $1<=e+1; e=$1); print s==e ? s : s","e }while(r>0) }'| awk '{print $0"s/./@/g"}' | sed -f- test_secure > tmp
# inefficient version
grep -n -C 3 admin < test_secure | awk -F '[-:]' '{print $1}' | awk NF | awk '{print $0"s/./@/g"}' | sed -f- test_secure > tmp
echo "sha1sum = $(sha1sum tmp)"
| true
|
f4c1e94aec3a9058a7233eec7ae16b449b5bd3db
|
Shell
|
myurasov/Kaggle-BirdCLEF-2021
|
/docker/docker.sh
|
UTF-8
| 1,734
| 4.1875
| 4
|
[] |
no_license
|
#!/bin/bash
UP1_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. >/dev/null && pwd)"
THIS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
IMAGE_NAME=`cd "${UP1_DIR}" && echo ${PWD##*/} | tr '[:upper:]' '[:lower:]' | sed -e 's/[-_ ]+/-/g'`
JUPYTER_PORT=8888
TENSORBORAD_PORT=6006
DOCKER_RUN_FLAGS="it"
GPUS="all"
FOREVER=0
BUILD=1
KILL=1
CMD=""
# process named arguments
while [ $# -gt 0 ]; do
case "$1" in
--jupyter_port=*)
JUPYTER_PORT="${1#*=}"
;;
--tensorboard_port=*)
TENSORBORAD_PORT="${1#*=}"
;;
--image_suffix=*)
IMAGE_NAME="${IMAGE_NAME}-${1#*=}"
;;
--gpus=*)
GPUS="${1#*=}"
;;
--forever)
DOCKER_RUN_FLAGS+="d"
;;
--no-kill)
KILL=0
;;
--no-build)
BUILD=0
;;
--help)
echo "Usage: docker.sh [--jupyter_port=####|8888] [--tensorboard_port=####|6006] [--help] [command]"
exit
;;
*)
CMD="${1}"
esac
shift
done
if [ $KILL -ge 1 ]
then
echo "Killing ${IMAGE_NAME}..."
docker kill "${IMAGE_NAME}"
fi
if [ $BUILD -ge 1 ]
then
echo "Building ${IMAGE_NAME}..."
docker build -f "${THIS_DIR}/Dockerfile" -t $IMAGE_NAME "${UP1_DIR}" || exit 1
fi
# only map jupyter/tensorboard ports if command is not specified
if [ -z "$CMD" ]
then
PORT_MAPPINGS_ARG="-p ${JUPYTER_PORT}:8888 -p ${TENSORBORAD_PORT}:6006"
fi
# only add --gpus switch if GPUs are present
if [ `lspci | grep -i nvidia | wc -l` -ge 1 ]
then
GPUS_ARG="--gpus=\"${GPUS}\""
fi
docker run --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864 \
${GPUS_ARG} --rm "-${DOCKER_RUN_FLAGS}" --name="${IMAGE_NAME}" \
-v "${UP1_DIR}:/app" $PORT_MAPPINGS_ARG \
$IMAGE_NAME $CMD
| true
|
2152c2894c9f44d55f8415fbc84c875ec5045775
|
Shell
|
ygwane/scripts
|
/MySQL_Backup/dump_dbs_server.sh
|
UTF-8
| 1,706
| 4.28125
| 4
|
[] |
no_license
|
#!/bin/bash
#
# Name: dump_dbs_[server].sh
#
# Description: Dump databases from localhost to
# NFS mount directory stored on NAS server
#
#######################################################
## VARS
SRV=$(/bin/hostname)
MAIL=user@domain.com
LOG=/var/log/dump_${SRV}.log
BACKUPDIR=/mnt/backup
LCK=/tmp/dump_${SRV}.lock
DBs=(
BASE1
BASE2
BASE3
)
## FUNCTIONS
function MailNotif()
{
echo "$*" | mail -s Script\ Error\ :\ $(basename "$0")\ on\ $(/bin/hostname) ${MAIL}
echo "$*" >> ${LOG}
}
function DUMP()
{
for BASE in ${DBs[@]}
do
echo -e "\033[32m${BASE} will be dumped to ${BACKUPDIR}!\033[0m"
mysqldump -uroot ${BASE} > ${BACKUPDIR}/${BASE}_${SRV}.sql
done
}
## EXEC
echo -e "####################################################################"
echo -e ".: $(date +%c) : Starting dump dbs for ${SRV} to ${BACKUPDIR} :."
echo -e "####################################################################"
if [ ! -s ${LCK} ]
then
echo "INFO: Create lock file ${LCK}"
date > ${LCK}
else
MailNotif "ERROR: lock file already exists, execution aborted ..."
exit 1
fi
if [ -d ${BACKUPDIR} ]
then
echo -e "$(date +%c) : ${BACKUPDIR} is reachable, lauching backup !"
DUMP
echo -e "Deleting lock file ${LCK}"
rm -f ${LCK}
else
MailNotif "$(date +%c) : ${BACKUPDIR} is unreachable, execution aborted ..."
exit 1
fi
echo -e "############################################################################################"
echo -e ".: $(date +%c) : MySQL dumps have been successfully backup for ${SRV} to ${BACKUPDIR} :."
echo -e "############################################################################################"
# EOS
| true
|
27070e0e2c986d1d4c9b94747184b7a8e8592323
|
Shell
|
succi0303/terraform-simple-eccube-on-aws
|
/user-data.sh
|
UTF-8
| 686
| 2.53125
| 3
|
[] |
no_license
|
#!/bin/bash
yum update -y
amazon-linux-extras install -y lamp-mariadb10.2-php7.2
yum install -y mariadb-server
yum install -y httpd php php-xml php-mbstring php-zip php-intl
cd /usr/local/src/
wget http://downloads.ec-cube.net/src/eccube-4.0.4.zip
unzip eccube-4.0.4.zip
mv eccube-4.0.4 /var/www/html/ec
chown -R apache:apache /var/www/html/
echo -e '<Directory "/var/www/html/ec">\n AllowOverride All\n</Directory>' > /etc/httpd/conf.d/ec.conf
systemctl start mariadb
mysql -u root -e "CREATE DATABASE ecdb DEFAULT CHARACTER SET utf8;CREATE USER 'ecuser'@'localhost' IDENTIFIED BY 'ecpass';GRANT ALL PRIVILEGES ON ecdb.* TO 'ecuser'@'localhost';FLUSH PRIVILEGES;"
systemctl start httpd
| true
|
f45e540e6743d76c513a109abded6f50ef52cefa
|
Shell
|
hashbang/stack
|
/images/stack-base/files/usr/local/bin/enable-faketime
|
UTF-8
| 386
| 2.921875
| 3
|
[
"LicenseRef-scancode-warranty-disclaimer"
] |
no_license
|
#!/usr/bin/env bash
set -e;
# Set faketime date to match in-use debian archive
cat /etc/apt/sources.list \
| grep archive \
| head -n1 \
| sed -e 's/.*debian\/\([0-9]\+T[0-9]\+Z\).*/\1/g' \
| sed -r 's/(....)(..)(..)T(..)(..)(..)Z/@\1-\2-\3 \4:\5:\6/' \
> /etc/faketimerc
# Enable faketime globally
echo "/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1" > /etc/ld.so.preload
| true
|
4525bfdca0f9a99ff5f568f42071f533e4c1c0db
|
Shell
|
iamhsa/pkenv
|
/bin/pkenv
|
UTF-8
| 1,179
| 3.96875
| 4
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
set -e
if [ -n "$PKENV_DEBUG" ]; then
export PS4='+ [${BASH_SOURCE##*/}:${LINENO}] '
set -x
fi
# http://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac
readlink_f() {
local target_file=$1
local file_name
while [ "$target_file" != "" ]; do
cd $(dirname ${target_file})
file_name=$(basename ${target_file})
target_file=$(readlink ${file_name})
done
echo $(pwd -P)/${file_name}
}
if [ -z "${PKENV_ROOT}" ]; then
PKENV_ROOT=$(cd $(dirname $(readlink_f $0))/.. && pwd)
else
PKENV_ROOT="${PKENV_ROOT%/}"
fi
export PKENV_ROOT
PATH="${PKENV_ROOT}/libexec:${PATH}"
export PATH
export PKENV_DIR="${PWD}"
abort() {
{ if [ "$#" -eq 0 ]; then cat -
else echo "pkenv: $*"
fi
} >&2
exit 1
}
command="$1"
case "$command" in
"" )
{ pkenv---version
pkenv-help
} | abort
;;
-v | --version )
exec pkenv---version
;;
-h | --help )
exec pkenv-help
;;
* )
command_path="$(command -v "pkenv-${command}" || true)"
if [ -z "$command_path" ];then
{ echo "no such command '$command'"
pkenv-help
} | abort
fi
shift 1
exec "$command_path" "$@"
;;
esac
| true
|
05ba6afaeedb5f507471f0600cdaefb8789e5eb6
|
Shell
|
mannd00/Final_Pack
|
/week7/week7-runlevel.sh
|
UTF-8
| 144
| 2.515625
| 3
|
[] |
no_license
|
#! /bin/bash
echo "Welcome to Week 7 runlevel checker."
echo "Your runlevel is: "
who -r
echo "Alternative Method using runlevel"
runlevel
| true
|
31052e1ad4180aa895e7675886c5021d80397e7d
|
Shell
|
Ecommerce-org/subbufirstrepo
|
/hello.sh
|
UTF-8
| 184
| 2.890625
| 3
|
[] |
no_license
|
echo "Hello"
date
whoami
echo $0
echo $1
echo $$
if [ $# -eq 2 ]
then
echo "Received 2 Args"
else
echo "need 2 args"
fi
date
if [ $? -eq 0 ]
then
echo "success"
else
echo "failure"
fi
| true
|
6938349131eaa91bb13bb9d386b5e873fd5d9d06
|
Shell
|
qq18436558/livezilla-docker
|
/entrypoint.sh
|
UTF-8
| 976
| 2.84375
| 3
|
[] |
no_license
|
#!/bin/bash
set -o errexit -o nounset -o pipefail
if [ "${INSTALL_MODE}" = "false" ]; then
sed 's,{{DB_HOST}},'"${DB_HOST}"',g' -i /var/www/html/_config/config.php
sed 's,{{DB_DATABASE}},'"${DB_DATABASE}"',g' -i /var/www/html/_config/config.php
sed 's,{{DB_USERNAME}},'"${DB_USERNAME}"',g' -i /var/www/html/_config/config.php
sed 's,{{DB_PASSWORD}},'"${DB_PASSWORD}"',g' -i /var/www/html/_config/config.php
sed 's,{{DB_PREFIX}},'"${DB_PREFIX}"',g' -i /var/www/html/_config/config.php
sed 's,{{DB_ENGINE}},'"${DB_ENGINE}"',g' -i /var/www/html/_config/config.php
sed 's,{{LIVEZILLA_ID}},'"${LIVEZILLA_ID}"',g' -i /var/www/html/_config/config.php
sed 's,{{LIVEZILLA_PR_CR}},'"${LIVEZILLA_PR_CR}"',g' -i /var/www/html/_config/config.php
echo install mode false
rm -rf /var/www/html/install
else
echo install mode true
rm -rf /var/www/html/_config/config.php
fi
start_system() {
/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf
}
start_system
exit 0
| true
|
d01fa489d35b2fe32a655ede735b2d113113fb4c
|
Shell
|
Demelza/homura
|
/homura.sh
|
UTF-8
| 11,872
| 3.53125
| 4
|
[] |
no_license
|
#!/bin/bash
reset
echo "********************************************************************************"
echo "* Homura *"
echo "********************************************************************************"
echo ""
echo "1/ Download sources for your device"
echo "2/ Convert device sources to AICP sources"
echo "3/ Compile AICP"
echo "4/ Help (MUST READ FIRST)"
echo ""
read -p "What do you want to do? " choice
case $choice in
[1]* ) reset;
echo "********************************************************************************";
echo "* Device Source Downloader *";
echo "********************************************************************************";
echo "";
echo "You are about to download sources for your device.";
echo "Please make sure that you are in your AICP folder before going further.";
echo "Please input the link to github CyanogenMod sources for your device."
echo "";
read -p "Please type the link to sources: " sources;
read -p "Please type the branch you want to download: " branch;
read -p "Please type the brand of your device: " brands;
read -p "Please type the codename of your device: " codename;
git clone $sources -b $branch device/$brands/$codename;
echo "";
echo "Sources for your device have been downloaded and should have been placed in the right directory.";
echo "Please make sure your sources are in device/brand/device_name directory before going further.";
echo "";
read -p "Please type YES to go back to main menu: " menu;
case $menu in
[YES]* ) reset; ./homura.sh;;
esac
esac
case $choice in
[2]* ) reset;
echo "********************************************************************************";
echo "* Device Source Converter *";
echo "********************************************************************************";
echo "";
echo "You are about to convert sources from CM to AICP.";
echo "You will now have to input some data for the conversion to work.";
echo "";
read -p "Please input your device's codename: " device;
read -p "Please input your device's brand: " brand;
read -p "Please input your device's real brand: " rbrand;
read -p "Please input your device's full name: " fulldevice;
read -p "Please input your name/nickname: " yourname;
cd device/$brand/$device;
mkdir -p aicp;
echo "# Inherit some common AICP stuff." >> aicp/$device.mk;
echo '$(call inherit-product, vendor/aicp/configs/common.mk)' >> aicp/$device.mk;
echo "" >> aicp/$device.mk;
echo "# Inherit telephony stuff" >> aicp/$device.mk;
echo '$(call inherit-product, vendor/aicp/configs/telephony.mk)' >> aicp/$device.mk;
echo "" >> aicp/$device.mk;
echo "# Enhanced NFC" >> aicp/$device.mk;
echo '$(call inherit-product, vendor/aicp/configs/nfc_enhanced.mk)' >> aicp/$device.mk;
echo "" >> aicp/$device.mk;
echo "# Inherit device configuration" >> aicp/$device.mk;
line='$(call inherit-product, device/';
line="$line$brand";
line="$line/";
line="$line$device";
line="$line/";
line="$line$device";
line="$line.mk)";
echo "$line" >> aicp/$device.mk;
echo "" >> aicp/$device.mk;
echo "DEVICE_PACKAGE_OVERLAYS += device/$brand/$device/overlay" >> aicp/$device.mk;
echo "" >> aicp/$device.mk;
echo "## Device identifier. This must come after all inclusions" >> aicp/$device.mk;
echo "PRODUCT_NAME := aicp_$device" >> aicp/$device.mk;
echo "PRODUCT_BRAND := $rbrand" >> aicp/$device.mk;
echo "PRODUCT_MODEL := $fulldevice" >> aicp/$device.mk;
echo "" >> aicp/$device.mk;
echo "TARGET_VENDOR := $brand" >> aicp/$device.mk;
echo "" >> aicp/$device.mk;
echo "PRODUCT_BUILD_PROP_OVERRIDES += \ " >> aicp/$device.mk;
echo " PRODUCT_NAME=$device \ " >> aicp/$device.mk;
ggrep -R " BUILD_FINGERPRINT=" cm.mk >> aicp/$device.mk;
ggrep -R " PRIVATE_BUILD_DESC=" cm.mk >> aicp/$device.mk;
echo "" >> aicp/$device.mk;
echo "# AICP Device Maintainers" >> aicp/$device.mk;
echo "PRODUCT_BUILD_PROP_OVERRIDES += \ " >> aicp/$device.mk;
echo " DEVICE_MAINTAINERS="$yourname"" >> aicp/$device.mk;
echo "" >> aicp/$device.mk;
echo "# Boot animation" >> aicp/$device.mk;
ggrep -R "TARGET_SCREEN_HEIGHT :=" cm.mk >> aicp/$device.mk;
ggrep -R "TARGET_SCREEN_WIDTH :=" cm.mk >> aicp/$device.mk;
echo "-include vendor/aicp/configs/bootanimation.mk" >> aicp/$device.mk;
mv cm.mk $device.mk;
mv aicp/$device.mk ../../../vendor/aicp/products/$device.mk
echo "";
echo "Sources for your device have been converted into AICP sources.";
read -p "Please type YES to go back to main menu: " menu;
case $menu in
[YES]* ) reset; ./../../../homura.sh;;
esac
esac
case $choice in
[3]* ) reset;
echo "********************************************************************************";
echo "* AICP Compiler *";
echo "********************************************************************************";
echo "";
echo "You are about to compile AICP ROM for your device.";
echo "If there are errors during compilation, it may mean one of the following things:";
echo "1/ Your sources have been converted but they are not proper for AICP;";
echo "2/ Your building environment has not been correctly set up.";
echo "";
echo "Either way, the automatic compilator for AICP is not working yet.";
echo "Please compile manually following the instructions in their github for now.";
echo "";
echo "AICP has not been compiled because this part of the program does not work yet.";
read -p "Please type YES to go back to main menu: " menu;
case $menu in
[YES]* ) reset; ./homura.sh;;
esac
esac
case $choice in
[4]* ) reset;
echo "********************************************************************************";
echo "* Help *";
echo "********************************************************************************";
echo "";
echo "1/ Downloading sources for your device";
echo "2/ Converting sources for your device";
echo "3/ Compiling AICP";
echo "";
read -p "What do you need help with? " help;
case $help in
[1]* ) reset;
echo "********************************************************************************";
echo "* Downloader Help *";
echo "********************************************************************************";
echo "";
echo "The program will ask you for several things to input in order to work properly.";
echo "";
echo "Link to sources: this is the URL for your device's device tree. If you don't know what it is, you can search on CyanogenMod's github: for example, Nubia Z9 Max repo is https://github.com/CyanogenMod/android_device_zte_nx510j. It ALWAYS should begin with android_device_.";
echo "";
echo "Branch: this is the tree branch you want to download. If you are downloading from CyanogenMod's repository, the branch you want to download should be cm-13.0.";
echo "";
echo "Device brand: this simply is the brand of your device. If you don't know what it is, take a simple look at CyanogenMod's github repo: for example, Nubia Z9 Max repo is https://github.com/CyanogenMod/android_device_zte_nx510j, and zte is the device's brand. You should ALWAYS use the brand that is in the repo's URL, even if the actual brand of your device is different (for example, Nubia Z9 Max is a device made by Nubia but you should use zte instead).";
echo "";
echo "Device codename: this simply is the codename for your device. If you don't know what it is, take a simple look at CyanogenMod's github repo: for example, Nubia Z9 Max's repo is https://github.com/CyanogenMod/android_device_zte_nx510j, and nx510j is the device's codename. You should ALWAYS use your device codename, and NOT the actual device name (for example, for the Nubia Z9 Max, use nx510j and not Z9 Max).";
echo "";
read -p "Please type YES to go back to main menu: " menu;
case $menu in
[YES]* ) reset; ./homura.sh;;
esac
esac
case $help in
[2]* ) reset;
echo "********************************************************************************";
echo "* Converter Help *";
echo "********************************************************************************";
echo "";
echo "The program will ask you for several things to input in order to work properly.";
echo "";
echo "Device codename: this simply is the codename for your device. If you don't know what it is, take a simple look at CyanogenMod's github repo: for example, Nubia Z9 Max's repo is https://github.com/CyanogenMod/android_device_zte_nx510j, and nx510j is the device's codename. You should ALWAYS use your device codename, and NOT the actual device name (for example, for the Nubia Z9 Max, use nx510j and not Z9 Max).";
echo "";
echo "Device brand: this simply is the brand of your device. If you don't know what it is, take a simple look at CyanogenMod's github repo: for example, Nubia Z9 Max repo is https://github.com/CyanogenMod/android_device_zte_nx510j, and zte is the device's brand. You should ALWAYS use the brand that is in the repo's URL, even if the actual brand of your device is different (for example, Nubia Z9 Max is a device made by Nubia but you should use zte instead).";
echo "";
echo "Device real brand: this is the real brand of your device. For exemple, if you have a Nubia Z9 Max, you should input nubia, as opposed to brand in previous step which should have been zte. Please not that in most cases, you should input the brand in lowercase.";
echo "";
echo "Device full name: this is the name for your device. For the Nubia Z9 Max, it should simply be Z9 Max. Please note that here, lettercase should be the real one, and not lowercase only.";
echo "";
echo "Your name: this is the name you will appear as inside the ROM. You can type whatever you want here, be it your real name, your developer nickname, or whatever crosses your mind.";
echo "";
read -p "Please type YES to go back to main menu: " menu;
case $menu in
[YES]* ) reset; ./homura.sh;;
esac
esac
case $help in
[3]* ) reset;
echo "********************************************************************************";
echo "* Converter Help *";
echo "********************************************************************************";
echo "";
echo "The part of the program is not working yet.";
echo "Please come again at a later time when an update is available.";
echo "";
read -p "Please type YES to go back to main menu: " menu;
case $menu in
[YES]* ) reset; ./homura.sh;;
esac
esac
esac
| true
|
2e1cbd12824056c7193e3b2f3ec60721b9c2fc1b
|
Shell
|
chaquo/chaquopy
|
/server/pypi/packages/llvmlite/llvm-config
|
UTF-8
| 612
| 3.3125
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
set -eu
llvm_version=$(grep chaquopy-llvm $(dirname $0)/meta.yaml | sed 's/.*chaquopy-llvm //')
chaquopy_dir=$(realpath -e ../../requirements/chaquopy)
# Support arguments used by ffi/build.py.
if [ "$*" == "--version" ]; then
echo $llvm_version
elif [ "$*" == "--includedir" ]; then
echo $chaquopy_dir/include
elif [ "$*" == "--cxxflags" ]; then
echo -I $chaquopy_dir/include
elif [ "$*" == "--ldflags" ]; then
echo -L $chaquopy_dir/lib
elif [ "$*" == "--system-libs --libs all" ]; then
echo -lLLVM-${llvm_version:0:1}
else
echo $0: Unknown arguments: \'$*\'
exit 1
fi
| true
|
02dd05cd13bb7242dd1257fbc2659c4f334d4cb9
|
Shell
|
AlexHowansky/shmd
|
/bin/dumpCollection.sh
|
UTF-8
| 377
| 3.53125
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
# This script will dump the contents of an AWS Rekognition collection.
if ! hash aws 2>/dev/null
then
echo "ERROR: Requires awscli. See https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html"
exit 1
fi
if [ ${#} -ne 1 ]
then
echo "Usage: ${0} <collection>";
exit
fi
aws --output json rekognition list-faces --collection-id ${1}
| true
|
684ce2ef665a860392194149aae8557270e3c393
|
Shell
|
Einherjarulian/FG-turbo-lappies
|
/Laptops.sh
|
UTF-8
| 19,094
| 3.4375
| 3
|
[] |
no_license
|
#!/bin/bash
# https://askubuntu.com/questions/1705/how-can-i-create-a-select-menu-in-a-shell-script
DIALOG_HEIGHT=17
DIALOG_WIDTH=50
HEIGHT=15
WIDTH=50
CHOICE_HEIGHT=6
TITLE="Laptop Scripts"
MENU="Choose one of the following options:"
CHOICE=$(dialog --clear \
--title "$TITLE" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
1 "Build" \
2 "QC" \
3 "OEM Rollback" \
4 "Broadcom Drivers" \
5 "Libdvd" \
6 "Regionset" \
7 "Production Day Build" \
8 "Production Day QC" \
2>&1 >/dev/tty)
#This sets up a menu to make a choice regarding the preferred usage of this script.
clear
case $CHOICE in
1)
dialog --title "Build" --msgbox "\nYou have chosen Build!\n\n\nClick ENTER key to continue..." 10 50; clear;
ping -c1 data
if [ $? -eq 0 ]
then
dialog --title "Hello!" --msgbox "\nWelcome to the Build Program. Make sure that you have a build binder handy and open to the build section, then press Enter." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
dialog --title "Speaker Test" --msgbox "\nThe first thing we are going to do is test the speakers on this machine. Review Section 10 in the build section of the laptops binder to understand what it's doing and why. Turn up the volume! If you don't hear anything, please consult your instructor.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
speaker-test -t wav -c2 -l1
dialog --title "Headphone Test" --msgbox "\nNow we are going to test the headphone jack. Plug in some headphones and turn the volume down so you don't deafen yourself. If you don't hear anything, please consult your instructor.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
speaker-test -t wav -c2 -l1
dialog --title "Stress Testing the CPU" --msgbox "\nNext we will test the processor by installing some scripts from our tools on the Free Geek server. Type 'freegeek' when prompted for a password. Beware! The cursor will not move when you input the password! Just keep typing and press enter after you have typed the password.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
wget -O - build/tools | sh
stress-test
dialog --title "WiFi Test" --msgbox "\nTo test the WiFi, we need to unplug the ethernet cable and connect to the Freegeek WiFi network. Open Firefox and run a google search for Free Geek Mothership. If this doesn't work, consult your instructor. Otherwise...\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
dialog --title "Drivers" --msgbox "\nNow we will check to see if there are any necessary drivers for this laptop. Reconnect the ethernet cable and open the Menu in the lower left corner of the screen. In the text box type driver and select the driver manager. Enter freegeek as the password. If any drivers show up, ask your instructor for further instruction. Also see section 13 in the Build section of the laptop binder for additional information.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
eject
dialog --title "Optical Drive" --msgbox "\nThe optical drive should have opened, and now you should take an audio CD and place it in the drive. A menu will appear, and you should select VLC from the dropdown menu and check the box saying 'Always Perform this Action.' If the CD plays, repeat with a DVD. If the DVD plays, utter a Huzzah! If these do not function properly, review section 15 in the Build section of the laptop binder and consult your instructor.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
dialog --title "USB Ports" --msgbox "\nNow grab a USB mouse and test to make sure that you are able to move the mouse cursor when it is plugged into each of the USB ports. Make note of any ports that do not function and cover broken or non-functional ports with electrical tape.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
dialog --title "Webcam" --msgbox "\nWe will test the webcam next.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
sudo apt install cheese
cheese
dialog --title "HDMI" --msgbox "\nTake the laptop to the monitor at the end of the bench, and plug in the HDMI cable. You should see the screen wake up and something will be displayed. If so, return to your place on the bench and reconnect the power cable and ethernet cable. If not, consult your instructor.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
dialog --title "OEM Config" --msgbox "\nNow we will install the OEM Config software we use to make sure that everyone sets their own username and password when they receive this laptop from Free Geek.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
sudo apt install oem-config-gtk
dialog --title "System Updates" --msgbox "\nWe will now install any software and system updates for this laptop to ensure the best possible security and most stable experience on this laptop. While this is occuring, check out step 17 in the binder and follow the directions for store display directions.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
sudo apt update && sudo apt upgrade -y
dialog --title "Battery Quest" --msgbox "\nSee the instructions for battery testing in part 17 of the binder. If you have a battery below 70% capacity, prepare yourself for Battery Quest. Good Luck! \n\n\nPress Enter once you have finished checking the battery..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
dialog --title "Power/Display Settings" --msgbox "\nRead the instructions in section 17 of the build part of the laptops binder. Make sure you both Prepare the system for display in the store and change the More Display Settings.\n\n\nPress Enter once you have made the necessary changes..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
dialog --title "Printme" --msgbox "\nWe are almost finished! Now we will run printme, a piece of software that will ask you some questions and assemble a specification sheet for this laptop. Please answer all of the questions.\n\nBe sure to record the battery capacity (%) in the noteworthy items!!\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
printme
dialog --title "Shutdown" --msgbox "\nCongratulations, you have finished building this laptop! This laptop will now shutdown, so prepare to move this laptop to the testing rack and begin memtest86+. Consult the instructions part 18 of the build section of the binder to do so.\n\n\nThank you for all your help and press Enter to shutdown..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
shutdown -P now
else
echo Please connect an ethernet cable and try again.
fi
;;
2)
ping -c1 data
if [ $? -eq 0 ]
then
dialog --title "QC" --msgbox "\nYou have chosen Quality Control!\n\n\nClick ENTER key to continue..." 10 50; clear;
dialog --title "Hello!" --msgbox "\nWelcome to the Quality Control. Make sure that you have a build binder handy and open to the QC section, then press Enter." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
dialog --title "Speaker Test" --msgbox "\nThe first thing we are going to do is test the speakers on this machine. Turn up the volume! If you don't hear anything, please review section 6 in the QC portion of the laptops binder and consult your instructor.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
speaker-test -t wav -c2 -l1
dialog --title "Headphone Test" --msgbox "\nNow we are going to test the headphone jack. Plug in some headphones and turn the volume down so you don't deafen yourself. If you don't hear anything, please consult your instructor.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
speaker-test -t wav -c2 -l1
dialog --title "Stress Testing the CPU" --msgbox "\nNext we will test the processor by installing some scripts from our tools on the Free Geek server. Type 'freegeek' when prompted for a password. Beware! The cursor will not move when you input the password! Just keep typing and press enter after you have typed the password.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
wget -O - build/tools | sh ; sleep 5;
stress-test
dialog --title "WiFi Test" --msgbox "\nTo test the WiFi, we need to unplug the ethernet cable and connect to the Freegeek WiFi network. Open Firefox and run a google search for Free Geek Mothership. If this doesn't work, consult section 6 in the QC portion of the laptops binder and your instructor. Otherwise...\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
dialog --title "Drivers" --msgbox "\nNow we will check to see if there are any necessary drivers for this laptop. Reconnect the ethernet cable and open the Menu in the lower left corner of the screen. In the text box type driver and select the driver manager. Enter freegeek as the password. If any drivers show up, ask your instructor for further instruction.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
eject
dialog --title "Optical Drive" --msgbox "\nThe optical drive should have opened, and now you should take an audio CD and place it in the drive. A menu will appear, and you should select VLC from the dropdown menu and check the box saying Always Perform this Action. If the CD plays, repeat with a DVD. If the DVD plays, utter a Huzzah! Review section 6 of the laptops binder and consult your instructor if the optical drive fails to function.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
dialog --title "USB Ports" --msgbox "\nNow grab a USB mouse and test to make sure that you are able to move the mouse cursor when it is plugged into each of the USB ports. Make note of any ports that do not function and cover broken or non-functional ports with electrical tape.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
dialog --title "Webcam" --msgbox "\nWe will test the webcam next.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
sudo apt install cheese
cheese
dialog --title "HDMI" --msgbox "\nTake the laptop to the monitor at the end of the bench, and plug in the HDMI cable. You should see the screen wake up and something will be displayed. If so, return to your place on the bench and reconnect the power cable and ethernet cable. If not, consult your instructor.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
dialog --title "OEM Config" --msgbox "\nNow we make sure that the OEM Config software that we use to make sure that everyone sets their own username and password when they receive this laptop from Free Geek is installed.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
sudo apt install oem-config-gtk
dialog --title "Battery Quest" --msgbox "\nSee the instructions for battery testing in part 17 of Build section of the binder. Make sure that the percentage on the keeper label matches what the system reports. Good Luck! \n\n\nPress Enter once you have finished checking the battery..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
dialog --title "Power/Display Settings" --msgbox "\nRead the instructions in section 17 of the build part of the laptops binder. Make sure you both Prepare the system for display in the store and change the More Display Settings.\n\n\nPress Enter once you have made the necessary changes..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
dialog --title "System Updates" --msgbox "\nWe will now install any software and system updates for this laptop to ensure the best possible security and most stable experience on this laptop. While this is occuring, check out step 16 in the binder and follow the directions for store display directions.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
sudo apt update && sudo apt upgrade -y
dialog --title "Printme" --msgbox "\nWe are almost finished! Now we will run printme, a piece of software that will ask you some questions and assemble a specification sheet for this laptop. Please answer all of the questions.\n\nBe sure to record the battery capacity (%) in the noteworthy items at the end of the questions.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
printme; sleep 5;
#This keeps getting skipped, but for why?
CHOICE_HEIGHT=2
TITLE="End Destination"
MENU="Choose the end destination for this laptop. If you are not sure what this means, consult your instructor."
QC_CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
1 "Store" \
2 "Grant" \
2>&1 >/dev/tty)
clear
case $QC_CHOICE in
1)
dialog --title "Password Change" --msgbox "\nNext we need to change the password on the machine. Have a staff member take care of the next step.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
passwd
dialog --title "Shutdown" --msgbox "\nCongratulations, you have finished quality checking this laptop! This laptop will now shutdown, so make sure that you have checked off all of the boxes on the keeper label for the QC column.\n\n\nThank you for all your help and press Enter to shutdown..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
shutdown -P now
;;
2)
dialog --title "Prepare for Shipping to End User" --msgbox "\nNow we will run the OEM configuration software so that the next person to turn it on will be able to set their own username and password.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
oem-config-prepare
dialog --title "Shutdown" --msgbox "\nCongratulations, you have finished quality checking this laptop! This laptop will now shutdown, so make sure that you have checked off all of the boxes on the keeper label for the QC column.\n\n\nThank you for all your help and press Enter to shutdown..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
shutdown -P now
;;
esac
else
echo Please connect an ethernet cable and try again
fi
;;
3)
dialog --title "OEM Rollback" --msgbox "\nYou have chosen OEM Rollback! Please make sure that you are connected to an ethernet cable.\n\n\nClick ENTER key to continue..." 10 50; clear;
sudo rm -r /etc/systemd/system/oem-config-target.wants
sudo rm -r /etc/systemd/system/default.target
sudo apt purge oem-config-gtk -y
sudo apt install oem-config-gtk -y
sudo reboot
;;
4)
dialog --title "Broadcom" --msgbox "\nYou have chosen Broadcom Drivers!\n\n\nClick ENTER key to continue..." 10 50; clear;
sudo apt purge bcmwl* -y
sudo apt install b43-fwcutter firmware-b43-installer -y
;;
5)
dialog --title "Libdvd" --msgbox "\nYou have chosen Libdvd!\n\n\nClick ENTER key to continue..." 10 50; clear;
sudo apt install libdvd-pkg -y
sudo dpkg-reconfigure libdvd-pkg
;;
6)
dialog --title "Regionset" --msgbox "\nYou have chosen Regionset!\n\n\nClick ENTER key to continue..." 10 50; clear;
sudo rm -R ~/.dvdcss/
sudo apt install regionset -y
regionset /dev/sr0
;;
7)
dialog --title "Production Day Build" --msgbox "\nYou have chosen Build!\n\n\nClick ENTER key to continue..." 10 50; clear;
ping -c1 data
if [ $? -eq 0 ]
then
dialog --title "Action Required" --msgbox "\nSpeaker test. Turn it up!\n\n\nClick ENTER key to continue..." $HEIGHT $WIDTH; clear;
speaker-test -t wav -c2 -l1
sudo apt install oem-config-gtk -y
sudo apt install cheese -y
wget -O - build/tools | sh
cheese
stress-test
dialog --title "Action Required" --msgbox "\nPlug in headphones for the next test.\n\n\nClick ENTER key to continue..." $HEIGHT $WIDTH; clear;
speaker-test -t wav -c2 -l1
eject
dialog --title "Action Required" --msgbox "\nTest optical drive.\n\n\nClick ENTER key to continue..." $HEIGHT $WIDTH; clear;
printme
sudo apt update && sudo apt upgrade -y
dialog --title "Action Required" --msgbox "\nSystem will shutdown, complete any unfinished testing.\n\n\nClick ENTER key to continue..." $HEIGHT $WIDTH; clear;
shutdown -P now
else
echo Please connect an ethernet cable and try again.
fi
;;
8)
dialog --title "Production Day QC" --msgbox "\nYou have chosen QC!\n\n\nClick ENTER key to continue..." 10 50; clear;
ping -c1 data
if [ $? -eq 0 ]
then
wget -O - build/tools | sh
dialog --title "Action Required" --msgbox "\nSpeaker test. Turn it up!\n\n\nClick ENTER key to continue..." 10 50; clear;
speaker-test -t wav -c2 -l1
sudo apt install oem-config-gtk -y
sudo apt install cheese -y
cheese
stress-test
dialog --title "Action Required" --msgbox "\nPlug in headphones for the next test.\n\n\nClick ENTER key to continue..." 10 50; clear;
speaker-test -t wav -c2 -l1
sudo apt update && sudo apt upgrade -y
eject
dialog --title "Action Required" --msgbox "\nTest optical drive.\n\n\nClick ENTER key to continue..." 10 50; clear;
dialog --title "Action Required" --msgbox "\nPrintme is starting, don't forget battery % in notes.\n\n\nClick ENTER key to continue..." 10 50; clear;
printme; sleep 5;
#This keeps getting skipped, but for why?
CHOICE_HEIGHT=2
TITLE="End Destination"
MENU="Choose the end destination for this laptop. If you are not sure what this means, consult your instructor."
QC_CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
1 "Store" \
2 "Grant" \
2>&1 >/dev/tty)
clear
case $QC_CHOICE in
1)
dialog --title "Password Change" --msgbox "\nNext we need to change the password on the machine. Have a staff member take care of the next step.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
passwd
dialog --title "Shutdown" --msgbox "\nCongratulations, you have finished quality checking this laptop! This laptop will now shutdown, so make sure that you have checked off all of the boxes on the keeper label for the QC column.\n\n\nThank you for all your help and press Enter to shutdown..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
shutdown -P now
;;
2)
dialog --title "Prepare for Shipping to End User" --msgbox "\nNow we will run the OEM configuration software so that the next person to turn it on will be able to set their own username and password.\n\n\nPress Enter to continue..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
oem-config-prepare
dialog --title "Shutdown" --msgbox "\nCongratulations, you have finished quality checking this laptop! This laptop will now shutdown, so make sure that you have checked off all of the boxes on the keeper label for the QC column.\n\n\nThank you for all your help and press Enter to shutdown..." $DIALOG_HEIGHT $DIALOG_WIDTH; clear;
shutdown -P now
;;
esac
fi
;;
esac
| true
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.