-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstall_epp_module.sh
49 lines (38 loc) · 2.01 KB
/
install_epp_module.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# Function to make a string filename safe
sanitize_filename() {
echo "$1" | tr -cd '[:alnum:]_-'
}
# Ask for registry name
echo "Enter the name of the registry you are installing this module for:"
read -r registry_name
safe_registry_name=$(sanitize_filename "$(echo "$registry_name" | sed -E 's/^(.)/\U\1/')")
# Ask for FOSSBilling directory
echo "Enter the path to the FOSSBilling directory (default is /var/www):"
read -r fossbilling_path
fossbilling_path=${fossbilling_path:-/var/www}
# Clone the repository to /tmp
git clone https://github.com/getpinga/fossbilling-epp-rfc /tmp/fossbilling-epp-rfc
# Rename and move the epp.php file
mv /tmp/fossbilling-epp-rfc/epp.php "$fossbilling_path/library/Registrar/Adapter/${safe_registry_name}.php"
# Edit the newly copied file
sed -i "s/Registrar_Adapter_EPP/Registrar_Adapter_${safe_registry_name}/g" "$fossbilling_path/library/Registrar/Adapter/${safe_registry_name}.php"
# Move and rename eppSync.php
mv /tmp/fossbilling-epp-rfc/eppSync.php "$fossbilling_path/${safe_registry_name}Sync.php"
# Edit the renamed eppSync.php
sed -i "s/\$registrar = \"Epp\";/\$registrar = \"${safe_registry_name}\";/g" "$fossbilling_path/${safe_registry_name}Sync.php"
# Add the cron job
(crontab -l 2>/dev/null; echo "0 0,12 * * * php $fossbilling_path/${safe_registry_name}Sync.php") | crontab -
# Clean up
rm -rf /tmp/fossbilling-epp-rfc
# Final instructions
echo "Installation complete."
echo ""
echo "1. Activate the Domain Registrar Module:"
echo "Within FOSSBilling, go to System -> Domain Registration -> New Domain Registrar and activate the new domain registrar."
echo ""
echo "2. Registrar Configuration:"
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."
echo ""
echo "3. Adding a New TLD:"
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 #, within this tab."