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
a3e6ce96
Commit
a3e6ce96
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
inadyn confile file variable
parent
bd7f8b4a
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-utils-dns
+28
-27
28 additions, 27 deletions
src/freedombone-utils-dns
with
28 additions
and
27 deletions
src/freedombone-utils-dns
+
28
−
27
View file @
a3e6ce96
...
...
@@ -41,6 +41,7 @@ DDNS_PASSWORD=
INADYN_REPO
=
"https://github.com/bashrc/inadyn"
INADYN_COMMIT
=
'fadbe17f520d337dfb8d69ee4bf1fcaa23fce0d6'
INADYN_CONFIG_FILE
=
/etc/inadyn.conf
# web site used to obtain the external IP address of the system
GET_IP_ADDRESS_URL
=
"checkip.two-dns.de"
...
...
@@ -95,7 +96,7 @@ EXTERNAL_IP_SERVICES=( \
'http://httpbin.org/ip'
)
function
update_inadyn_config
{
if
[
!
-f
/etc/inadyn.conf
]
;
then
if
[
!
-f
"
${
INADYN_CONFIG_FILE
}
"
]
;
then
return
fi
...
...
@@ -103,43 +104,43 @@ function update_inadyn_config {
return
fi
if
!
grep
-q
"
$DDNS_PROVIDER
"
/etc/inadyn.conf
;
then
if
!
grep
-q
"
$DDNS_PROVIDER
"
"
${
INADYN_CONFIG_FILE
}
"
;
then
# store any previous aliases
grep
'alias '
/etc/inadyn.conf
>
/tmp/inadyn_aliases
grep
'alias '
"
${
INADYN_CONFIG_FILE
}
"
>
/tmp/inadyn_aliases
# remove entry for any previous ddns
sed
-i
'/system /,$d'
/etc/inadyn.conf
sed
-i
'/system /,$d'
"
${
INADYN_CONFIG_FILE
}
"
# add the new provider
{
echo
''
;
echo
"system
$DDNS_PROVIDER
"
;
echo
' ssl'
;
echo
" checkip-url
$GET_IP_ADDRESS_URL
/"
;
}
>>
/etc/inadyn.conf
echo
" checkip-url
$GET_IP_ADDRESS_URL
/"
;
}
>>
"
${
INADYN_CONFIG_FILE
}
"
if
[
"
$DDNS_USERNAME
"
]
;
then
echo
" username
$DDNS_USERNAME
"
>>
/etc/inadyn.conf
echo
" username
$DDNS_USERNAME
"
>>
"
${
INADYN_CONFIG_FILE
}
"
fi
if
[
"
$DDNS_PASSWORD
"
]
;
then
echo
" password
$DDNS_PASSWORD
"
>>
/etc/inadyn.conf
echo
" password
$DDNS_PASSWORD
"
>>
"
${
INADYN_CONFIG_FILE
}
"
fi
if
[
-f
/tmp/inadyn_aliases
]
;
then
cat
/tmp/inadyn_aliases
>>
/etc/inadyn.conf
cat
/tmp/inadyn_aliases
>>
"
${
INADYN_CONFIG_FILE
}
"
rm
/tmp/inadyn_aliases
fi
else
# change username/password for an existing provider
if
[
"
$DDNS_USERNAME
"
]
;
then
if
grep
-q
" username "
/etc/inadyn.conf
;
then
sed
-i
"s| username .*| username
$DDNS_USERNAME
|g"
/etc/inadyn.conf
if
grep
-q
" username "
"
${
INADYN_CONFIG_FILE
}
"
;
then
sed
-i
"s| username .*| username
$DDNS_USERNAME
|g"
"
${
INADYN_CONFIG_FILE
}
"
else
echo
" username
$DDNS_USERNAME
"
>>
/etc/inadyn.conf
echo
" username
$DDNS_USERNAME
"
>>
"
${
INADYN_CONFIG_FILE
}
"
fi
fi
if
[
"
$DDNS_PASSWORD
"
]
;
then
if
grep
-q
" password "
/etc/inadyn.conf
;
then
sed
-i
"s| password .*| password
$DDNS_PASSWORD
|g"
/etc/inadyn.conf
if
grep
-q
" password "
"
${
INADYN_CONFIG_FILE
}
"
;
then
sed
-i
"s| password .*| password
$DDNS_PASSWORD
|g"
"
${
INADYN_CONFIG_FILE
}
"
else
echo
" password
$DDNS_PASSWORD
"
>>
/etc/inadyn.conf
echo
" password
$DDNS_PASSWORD
"
>>
"
${
INADYN_CONFIG_FILE
}
"
fi
fi
fi
...
...
@@ -197,27 +198,27 @@ function add_ddns_domain {
if
[[
"
$DDNS_PROVIDER
"
==
'none'
]]
;
then
return
fi
if
[
!
-f
/etc/inadyn.conf
]
;
then
echo
$'Unable to find inadyn configuration file
/etc/inadyn.conf
'
if
[
!
-f
"
${
INADYN_CONFIG_FILE
}
"
]
;
then
echo
$'Unable to find inadyn configuration file
"${INADYN_CONFIG_FILE}"
'
exit
5745
fi
if
!
grep
-q
"
$DDNS_PROVIDER
"
/etc/inadyn.conf
;
then
if
!
grep
-q
"
$DDNS_PROVIDER
"
"
${
INADYN_CONFIG_FILE
}
"
;
then
{
echo
''
;
echo
"system
$DDNS_PROVIDER
"
;
echo
' ssl'
;
echo
" checkip-url
$GET_IP_ADDRESS_URL
/"
;
}
>>
/etc/inadyn.conf
echo
" checkip-url
$GET_IP_ADDRESS_URL
/"
;
}
>>
"
${
INADYN_CONFIG_FILE
}
"
if
[
$DDNS_USERNAME
]
;
then
echo
" username
$DDNS_USERNAME
"
>>
/etc/inadyn.conf
echo
" username
$DDNS_USERNAME
"
>>
"
${
INADYN_CONFIG_FILE
}
"
fi
if
[
$DDNS_PASSWORD
]
;
then
echo
" password
$DDNS_PASSWORD
"
>>
/etc/inadyn.conf
echo
" password
$DDNS_PASSWORD
"
>>
"
${
INADYN_CONFIG_FILE
}
"
fi
fi
if
!
grep
-q
"
$CURRENT_DDNS_DOMAIN
"
/etc/inadyn.conf
;
then
echo
" alias
$CURRENT_DDNS_DOMAIN
"
>>
/etc/inadyn.conf
if
!
grep
-q
"
$CURRENT_DDNS_DOMAIN
"
"
${
INADYN_CONFIG_FILE
}
"
;
then
echo
" alias
$CURRENT_DDNS_DOMAIN
"
>>
"
${
INADYN_CONFIG_FILE
}
"
fi
chmod
600
/etc/inadyn.conf
chmod
600
"
${
INADYN_CONFIG_FILE
}
"
systemctl restart inadyn
systemctl daemon-reload
}
...
...
@@ -234,13 +235,13 @@ function remove_ddns_domain {
if
[[
"
$DDNS_PROVIDER
"
==
'none'
]]
;
then
return
fi
if
[
!
-f
/etc/inadyn.conf
]
;
then
echo
$'Unable to find inadyn configuration file
/etc/inadyn.conf
'
if
[
!
-f
"
${
INADYN_CONFIG_FILE
}
"
]
;
then
echo
$'Unable to find inadyn configuration file
"${INADYN_CONFIG_FILE}"
'
exit
5745
fi
if
grep
-q
"
$CURRENT_DDNS_DOMAIN
"
/etc/inadyn.conf
;
then
if
grep
-q
"
$CURRENT_DDNS_DOMAIN
"
"
${
INADYN_CONFIG_FILE
}
"
;
then
systemctl stop inadyn
sed
-i
"/alias
$CURRENT_DDNS_DOMAIN
/d"
/etc/inadyn.conf
sed
-i
"/alias
$CURRENT_DDNS_DOMAIN
/d"
"
${
INADYN_CONFIG_FILE
}
"
systemctl start inadyn
systemctl daemon-reload
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