Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornachoparker <nacho@ownyourbits.com>2017-11-27 22:10:49 +0300
committernachoparker <nacho@ownyourbits.com>2017-11-27 22:11:28 +0300
commitf8b328e3963715ce7f93284b62e4f9d195b3837a (patch)
treec18f88d44520071caab01efc74c21ab31a123d82
parent6c7cd4b8be13c038fb035871be5953c4f4d8075f (diff)
added nc-export-ncp and nc-import-ncpv0.39.0
-rw-r--r--changelog.md8
-rw-r--r--etc/nextcloudpi-config.d/nc-export-ncp.sh57
-rw-r--r--etc/nextcloudpi-config.d/nc-import-ncp.sh66
3 files changed, 130 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md
index 3250625f..1c57ae70 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,11 @@
-[v0.37.5](https://github.com/nextcloud/nextcloudpi/commit/0a7850c) (2017-11-25) nc-info: provide suggestions
+[v0.39.0](https://github.com/nextcloud/nextcloudpi/commit/3bbd913) (2017-11-27) added nc-export-ncp and nc-import-ncp
+
+[v0.38.1 ](https://github.com/nextcloud/nextcloudpi/commit/0943d83) (2017-11-27) nc-info: warn distro
+
+[v0.38.0 ](https://github.com/nextcloud/nextcloudpi/commit/b05debc) (2017-11-27) added SSH
+
+[v0.37.5](https://github.com/nextcloud/nextcloudpi/commit/f28dcbc) (2017-11-25) nc-info: provide suggestions
[v0.37.4 ](https://github.com/nextcloud/nextcloudpi/commit/a2b7a7a) (2017-11-25) dnsmasq: improve output
diff --git a/etc/nextcloudpi-config.d/nc-export-ncp.sh b/etc/nextcloudpi-config.d/nc-export-ncp.sh
new file mode 100644
index 00000000..e0071fa6
--- /dev/null
+++ b/etc/nextcloudpi-config.d/nc-export-ncp.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+# Export NextCloudPi configuration
+#
+#
+# Copyleft 2017 by Courtney Hicks
+# GPL licensed (see end of file) * Use at your own risk!
+#
+
+DIR_=/media/USBdrive/
+
+DESCRIPTION="Export NextCloudPi configuration"
+
+configure()
+{
+ [[ -d "$DIR_" ]] || { echo "directory $DIR_ does not exist"; return 1; }
+
+ local DESTFILE="$DIR_"/ncp-config_$( date +"%Y%m%d" ).tar
+ rm -rf /tmp/ncp-export
+ mkdir -p /tmp/ncp-export
+ cd /tmp/ncp-export || return 1
+
+ for file in /usr/local/etc/nextcloudpi-config.d/*; do
+ VARS=( $( grep "^[[:alpha:]]\+_=" "$file" | cut -d= -f1 | sed 's|_$||' ) )
+ VALS=( $( grep "^[[:alpha:]]\+_=" "$file" | cut -d= -f2 ) )
+ local CONFIG=""
+ for i in $( seq 0 1 $(( ${#VARS[@]} - 1 )) ); do
+ CONFIG+="${VARS[$i]}=${VALS[$i]}\n"
+ done
+ echo -e "$CONFIG" > "$( basename "$file" .sh ).cfg"
+ done
+
+ tar -cf "$DESTFILE" *
+
+ cd -
+ rm -rf /tmp/ncp-export
+ echo -e "configuration exported to $DESTFILE"
+}
+
+install() { :; }
+
+# License
+#
+# This script is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This script is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this script; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+# Boston, MA 02111-1307 USA
diff --git a/etc/nextcloudpi-config.d/nc-import-ncp.sh b/etc/nextcloudpi-config.d/nc-import-ncp.sh
new file mode 100644
index 00000000..5fda3538
--- /dev/null
+++ b/etc/nextcloudpi-config.d/nc-import-ncp.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+# Import NextCloudPi configuration
+#
+#
+# Copyleft 2017 by Courtney Hicks
+# GPL licensed (see end of file) * Use at your own risk!
+#
+
+FILE_=/media/USBdrive/ncp-config_xxxxxx.cfg
+
+DESCRIPTION="Import NextCloudPi configuration from file"
+
+configure()
+{
+ [[ -f "$FILE_" ]] || { echo "export file $FILE_ does not exist"; return 1; }
+
+ source /usr/local/etc/library.sh || return 1
+ cd /usr/local/etc/nextcloudpi-config.d || return 1
+
+ # extract export
+ local TMP="/tmp/ncp-export"
+ rm -rf "$TMP"
+ mkdir -p "$TMP"
+ tar -xf "$FILE_" -C "$TMP"
+
+ # restore configuration and activate
+ for file in /"$TMP"/*; do
+ local SCRIPT="$( basename "$file" .cfg ).sh"
+
+ # restore
+ [ -f /usr/local/etc/nextcloudpi-config.d/"$SCRIPT" ] && {
+ local VARS=( $( grep "^[[:alpha:]]\+=" "$file" | cut -d= -f1 ) )
+ local VALS=( $( grep "^[[:alpha:]]\+=" "$file" | cut -d= -f2 ) )
+ for i in $( seq 0 1 ${#VARS[@]} ); do
+ sed -i "s|^${VARS[$i]}_=.*|${VARS[$i]}_=${VALS[$i]}|" "$SCRIPT"
+ done
+ }
+
+ # activate
+ grep -q "^ACTIVE_=yes" "$SCRIPT" && echo && activate_script "$SCRIPT"
+ done
+
+ # cleanup
+ rm -rf "$TMP"
+ echo -e "\nconfiguration restored"
+}
+
+install() { :; }
+
+# License
+#
+# This script is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This script is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this script; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+# Boston, MA 02111-1307 USA