Fixed mistakes in helper script, repo script, css, and more
This commit is contained in:
parent
b8e04ff4cb
commit
17b5dc39b0
@ -1,5 +1,4 @@
|
||||
#!/bin/sh
|
||||
# git deployment for stagit - developed by acidvegas (https://git.acid.vegas/stagit)
|
||||
[ ! $(grep -q /usr/bin/git-shell /etc/shells) ] && echo "/usr/bin/git-shell" >> /etc/shells
|
||||
[ ! $(getent passwd git) ] && userdel -f git
|
||||
useradd -d /srv/git -k /dev/null -m -s /usr/bin/git-shell -U git
|
||||
@ -10,4 +9,13 @@ usermod -p '*' git
|
||||
echo -e "[Unit]\nDescription=Start Git Daemon\n\n[Service]\nExecStart=/usr/bin/git daemon --reuseaddr --base-path=/srv/git/ /srv/git/\n\nRestart=always\nRestartSec=500ms\nUser=git\nGroup=git\n\n[Install]\nWantedBy=multi-user.target" > /etc/systemd/system/git-daemon.service
|
||||
systemctl start git-daemon && systemctl enable git-daemon
|
||||
echo "Be sure to use 'AuthorizedKeysFile /etc/ssh/authorized_keys/%u' in your /etc/ssh/sshd_config"
|
||||
echo "Add your public key to /etc/ssh/authorized_keys/git prefixed with 'no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty'"
|
||||
echo "Add your public key to /etc/ssh/authorized_keys/git prefixed with 'no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty'"
|
||||
sudo apt-get install libmd4c-dev libmd4c-html0 libmd4c-html0-dev libmd4c0
|
||||
sudo apt-get install libgit2-dev
|
||||
#STAGIT_CFLAGS += -DGIT_OPT_SET_OWNER_VALIDATION=-1
|
||||
Makefile uncomment
|
||||
sudo certbot --nginx -d example.com -d www.example.com
|
||||
|
||||
|
||||
sudo git config --system init.defaultBranch main
|
||||
^^^^^^ THIS MOTHER FGCKER
|
||||
|
@ -7,65 +7,57 @@ URL="git.acid.vegas"
|
||||
PROTO="https"
|
||||
CLONE_URL="git://$URL"
|
||||
COMMIT_LIMIT=100
|
||||
HTML_DIR="$HOME/dev/git/acidvegas/git.acid.vegas"
|
||||
REPOS_DIR="$HOME/dev/git"
|
||||
REPOS_EXCLUDE="git.acid.vegas mirror readme"
|
||||
|
||||
find_repos() {
|
||||
args=""
|
||||
for dir in $REPOS_EXCLUDE; do
|
||||
args="$args -type d -name $dir -prune -o"
|
||||
done
|
||||
echo "$(find $1 $args -type d -name .git -printf "%h\\n " | sort | xargs echo)"
|
||||
}
|
||||
HTML_DIR="/srv/http"
|
||||
REPOS_DIR="/srv/git"
|
||||
|
||||
prepair() {
|
||||
[ -d $HTML_DIR ] && rm -rf $HTML_DIR/*
|
||||
mkdir -p $HTML_DIR/assets
|
||||
echo "[~] populating custom assets..."
|
||||
cp acidvegas.png favicon.png logo.png mostdangerous.png style.css $HTML_DIR/assets
|
||||
echo $URL > $HTML_DIR/CNAME
|
||||
}
|
||||
|
||||
make_index() {
|
||||
echo "[~] creating index..."
|
||||
args=""
|
||||
for dir in $(ls $REPOS_DIR | grep -v 'mirror'); do
|
||||
echo "[~] indexing '$dir' repositories..."
|
||||
DIR_REPOS="$(find_repos $REPOS_DIR/$dir)"
|
||||
args="$args -c \"$dir\" $DIR_REPOS"
|
||||
done
|
||||
args=""
|
||||
for category in $(cat /srv/git/*/owner | xargs -n1 | sort -u | xargs); do
|
||||
echo "[~] indexing '$category' repositories..."
|
||||
REPOS=$(grep -rl "$category" /srv/git/*/owner | xargs -I{} dirname {} | sort -f | tr '\n' ' ')
|
||||
args="$args -c \"$category\" $REPOS"
|
||||
done
|
||||
echo "$args" | xargs stagit-index > $HTML_DIR/index.html
|
||||
echo "[+] finished"
|
||||
}
|
||||
|
||||
make_repos() {
|
||||
for dir in $(find_repos $REPOS_DIR); do
|
||||
USER=$(basename $(dirname $dir))
|
||||
REPO=$(basename $dir)
|
||||
if [ -f $dir/.git/description ]; then
|
||||
if [ "$(cat $dir/.git/description)" = "Unnamed repository; edit this file 'description' to name the repository." ]; then
|
||||
read -p "description for '$USER/$REPO':" desc
|
||||
echo "$desc" > $dir/.git/description
|
||||
echo "[+] updated default 'description' file for '$REPO'"
|
||||
fi
|
||||
else
|
||||
read -p "description for '$USER/$REPO':" desc
|
||||
echo "$desc" > $dir/.git/description
|
||||
echo "[+] added missing 'description' file for '$REPO'"
|
||||
make_repo() {
|
||||
REPO=$(basename "$(echo "$1" | sed 's/\.git$//')")
|
||||
if [ -f $1/description ]; then
|
||||
if [ "$(cat $1/description)" = "Unnamed repository; edit this file 'description' to name the repository." ]; then
|
||||
read -p "description for '$REPO':" desc
|
||||
echo "$desc" > $1/description
|
||||
echo "[+] updated default 'description' file for '$REPO'"
|
||||
fi
|
||||
if [ ! -f $dir/.git/url ]; then
|
||||
echo "$CLONE_URL/$REPO.git" > $dir/.git/url
|
||||
echo "[+] added missing 'url' file for '$REPO'"
|
||||
fi
|
||||
echo "[~] processing '$REPO' repository..."
|
||||
mkdir -p $HTML_DIR/$REPO && cd $HTML_DIR/$REPO && stagit -l $COMMIT_LIMIT -u "$PROTO://$URL/$REPO" $dir
|
||||
ln -sf log.html index.html
|
||||
git --git-dir $dir/.git archive --format=tar.gz -o "$HTML_DIR/$REPO/archive.tar.gz" --prefix="$REPO/" HEAD
|
||||
else
|
||||
read -p "description for '$REPO':" desc
|
||||
echo "$desc" > $1/description
|
||||
echo "[+] added missing 'description' file for '$REPO'"
|
||||
fi
|
||||
if [ ! -f $1/url ]; then
|
||||
echo "$CLONE_URL/$REPO.git" > $1/url
|
||||
echo "[+] added missing 'url' file for '$REPO'"
|
||||
fi
|
||||
echo "[~] processing '$REPO' repository..."
|
||||
mkdir -p $HTML_DIR/$REPO && cd $HTML_DIR/$REPO && stagit -l $COMMIT_LIMIT -u "$PROTO://$URL/$REPO" $1
|
||||
ln -sf log.html index.html
|
||||
git --git-dir $1 archive --format=tar.gz -o "$HTML_DIR/$REPO/archive.tar.gz" --prefix="$REPO/" HEAD
|
||||
}
|
||||
|
||||
make_all_repos() {
|
||||
for dir in $(find $REPOS_DIR -type d -name "*.git" | sort); do
|
||||
make_repo $dir
|
||||
done
|
||||
}
|
||||
|
||||
# Main
|
||||
prepair
|
||||
make_repos
|
||||
make_index
|
||||
make_all_repos
|
||||
make_index
|
||||
|
@ -6,9 +6,11 @@ if [ $1 = '-c' ]; then
|
||||
[ ! -f post-receive ] && "missing post-receive script" && exit 1
|
||||
mkdir $2.git && git init --bare $2.git
|
||||
touch $2.git/git-daemon-export-ok
|
||||
ln post-recieve $2.git/hooks/post-recieve
|
||||
echo "git://git.acid.vegas/$1.git" > $2.git/url
|
||||
ln /srv/git/git-shell-commands/post-receive $2.git/hooks/post-receive
|
||||
echo "git://git.acid.vegas/$2.git" > $2.git/url
|
||||
elif [ $1 = '-d' ]; then
|
||||
[ ! -d $2.git ] && echo "repository does not exist" && exit 1
|
||||
rm -rf $2.git
|
||||
fi
|
||||
else
|
||||
echo "invlid arguments (use -c or -d)" && exit 1
|
||||
fi
|
||||
|
@ -1,15 +1,12 @@
|
||||
AuthenticationMethods publickey
|
||||
AuthorizedKeysFile /etc/ssh/authorized_keys/%u
|
||||
Banner /etc/issue
|
||||
ChallengeResponseAuthentication no
|
||||
ClientAliveInterval 0
|
||||
DisableForwarding yes
|
||||
PasswordAuthentication no
|
||||
PermitRootLogin no
|
||||
Port CHANGEME
|
||||
Port 22
|
||||
Port CHANGEME
|
||||
PrintLastLog no
|
||||
Protocol 2
|
||||
|
||||
Match LocalPort 22
|
||||
AllowUsers git
|
||||
|
@ -28,7 +28,7 @@ td.num{text-align:right;}
|
||||
|
||||
a.d, a.h, a.i, a.line {text-decoration:none;}
|
||||
h1, h2, h3, h4, h5, h6{font-size:1em;margin:0;}
|
||||
img, h1, h2{vertical-align middle;}
|
||||
img, h1, h2{vertical-align: middle;}
|
||||
#branches tr td:nth-child(3),
|
||||
#branches tr:hover td, #tags tr:hover td{background-color:#111;}
|
||||
#tags tr td:nth-child(3){white-space:normal;}
|
||||
|
Loading…
Reference in New Issue
Block a user