mirror of
https://github.com/NeoCloud/NeoNetwork
synced 2024-11-23 00:00:45 +08:00
Regular update: 2020-07-20T18:06:15Z
This commit is contained in:
parent
8c1b87eaa4
commit
af02d7ece0
5 changed files with 55 additions and 62 deletions
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
# shellcheck disable=SC1091
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
@ -6,7 +7,7 @@ export MAX_LEN_4=29
|
||||||
export MAX_LEN_6=64
|
export MAX_LEN_6=64
|
||||||
|
|
||||||
if [ ! -d .venv ]; then
|
if [ ! -d .venv ]; then
|
||||||
python3 -m venv .venv
|
python3 -m venv .venv
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -xeu
|
set -xeu
|
||||||
|
|
||||||
if ! which markdown 2>&1 > /dev/null; then
|
if ! which markdown 2>&1 >/dev/null; then
|
||||||
echo "need markdown"
|
echo "need markdown"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -10,4 +10,4 @@ fi
|
||||||
cat docs/header.html
|
cat docs/header.html
|
||||||
markdown README.md
|
markdown README.md
|
||||||
cat docs/footer.html
|
cat docs/footer.html
|
||||||
) > docs/index.html
|
) >docs/index.html
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -xe
|
set -xe
|
||||||
|
|
||||||
if which dot 2>&1 > /dev/null ; then
|
if which dot 2>&1 >/dev/null; then
|
||||||
dot -T svg nodes.dot -o nodes.svg
|
dot -T svg nodes.dot -o nodes.svg
|
||||||
else
|
else
|
||||||
echo 'You need to install graphviz first'
|
echo 'You need to install graphviz first'
|
||||||
|
|
|
@ -1,80 +1,73 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
##########################################
|
##########################################
|
||||||
# =============== Colors =============== #
|
# =============== Colors =============== #
|
||||||
##########################################
|
##########################################
|
||||||
|
|
||||||
ESC='\033'
|
ESC='\033'
|
||||||
RESET="${ESC}[0m" #Reset all attributes
|
RESET="${ESC}[0m" #Reset all attributes
|
||||||
BRIGHT="${ESC}[1m" #Bright
|
BRIGHT="${ESC}[1m" #Bright
|
||||||
DIM="${ESC}[2m" #Dim
|
DIM="${ESC}[2m" #Dim
|
||||||
BLINK="${ESC}[5m" #Blink
|
BLINK="${ESC}[5m" #Blink
|
||||||
# Foreground Colours #
|
# Foreground Colours #
|
||||||
FBLACK="${ESC}[30m" #Black
|
FBLACK="${ESC}[30m" #Black
|
||||||
FRED="${ESC}[31m" #Red
|
FRED="${ESC}[31m" #Red
|
||||||
FGREEN="${ESC}[32m" #Green
|
FGREEN="${ESC}[32m" #Green
|
||||||
FYELLOW="${ESC}[33m" #Yellow
|
FYELLOW="${ESC}[33m" #Yellow
|
||||||
FBLUE="${ESC}[34m" #Blue
|
FBLUE="${ESC}[34m" #Blue
|
||||||
FMAGENTA="${ESC}[35m" #Magenta
|
FMAGENTA="${ESC}[35m" #Magenta
|
||||||
FCYAN="${ESC}[36m" #Cyan
|
FCYAN="${ESC}[36m" #Cyan
|
||||||
FWHITE="${ESC}[37m" #White
|
FWHITE="${ESC}[37m" #White
|
||||||
# Background Colours #
|
# Background Colours #
|
||||||
BBLACK="${ESC}[40m" #Black
|
BBLACK="${ESC}[40m" #Black
|
||||||
BRED="${ESC}[41m" #Red
|
BRED="${ESC}[41m" #Red
|
||||||
BGREEN="${ESC}[42m" #Green
|
BGREEN="${ESC}[42m" #Green
|
||||||
BYELLOW="${ESC}[43m" #Yellow
|
BYELLOW="${ESC}[43m" #Yellow
|
||||||
BBLUE="${ESC}[44m" #Blue
|
BBLUE="${ESC}[44m" #Blue
|
||||||
BMAGENTA="${ESC}[45m" #Magenta
|
BMAGENTA="${ESC}[45m" #Magenta
|
||||||
BCYAN="${ESC}[46m" #Cyan
|
BCYAN="${ESC}[46m" #Cyan
|
||||||
BWHITE="${ESC}[47m" #White
|
BWHITE="${ESC}[47m" #White
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
# Functions: #
|
# Functions: #
|
||||||
# Make your life easier #
|
# Make your life easier #
|
||||||
#########################
|
#########################
|
||||||
|
|
||||||
# Error Message that stops the script
|
# Error Message that stops the script
|
||||||
errmsg()
|
errmsg() {
|
||||||
{
|
|
||||||
echo -en "${BRED}>>${RESET} ${FMAGENTA}${*}${RESET}"
|
echo -en "${BRED}>>${RESET} ${FMAGENTA}${*}${RESET}"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Normal Message
|
# Normal Message
|
||||||
msg()
|
msg() {
|
||||||
{
|
|
||||||
echo -en "${BBLUE}>>${RESET} ${BRIGHT}${FGREEN}${*}${RESET}"
|
echo -en "${BBLUE}>>${RESET} ${BRIGHT}${FGREEN}${*}${RESET}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Debug Level Verbose
|
# Debug Level Verbose
|
||||||
dbgmsg()
|
dbgmsg() {
|
||||||
{
|
|
||||||
echo -en "${BRIGHT}${BBLUE}>>${RESET} ${BRIGHT}${FGREEN}${*}${RESET}"
|
echo -en "${BRIGHT}${BBLUE}>>${RESET} ${BRIGHT}${FGREEN}${*}${RESET}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Verbose Message
|
# Verbose Message
|
||||||
vmsg()
|
vmsg() {
|
||||||
{
|
|
||||||
echo -en "${BRIGHT}${BBLUE}>>${RESET} ${BRIGHT}${FCYAN}${*}${RESET}"
|
echo -en "${BRIGHT}${BBLUE}>>${RESET} ${BRIGHT}${FCYAN}${*}${RESET}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Formatted Output
|
# Formatted Output
|
||||||
|
|
||||||
# for TUN30
|
# for TUN30
|
||||||
print_tun30()
|
print_tun30() {
|
||||||
{
|
|
||||||
printf "${FGREEN}%-20s${RESET}|${FYELLOW}%10s${RESET}| ${FCYAN}%20s ${BRIGHT}${FBLUE}<--> ${FMAGENTA}%s${RESET}\n" \
|
printf "${FGREEN}%-20s${RESET}|${FYELLOW}%10s${RESET}| ${FCYAN}%20s ${BRIGHT}${FBLUE}<--> ${FMAGENTA}%s${RESET}\n" \
|
||||||
"$1" "$2" "$3" "$4"
|
"$1" "$2" "$3" "$4"
|
||||||
}
|
}
|
||||||
|
|
||||||
print_subnet()
|
print_subnet() {
|
||||||
{
|
|
||||||
printf "${FGREEN}%-20s${RESET}${BRIGHT}${FBLUE}|| ${FMAGENTA}%s${RESET}\n\t>> %s\n" \
|
printf "${FGREEN}%-20s${RESET}${BRIGHT}${FBLUE}|| ${FMAGENTA}%s${RESET}\n\t>> %s\n" \
|
||||||
"$1" "$2" "$3"
|
"$1" "$2" "$3"
|
||||||
}
|
}
|
||||||
|
|
||||||
print_ptp()
|
print_ptp() {
|
||||||
{
|
|
||||||
upstream_ip="${1%~*}"
|
upstream_ip="${1%~*}"
|
||||||
downstream_ip="${1#$upstream_ip}"
|
downstream_ip="${1#$upstream_ip}"
|
||||||
downstream_ip="${downstream_ip#*~}"
|
downstream_ip="${downstream_ip#*~}"
|
||||||
|
@ -83,8 +76,7 @@ print_ptp()
|
||||||
"$2" "$upstream_ip" "$downstream_ip" "$3" "$4"
|
"$2" "$upstream_ip" "$downstream_ip" "$3" "$4"
|
||||||
}
|
}
|
||||||
|
|
||||||
print_lo()
|
print_lo() {
|
||||||
{
|
|
||||||
printf "${FGREEN}%-20s${RESET}${BRIGHT}${FBLUE}||${FMAGENTA}%24s${RESET} ${BRIGHT}${FBLUE}|| ${RESET}%s\n" \
|
printf "${FGREEN}%-20s${RESET}${BRIGHT}${FBLUE}||${FMAGENTA}%24s${RESET} ${BRIGHT}${FBLUE}|| ${RESET}%s\n" \
|
||||||
"$1" "$2" "$3"
|
"$1" "$2" "$3"
|
||||||
}
|
}
|
||||||
|
@ -102,19 +94,19 @@ if [ $# -lt 1 ]; then
|
||||||
" asn, route, entity, node\n"
|
" asn, route, entity, node\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
arg="$2" # Optional argument
|
arg="$2" # Optional argument
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
asn)
|
asn)
|
||||||
(
|
(
|
||||||
cd asn
|
cd asn
|
||||||
for i in *; do
|
for i in *; do
|
||||||
msg "${i#asn/}\n"
|
msg "${i#asn/}\n"
|
||||||
source "$i"
|
source "$i"
|
||||||
|
|
||||||
printf "${BRIGHT}${FMAGENTA}%-16s${RESET}| ${BRIGHT}${FYELLOW}%s\n\t>> %s\n" \
|
printf "${BRIGHT}${FMAGENTA}%-16s${RESET}| ${BRIGHT}${FYELLOW}%s\n\t>> %s\n" \
|
||||||
"$OWNER" "$NAME" "$DESC"
|
"$OWNER" "$NAME" "$DESC"
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
route)
|
route)
|
||||||
|
@ -123,13 +115,13 @@ route)
|
||||||
subnet="${subnet/,/\/}"
|
subnet="${subnet/,/\/}"
|
||||||
source "$i"
|
source "$i"
|
||||||
case "$TYPE" in
|
case "$TYPE" in
|
||||||
SUBNET) print_subnet "$subnet" "$NAME" "$DESC";;
|
SUBNET) print_subnet "$subnet" "$NAME" "$DESC" ;;
|
||||||
LO) print_lo "$subnet" "$NAME" "$DESC";;
|
LO) print_lo "$subnet" "$NAME" "$DESC" ;;
|
||||||
*) errmsg "Invalid \$TYPE in $i\n";;
|
*) errmsg "Invalid \$TYPE in $i\n" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
entity);;
|
entity) ;;
|
||||||
node)
|
node)
|
||||||
for i in node/*; do
|
for i in node/*; do
|
||||||
node="${i#node/}"
|
node="${i#node/}"
|
||||||
|
@ -145,7 +137,7 @@ node)
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
*) errmsg "Invalid type\n";;
|
*) errmsg "Invalid type\n" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# vim: set tabstop=8:softtabstop=8:shiftwidth=8
|
# vim: set tabstop=8:softtabstop=8:shiftwidth=8
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
if [ ! -n "$SSHPRIVKEY" ]; then
|
if [ -z "$SSHPRIVKEY" ]; then
|
||||||
echo SSHPRIVKEY is not set
|
echo SSHPRIVKEY is not set
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -13,7 +13,7 @@ chmod 0600 "$HOME/.ssh/id_ed25519"
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
cd generated || exit -1
|
cd generated || exit 1
|
||||||
|
|
||||||
git remote set-url origin git@github.com:NeoCloud/NeoNetwork-ROA.git
|
git remote set-url origin git@github.com:NeoCloud/NeoNetwork-ROA.git
|
||||||
git config user.name "NeoCloud ROA bot"
|
git config user.name "NeoCloud ROA bot"
|
||||||
|
|
Loading…
Reference in a new issue