mirror of
https://git.dn42.dev/dn42/registry.git
synced 2025-07-12 05:35:27 +08:00
run shellcheck on helper scripts
fmt-my-stuff: #3595 squash-my-commits: __future__ fix shellcheck warnings on fmt-my-stuff and squash-my-commits
This commit is contained in:
parent
1f76bc5adb
commit
87b641814f
5 changed files with 17 additions and 18 deletions
|
@ -11,8 +11,8 @@ BASE="$(readlink -f "$0" 2>/dev/null || python -c 'import os,sys;print(os.path.r
|
||||||
BASE="$(dirname "$BASE")"
|
BASE="$(dirname "$BASE")"
|
||||||
cd "$BASE" || exit 1
|
cd "$BASE" || exit 1
|
||||||
|
|
||||||
git diff --name-only $1 | while IFS='/' read -ra LINE; do
|
git diff --name-only "$1" | while IFS='/' read -ra LINE; do
|
||||||
if [[ "${LINE[0]}" = "data" && -n "${LINE[2]}" ]]; then
|
if [[ "${LINE[0]}" = "data" && -n "${LINE[2]}" ]]; then
|
||||||
utils/schema-check/dn42-schema.py -v policy ${LINE[1]} ${LINE[2]} $2
|
utils/schema-check/dn42-schema.py -v policy "${LINE[1]}" "${LINE[2]}" "$2"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -11,8 +11,8 @@ BASE="$(readlink -f "$0" 2>/dev/null || python -c 'import os,sys;print(os.path.r
|
||||||
BASE="$(dirname "$BASE")"
|
BASE="$(dirname "$BASE")"
|
||||||
cd "$BASE" || exit 1
|
cd "$BASE" || exit 1
|
||||||
|
|
||||||
git diff --name-only $1 | while IFS='/' read -ra LINE; do
|
git diff --name-only "$1" | while IFS='/' read -ra LINE; do
|
||||||
if [[ "${LINE[0]}" = "data" && -n "${LINE[2]}" ]]; then
|
if [[ "${LINE[0]}" = "data" && -n "${LINE[2]}" ]]; then
|
||||||
utils/schema-check/dn42_schema_local.py -v policy ${LINE[1]} ${LINE[2]} $2
|
utils/schema-check/dn42_schema_local.py -v policy "${LINE[1]}" "${LINE[2]}" "$2"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -9,4 +9,7 @@ fi
|
||||||
BASE="$(readlink -f "$0" 2>/dev/null || python -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "$0")"
|
BASE="$(readlink -f "$0" 2>/dev/null || python -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "$0")"
|
||||||
BASE="$(dirname "$BASE")"
|
BASE="$(dirname "$BASE")"
|
||||||
|
|
||||||
grep -lrE "(\s|:)$1(\s|\$)" "$BASE/data/" | while read line; do utils/schema-check/dn42-schema.py fmt -i "$line"; done
|
grep -lrE "(\s|:)$1(\s|\$)" "$BASE/data/" | while read -r line; do
|
||||||
|
utils/schema-check/dn42-schema.py fmt -i "$line"
|
||||||
|
done
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,7 @@ done
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
# check for dn42registry remote, and add if missing
|
# check for dn42registry remote, and add if missing
|
||||||
git remote -v | grep dn42registry > /dev/null 2>&1
|
if ! git remote -v | grep dn42registry > /dev/null 2>&1
|
||||||
if [ "$?" -ne 0 ]
|
|
||||||
then
|
then
|
||||||
|
|
||||||
# was the URL specified directly ?
|
# was the URL specified directly ?
|
||||||
|
@ -81,8 +80,7 @@ then
|
||||||
if [ -z "$reg_proto" ]
|
if [ -z "$reg_proto" ]
|
||||||
then
|
then
|
||||||
# if the proto wasn't forced, try to guess it
|
# if the proto wasn't forced, try to guess it
|
||||||
git remote -v | grep 'https' > /dev/null 2>&1
|
if git remote -v | grep 'https' > /dev/null 2>&1
|
||||||
if [ $? -eq 0 ]
|
|
||||||
then
|
then
|
||||||
reg_proto='https'
|
reg_proto='https'
|
||||||
else
|
else
|
||||||
|
@ -112,8 +110,7 @@ fi
|
||||||
|
|
||||||
# ensure the local branch is up to date
|
# ensure the local branch is up to date
|
||||||
echo "Fetching dn42registry master"
|
echo "Fetching dn42registry master"
|
||||||
git fetch dn42registry master
|
if ! git fetch dn42registry master
|
||||||
if [ $? -ne 0 ]
|
|
||||||
then
|
then
|
||||||
echo 'ERROR: Failed to fetch registry master branch'
|
echo 'ERROR: Failed to fetch registry master branch'
|
||||||
echo 'Hint: you can use --ssh/--https to force use of ssh or https'
|
echo 'Hint: you can use --ssh/--https to force use of ssh or https'
|
||||||
|
@ -123,8 +120,7 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# find number of local commits
|
# find number of local commits
|
||||||
count=$(git rev-list --count HEAD ^dn42registry/master)
|
if ! count=$(git rev-list --count HEAD ^dn42registry/master)
|
||||||
if [ $? -ne 0 ]
|
|
||||||
then
|
then
|
||||||
echo "ERROR: Failed to find the number of local commits"
|
echo "ERROR: Failed to find the number of local commits"
|
||||||
echo "Please report this as a bug to the registry maintainters"
|
echo "Please report this as a bug to the registry maintainters"
|
||||||
|
@ -160,7 +156,7 @@ $(git log --oneline HEAD ^dn42registry/master)"
|
||||||
|
|
||||||
# and finally squash
|
# and finally squash
|
||||||
git reset --soft dn42registry/master
|
git reset --soft dn42registry/master
|
||||||
git commit $do_sign -m "$comment"
|
git commit "$do_sign" -m "$comment"
|
||||||
|
|
||||||
# show what happened
|
# show what happened
|
||||||
echo '---'
|
echo '---'
|
||||||
|
|
|
@ -14,8 +14,8 @@ fix_dns() {
|
||||||
{
|
{
|
||||||
set -e
|
set -e
|
||||||
echo "domain: ${DST}"
|
echo "domain: ${DST}"
|
||||||
cat "${TMP}" | grep -E '^(remarks):' || true
|
grep -E '^(remarks):' "${TMP}" || true
|
||||||
cat "data/dns/${SRC}" | grep '^nserver:' | tr -s " " | cut -d' ' -f2 | sort | uniq | xargs -i echo 'nserver: {}'
|
grep '^nserver:' "data/dns/${SRC}" | tr -s " " | cut -d' ' -f2 | sort | uniq | xargs -I{} echo 'nserver: {}'
|
||||||
drill -t "${DST}" "@${DS_NSERVER}" DNSKEY -s | grep sha256 | cut -d: -f2 | sed -E 's/^ [^\t ]+\t900\tIN\tDS\t/ds-rdata: /g' | grep -E "${KSK_PATTERN}"
|
drill -t "${DST}" "@${DS_NSERVER}" DNSKEY -s | grep sha256 | cut -d: -f2 | sed -E 's/^ [^\t ]+\t900\tIN\tDS\t/ds-rdata: /g' | grep -E "${KSK_PATTERN}"
|
||||||
echo 'org: ORG-DN42'
|
echo 'org: ORG-DN42'
|
||||||
echo 'mnt-by: DN42-MNT'
|
echo 'mnt-by: DN42-MNT'
|
||||||
|
@ -35,7 +35,7 @@ fix_inetnum() {
|
||||||
sed -r -i '/^(nserver|ds-rdata|status|org|policy|mnt-by|source|admin-c|tech-c):.*$/d' "data/${CLASS}/${DST}"
|
sed -r -i '/^(nserver|ds-rdata|status|org|policy|mnt-by|source|admin-c|tech-c):.*$/d' "data/${CLASS}/${DST}"
|
||||||
{
|
{
|
||||||
set -e
|
set -e
|
||||||
cat "data/dns/${SRC}" | grep '^nserver:' | tr -s " " | cut -d' ' -f2 | sort | uniq | xargs -i echo 'nserver: {}'
|
grep '^nserver:' "data/dns/${SRC}" | tr -s " " | cut -d' ' -f2 | sort | uniq | xargs -I{} echo 'nserver: {}'
|
||||||
drill -t "${DNS_NAME}" "@${DS_NSERVER}" DNSKEY -s | grep sha256 | cut -d: -f2 | sed -E 's/^ [^\t ]+\t900\tIN\tDS\t/ds-rdata: /g' | grep -E "${KSK_PATTERN}"
|
drill -t "${DNS_NAME}" "@${DS_NSERVER}" DNSKEY -s | grep sha256 | cut -d: -f2 | sed -E 's/^ [^\t ]+\t900\tIN\tDS\t/ds-rdata: /g' | grep -E "${KSK_PATTERN}"
|
||||||
echo 'status: ALLOCATED'
|
echo 'status: ALLOCATED'
|
||||||
echo "policy: ${POLICY}"
|
echo "policy: ${POLICY}"
|
||||||
|
@ -54,7 +54,7 @@ fix_dns_ds_only() {
|
||||||
{
|
{
|
||||||
set -e
|
set -e
|
||||||
echo "domain: ${DST}"
|
echo "domain: ${DST}"
|
||||||
cat "${TMP}" | grep -E '^(nserver|remarks):' || true
|
grep -E '^(nserver|remarks):' "${TMP}" || true
|
||||||
drill -t "${DST}" "@${DS_NSERVER}" DNSKEY -s | grep sha256 | cut -d: -f2 | sed -E 's/^ [^\t ]+\t900\tIN\tDS\t/ds-rdata: /g' | grep -E "${KSK_PATTERN}"
|
drill -t "${DST}" "@${DS_NSERVER}" DNSKEY -s | grep sha256 | cut -d: -f2 | sed -E 's/^ [^\t ]+\t900\tIN\tDS\t/ds-rdata: /g' | grep -E "${KSK_PATTERN}"
|
||||||
echo 'org: ORG-DN42'
|
echo 'org: ORG-DN42'
|
||||||
echo 'mnt-by: DN42-MNT'
|
echo 'mnt-by: DN42-MNT'
|
Loading…
Add table
Reference in a new issue