Skip to content

Commit d9d7a16

Browse files
committed
Added automated installer
1 parent 2d52bfb commit d9d7a16

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ This module is designed for use with:
3434

3535
## 1. Download and Install FOSSBilling:
3636

37-
Start by downloading the latest version of FOSSBilling from the official website (https://fossbilling.org/). Follow the provided instructions to install it.
37+
Start by downloading the latest version of FOSSBilling from the official website (https://fossbilling.org/). Follow the instructions below to install it, or run for automated installation:
38+
39+
```bash
40+
wget https://raw.githubusercontent.com/getpinga/fossbilling-epp-rfc/main/install_epp_module.sh -O install_epp_module.sh && chmod +x install_epp_module.sh && ./install_epp_module.sh
41+
```
3842

3943
## 2. Installation and Configuration of Registrar Adapter:
4044

install_epp_module.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
# Function to make a string filename safe
4+
sanitize_filename() {
5+
echo "$1" | tr -cd '[:alnum:]_-'
6+
}
7+
8+
# Ask for registry name
9+
echo "Enter the name of the registry you are installing this module for:"
10+
read -r registry_name
11+
safe_registry_name=$(sanitize_filename "$(echo "$registry_name" | sed -E 's/^(.)/\U\1/')")
12+
13+
# Ask for FOSSBilling directory
14+
echo "Enter the path to the FOSSBilling directory (default is /var/www):"
15+
read -r fossbilling_path
16+
fossbilling_path=${fossbilling_path:-/var/www}
17+
18+
# Clone the repository to /tmp
19+
git clone https://github.com/getpinga/fossbilling-epp-rfc /tmp/fossbilling-epp-rfc
20+
21+
# Rename and move the epp.php file
22+
mv /tmp/fossbilling-epp-rfc/epp.php "$fossbilling_path/library/Registrar/Adapter/${safe_registry_name}.php"
23+
24+
# Edit the newly copied file
25+
sed -i "s/Registrar_Adapter_EPP/Registrar_Adapter_${safe_registry_name}/g" "$fossbilling_path/library/Registrar/Adapter/${safe_registry_name}.php"
26+
27+
# Move and rename eppSync.php
28+
mv /tmp/fossbilling-epp-rfc/eppSync.php "$fossbilling_path/${safe_registry_name}Sync.php"
29+
30+
# Check if eppClient.php exists and move if not
31+
if [ ! -f "$fossbilling_path/eppClient.php" ]; then
32+
mv /tmp/fossbilling-epp-rfc/eppClient.php "$fossbilling_path/"
33+
fi
34+
35+
# Edit the renamed eppSync.php
36+
sed -i "s/\$registrar = \"Epp\";/\$registrar = \"${safe_registry_name}\";/g" "$fossbilling_path/${safe_registry_name}Sync.php"
37+
38+
# Add the cron job
39+
(crontab -l 2>/dev/null; echo "0 0,12 * * * php $fossbilling_path/${safe_registry_name}Sync.php") | crontab -
40+
41+
# Clean up
42+
rm -rf /tmp/fossbilling-epp-rfc
43+
44+
# Final instructions
45+
echo "Installation complete."
46+
echo ""
47+
echo "1. Activate the Domain Registrar Module:"
48+
echo "Within FOSSBilling, go to System -> Domain Registration -> New Domain Registrar and activate the new domain registrar."
49+
echo ""
50+
echo "2. Registrar Configuration:"
51+
echo "Next, head to the 'Registrars' tab. Here, you'll need to enter your specific configuration details, including the path to your SSL certificate and key."
52+
echo ""
53+
echo "3. Adding a New TLD:"
54+
echo "Finally, add a new Top Level Domain (TLD) using your module from the 'New Top Level Domain' tab. Make sure to configure all necessary details, such as pricing, within this tab."

0 commit comments

Comments
 (0)