Compare commits

..

No commits in common. "master" and "0.0.1a" have entirely different histories.

13 changed files with 22 additions and 133 deletions

View file

@ -1,6 +1,6 @@
# lp-dyndns # lp-dyndns
This is the buildsource for the lp-dyndns package - mean for being distributed to users of FreeDNS.linux.pizza This is the buildsource for the lp-dyndns package - mean for being distributed to users of FreeDNS.linux.pizza
[![Build Status](https://drone.selea.se/api/badges/jonathan/lp-dyndns/status.svg)](https://drone.selea.se/jonathan/lp-dyndns)
Feel free to fork and contribute Feel free to fork and contribute

View file

@ -1,2 +0,0 @@
[buildpackage]
debian-branch = debian/sid

Binary file not shown.

View file

@ -1,4 +0,0 @@
# bzr-builder format 0.2 deb-version {debupstream}-0~{revno}
lp:lp-ddns
nest packaging lp:~jonathan-selea/lp-ddns/lp-ddns debian

View file

@ -1,5 +1,5 @@
PACKAGE (0.2) UNRELEASED; urgency=medium PACKAGE (0.1a) UNRELEASED; urgency=medium
* 0.2 Make output prettier when executing "lp-ddns" * 0.1a First working commit,
-- Jonathan Sélea <jonathan@selea.se> Sun, 4 Jan 2020 22:48:15 +0100 -- Jonathan Sélea <jonathan@selea.se> Sun, 08 Dec 2019 16:02:15 +0100

View file

@ -1,2 +1 @@
/etc/lp-dyndns/settings.conf /etc/lp-dyndns/settings.conf
/etc/cron.d/lp-ddns

View file

@ -3,11 +3,11 @@ Section: custom
Priority: optional Priority: optional
Maintainer: Jonathan Sélea <jonathan@selea.se> Maintainer: Jonathan Sélea <jonathan@selea.se>
Package: lp-ddns Package: lp-ddns
Version: 0.5 Version: 0.1a
Standard-Version: 0.5 Standard-Version: 0.1a
Architecture: all Architecture: all
Essential: no Essential: no
Depends-On: curl bash Depends-On: curl
Homepage: https://linux.pizza Homepage: https://linux.pizza
Vcs-Git: https://github.com/wioxjk/lp-ddns/ Vcs-Git: https://git.selea.se/jonathan/lp-dyndns
Description: Tool for managing Dynamic DNS toghether with FreeDNS.linux.pizza Description: Tool for managing Dynamic DNS toghether with FreeDNS.linux.pizza

View file

@ -1,34 +0,0 @@
Files: *
Copyright: 2019 Jonathan Sélea
License: GPL-2+
Files: debian/*
Copyright: 1998-2010 Josip Rodin <joy-mg@debian.org>
License: GPL-2+
Files: /etc/lp-ddns/*
Copyright: 2019 Jonathan Sélea
License: GPL-2+
Files: /usr/local/bin/lp-ddns
Copyright: 2019 Jonathan Sélea
License: GPL-2+
License: GPL-2+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 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 General Public License for more details.
.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
'/usr/share/common-licenses/GPL-2'.

View file

View file

@ -1,6 +0,0 @@
# Please modify this according to your needs.
# This crontab works on Debian, but certain distro may interpret this differently.
#@reboot /usr/local/bin/lp-ddns >/dev/null 2>&1
#*/30 * * * /usr/local/bin/lp-ddns >/dev/null 2>&1

View file

@ -2,11 +2,10 @@
# RECORDID="235890 # RECORDID="235890
# PASSWORD="verystrongpassword" # PASSWORD="verystrongpassword"
# DOMAIN="sub.domain.tld" # DOMAIN="sub.domain.tld"
# NAMESERVER="NameServerToQuery"
RECORDID="" RECORDID=""
PASSWORD="" PASSWORD=""
DOMAIN="" DOMAIN=""
NAMESERVER="" #Blank for system NameServer

View file

@ -1,25 +1,17 @@
#!/bin/bash #!/bin/bash
set -e set -e
# Comment this if you want to use this script standalone:
. /etc/lp-dyndns/settings.conf . /etc/lp-dyndns/settings.conf
# Uncomment if you want to use this script standalone: #RECORDID="11111"
#RECORDID= #PASSWORD="passss"
#PASSWORD= #DOMAIN="sub.domain.tld"
#DOMAIN=
# Do not touch this, unless you want to touch this :) # DO NOT MODIFY #
IP="$(curl --connect-timeout 10 -s ipv4.is || curl --connect-timeout 10 -s ipv4.is)" IP="$(curl --connect-timeout 10 -s ipv4.is || curl --connect-timeout 10 -s ipv4.is)"
#IP="$(curl --config /etc/lp-dyndns/curlrc)" #IP="$(curl --config /etc/lp-dyndns/curlrc)"
if [ "${NAMESERVER}" = "" ];
then
CURRENTIP="$(dig ${DOMAIN} +short)" CURRENTIP="$(dig ${DOMAIN} +short)"
else
CURRENTIP="$(dig @${NAMESERVER} ${DOMAIN} +short)"
fi
APIURL="https://freedns.linux.pizza/api/v1/remote/updatepw?record=${RECORDID}&password=${PASSWORD}&content=${IP}" APIURL="https://freedns.linux.pizza/api/v1/remote/updatepw?record=${RECORDID}&password=${PASSWORD}&content=${IP}"
# Making stuff fancy # Making stuff fancy
NC='\033[0m' NC='\033[0m'
@ -30,12 +22,17 @@ CYAN='\033[0;36m'
LCYAN='\033[0;37m' LCYAN='\033[0;37m'
YELLOW='\033[1;33m' YELLOW='\033[1;33m'
# END # END
echo -e "The current external IP is ${YELLOW}${IP}${NC}"
echo -e "The current external IP is ${YELLOW}${IP}${NC}" | logger
if [ "${IP}" == "${CURRENTIP}" ]; if [ "${IP}" == "${CURRENTIP}" ];
then then
echo -e "${GREEN}The current IP matches the record ${DOMAIN}, no need to update.${NC}" echo -e "${GREEN}The current IP matches the record ${DOMAIN}, no need to update.${NC}" | logger
else else
echo -e "${RED}Current IP does not match the record ${CURRENTIP} updating...${NC}" echo -e "${RED}Current IP does not match the record ${CURRENTIP} updating...${NC}" | logger
curl ${APIURL} curl ${APIURL}
fi fi
exit 0 exit 0

View file

@ -1,60 +0,0 @@
#!/usr/bin/env bash
# Based on scripts by azlux.fr
pkgname=lp-ddns
repo="wioxjk/lp-ddns"
current=$(reprepro -b /srv/repos/ list stable lp-ddns | head -n1 | awk '{print $3}')
if [[ ! -d /tmp/${pkgname} ]]; then
git clone https://github.com/$repo /tmp/lp-ddns
else
cd /tmp/${pkgname}
git fetch
tp=$(git pull)
fi
cd /tmp/${pkgname}
new=$(grep 'declare version=' ${pkgname} | cut -d '"' -f 2)
if [ "$current" == "$new" ]; then
exit
fi
echo "New LP-DDNS version $current -> $new"
STARTDIR="/tmp/${pkgname}/build"
DESTDIR="$STARTDIR/pkg"
OUTDIR="$STARTDIR/deb"
rm -rf "$STARTDIR"
mkdir "$STARTDIR"
install -Dm 755 "/tmp/${pkgname}/${pkgname}" "$DESTDIR/usr/local/bin/${pkgname}"
mkdir -p "$DESTDIR/DEBIAN"
cat >"$DESTDIR/DEBIAN/control"<<EOL
Source: lp-ddns
Section: custom
Priority: optional
Maintainer: Jonathan Sélea <jonathan@selea.se>
Package: ${pkgname}
Version: $new
Standard-Version: 0.2a
Architecture: all
Essential: no
Depends-On: curl bash
Homepage: https://linux.pizza
Vcs-Git: https://github.com/wioxjk/lp-ddns
Bugs: https://github.com/wioxjk/lp-ddns/issues
Description: Tool for managing Dynamic DNS toghether with FreeDNS.linux.pizza
EOL
mkdir "$OUTDIR"
dpkg-deb --build "$DESTDIR" "$OUTDIR"
reprepro -b /srv/repos includedeb buster "$OUTDIR"/*.deb
reprepro -b /srv/repos includedeb stretch "$OUTDIR"/*.deb
rm -rf "$STARTDIR"