summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/check_db_safety21
-rwxr-xr-xscripts/update-git-remotes1
2 files changed, 15 insertions, 7 deletions
diff --git a/scripts/check_db_safety b/scripts/check_db_safety
index 2019929..44de8e6 100755
--- a/scripts/check_db_safety
+++ b/scripts/check_db_safety
@@ -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 @@ for tld in db/dom/* ; do
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 --git a/scripts/update-git-remotes b/scripts/update-git-remotes
index d01a0eb..4fe2570 100755
--- a/scripts/update-git-remotes
+++ b/scripts/update-git-remotes
@@ -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