mirror of
https://github.com/pi-hole/pi-hole
synced 2025-07-01 21:02:34 +00:00
Update advanced/Scripts/webpage.sh to enable Teleport restore from the command line
This commit is contained in:
parent
1eb4ad8238
commit
782cd2edd8
@ -52,6 +52,7 @@ Options:
|
|||||||
-i, interface Specify dnsmasq's interface listening behavior
|
-i, interface Specify dnsmasq's interface listening behavior
|
||||||
-l, privacylevel Set privacy level (0 = lowest, 3 = highest)
|
-l, privacylevel Set privacy level (0 = lowest, 3 = highest)
|
||||||
-t, teleporter Backup configuration as an archive
|
-t, teleporter Backup configuration as an archive
|
||||||
|
Add '-h' for more info on Teleporter usage
|
||||||
-t, teleporter myname.tar.gz Backup configuration to archive with name myname.tar.gz as specified"
|
-t, teleporter myname.tar.gz Backup configuration to archive with name myname.tar.gz as specified"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
@ -646,6 +647,27 @@ Interfaces:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Teleporter() {
|
Teleporter() {
|
||||||
|
case "${args[2]}" in
|
||||||
|
"-h" | "help" ) TeleporterHelpFunc;;
|
||||||
|
"-r" | "restore" ) TeleporterRestore;;
|
||||||
|
* ) TeleporterBackup;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
TeleporterHelpFunc() {
|
||||||
|
echo "Usage: pihole -a -t [options] [file]
|
||||||
|
If no options or file are specified, then backup configuration as an archive
|
||||||
|
If a file is specified, then backup configuration to archive with name myname.tar.gz as specified
|
||||||
|
|
||||||
|
Example: pihole -a -t myname.tar.gz
|
||||||
|
Set options for Teleporter
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-r, restore myname.tar.gz Restore configuration from an archive with name myname.tar.gz as specified"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
TeleporterBackup() {
|
||||||
local filename
|
local filename
|
||||||
filename="${args[2]}"
|
filename="${args[2]}"
|
||||||
if [[ -z "${filename}" ]]; then
|
if [[ -z "${filename}" ]]; then
|
||||||
@ -659,6 +681,15 @@ Teleporter() {
|
|||||||
php "${webroot}/admin/scripts/pi-hole/php/teleporter.php" > "${filename}"
|
php "${webroot}/admin/scripts/pi-hole/php/teleporter.php" > "${filename}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TeleporterRestore() {
|
||||||
|
if [[ "${#args[@]}" -gt 3 ]]; then
|
||||||
|
# webroot is sourced from basic-install above
|
||||||
|
php "${webroot}/admin/scripts/pi-hole/php/teleporter.php" "${args[@]:3}"
|
||||||
|
else
|
||||||
|
TeleporterHelpFunc
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
checkDomain()
|
checkDomain()
|
||||||
{
|
{
|
||||||
local domain validDomain
|
local domain validDomain
|
||||||
|
Loading…
Reference in New Issue
Block a user