mirror of
https://github.com/SeriousBug/gandi-live-dns-rust
synced 2024-12-26 15:19:59 -06:00
Add packaging for ArchLinux
This commit is contained in:
parent
948521fcc4
commit
87bc572111
3
Packaging/.gitignore
vendored
Normal file
3
Packaging/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
pkg/
|
||||
src/
|
||||
example.toml
|
51
Packaging/PKGBUILD
Normal file
51
Packaging/PKGBUILD
Normal file
|
@ -0,0 +1,51 @@
|
|||
# Maintainer: Kaan Genc <kaan@bgenc.net>
|
||||
|
||||
pkgname=gandi-live-dns
|
||||
pkgver=1.0.1
|
||||
pkgrel=1
|
||||
pkgdesc="Automatically updates your IP address for Gandi's Live DNS."
|
||||
_repo_path="SeriousBug/gandi-live-dns-rust"
|
||||
url="https://github.com/${_repo_path}"
|
||||
license=('MIT')
|
||||
install="gandi-live-dns.install"
|
||||
arch=('x86_64' 'armv6h' 'armv7h' 'aarch64')
|
||||
backup=("etc/gandi-live-dns/gandi.conf")
|
||||
depends=() # Dependency free
|
||||
|
||||
|
||||
source=(
|
||||
"https://raw.githubusercontent.com/${_repo_path}/${pkgver}/example.toml"
|
||||
"gandi-live-dns.service"
|
||||
"gandi-live-dns.timer"
|
||||
"gandi-live-dns.sysusers"
|
||||
)
|
||||
_source_common="${url}/releases/download/${pkgver}/${pkgname}.${pkgver}.linux"
|
||||
source_x86_64=("${_source_common}-x86_64.tar.xz")
|
||||
source_armv6h=("${_source_common}-armv6.tar.xz")
|
||||
source_armv7h=("${_source_common}-armv7.tar.xz")
|
||||
source_aarch64=("${_source_common}-arm64.tar.xz")
|
||||
|
||||
|
||||
package() {
|
||||
# Install service files
|
||||
install -Dm644 gandi-live-dns.service "${pkgdir}/usr/lib/systemd/system/gandi-live-dns.service"
|
||||
install -Dm644 gandi-live-dns.timer "${pkgdir}/usr/lib/systemd/system/gandi-live-dns.timer"
|
||||
install -Dm644 gandi-live-dns.sysusers "${pkgdir}/usr/lib/sysusers.d/gandi-live-dns.conf"
|
||||
|
||||
# Add the example config
|
||||
mkdir -m600 -p "${pkgdir}/etc/gandi-live-dns"
|
||||
install -Dm600 example.toml "${pkgdir}/etc/gandi-live-dns/example.toml"
|
||||
|
||||
# Install the program itself
|
||||
install -Dm755 gandi-live-dns "${pkgdir}/usr/bin/gandi-live-dns"
|
||||
}
|
||||
|
||||
|
||||
sha256sums=('4f9dd02e0e03fd838081c3a8dd88b386411204853399f78fa83e8781271a012f'
|
||||
'7ae1a8fa18e0ef41aa42c94b4a364fdab0a6c9520cbea486f8c9c7f5da22e88f'
|
||||
'cd3b1ab682d421e8b9f230d9f44c07a9afe54ce12e55a2990fcbe606e4ccb9a3'
|
||||
'a0e652bf8fd879dcbb96488322cac572346fa9a1dbbc2cac08b94b12d9629128')
|
||||
sha256sums_x86_64=('75afe5409f4e98b91ef5966fbf6e2bfdeaccb299c2ccd35e722606ed0779c9f0')
|
||||
sha256sums_armv6h=('cc8465bc0a8d1de0bbb1817071d5aadce5a30287e8a7f6f357180559cddbd78d')
|
||||
sha256sums_armv7h=('95f80dd4fab25b4e6aeb4278e4b19255277000515d1ffacc03189c162b0c3b5c')
|
||||
sha256sums_aarch64=('df5c93303707ff60a015da4548f80218978247c886152b2f59b8509826245c34')
|
4
Packaging/gandi-live-dns.install
Normal file
4
Packaging/gandi-live-dns.install
Normal file
|
@ -0,0 +1,4 @@
|
|||
post_install() {
|
||||
systemd-sysusers gandi-live-dns.conf
|
||||
chown -R gandi-live-dns:gandi-live-dns /etc/gandi-live-dns
|
||||
}
|
14
Packaging/gandi-live-dns.service
Normal file
14
Packaging/gandi-live-dns.service
Normal file
|
@ -0,0 +1,14 @@
|
|||
[Unit]
|
||||
Description=Automatically updates your IP adress with Gandi LiveDNS.
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/gandi-live-dns
|
||||
User=gandi-live-dns
|
||||
Group=gandi-live-dns
|
||||
WorkingDirectory=/etc/gandi-live-dns/
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
1
Packaging/gandi-live-dns.sysusers
Normal file
1
Packaging/gandi-live-dns.sysusers
Normal file
|
@ -0,0 +1 @@
|
|||
u gandi-live-dns - "Gandi LiveDNS updater" /etc/gandi-live-dns
|
11
Packaging/gandi-live-dns.timer
Normal file
11
Packaging/gandi-live-dns.timer
Normal file
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=Automatically updates your IP adress with Gandi LiveDNS.
|
||||
Wants=network-online.target
|
||||
|
||||
[Timer]
|
||||
OnBootSec=1s
|
||||
OnCalendar=daily
|
||||
RandomizedDelaySec=10s
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
17
Readme.md
17
Readme.md
|
@ -17,12 +17,10 @@ it in Rust as a learning project.
|
|||
|
||||
## Usage
|
||||
|
||||
> Warning!
|
||||
>
|
||||
> This tool does not rate limit itself, or otherwise do anything that limits how
|
||||
> often it sends changes to Gandi's servers. It's up to you to use the tool
|
||||
> properly and avoid abusing Gandi's servers. The tool is one-shot, so all you
|
||||
> have to do is to avoid running it too often.
|
||||
> This tool doesn't rate limit itself at the moment. If you have more than 30
|
||||
> entries that need to be updated, the operation may hit rate the limit of Gandi
|
||||
> and fail. You can work around this using multiple config files and waiting at
|
||||
> least 1 minute between runs.
|
||||
|
||||
### Prebuilt binaries
|
||||
|
||||
|
@ -55,6 +53,13 @@ Follow the steps below to use these images.
|
|||
> has a full path to the config file (`$(pwd)/gandi.toml` part). Otherwise
|
||||
> Docker will create a directory.
|
||||
|
||||
## Automation
|
||||
|
||||
The `Packaging` folder contains a Systemd service and timer, which you can use
|
||||
to automatically run this tool. By default it will update the IP addresses after
|
||||
every boot up, and at least once a day. You can adjust the timer to speed this
|
||||
up, but avoid unnecessarily overloading Gandi's servers.
|
||||
|
||||
## Development
|
||||
|
||||
### Local builds
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# If you have rootless docker set up, remove sudo from this variable.
|
||||
DOCKER="sudo docker"
|
||||
#
|
||||
shopt -s extglob
|
||||
# Trap errors and interrupts
|
||||
set -Eeuo pipefail
|
||||
function handle_sigint() {
|
||||
|
@ -50,12 +51,18 @@ for target in "${!TARGETS[@]}"; do
|
|||
echo Building "${target}"
|
||||
cross build -j $(($(nproc) / 2)) --release --target "${target}"
|
||||
if [[ "${target}" =~ .*"windows".* ]] ; then
|
||||
7z a -tzip "gandi-live-dns.${VERSION}.${TARGETS[${target}]}.zip" target/"${target}"/release/gandi-live-dns.exe 1>/dev/null
|
||||
zip -j "gandi-live-dns.${VERSION}.${TARGETS[${target}]}.zip" target/"${target}"/release/gandi-live-dns.exe 1>/dev/null
|
||||
else
|
||||
tar -acf "gandi-live-dns.${VERSION}.${TARGETS[${target}]}.tar.xz" target/"${target}"/release/gandi-live-dns
|
||||
tar -acf "gandi-live-dns.${VERSION}.${TARGETS[${target}]}.tar.xz" -C "target/${target}/release/" "gandi-live-dns"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$1" = "--no-docker" ]] ; then
|
||||
echo "Exiting without releasing to docker"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Copy files into place so Docker can get them easily
|
||||
cd Docker
|
||||
echo Building Docker images
|
||||
|
|
Loading…
Reference in a new issue