Files
squi.bid/scripts/gengit

14 lines
411 B
Bash
Executable File

#!/bin/sh
repos=$(ls -1 /var/git | grep -o '.*\.git' | head -5)
# delete old list
sed -i -n '1,/ <p> <!-- script marker git -->/p;/ <\/p> <!-- script marker git -->/,$p' index.html
for i in $repos ; do
name=$(echo $i | sed 's/\.git//')
line="<a href=\"https://git.squi.bid/$name\">$name</a><br>"
# add new repo
sed -i "/ <\/p> <!-- script marker git -->/i $line" index.html
done