Compare commits
19 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 182cf7ceff | |||
|
|
7ca4805578 | ||
|
|
cf46b9d581 | ||
|
|
36c916750d | ||
|
|
663bb318f3 | ||
|
|
e6576af281 | ||
| 9e3dcc6833 | |||
|
|
7b02709e4e | ||
| 2efd607d21 | |||
|
|
ed8d1d1e42 | ||
| 6f03ba3283 | |||
|
|
0ab371e535 | ||
| 64d1d3cd57 | |||
| 0205dfea65 | |||
| 2b38980d50 | |||
| 8084b862e9 | |||
| 2c9144ed5c | |||
| e7a2d8c996 | |||
| 5687980764 |
13 changed files with 133 additions and 22 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# lp-dyndns
|
||||
|
||||
This is the buildsource for the lp-dyndns package - mean for being distributed to users of FreeDNS.linux.pizza
|
||||
[](https://drone.selea.se/jonathan/lp-dyndns)
|
||||
|
||||
|
||||
Feel free to fork and contribute
|
||||
|
|
|
|||
2
gbp.conf
Normal file
2
gbp.conf
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[buildpackage]
|
||||
debian-branch = debian/sid
|
||||
BIN
lp-ddns.deb
BIN
lp-ddns.deb
Binary file not shown.
4
lp-ddns.recipe
Normal file
4
lp-ddns.recipe
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# bzr-builder format 0.2 deb-version {debupstream}-0~{revno}
|
||||
lp:lp-ddns
|
||||
nest packaging lp:~jonathan-selea/lp-ddns/lp-ddns debian
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
PACKAGE (0.1a) UNRELEASED; urgency=medium
|
||||
PACKAGE (0.2) UNRELEASED; urgency=medium
|
||||
|
||||
* 0.1a First working commit,
|
||||
* 0.2 Make output prettier when executing "lp-ddns"
|
||||
|
||||
-- Jonathan Sélea <jonathan@selea.se> Sun, 08 Dec 2019 16:02:15 +0100
|
||||
-- Jonathan Sélea <jonathan@selea.se> Sun, 4 Jan 2020 22:48:15 +0100
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
/etc/lp-dyndns/settings.conf
|
||||
/etc/cron.d/lp-ddns
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ Section: custom
|
|||
Priority: optional
|
||||
Maintainer: Jonathan Sélea <jonathan@selea.se>
|
||||
Package: lp-ddns
|
||||
Version: 0.1a
|
||||
Standard-Version: 0.1a
|
||||
Version: 0.5
|
||||
Standard-Version: 0.5
|
||||
Architecture: all
|
||||
Essential: no
|
||||
Depends-On: curl
|
||||
Depends-On: curl bash
|
||||
Homepage: https://linux.pizza
|
||||
Vcs-Git: https://git.selea.se/jonathan/lp-dyndns
|
||||
Vcs-Git: https://github.com/wioxjk/lp-ddns/
|
||||
Description: Tool for managing Dynamic DNS toghether with FreeDNS.linux.pizza
|
||||
|
|
|
|||
34
lp-ddns/DEBIAN/copyright
Normal file
34
lp-ddns/DEBIAN/copyright
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
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'.
|
||||
0
lp-ddns/DEBIAN/rules
Executable file
0
lp-ddns/DEBIAN/rules
Executable file
6
lp-ddns/etc/cron.d/lp-ddns
Normal file
6
lp-ddns/etc/cron.d/lp-ddns
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# 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
|
||||
|
|
@ -2,10 +2,11 @@
|
|||
# RECORDID="235890
|
||||
# PASSWORD="verystrongpassword"
|
||||
# DOMAIN="sub.domain.tld"
|
||||
|
||||
# NAMESERVER="NameServerToQuery"
|
||||
|
||||
|
||||
|
||||
RECORDID=""
|
||||
PASSWORD=""
|
||||
DOMAIN=""
|
||||
NAMESERVER="" #Blank for system NameServer
|
||||
|
|
|
|||
|
|
@ -1,17 +1,25 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Comment this if you want to use this script standalone:
|
||||
. /etc/lp-dyndns/settings.conf
|
||||
|
||||
#RECORDID="11111"
|
||||
#PASSWORD="passss"
|
||||
#DOMAIN="sub.domain.tld"
|
||||
# Uncomment if you want to use this script standalone:
|
||||
#RECORDID=
|
||||
#PASSWORD=
|
||||
#DOMAIN=
|
||||
|
||||
|
||||
# DO NOT MODIFY #
|
||||
# Do not touch this, unless you want to touch this :)
|
||||
|
||||
IP="$(curl --connect-timeout 10 -s ipv4.is || curl --connect-timeout 10 -s ipv4.is)"
|
||||
#IP="$(curl --config /etc/lp-dyndns/curlrc)"
|
||||
CURRENTIP="$(dig ${DOMAIN} +short)"
|
||||
if [ "${NAMESERVER}" = "" ];
|
||||
then
|
||||
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}"
|
||||
# Making stuff fancy
|
||||
NC='\033[0m'
|
||||
|
|
@ -22,17 +30,12 @@ CYAN='\033[0;36m'
|
|||
LCYAN='\033[0;37m'
|
||||
YELLOW='\033[1;33m'
|
||||
# END
|
||||
|
||||
|
||||
echo -e "The current external IP is ${YELLOW}${IP}${NC}" | logger
|
||||
|
||||
echo -e "The current external IP is ${YELLOW}${IP}${NC}"
|
||||
if [ "${IP}" == "${CURRENTIP}" ];
|
||||
then
|
||||
echo -e "${GREEN}The current IP matches the record ${DOMAIN}, no need to update.${NC}" | logger
|
||||
echo -e "${GREEN}The current IP matches the record ${DOMAIN}, no need to update.${NC}"
|
||||
else
|
||||
echo -e "${RED}Current IP does not match the record ${CURRENTIP} updating...${NC}" | logger
|
||||
echo -e "${RED}Current IP does not match the record ${CURRENTIP} updating...${NC}"
|
||||
curl ${APIURL}
|
||||
fi
|
||||
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
60
packagingscript.sh
Executable file
60
packagingscript.sh
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
#!/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"
|
||||
Loading…
Reference in a new issue