# HG changeset patch # User cathugger # Date 1526215239 0 # Node ID 2dcb03d77b036674563ce302f51aba586861dab3 # Parent eeef7c9bc251d982a45ed0b1c01dc19440005e04 scripts/check_db_safety: don't complain so much about missing things they aren't unsafe diff -r eeef7c9bc251 -r 2dcb03d77b03 scripts/check_db_safety --- a/scripts/check_db_safety Sun May 13 15:26:47 2018 +0300 +++ b/scripts/check_db_safety Sun May 13 12:40:39 2018 +0000 @@ -1,23 +1,26 @@ #!/bin/sh -if [ "$(ls db/dom/ | tr -d 'a-z0-9\n\-' | wc -c | tr -d ' \t')" != 0 ]; then +if [ "$(ls db/dom/ 2>/dev/null | tr -d 'a-z0-9\n\-' | wc -c | tr -d ' \t')" != 0 ]; then echo "There's a bad TLD. You probably don't want to run any shell scripts." >&2 exit 1 fi for tld in db/dom/* ; do - if [ "$(ls $tld/ | tr -d 'a-z0-9\n\-' | wc -c | tr -d ' \t')" != 0 ]; then + [ -e "$tld" ] || continue + if [ "$(ls $tld/ 2>/dev/null| tr -d 'a-z0-9\n\-' | wc -c | tr -d ' \t')" != 0 ]; then tld="$(basename $tld)" echo "There's a bad domain under $tld." >&2 echo "You probably don't want to run any shell scripts." >&2 exit 1 fi for dom in $tld/* ; do - if [ "$(ls $dom/ns/ | tr -d 'A-Fa-z0-9\n.:\-' | wc -c | tr -d ' \t')" != 0 ]; then + [ -e "$dom" ] || continue + if [ "$(ls $dom/ns/ 2>/dev/null | tr -d 'A-Fa-z0-9\n.:\-' | wc -c | tr -d ' \t')" != 0 ]; then domain="$(basename $dom).$(basename $tld)" echo "There's a bad nameserver under $domain." >&2 echo "You probably don't want to run any shell scripts." >&2 exit 1 fi for ns in $dom/ns/* ; do + [ -e "$ns" ] || continue if [ "$(cat $ns | tr -d 'A-Fa-f0-9.:\r\n' | wc -c | tr -d ' \t')" != 0 ]; then domain="$(basename $dom).$(basename $tld)" nsname="$(basename $ns)" @@ -29,28 +32,32 @@ done done done -if [ "$(ls db/ip/ | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then +if [ "$(ls db/ip/ 2>/dev/null | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then echo "There's a bad first octet. You probably don't want to run any shell scripts." >&2 exit 1 for first in db/ip/* ; do - if [ "$(ls $first/ | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then + [ -e "$first" ] || continue + if [ "$(ls $first/ 2>/dev/null | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then echo "There's a bad second octet under $first." >&2 echo "You probably don't want to run any shell scripts." >&2 exit 1 for second in $first/* ; do - if [ "$(ls $second/ | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then + [ -e "$second" ] || continue + if [ "$(ls $second/ 2>/dev/null | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then echo "There's a bad third octet under $second." >&2 echo "You probably don't want to run any shell scripts." >&2 exit 1 fi for third in $second/* ; do - if [ "$(ls $third/ns/ | tr -d 'a-z0-9\n.\-' | wc -c | tr -d ' \t')" != 0 ]; then + [ -e "$third" ] || continue + if [ "$(ls $third/ns/ 2>/dev/null | tr -d 'a-z0-9\n.\-' | wc -c | tr -d ' \t')" != 0 ]; then ip="$(basename $first).$(basename $second).$(basename $third).0/24" echo "There's a bad nameserver under $ip." >&2 echo "You probably don't want to run any shell scripts." >&2 exit 1 fi for ns in $third/ns/* ; do + [ -e "$ns" ] || continue if [ "$(cat $ns | tr -d '0-9.\n' | wc -c | tr -d ' \t')" != 0 ]; then ip="$(basename $first).$(basename $second).$(basename $third).0/24" nsname="$(basename $ns)" diff -r eeef7c9bc251 -r 2dcb03d77b03 scripts/update-git-remotes --- a/scripts/update-git-remotes Sun May 13 15:26:47 2018 +0300 +++ b/scripts/update-git-remotes Sun May 13 12:40:39 2018 +0000 @@ -3,6 +3,7 @@ # Synchronizes git remotes with the user db # +echo "checking database safety" >&2 if ! `dirname "$0"`/check_db_safety; then exit 1 fi