#!/bin/bash basedir=$(pwd) # generate index.html index_before=$(cat << EOF mirrors.zhanfang.org
Index of EOF ) index_after=$(cat << EOF EOF ) function gen_index() { dname=$1 if [ -d $dname ]; then if [ "x$dname" = "xrepodata" ]; then return fi cd $dname curpath=$(pwd | awk -F $basedir '{print $2;}') if [ "x$curpath" = "x" ]; then curpath="/" fi echo $curpath echo $index_before > index.html echo $curpath >> index.html echo "
..
" >> index.html for fn in $(ls .) do if [ "x$fn" = "xupdatetools.sh" ]; then continue fi if [ "x$fn" = "xupdate_repo.sh" ]; then continue fi if [ "x$fn" = "xadd_repo.sh" ]; then continue fi if [ "x$fn" = "xupdate_index.sh" ]; then continue fi if [ "x$fn" = "xindex.html" ]; then continue fi if [ "x$fn" = "xgithub-md.css" ]; then continue fi if [ "x$fn" = "xfavicon.ico" ]; then continue fi if [ "x$fn" = "xrobots.txt" ]; then continue fi if [ "x$fn" = "xREADME.md" ]; then continue fi echo "
$fn
" >> index.html gen_index $fn done echo $index_after >> index.html cd .. fi } gen_index $basedir