summaryrefslogtreecommitdiff
path: root/example_create.sh
diff options
context:
space:
mode:
authorOscar Benedito <oscar@oscarbenedito.com>2020-06-22 23:29:40 +0200
committerOscar Benedito <oscar@oscarbenedito.com>2020-07-30 12:44:15 +0200
commitecbac75848acfcd7ed4bba624358ffd62624344b (patch)
tree19885a0ea90bbc4a81062f0128fe7e02da775f53 /example_create.sh
parent65a2b9768d412317adabc0d6e99894842b7738ba (diff)
Add my assets
Diffstat (limited to 'example_create.sh')
-rwxr-xr-xexample_create.sh65
1 files changed, 40 insertions, 25 deletions
diff --git a/example_create.sh b/example_create.sh
index e1adbe1..33d8e64 100755
--- a/example_create.sh
+++ b/example_create.sh
@@ -15,29 +15,44 @@
# - mkdir -p htmldir && cd htmldir
# - sh example_create.sh
-# path must be absolute.
-reposdir="/var/www/domains/git.codemadness.nl/home/src"
-curdir="$(pwd)"
-
-# make index.
-stagit-index "${reposdir}/"*/ > "${curdir}/index.html"
-
-# make files per repo.
-for dir in "${reposdir}/"*/; do
- # strip .git suffix.
- r=$(basename "${dir}")
- d=$(basename "${dir}" ".git")
- printf "%s... " "${d}"
-
- mkdir -p "${curdir}/${d}"
- cd "${curdir}/${d}" || continue
- stagit -c ".cache" "${reposdir}/${r}"
-
- # symlinks
- ln -sf log.html index.html
- ln -sf ../style.css style.css
- ln -sf ../logo.png logo.png
- ln -sf ../favicon.ico favicon.ico
-
- echo "done"
+# path must be absolute
+reposdir="/srv/git"
+webdir="/srv/git/html"
+defaultdir="/usr/local/share/doc/stagit"
+
+mkdir -p "$webdir" || exit 1
+
+# set assets if not already there
+ln -s "$defaultdir/style.css" "$webdir/style.css" 2> /dev/null
+ln -s "$defaultdir/logo.png" "$webdir/logo.png" 2> /dev/null
+ln -s "$defaultdir/favicon.ico" "$webdir/favicon.ico" 2> /dev/null
+
+# clean
+for dir in "$webdir/"*/; do
+ rm -rf "$dir"
done
+
+repos=""
+
+# make files per repo
+for dir in "$reposdir/"*.git/; do
+ [ ! -f "$dir/git-daemon-export-ok" ] && continue
+ repos="$repos $dir"
+
+ # strip .git suffix
+ r=$(basename "$dir")
+ d=$(basename "$dir" ".git")
+ printf "%s... " "$d"
+
+ mkdir -p "$webdir/$d"
+ cd "$webdir/$d" || continue
+ stagit -c ".stagit-build-cache" "$reposdir/$r"
+
+ # symlinks
+ ln -sf log.html index.html
+
+ echo "done"
+done
+
+# make index
+echo "$repos" | xargs stagit-index > "$webdir/index.html"