Files
bundle-bot/bundle-bot-creator.sh

113 lines
4.8 KiB
Bash

#!/bin/bash
# bundle-bot
# Copyright (C) 2023 Little Big T (lbt@mail.i2p)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Requirements:
# apt install git
# apt install mktorrent
# adduser bundle-bot
# -> setup git to work with the transport and URL you wish to use
# -> (ssh/git vs. http and .i2p vs. clearnet)
# -> see http://i2p-projekt.i2p/en/docs/applications/git
# Router with I2PSnark running on same machine as a service
# (or you need to adjust accordingly)
# You will need to get the (complete) repositories, obviously
LOGFILE="/home/bundle-bot/bundle-bot.log"
DATE=`date --rfc-3339=date`
PATH_I2PSNARK="/var/lib/i2p/i2p-config/i2psnark"
USER_I2PSNARK="i2psvc"
# first do the i2p.i2p repository
PATH_REPO="/home/bundle-bot/git/i2p.i2p"
FILENAME="i2p.i2p.bundle-complete-git-$DATE"
echo "$DATE Bundle-Bot was here ..." >> $LOGFILE
cd $PATH_REPO
su bundle-bot -c "git fetch origin +refs/heads/*:refs/remotes/origin/*"
su bundle-bot -c "git fetch --all"
su bundle-bot -c "git pull --tags"
su bundle-bot -c "git pull --all"
su bundle-bot -c "git remote prune origin"
su bundle-bot -c "git gc --prune=now"
su bundle-bot -c "git bundle create $FILENAME --all --branches --tags"
mktorrent --announce="http://tracker2.postman.i2p/announce.php" --name=$FILENAME --comment="
This is a git-bundle of the official I2P code repository for people having trouble getting the initial cloning done.
Download the file and then do:
git clone -b master --single-branch i2p.i2p.bundle-complete-git-xxxx-xx-xx i2p.i2p
cd i2p.i2p
git remote set-url origin git@git.idk.i2p:YOUR-GITLAB-ACCOUNT-HERE/i2p.i2p
git remote add upstream git@git.idk.i2p:i2p-hackers/i2p.i2p
git pull upstream master
You are supposed to connect this to the upstream repository at git.idk.i2p as above with remote add. When pulling from there you also ensure I have not tempered with the sources (or you would notice) :)
You can use http://git.idk.i2p/i2p-hackers/i2p.i2p.git instead, if you do not require write access.
Based on http://i2p-projekt.i2p/en/docs/applications/git-bundle
Also see http://i2p-projekt.i2p/en/docs/applications/git for more on git/gitlab over I2P and a proposed git workflow.
" $FILENAME
mv --force $PATH_REPO/$FILENAME $PATH_I2PSNARK/
chown $USER_I2PSNARK:$USER_I2PSNARK $PATH_I2PSNARK/$FILENAME
mv --force $PATH_REPO/$FILENAME.torrent $PATH_I2PSNARK/
chown $USER_I2PSNARK:$USER_I2PSNARK $PATH_I2PSNARK/$FILENAME.torrent
# then do the i2p.www repository
PATH_REPO="/home/bundle-bot/git/i2p.www"
FILENAME="i2p.www.bundle-complete-git-$DATE"
cd $PATH_REPO
su bundle-bot -c "git fetch origin +refs/heads/*:refs/remotes/origin/*"
su bundle-bot -c "git fetch --all"
su bundle-bot -c "git pull --tags"
su bundle-bot -c "git pull --all"
su bundle-bot -c "git remote prune origin"
su bundle-bot -c "git gc --prune=now"
su bundle-bot -c "git bundle create $FILENAME --all --branches --tags"
mktorrent --announce="http://tracker2.postman.i2p/announce.php" --name=$FILENAME --comment="
This is a git-bundle of the official I2P web-site and documentation repository for people having trouble getting the initial cloning done.
Download the file and then do:
git clone -b master --single-branch i2p.www.bundle-complete-git-xxxx-xx-xx i2p.www
cd i2p.www
git remote set-url origin git@git.idk.i2p:YOUR-GITLAB-ACCOUNT-HERE/i2p.www
git remote add upstream git@git.idk.i2p:i2p-hackers/i2p.www
git pull upstream master
You are supposed to connect this to the upstream repository at git.idk.i2p as above with remote add. When pulling from there you also ensure I have not tempered with the sources (or you would notice) :)
You can use http-transport using http://git.idk.i2p/i2p-hackers/i2p.www.git instead, if you do not require write access.
Based on http://i2p-projekt.i2p/en/docs/applications/git-bundle
Also see http://i2p-projekt.i2p/en/docs/applications/git for more on git/gitlab over I2P and a proposed git workflow.
" $FILENAME
mv --force $PATH_REPO/$FILENAME $PATH_I2PSNARK/
chown $USER_I2PSNARK:$USER_I2PSNARK $PATH_I2PSNARK/$FILENAME
mv --force $PATH_REPO/$FILENAME.torrent $PATH_I2PSNARK/
chown $USER_I2PSNARK:$USER_I2PSNARK $PATH_I2PSNARK/$FILENAME.torrent
exit