First Steps with Gitea
From SME Server
Jump to navigationJump to searchInitial script to take the latest version of a module and move it to Gitea.
#!/bin/bash
# $1 = Module name e.g. smeserver-ddclient
# $2 = "contrib" ot anything else -=> core module
LocalUser="brianr"
RemoteUser="brianr"
if [ $2 = "contrib" ]; then
CVSFiles="/home/$LocalUser/smecontribs/rpms"
else
CVSFiles="/home/$LocalUser/smeserver/rpms"
fi
GitFiles="/home/$LocalUser/GitFiles"
RemoteRepoURL="https://src.koozali.org/$RemoteUser/$1"
mkdir -p $GitFiles
#Make sure credentials taken from store
git config --global credential.helper store
# Clone the CVS repository
cd $CVSFiles
cvs -d:ext:shell.koozali.org:/cvs/smecontribs checkout $1
# Fully populate the directory (gets the tar file - which is not strictly in CVS)
cd $1/contribs10
make prep
# Create the local Git repository
cd $GitFiles
git init $1
cd $1
#pull in all the files we want
if [ $2 = "contrib" ]; then
cp $CVSFiles/$1/contribs10/*.patch .
cp $CVSFiles/$1/contribs10/*.spec .
cp $CVSFiles/$1/contribs10/*.tar.gz .
cp $CVSFiles/$1/contribs10/*.tgz .
cp $CVSFiles/$1/contribs10/*.xz .
else
cp $CVSFiles/$1/sme10/*.patch .
cp $CVSFiles/$1/sme10/*.spec .
cp $CVSFiles/$1/sme10/*.tar.gz .
cp $CVSFiles/$1/sme10/*.tgz .
cp $CVSFiles/$1/sme10/*.xz .
fi
#stage and commit them
git add -A
git commit -m "initial commit of file from CVS for $1"
# Create the remote repo and push the converted git repository to the remote
git remote remove origin
git remote add origin $RemoteRepoURL
# Need to have created the repo at this point....
git pull --no-edit origin master
git push -u origin master
echo "Created $1 Repo in $RemoteRepoURL"
exit 0
Issues:
- How to partition the repos between smecontribs and core? different User?
- Need ssh access to gitea for automatic creation of repos, else each one has to be created by hand!