Skip to content

Commit

Permalink
🎉 added update script
Browse files Browse the repository at this point in the history
  • Loading branch information
Ooggle committed Jul 22, 2021
1 parent 9cea540 commit a27f450
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ dead-simple blog template powered by Markdown and PHP

## Update guide

### You can use the update.sh script to update your apache2/src/ directory by doing the following (thanks to @Kevin-Mizu):
(don't forget to change the path in your command)
```
wget https://raw.githubusercontent.com/Ooggle/dead-simple-blog/master/update.sh
chmod u+x ./update.sh
./update.sh path/to/apache2/src/
```

In order to update the website to the latest version, you need to download the latest release, copy the content of the new `src/apache2/src/` in your own `apache2/src/` directory.

:warning: If you don't want all your work to be lost, don't copy:
Expand Down
24 changes: 24 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
#!/bin/bash

if [[ $# -ne 1 ]]; then
echo "Usage : ${0} PATH to apache2/src/"
fi

if [[ -d "${1}" ]]; then
dest_path="$1"
tmp_path=$(mktemp -d)

git clone https://github.com/Ooggle/dead-simple-blog.git $tmp_path

for file in ".htaccess" "articles" "favicon.png" "website.conf.php" "sitemap.json"
do
rm -r "$tmp_path/src/apache2/src/$file"
done

if ! [[ -d "$dest_path/../src_backup" ]]; then
mkdir "$dest_path/../src_backup/"
fi
backup_name="backup_$(date +"%Y-%m-%d-%H%M%S").tar"
tar c "$dest_path/" -f "$dest_path/../src_backup/$backup_name"
(cd "$tmp_path/src/apache2/src/" && tar c .) | (cd "$dest_path" && tar xf -)
rm -r "$tmp_path"
fi

0 comments on commit a27f450

Please sign in to comment.