2023-08-09 13:57:13 +03:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# see https://people.debian.org/~stapelberg/2015/07/27/dh-make-golang.html
|
|
|
|
|
|
|
|
|
|
GIT_HOST="git.aliberksandikci.com.tr"
|
2023-08-10 00:08:58 +03:00
|
|
|
|
GIT_ORG="liderahenk"
|
2023-08-09 13:57:13 +03:00
|
|
|
|
GIT_REPO="ahenk-go"
|
2023-08-14 15:43:45 +03:00
|
|
|
|
FULL_URL="https://$GIT_HOST/$GIT_ORG/$GIT_REPO"
|
2023-08-10 01:28:28 +03:00
|
|
|
|
DEV_NAME="Aliberk Sandıkçı"
|
|
|
|
|
GIT_MAIL="git@aliberksandikci.com.tr"
|
|
|
|
|
|
2023-08-14 15:43:45 +03:00
|
|
|
|
UPLOAD_URL="127.0.0.1"
|
|
|
|
|
UPLOAD_PORT="8000"
|
|
|
|
|
|
2023-08-10 01:28:28 +03:00
|
|
|
|
echo "Editing git configs..."
|
|
|
|
|
git config --global init.defaultBranch main
|
|
|
|
|
git config --global user.name "$DEV_NAME"
|
|
|
|
|
git config --global user.email $GIT_MAIL
|
|
|
|
|
git config --global color.status auto
|
|
|
|
|
git config --global color.branch auto
|
|
|
|
|
git config --global color.interactive auto
|
|
|
|
|
git config --global color.diff auto
|
2023-08-09 13:57:13 +03:00
|
|
|
|
|
|
|
|
|
mkdir /build
|
|
|
|
|
cd /build || exit
|
|
|
|
|
|
2023-08-14 15:43:45 +03:00
|
|
|
|
if [[ "$1" != "update" ]]; then
|
2023-08-09 16:17:26 +03:00
|
|
|
|
|
2023-08-14 15:43:45 +03:00
|
|
|
|
dh-make-golang make -allow_unknown_hoster "$GIT_HOST/$GIT_ORG/$GIT_REPO"
|
2023-08-09 16:17:26 +03:00
|
|
|
|
|
2023-08-14 15:43:45 +03:00
|
|
|
|
if [[ ! ("$1" != "notodo" || "$2" != "notodo") ]]; then
|
2023-08-10 01:28:28 +03:00
|
|
|
|
|
2023-08-14 15:43:45 +03:00
|
|
|
|
# TODO Add option to disable writing all these files all the time (-s --skip)
|
|
|
|
|
nano "itp-$GIT_REPO.txt"
|
|
|
|
|
sendmail -t <"itp-$GIT_REPO.txt"
|
2023-08-10 01:28:28 +03:00
|
|
|
|
|
2023-08-14 15:43:45 +03:00
|
|
|
|
cd $GIT_REPO || exit
|
2023-08-10 01:28:28 +03:00
|
|
|
|
grep --color=always -r TODO debian
|
2023-08-14 15:43:45 +03:00
|
|
|
|
echo -e "\nThese files needs review. Starting reviewing automatically in 10sec...\n"
|
|
|
|
|
sleep 10
|
|
|
|
|
# TODO Allow users to escape from automatic review and manually do it while in this script
|
2023-08-10 01:28:28 +03:00
|
|
|
|
|
2023-08-14 15:43:45 +03:00
|
|
|
|
while [[ $(grep -r TODO debian | wc --lines) -ne 0 ]]; do
|
|
|
|
|
nano "$(grep -r TODO debian | awk '{sub(/:.*/,"")} NR==1')"
|
|
|
|
|
|
|
|
|
|
echo "Continuing from next file..."
|
|
|
|
|
sleep 1
|
|
|
|
|
grep --color=always -r TODO debian
|
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
|
|
# TODO Allow user to reviewing remaining files, choosing between them, optional skipping, and waiting for an answer (continue? [Y/n])
|
|
|
|
|
done
|
|
|
|
|
echo "ALL FILES DONE"
|
|
|
|
|
|
|
|
|
|
dh_installsystemd
|
|
|
|
|
echo """
|
|
|
|
|
#!/usr/bin/make -f
|
2023-08-10 01:28:28 +03:00
|
|
|
|
|
|
|
|
|
%:
|
|
|
|
|
dh \$@ --builddirectory=_build --buildsystem=golang --with=golang --with-systemd
|
|
|
|
|
override_dh_auto_install:
|
|
|
|
|
dh_auto_install -- --no-source
|
2023-08-14 15:43:45 +03:00
|
|
|
|
""" >debian/rules
|
|
|
|
|
sleep 5
|
|
|
|
|
# FIXME Not working!
|
2023-08-09 16:17:26 +03:00
|
|
|
|
|
2023-08-14 15:43:45 +03:00
|
|
|
|
else
|
|
|
|
|
cd $GIT_REPO || exit
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
gbp clone "$FULL_URL"
|
|
|
|
|
cd $GIT_REPO || exit
|
|
|
|
|
git checkout debian/sid
|
|
|
|
|
pwd
|
|
|
|
|
if [[ "$1" == "nmu" ]]; then
|
|
|
|
|
dch --nmu
|
|
|
|
|
else
|
|
|
|
|
dch
|
|
|
|
|
fi
|
|
|
|
|
echo "Succesfully Updated deb package information"
|
|
|
|
|
fi
|
2023-08-09 13:57:13 +03:00
|
|
|
|
|
2023-08-09 16:17:26 +03:00
|
|
|
|
# TODO ask user to continue
|
|
|
|
|
|
2023-08-09 23:47:40 +03:00
|
|
|
|
git add debian && git commit -a -m 'Initial packaging'
|
|
|
|
|
|
|
|
|
|
gbp buildpackage
|
|
|
|
|
|
2023-08-10 00:08:58 +03:00
|
|
|
|
cd ..
|
2023-08-09 23:47:40 +03:00
|
|
|
|
lintian -- *.changes
|
|
|
|
|
|
2023-08-10 01:28:28 +03:00
|
|
|
|
echo -e "SOLVE LINTIAN ERRORS / WARNINGS\nAFTER THAT, PUSH REPO"
|