Updated assets and scripts
This commit is contained in:
parent
edd38e0cc4
commit
2a87b5b0ed
@ -1,21 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
apt-get install -y git
|
||||
|
||||
[ ! $(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
|
||||
mkdir -p /srv/git/git-shell-commands
|
||||
# wget git-shells-command repo script
|
||||
|
||||
mkdir -p /srv/git/git-shell-commands && wget -O /srv/git/git-shell-commands https://raw.githubusercontent.com/acidvegas/stagit/master/assets/repo
|
||||
chmod +x /srv/git/git-shell-commands/* && chown -R git:git /srv/git/git-shell-commands
|
||||
|
||||
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
|
||||
|
||||
printf "[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\n" > /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'"
|
||||
sudo apt-get install libmd4c-dev libmd4c-html0 libmd4c-html0-dev libmd4c0
|
||||
sudo apt-get install libgit2-dev
|
||||
|
||||
apt-get install libmd4c-dev libmd4c-html0 libmd4c-html0-dev libmd4c0
|
||||
apt-get install libgit2-dev
|
||||
|
||||
certbot --nginx -d example.com -d www.example.com
|
||||
|
||||
git config --system init.defaultBranch main # <- THIS MOTHER FUCKER
|
||||
|
||||
# Not finished yet
|
||||
git clone https://github.com/acidvegas/stagit
|
||||
#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
|
||||
|
29
assets/repo
29
assets/repo
@ -1,6 +1,31 @@
|
||||
#!/bin/sh
|
||||
# git-shell-commands helper for stagit - developed by acidvegas (https://git.acid.vegas/stagit)
|
||||
|
||||
check_description() {
|
||||
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
|
||||
else
|
||||
read -p "description for '$REPO':" desc
|
||||
echo "$desc" > $1/description
|
||||
echo "[+] added missing 'description' file for '$REPO'"
|
||||
fi
|
||||
}
|
||||
|
||||
remake_index() {
|
||||
echo "[~] recreating index..."
|
||||
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
|
||||
}
|
||||
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "invalid arguments (use -c or -d)" >&2
|
||||
exit 1
|
||||
@ -18,7 +43,7 @@ if [ "$1" = '-c' ]; then
|
||||
mkdir "$2.git" && git init --bare "$2.git" || exit 1
|
||||
touch "$2.git/git-daemon-export-ok"
|
||||
ln /srv/git/git-shell-commands/post-receive "$2.git/hooks/post-receive" || exit 1
|
||||
echo "git://git.acid.vegas/$2.git" > "$2.git/url"
|
||||
echo "https://git.acid.vegas/$2.git" > "$2.git/url"
|
||||
elif [ "$1" = '-d' ]; then
|
||||
if [ ! -d "$2.git" ]; then
|
||||
echo "repository does not exist" >&2
|
||||
@ -28,4 +53,4 @@ elif [ "$1" = '-d' ]; then
|
||||
else
|
||||
echo "invalid arguments (use -c or -d)" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
@ -1,6 +1,5 @@
|
||||
AuthenticationMethods publickey
|
||||
AuthorizedKeysFile /etc/ssh/authorized_keys/%u
|
||||
Banner /etc/issue
|
||||
ClientAliveInterval 0
|
||||
DisableForwarding yes
|
||||
PermitRootLogin no
|
||||
|
Loading…
Reference in New Issue
Block a user