From 17f2f04c6650b9e353b9f10f2bcb5528d6e8d813 Mon Sep 17 00:00:00 2001 From: OranJuiceJohnes Date: Mon, 12 Jan 2015 01:47:22 +0100 Subject: [PATCH 1/3] Added checks Added checks for needed commands and existance of config file. --- nsupdate.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/nsupdate.sh b/nsupdate.sh index f9f9e3b..e242fb9 100755 --- a/nsupdate.sh +++ b/nsupdate.sh @@ -24,6 +24,20 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +################## +# check required # +################## +command -v curl >/dev/null 2>&1 || { echo >&2 "I require curl but it's not installed. Note: all needed items are listed in the README.md file."; exit 1; } +command -v awk >/dev/null 2>&1 || { echo >&2 "I require awk but it's not installed. Note: all needed items are listed in the README.md file."; exit 1; } +command -v drill >/dev/null 2>&1 || command -v nslookup >/dev/null 2>&1 || { echo >&2 "I need drill or nslookup installed. Note: all needed items are listed in the README.md file."; exit 1; } +################## +# check config # +################## +if [ ! -f nsupdate.d/*.config ]; then + echo "There does not seem to be ready to be used config file available." ; exit 1; +fi +################## + LOG=$0.log # Loop through configs @@ -102,4 +116,4 @@ do unset INWX_PASS unset INWX_USER unset INWX_DOMAIN_ID -done \ No newline at end of file +done From 5de67f69206386c78cf34be7897c818448e10fd3 Mon Sep 17 00:00:00 2001 From: OranJuiceJohnes Date: Mon, 12 Jan 2015 01:52:46 +0100 Subject: [PATCH 2/3] Added requirements Added changelog entries as well as a required listing. --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d00aaaa..45a6ad1 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,21 @@ nsbackup is a bash script that uses curl and the inwx API to update nameserver e Place your config files in the _nsupdate.d_ folder. +## Requirements + +In order to run you need to have _curl_ and _awk_ installed, as well as _drill_ or _nslookup_. + +At least one config file needs to exist ending with _.config_. A "sample.config.dist" is provided. + ## Changelog +**2015-01-12** + +- Added checking for needed commands +- Added checking for existing config file +- Added requirements to README.md + + **2014-02-21** - Added support for IPv6 @@ -38,4 +51,4 @@ nsupdate is distributed under the MIT license, which is similar in effect to the > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. > -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From e9046338cd2015cfb5bce49a51a2c0bbc09525a3 Mon Sep 17 00:00:00 2001 From: OranJuiceJohnes Date: Mon, 12 Jan 2015 14:02:45 +0100 Subject: [PATCH 3/3] WAN IP provider WAN IP provider changed from hhtp to https. --- nsupdate.d/sample.config.dist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nsupdate.d/sample.config.dist b/nsupdate.d/sample.config.dist index 6861db9..52d6507 100755 --- a/nsupdate.d/sample.config.dist +++ b/nsupdate.d/sample.config.dist @@ -1,7 +1,7 @@ # nsupdate.config # from which site should we get your wan ip? -IP_CHECK_SITE="http://ip.dblx.io" +IP_CHECK_SITE="https://ip.dblx.io" # use drill instead of nslookup for hostname lookup USE_DRILL="YES" @@ -14,4 +14,4 @@ INWX_PASS="PASSWORD" # The hostname that you want to update and it's ID from the inwx interface # You get the ID when you edit the given nameserver entry and hover the save button. DOMAIN="DOMAIN" -INWX_DOMAIN_ID="123456789" \ No newline at end of file +INWX_DOMAIN_ID="123456789"