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
22fc220f
Commit
22fc220f
authored
8 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Change freedns update so that it can handle arbitrary domains
parent
e3dafd63
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/freedombone-freedns
+69
-0
69 additions, 0 deletions
src/freedombone-freedns
src/freedombone-utils-dns
+3
-51
3 additions, 51 deletions
src/freedombone-utils-dns
with
72 additions
and
51 deletions
src/freedombone-freedns
0 → 100755
+
69
−
0
View file @
22fc220f
#!/bin/bash
#
# .---. . .
# | | |
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
#
# Freedom in the Cloud
#
# freedns update command for use in cron or a daemon
# License
# =======
#
# Copyright (C) 2016 Bob Mottram <bob@robotics.uk.to>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PROJECT_NAME
=
'freedombone'
export
TEXTDOMAIN
=
${
PROJECT_NAME
}
-freedns
export
TEXTDOMAINDIR
=
"/usr/share/locale"
CONFIGURATION_FILE
=
$HOME
/
${
PROJECT_NAME
}
.cfg
FREEDNS_WGET
=
'wget -q --read-timeout=0.0 --waitretry=5 --tries=4 https://freedns.afraid.org/dynamic/update.php?'
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
=()
codelines
=
$(
grep
"_CODE="
$CONFIGURATION_FILE
|
uniq
)
for
line
in
"
${
codelines
[@]
}
"
do
code
=
$(
echo
"
$line
"
|
awk
-F
'='
'{print $2}'
)
item_in_array
"
$code
"
"
${
detected_codes
[@]
}
"
if
[[
$?
!=
0
]]
;
then
detected_codes+
=(
"
$code
"
)
fi
done
if
[
!
-d
$HOME
/.freedns-update
]
;
then
mkdir
$HOME
/.freedns-update
fi
cd
$HOME
/.freedns-update
for
code
in
"
${
detected_codes
[@]
}
"
do
$FREEDNS_WGET
${
code
}
done
exit
0
This diff is collapsed.
Click to expand it.
src/freedombone-utils-dns
+
3
−
51
View file @
22fc220f
...
...
@@ -101,64 +101,16 @@ function create_freedns_updater {
if
grep
-Fxq
"create_freedns_updater"
$COMPLETION_FILE
;
then
return
fi
if
[[
$DDNS_PROVIDER
!=
"default@freedns.afraid.org"
]]
;
then
if
[[
$DDNS_PROVIDER
!=
*
"freedns"
*
]]
;
then
return
fi
if
[[
$SYSTEM_TYPE
==
"mesh"
*
]]
;
then
return
fi
FREEDNS_WGET
=
'wget -q --read-timeout=0.0 --waitretry=5 --tries=4 https://freedns.afraid.org/dynamic/update.php?'
echo
'#!/bin/bash'
>
/usr/bin/dynamicdns
echo
'cd /tmp'
>>
/usr/bin/dynamicdns
if
[
$DEFAULT_DOMAIN_CODE
]
;
then
echo
"#
$DEFAULT_DOMAIN_NAME
"
>>
/usr/bin/dynamicdns
echo
"
$FREEDNS_WGET$DEFAULT_DOMAIN_CODE
="
>>
/usr/bin/dynamicdns
fi
if
[
$DOKUWIKI_CODE
]
;
then
if
[[
$DOKUWIKI_CODE
!=
"
$DEFAULT_DOMAIN_CODE
"
]]
;
then
echo
"#
$DOKUWIKI_DOMAIN_NAME
"
>>
/usr/bin/dynamicdns
echo
"
$FREEDNS_WGET$DOKUWIKI_CODE
="
>>
/usr/bin/dynamicdns
fi
fi
if
[
$FULLBLOG_CODE
]
;
then
if
[[
$FULLBLOG_CODE
!=
"
$DEFAULT_DOMAIN_CODE
"
]]
;
then
echo
"#
$FULLBLOG_DOMAIN_NAME
"
>>
/usr/bin/dynamicdns
echo
"
$FREEDNS_WGET$FULLBLOG_CODE
="
>>
/usr/bin/dynamicdns
fi
fi
if
[
$HUBZILLA_CODE
]
;
then
if
[[
$HUBZILLA_CODE
!=
"
$DEFAULT_DOMAIN_CODE
"
]]
;
then
echo
"#
$HUBZILLA_DOMAIN_NAME
"
>>
/usr/bin/dynamicdns
echo
"
$FREEDNS_WGET$HUBZILLA_CODE
="
>>
/usr/bin/dynamicdns
fi
fi
if
[
$MICROBLOG_CODE
]
;
then
if
[[
$MICROBLOG_CODE
!=
"
$DEFAULT_DOMAIN_CODE
"
]]
;
then
echo
"#
$MICROBLOG_DOMAIN_NAME
"
>>
/usr/bin/dynamicdns
echo
"
$FREEDNS_WGET$MICROBLOG_CODE
="
>>
/usr/bin/dynamicdns
fi
fi
if
[
$GIT_CODE
]
;
then
if
[[
$GIT_CODE
!=
"
$DEFAULT_DOMAIN_CODE
"
]]
;
then
echo
"#
$GIT_DOMAIN_NAME
"
>>
/usr/bin/dynamicdns
echo
"
$FREEDNS_WGET$GIT_CODE
="
>>
/usr/bin/dynamicdns
fi
fi
if
[
$MEDIAGOBLIN_CODE
]
;
then
if
[[
$MEDIAGOBLIN_CODE
!=
"
$DEFAULT_DOMAIN_CODE
"
]]
;
then
echo
"#
$MEDIAGOBLIN_DOMAIN_NAME
"
>>
/usr/bin/dynamicdns
echo
"
$FREEDNS_WGET$MEDIAGOBLIN_CODE
="
>>
/usr/bin/dynamicdns
fi
fi
echo
'exit 0'
>>
/usr/bin/dynamicdns
chmod
600 /usr/bin/dynamicdns
chmod
+x /usr/bin/dynamicdns
if
!
grep
-q
"/usr/bin/dynamicdns"
/etc/crontab
;
then
if
!
grep
-q
"/usr/local/bin/freedombone-freedns"
/etc/crontab
;
then
function_check cron_add_mins
cron_add_mins 3
'/usr/
bin/dynamic
dns'
cron_add_mins 3
'/usr/
local/bin/freedombone-free
dns'
systemctl restart cron
fi
...
...
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