#!/bin/sh # # Copyright (c) 2017 Aaron LI # MIT License # # Make an existing Git repository public by linking it into # `repos.public`, which is exported via `cgit`. # # 2017-06-19 # . ${HOME}/vars.conf if [ $# -ne 1 ]; then echo "usage: make-public " exit 1 fi if [ ! -e "${PUBLIC}" ]; then echo "ERROR: public directory '${PUBLIC}' not exists!" exit 1 fi project="${1%.[gG][iI][tT]}.git" if [ ! -d "${project}" ]; then echo "ERROR: repository '${project}' not exists!" exit 3 elif [ -L "${PUBLIC}/${project}" ]; then echo "Repository '${project}' already made public." exit 0 else ln -sv ../${project} ${PUBLIC}/${project} echo "Made repository '${project}' public." exit 0 fi