aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-repositories
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-03-01 19:20:34 +0200
committerkaotisk <kaotisk@arching-kaos.org>2024-03-01 19:20:34 +0200
commit7affa2082f61455a413d0c8fea08e79935d4f308 (patch)
tree7efb39304c06b1c6e525a911308622818ef32d3b /bin/ak-repositories
parentcd43e57b999422980ea95df7f1d03117342e358e (diff)
downloadarching-kaos-tools-7affa2082f61455a413d0c8fea08e79935d4f308.tar.gz
arching-kaos-tools-7affa2082f61455a413d0c8fea08e79935d4f308.tar.bz2
arching-kaos-tools-7affa2082f61455a413d0c8fea08e79935d4f308.zip
Spacing adjustment
Diffstat (limited to 'bin/ak-repositories')
-rwxr-xr-xbin/ak-repositories236
1 files changed, 118 insertions, 118 deletions
diff --git a/bin/ak-repositories b/bin/ak-repositories
index 0344467..7689e08 100755
--- a/bin/ak-repositories
+++ b/bin/ak-repositories
@@ -6,146 +6,146 @@ if [ ! -d $BAREDIR ]; then mkdir $BAREDIR; fi
if [ ! -d $REPODIR ]; then echo "no $REPODIR" && exit; fi
if [ ! -f $REPOSTORE ]; then touch $REPOSTORE; fi
import(){
- REPOS="$(ls -1 $REPODIR)"
- for PROJECT in $REPOS
- do
- cd $BAREDIR
- # Can be as well be
- # git clone --bare $REPODIR/$PROJECT/.git
- # or whatever form git let's you use
- git clone --bare http://git.h.kaotisk-hund.com/$PROJECT/.git
- if [ $? == 0 ]
- then
- cd $PROJECT.git
- git repack -a
- IPFS="$(ak-ipfs-add .)"
- ak-ipfs-key-gen "$PROJECT.git"
- ak-ipfs-name-publish --key="$PROJECT.git" /ipfs/$IPFS
- cd $HOME/bare
- else
- echo "$PROJECT not a git repo"
- fi
- done
+ REPOS="$(ls -1 $REPODIR)"
+ for PROJECT in $REPOS
+ do
+ cd $BAREDIR
+ # Can be as well be
+ # git clone --bare $REPODIR/$PROJECT/.git
+ # or whatever form git let's you use
+ git clone --bare http://git.h.kaotisk-hund.com/$PROJECT/.git
+ if [ $? == 0 ]
+ then
+ cd $PROJECT.git
+ git repack -a
+ IPFS="$(ak-ipfs-add .)"
+ ak-ipfs-key-gen "$PROJECT.git"
+ ak-ipfs-name-publish --key="$PROJECT.git" /ipfs/$IPFS
+ cd $HOME/bare
+ else
+ echo "$PROJECT not a git repo"
+ fi
+ done
}
update(){
- if [ ! -z $1 ]
- then
- USING="$1"
- REPO="$REPODIR/$1/.git"
- BARE="$BAREDIR/$1.git"
- BARENAME="$1.git"
- if [ -d $BARE ]
- then
- cd $BARE
- git pull
- git repack -a
- IPFS="$(ak-ipfs-add .)"
- ak-ipfs-name-publish --key="$BARENAME" /ipfs/$IPFS
- echo "DONE"
- else
- echo "NO BARE TO UPDATE"
- echo "updating all..."
- fi
- else
- BARES="$(ls -1 $BAREDIR)"
- cd $BAREDIR
- for PROJECT in $BARES
- do
- cd "$PROJECT"
- git pull
- git repack -a
- IPFS="$(ak-ipfs-add .)"
- ak-ipfs-name-publish --key="$PROJECT" /ipfs/$IPFS
- cd $BAREDIR
- done
- fi
+ if [ ! -z $1 ]
+ then
+ USING="$1"
+ REPO="$REPODIR/$1/.git"
+ BARE="$BAREDIR/$1.git"
+ BARENAME="$1.git"
+ if [ -d $BARE ]
+ then
+ cd $BARE
+ git pull
+ git repack -a
+ IPFS="$(ak-ipfs-add .)"
+ ak-ipfs-name-publish --key="$BARENAME" /ipfs/$IPFS
+ echo "DONE"
+ else
+ echo "NO BARE TO UPDATE"
+ echo "updating all..."
+ fi
+ else
+ BARES="$(ls -1 $BAREDIR)"
+ cd $BAREDIR
+ for PROJECT in $BARES
+ do
+ cd "$PROJECT"
+ git pull
+ git repack -a
+ IPFS="$(ak-ipfs-add .)"
+ ak-ipfs-name-publish --key="$PROJECT" /ipfs/$IPFS
+ cd $BAREDIR
+ done
+ fi
}
append-if-needed(){
- under="$1"
- file="$HOME/.arching-kaos/repos"
- lines="$(cat $file)"
- found="no"
- for line in $lines
- do
- if [ $found == "yes" ]
- then
- echo "found $found"
- break
- else
- if [ "$line" == "$under" ]
- then
- found="yes"
- echo "found $found"
- break
- fi
- fi
- done
- if [ $found == "no" ]
- then
- echo $under > $file
- fi
+ under="$1"
+ file="$HOME/.arching-kaos/repos"
+ lines="$(cat $file)"
+ found="no"
+ for line in $lines
+ do
+ if [ $found == "yes" ]
+ then
+ echo "found $found"
+ break
+ else
+ if [ "$line" == "$under" ]
+ then
+ found="yes"
+ echo "found $found"
+ break
+ fi
+ fi
+ done
+ if [ $found == "no" ]
+ then
+ echo $under > $file
+ fi
}
add(){
- PROJECT="$1"
- PROJECTDIR="$REPODIR/$PROJECT"
- BAREGITDIR="$BAREDIR/$PROJECT.git"
- if [ -d $PROJECTDIR ]
- then
- cd $HOME/bare
- git clone --bare $PROJECTDIR/.git
- if [ $? == 0 ]
- then
- cd $BAREGITDIR
- git repack -a
- IPFS="$(ak-ipfs-add .)"
- try=ak-ipfs-key-gen "$PROJECT.git"
- if [ $? == 0 ]
- then
- ak-ipfs-name-publish --key="$PROJECT.git" /ipfs/$IPFS
- printf '{"project":"%s.git","ipns":"%s"}' $PROJECT $try > data
- ak-zblock-pack "repos/add" $PWD/data
- echo "Done"
- fi
- fi
- else
- echo "$PROJECT not a git repo"
- fi
+ PROJECT="$1"
+ PROJECTDIR="$REPODIR/$PROJECT"
+ BAREGITDIR="$BAREDIR/$PROJECT.git"
+ if [ -d $PROJECTDIR ]
+ then
+ cd $HOME/bare
+ git clone --bare $PROJECTDIR/.git
+ if [ $? == 0 ]
+ then
+ cd $BAREGITDIR
+ git repack -a
+ IPFS="$(ak-ipfs-add .)"
+ try=ak-ipfs-key-gen "$PROJECT.git"
+ if [ $? == 0 ]
+ then
+ ak-ipfs-name-publish --key="$PROJECT.git" /ipfs/$IPFS
+ printf '{"project":"%s.git","ipns":"%s"}' $PROJECT $try > data
+ ak-zblock-pack "repos/add" $PWD/data
+ echo "Done"
+ fi
+ fi
+ else
+ echo "$PROJECT not a git repo"
+ fi
}
index(){
- ak-ipfs-key-list-full | grep -e '\.git'
+ ak-ipfs-key-list-full | grep -e '\.git'
}
set-as-profile(){
- IPFS=$(ak-ipfs-add $REPOSTORE)
- if [ $? == 0 ]
- then
- profile set repositories $IPFS
- else
- echo error
- fi
+ IPFS=$(ak-ipfs-add $REPOSTORE)
+ if [ $? == 0 ]
+ then
+ profile set repositories $IPFS
+ else
+ echo error
+ fi
}
publish(){
- if [ ! -z $1 ]
- then
- echo "Filtering for $1..."
- index | grep "$1" > $REPOSTORE
- set-as-profile
- else
- echo "Publishing all..."
- index > $REPOSTORE
- set-as-profile
- fi
+ if [ ! -z $1 ]
+ then
+ echo "Filtering for $1..."
+ index | grep "$1" > $REPOSTORE
+ set-as-profile
+ else
+ echo "Publishing all..."
+ index > $REPOSTORE
+ set-as-profile
+ fi
}
usage(){
echo "TODO"
echo "index | add | publish | update"
- exit
+ exit
}
if [ ! -z $1 ]
@@ -159,5 +159,5 @@ then
*) echo "No command $1";usage; exit;;
esac
else
- usage
+ usage
fi