mirror of
https://github.com/AuxXxilium/arc-addons.git
synced 2024-11-23 21:50:52 +07:00
arcdns: rework
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
b1daab939f
commit
ff04f39553
34
arcdns/all/usr/bin/arcdns.sh
Executable file
34
arcdns/all/usr/bin/arcdns.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium>
|
||||
#
|
||||
# This is free software, licensed under the MIT License.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
cp -f /usr/bin/arcdns.php /usr/syno/bin/ddns/arcdns.php
|
||||
|
||||
ENTRIES=("[Custom - ArcDNS]")
|
||||
for ENTRY in "${ENTRIES[@]}"
|
||||
do
|
||||
if [ -f "/etc/ddns_provider.conf" ]; then
|
||||
if grep -Fxq "${ENTRY}" /etc/ddns_provider.conf; then
|
||||
echo "arcdns: Entry ${ENTRY} already exists"
|
||||
else
|
||||
echo "arcdns: Entry ${ENTRY} does not exist, adding now"
|
||||
echo "${ENTRY}" >> /etc/ddns_provider.conf
|
||||
echo " modulepath=/usr/syno/bin/ddns/namecheap.php" >> /etc/ddns_provider.conf
|
||||
echo " queryurl=https://arcdns.tech/update/__HOSTNAME__/__PASSWORD__" >> /etc/ddns_provider.conf
|
||||
fi
|
||||
fi
|
||||
if [ -f "/etc.defaults/ddns_provider.conf" ]; then
|
||||
if grep -Fxq "${ENTRY}" /etc.defaults/ddns_provider.conf; then
|
||||
echo "arcdns: Entry ${ENTRY} already exists"
|
||||
else
|
||||
echo "arcdns: Entry ${ENTRY} does not exist, adding now"
|
||||
echo "${ENTRY}" >> /etc.defaults/ddns_provider.conf
|
||||
echo " modulepath=/usr/syno/bin/ddns/namecheap.php" >> /etc.defaults/ddns_provider.conf
|
||||
echo " queryurl=https://arcdns.tech/update/__HOSTNAME__/__PASSWORD__" >> /etc.defaults/ddns_provider.conf
|
||||
fi
|
||||
fi
|
||||
done
|
@ -11,24 +11,30 @@ if [ "${1}" = "late" ]; then
|
||||
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||
|
||||
cp -vf /usr/bin/arcdns.php /tmpRoot/usr/syno/bin/ddns/arcdns.php
|
||||
cp -vf /usr/bin/arcdns.php /tmpRoot/usr/bin/arcdns.php
|
||||
cp -vf /usr/bin/arcdns.sh /tmpRoot/usr/bin/arcdns.sh
|
||||
|
||||
# Define the entries to be added
|
||||
ENTRIES=("[Custom - ArcDNS]")
|
||||
for ENTRY in "${ENTRIES[@]}"
|
||||
do
|
||||
if [ -f "/tmpRoot/etc.defaults/ddns_provider.conf" ]; then
|
||||
if grep -Fxq "${ENTRY}" /tmpRoot/etc.defaults/ddns_provider.conf; then
|
||||
echo "arcdns: Entry ${ENTRY} already exists"
|
||||
else
|
||||
echo "arcdns: Entry ${ENTRY} does not exist, adding now"
|
||||
echo "${ENTRY}" >> /tmpRoot/etc.defaults/ddns_provider.conf
|
||||
echo " modulepath=/usr/syno/bin/ddns/namecheap.php" >> /tmpRoot/etc.defaults/ddns_provider.conf
|
||||
echo " queryurl=https://arcdns.tech/update/__HOSTNAME__/__PASSWORD__" >> /tmpRoot/etc.defaults/ddns_provider.conf
|
||||
fi
|
||||
fi
|
||||
done
|
||||
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
||||
DEST="/tmpRoot/usr/lib/systemd/system/arcdns.service"
|
||||
cat << EOF > ${DEST}
|
||||
[Unit]
|
||||
Description=addon arcdns
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/bin/arcdns.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[X-Synology]
|
||||
Author=Virtualization Team
|
||||
EOF
|
||||
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
||||
ln -vsf /usr/lib/systemd/system/arcdns.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/arcdns.service
|
||||
elif [ "${1}" = "uninstall" ]; then
|
||||
echo "Installing addon arcdns - ${1}"
|
||||
# To-Do
|
||||
|
@ -1,6 +1,6 @@
|
||||
version: 1
|
||||
name: arcdns
|
||||
description: "Dynamic DNS client for arcdns.tech - Modify in Arc DSM Options"
|
||||
description: "Dynamic DNS client for arcdns.tech - Modify in DSM DynDNS Settings"
|
||||
system: false
|
||||
beta: true
|
||||
all:
|
||||
|
Loading…
Reference in New Issue
Block a user