icwmp/scripts/functions/conf_backup

29 lines
699 B
Bash

#!/bin/sh
# Copyright (C) 2019 iopsys Software Solutions AB
# Author: imen BHIRI <imen.bhiri@pivasoftware.com>
UCI_CONFIG_DIR="/etc/config/"
BACKUP_FILE="/etc/backup"
RESTORED_CONFIG_FILE="dropbear firewall mcpd multiwan network dhcp owsd samba system voice_client wireless"
export_config() {
rm -f $BACKUP_FILE
for i in `echo ${RESTORED_CONFIG_FILE}`; do
/sbin/uci -q ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} export /etc/config/$i >> $BACKUP_FILE
done
}
import_config() {
/sbin/uci -q ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} import < $BACKUP_FILE
}
if [ "$1" == "export_conf" ] ; then
export_config
return
elif [ "$1" == "import_conf" ] ; then
import_config
return
else
return
fi