Skip to content

Commit

Permalink
nc-restore: refresh trusted domains
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Jan 7, 2018
1 parent 0972d57 commit 614c57d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bin/nextcloudpi-config
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function nextcloud-config()
local LIST=()
for item in $CONFDIR/*.sh; do
DESC=$( grep "DESCRIPTION=" "$item" | sed 's|^DESCRIPTION="||;s|"$||' )
is_active_script "$item" && local ON="" || local ON=" "
is_active_script "$item" &>/dev/null && local ON="" || local ON=" "
LIST+=( "$ON $( basename "$item" .sh )" "$DESC" )
done

Expand Down
6 changes: 4 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

[v0.44.9](https://github.com/nextcloud/nextcloudpi/commit/e37978b) (2018-01-07) nc-restore: fix bug detecting data
[v0.44.10](https://github.com/nextcloud/nextcloudpi/commit/b1db925) (2018-01-07) nc-restore: refresh trusted domains

[v0.44.8](https://github.com/nextcloud/nextcloudpi/commit/c42993d) (2018-01-06) nc-restore: restore to a btrfs subvolume
[v0.44.9](https://github.com/nextcloud/nextcloudpi/commit/7dce423) (2018-01-07) nc-restore: fix bug detecting data

[v0.44.8 ](https://github.com/nextcloud/nextcloudpi/commit/c42993d) (2018-01-06) nc-restore: restore to a btrfs subvolume

[v0.44.7 ](https://github.com/nextcloud/nextcloudpi/commit/50513f6) (2018-01-06) nc-backup: make binary work standalone

Expand Down
11 changes: 8 additions & 3 deletions etc/nextcloudpi-config.d/nc-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ configure()
rm -rf "$TMPDIR" && mkdir -p "$TMPDIR"

# EXTRACT FILES
[[ "$BACKUPFILE_" =~ ".tar.gz" ]] && {
[[ "$BACKUPFILE_" =~ ".tar.gz" ]] && local COMPRESSED=1 || local COMPRESSED=0
[[ "$COMPRESSED" == "1" ]] && {
echo "decompressing backup file $BACKUPFILE_..."
tar -xzf "$BACKUPFILE_" -C "$TMPDIR" || return 1
tar -xzf "$BACKUPFILE_" -C "$TMPDIR" || return 1
BACKUPFILE_="$( ls "$TMPDIR"/*.tar 2>/dev/null )"
[[ -f "$BACKUPFILE_" ]] || { echo "$BACKUPFILE_ not found"; return 1; }
}
Expand Down Expand Up @@ -86,7 +87,8 @@ EOF

### INCLUDEDATA=yes situation

if [[ $( ls "$TMPDIR" | wc -l ) == 2 ]]; then
local NUMFILES=$(( 2 + COMPRESSED ))
if [[ $( ls "$TMPDIR" | wc -l ) -eq $NUMFILES ]]; then

local DATADIR=$( grep datadirectory /var/www/nextcloud/config/config.php | awk '{ print $3 }' | grep -oP "[^']*[^']" | head -1 )
[[ "$DATADIR" == "" ]] && { echo "Error reading data directory"; return 1; }
Expand Down Expand Up @@ -139,6 +141,9 @@ EOF
sed -i "s|logpath =.*|logpath = $DATADIR/nextcloud.log|" /etc/fail2ban/jail.conf
pgrep fail2ban &>/dev/null && service fail2ban restart

# refresh nextcloud trusted domains
bash /usr/local/bin/nextcloud-domain.sh

rm -r "$TMPDIR"
}

Expand Down

0 comments on commit 614c57d

Please sign in to comment.