Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
2cf8e6a4
Commit
2cf8e6a4
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
The whole thing can be way less complicated
parent
9a3451cc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/freedombone-freedns
+7
-56
7 additions, 56 deletions
src/freedombone-freedns
with
7 additions
and
56 deletions
src/freedombone-freedns
+
7
−
56
View file @
2cf8e6a4
...
...
@@ -7,7 +7,7 @@
# Freedom in the Cloud
#
# freedns update command for use in cron or a daemon
#
# License
# =======
#
...
...
@@ -33,9 +33,6 @@ export TEXTDOMAINDIR="/usr/share/locale"
VERBOSE
=
CONFIGURATION_FILE
=
/root/
${
PROJECT_NAME
}
.cfg
#FREEDNS_WGET='wget --read-timeout=0.0 --waitretry=5 --tries=4 https://freedns.afraid.org/dynamic/update.php?'
FREEDNS_WGET
=
'wget --no-check-certificate -O - https://freedns.afraid.org/dynamic/update.php?'
if
[[
"
$1
"
==
"--verbose"
||
"
$1
"
==
"-v"
]]
;
then
VERBOSE
=
1
...
...
@@ -45,63 +42,17 @@ if [ ! -f "$CONFIGURATION_FILE" ]; then
exit
0
fi
function
item_in_array
{
local
e
for
e
in
"
${
@
:2
}
"
;
do
[[
"
$e
"
==
"
$1
"
]]
&&
return
0
;
done
return
1
}
detected_codes
=()
detected_codes_ctr
=
0
codelines
=
$(
grep
"_CODE="
"
$CONFIGURATION_FILE
"
|
uniq
)
while
read
-r
line
;
do
if
[[
"
$line
"
!=
'#'
*
]]
;
then
code
=
$(
echo
"
$line
"
|
awk
-F
'='
'{print $2}'
)
# shellcheck disable=SC2068
if
!
item_in_array
"
$code
"
${
detected_codes
[@]
}
;
then
detected_codes+
=(
"
$code
"
)
detected_codes_ctr
=
$((
detected_codes_ctr+1
))
fi
fi
done
<<<
"
$codelines
"
if
[
$detected_codes_ctr
-eq
0
]
;
then
exit
0
fi
code
=
$(
grep
'DEFAULT_DOMAIN_CODE'
"
$CONFIGURATION_FILE
"
|
awk
-F
'='
'{print $2}'
)
if
[
!
-d
"
$HOME
/.freedns-update"
]
;
then
mkdir
"
$HOME
/.freedns-update
"
if
[
$VERBOSE
]
;
then
echo
$"wget --no-check-certificate -O - https://freedns.afraid.org/dynamic/update.php?
${
code
}
= >> /tmp/freedns 2>&1 &
"
fi
cd
"
$HOME
/.freedns-update"
||
exit
2467824684
# shellcheck disable=SC2068
for
code
in
${
detected_codes
[@]
}
do
if
[
$VERBOSE
]
;
then
echo
$"command:
$FREEDNS_WGET
${
code
}
= /tmp/freedns 2>&1 &"
fi
if
[
-f
/tmp/freedns
]
;
then
rm
/tmp/freedns
fi
# shellcheck disable=SC1066,SC1067,SC1007
$FREEDNS_WGET
${
code
}
=
>>
/tmp/freedns 2>&1 &
if
[
$VERBOSE
]
;
then
if
[
-f
/tmp/freedns
]
;
then
cat
/tmp/freedns
fi
fi
# if your subdomains are linked on the freedns site
# then we only need to update one entry for them
# all to be changed
# see "Link updates of the same IP together"
break
done
if
[
-f
/tmp/freedns
]
;
then
rm
/tmp/freedns
fi
# shellcheck disable=SC2086
wget
--no-check-certificate
-O
- https://freedns.afraid.org/dynamic/update.php?
${
code
}
=
>>
/tmp/freedns 2>&1 &
exit
0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment