diff options
| -rw-r--r-- | etc/cron.d/10m | 1 | ||||
| -rw-r--r-- | etc/cron.d/1m | 1 | ||||
| -rw-r--r-- | scripts/gitinfo.bash | 18 | ||||
| -rw-r--r-- | scripts/mirrors.bash | 5 |
4 files changed, 19 insertions, 6 deletions
diff --git a/etc/cron.d/10m b/etc/cron.d/10m deleted file mode 100644 index 56b6070..0000000 --- a/etc/cron.d/10m +++ /dev/null @@ -1 +0,0 @@ -* * * * * /bin/bash /scripts/mirrors.bash >> /var/log/mirrors.log 2>&1
\ No newline at end of file diff --git a/etc/cron.d/1m b/etc/cron.d/1m new file mode 100644 index 0000000..1dd9b9d --- /dev/null +++ b/etc/cron.d/1m @@ -0,0 +1 @@ +* * * * * /bin/bash /scripts/gitinfo.bash >> /var/log/gitinfo.log 2>&1
\ No newline at end of file diff --git a/scripts/gitinfo.bash b/scripts/gitinfo.bash new file mode 100644 index 0000000..e4b089f --- /dev/null +++ b/scripts/gitinfo.bash @@ -0,0 +1,18 @@ +#/bin/bash + +for repository in /repositories/*; do + cd /repositories/$(basename "$repository") + gitinfo=$(git cat-file -p @:.gitinfo) + + # does gitinfo exist? expect "fatal" if not + if [[ $gitinfo == fatal* ]]; then + echo "No .gitinfo found for $(basename "$repository")" + continue + fi + + # extract description from gitinfo (json format) + description=$(echo "$gitinfo" | grep -oP '"description":\s*"\K[^"]+') + + # write description to repository description file + echo "$description" > /repositories/$(basename "$repository")/description +done
\ No newline at end of file diff --git a/scripts/mirrors.bash b/scripts/mirrors.bash deleted file mode 100644 index 02c333f..0000000 --- a/scripts/mirrors.bash +++ /dev/null @@ -1,5 +0,0 @@ -#/bin/bash - -# This script is responsible for pushing to mirrors of the git repositories. It runs through all the repositories in the /repositories directory and performs a git push to the corresponding mirror URL(s) defined in the .gitinfo file if they exist. - -echo "to be implemented"
\ No newline at end of file |
