Skip to content

Commit

Permalink
add unix installer script
Browse files Browse the repository at this point in the history
  • Loading branch information
rjojjr committed Nov 29, 2024
1 parent 040f8d7 commit 1c08d7b
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ This is a simple python app to manage DyDNS updates for
the user manually creating and entering ClouDNS update URLs,
but I plan to integrate with the ClouDNS in the very near future.

## Installation

This client can currently be installed as systemd service
on most unix distributions.

To install this client as a system service:

```shell
curl -fsSL https://raw.githubusercontent.com/rjojjr/cloudns-ddns-client/master/scripts/linux-installer.sh | sudo bash
```

## USAGE

### Adding Hostnames
Expand All @@ -13,6 +24,9 @@ To add a ClouDNS hostname for updates, run this app
with the `-a`(or `--add-hostname`) flag followed by the hostname and then the
DyDNS update URL provided by the ClouDNS webapp.

**IMPORTANT** - Run the `--add-hostname` cmd with the `sudo` when
running this client as systemd service.

EX:

```shell
Expand Down
3 changes: 3 additions & 0 deletions scripts/cloudns-client
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

python3 /usr/local/cloudns-ddns-client/src/main.py "$@"
66 changes: 66 additions & 0 deletions scripts/linux-installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

echo 'Installing ClouDNS DyDNS Update Client'

# TODO - version argument
# TODO - argument to install from local repo(no git clone)

# TODO - install deps. for other OSes
if [[ "$1" == "--install-apt-deps" ]]; then
echo 'Installing apt dependencies'
{
apt install python3-pip -y && \
apt install python3-venv -y
} || {
echo 'Failed to install Torch Tuner CLI apt dependencies' && \
exit 1
}

fi

cd /usr/local || (mkdir -p /usr/local && (cd /usr/local || (echo 'failed to create install directory at /usr/local' && exit 1)))

if [ -d ./cloudns-ddns-client ]; then
echo "Removing old update client install"
{
rm -rf ./torch-tuner
} || {
echo 'Failed to remove old update client install' && \
exit 1
}
fi

{
git clone https://github.com/rjojjr/cloudns-ddns-client.git
} || {
echo 'Failed to clone update client' && \
exit 1
}

{
cd cloudns-ddns-client
} || {
echo 'Failed to navigate to cloudns-ddns-client directory' && \
exit 1
}

{
echo 'Installing update client as system wide application' && \
cp scripts/cloudns-client /bin/cloudns-client && \
sudo chmod +x /bin/cloudns-client
} || {
echo 'Failed to install update client as system wide application' && \
exit 1
}

{
echo 'Installing update client systemd service' && \
cp svc/cloudns-ddns-update-client.service /etc/systemd/system/ && \
sudo systemctl enable cloudns-ddns-update-client.service && \
sudo systemctl start cloudns-ddns-update-client.service
} || {
echo 'Failed to install update client service' && \
exit 1
}

echo 'ClouDNS DyDNS Update Client installed successfully!'

0 comments on commit 1c08d7b

Please sign in to comment.