2 # ---------------------------------------------------------------------------
3 # Multi-Phasic Applications: SquirrelJME
4 # Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 # Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
6 # ---------------------------------------------------------------------------
7 # SquirrelJME is under the GNU General Public License v3+, or later.
8 # See license.mkd for licensing and copyright information.
9 # ---------------------------------------------------------------------------
10 # DESCRIPTION: Extracts notes from the unversioned space and stores them in
11 # the repository for backup purposes.
16 # Directory of this script
17 __exedir
="$(dirname -- "$0")"
19 # Go through all unversioned files for the blog
21 fossil uv
ls |
grep '^developer-notes\/' |
while read __line
24 __target
="$__exedir/../assets/$__line"
25 __tardir
="$(dirname -- "$__target")"
27 # Calculate the sums of both files
28 __isum
="$(fossil uv cat "$__line" | fossil sha1sum - |
29 tr '\t' ' ' | cut -d ' ' -f 1)"
30 __xsum
="$(if [ -f "$__target" ];
31 then cat "$__target" | fossil sha1sum - | tr '\t' ' ' | cut -d ' ' -f 1;
35 echo "$__line -> $__target ($__tardir) [$__isum $__xsum]"
37 # If the sums differ then overwrite the destination files
38 if [ "$__isum" != "$__xsum" ]
40 # Make the target directory
41 if [ ! -d "$__tardir" ]
47 fossil uv
cat "$__line" > "$__target"
48 fossil add
"$__target"
50 # Increase change count
51 __changed
="$(($__changed + 1))"
56 #if [ "$__changed" -gt "0" ]
58 fossil commit
--no-prompt -m "Backup developer notes."