anudeepND / anudeepND/whitelist

Docker installation (with Python3 support)

Open
#256 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
4.4k
Forks
289
PR merge metrics
No merged PRs in 30d

Description

I'm working on an automated setup, and for the whitelist to work properly on Pi-hole on Docker, I need an entrypoint script. Since a script is needed, I'm working on installing python, checking if the repo was already cloned, if not, cloning it, and if so, pulling it, then proceeding to invoke the whitelist.py and add it to crontab. But the script I managed to reach is facing a fatal error:

```fatal: destination path 'whitelist' already exists and is not an empty directory.```

My `init.sh` as entrypoint:

```apt update
apt install python3 -y
cd

# The name of the directory to check/create
dir_name="whitelist"

# The Git repository URL to clone/pull from
repo_url="https://github.com/anudeepND/whitelist.git"

# Check if the directory already exists
if [ -d "$dir_name" ]; then
echo "Directory '$dir_name' already exists. Doing a 'git pull'..."
cd "$dir_name"
git pull
else
echo "Directory '$dir_name' does not exist. Doing a 'git clone'..."
git clone "$repo_url" "$dir_name"
fi

python3 whitelist/scripts/whitelist.py

cat /etc/crontab >> tmp_crontab
echo "0 1 * * */7 root /root/whitelist/scripts/whitelist.py" >> tmp_crontab

cp tmp_crontab /etc/crontab
rm tmp_crontab
```

I'm willing to send a PR with the working instructions once I get it working properly.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.