void- enter the void 🪐 |
git clone git://git.acid.vegas/archlinux.git |
Log | Files | Refs | Archive |
gitremote (2328B)
1 #!/bin/sh 2 # git remote setup script - developed by acidvegas (https://git.acid.vegas) 3 # 4 # note: This assumes the directory structure of $HOME/dev/git/$USER/$REPO for each repository. 5 # 6 # usage: 7 # gitremote | Update current working directory repository 8 # gitremote -a | Update every repository 9 10 SIGNING_KEY='441EB0F297E0DCF0AEF2F711EF4B922DB85DC9DE' 11 12 update_repo() { 13 DIR=$1 14 USER=$(basename $(dirname $(dirname $DIR))) 15 REPO=$(basename $(dirname $DIR)) 16 echo "updating $USER/$REPO..." 17 git -C $DIR remote remove origin 18 if [ $USER = 'internetrelaychat' ]; then 19 git -C $DIR remote add origin git@github.com:internet-relay-chat/$REPO.git 20 git -C $DIR remote set-url --add --push origin git@github.com:internet-relay-chat/$REPO.git 21 git -C $DIR remote set-url --add --push origin git@gitlab.com:$USER/$REPO.git 22 git -C $DIR remote set-url --add --push origin git@codeberg.org:$USER/$REPO.git 23 git -C $DIR remote set-url --add --push origin supergit:$USER/$REPO.git 24 git -C $DIR remote set-url --add --push origin acidgit:$REPO.git 25 else 26 git -C $DIR remote add origin git@github.com:$USER/$REPO.git 27 git -C $DIR remote set-url --add --push origin git@github.com:$USER/$REPO.git 28 git -C $DIR remote set-url --add --push origin git@gitlab.com:$USER/$REPO.git 29 git -C $DIR remote set-url --add --push origin git@codeberg.org:$USER/$REPO.git 30 git -C $DIR remote set-url --add --push origin supergit:$USER/$REPO.git 31 git -C $DIR remote set-url --add --push origin acidgit:$REPO.git 32 fi 33 git -C $DIR config user.signingkey $SIGNING_KEY 34 if [ -f $DIR/description ]; then 35 if [ "$(cat $1/description)" = "Unnamed repository; edit this file 'description' to name the repository." ]; then 36 echo "Enter a description for $REPO:" 37 read DESC 38 echo "$DESC" > $DIR/description 39 fi 40 else 41 echo "Enter a description for $REPO:" 42 read DESC 43 echo "$DESC" > $DIR/description 44 fi 45 cp $HOME/.scripts/irc-post-commit-hook $DIR/hooks/post-commit 46 echo $USER > $DIR/owner 47 echo "https://git.acid.vegas/$REPO.git" > $DIR/url 48 } 49 50 if [ "$#" = '1' ]; then 51 if [ $1 = '-a' ]; then 52 for d in $(find $HOME/dev/git -type d -name mirror -prune -o -type d -name .git -print | sort); do 53 update_repo $d 54 done 55 fi 56 else 57 if [ -d $PWD/.git ]; then 58 update_repo $PWD/.git 59 else 60 echo "invalid repository: missing .git directory" 61 fi 62 fi