6363fi
6464#
6565# Traps (ctrl-c)
66- killproc () {
66+ function killproc() {
6767 echo -e " \n**** Received SIGINT, aborting! ****\n"
6868 kill -- -$$ && exit 2
6969}
@@ -84,6 +84,23 @@ GITLABMSGCUST5="\e[1mGitlab repo updated - \e[7m$GITLABBINARYCUSTOM5\e[0m\e[0m"
8484AURMSG=" \e[1mAUR repo updated - \e[7m$AURBINARY \e[0m\e[0m"
8585FAILEDBUILDMSG=" \e[31mPackage build failed, removing ...\e[0m"
8686#
87+ # Online connection check
88+ function onlinecheck() {
89+ # Check for a internet connection
90+ if [ -z " $( curl -f -s " $GITHUBURL " ) " ]; then # Check if CURL fails
91+ echo " No online connection ..retrying"
92+ sleep 2
93+ if [ -z " $( curl -f -s " $GITHUBURL " ) " ]; then # Check if CURL fails
94+ echo " No online connection ..retrying"
95+ sleep 2
96+ if [ -z " $( curl -f -s " $GITHUBURL " ) " ]; then # Check if CURL fails
97+ echo " No online connection ..exit!"
98+ exit 1
99+ fi
100+ fi
101+ fi
102+ }
103+ #
87104# Supported build options
88105function buildoptions() {
89106 if [ " $var " == " 1" ]; then
@@ -198,20 +215,7 @@ function maincheck() {
198215
199216 ONLINEPKGBUILD=" .onlinepkgbuild"
200217 CURL=$( curl -f -s " $GITHUBURL " | tee " $ONLINEPKGBUILD " )
201-
202- # Check for a internet connection
203- if [ -z " $( curl -f -s " $GITHUBURL " ) " ]; then # Check if CURL fails
204- echo " No online connection ..retrying"
205- sleep 2
206- if [ -z " $( curl -f -s " $GITHUBURL " ) " ]; then # Check if CURL fails
207- echo " No online connection ..retrying"
208- sleep 2
209- if [ -z " $( curl -f -s " $GITHUBURL " ) " ]; then # Check if CURL fails
210- echo " No online connection ..exit!"
211- exit 1
212- fi
213- fi
214- fi
218+ onlinecheck
215219
216220 # Update check method 1: compare "pkgver" + "pkgrel" & "sha512sum of PKGBUILD's via curl"
217221 if [ " $UPDCHECK " == " 1" ]; then
@@ -287,7 +291,7 @@ function maincheck() {
287291 if [[ -n " $gitversioncheck1 " ]]; then
288292 if [[ " $( cat " $gitversionfile1 " ) " == " $( cat " .gitversioncheck" ) " ]]; then
289293 cd " $DIR /packages/$GITDIR /$p "
290- echo -e " \e[2m🗹 Up-to-Date [Git-Version] \e[0m"
294+ echo -e " \e[2m🗹 Up-to-Date\e[0m"
291295 rm -rf .onlinepkgbuild & > /dev/null
292296 return 1
293297 fi
@@ -299,7 +303,7 @@ function maincheck() {
299303 # Generate a gitcheck file for a update reference
300304 if [[ -n " $gitversioncheck " ]]; then
301305 cd " $DIR /packages/$GITDIR /$p "
302- echo -e " \e[2m🗹 Up-to-Date [Git-Version] \e[0m"
306+ echo -e " \e[2m🗹 Up-to-Date\e[0m"
303307 rm -rf .onlinepkgbuild & > /dev/null
304308 return 1
305309 fi
@@ -320,19 +324,7 @@ function maincheck() {
320324 echo -e " \e[7mOut-of-Date! Updating ...\e[0m"
321325 cd " $DIR /packages/$GITDIR /$p "
322326
323- # Check for a internet connection
324- if [ -z " $( curl -f -s " $GITHUBURL " ) " ]; then # Check if CURL fails
325- echo " No online connection ..retrying"
326- sleep 2
327- if [ -z " $( curl -f -s " $GITHUBURL " ) " ]; then # Check if CURL fails
328- echo " No online connection ..retrying"
329- sleep 2
330- if [ -z " $( curl -f -s " $GITHUBURL " ) " ]; then # Check if CURL fails
331- echo " No online connection ..exit!"
332- exit 1
333- fi
334- fi
335- fi
327+ onlinecheck
336328 git fetch origin & > /dev/null
337329 git checkout origin/$BRANCH & > /dev/null
338330 git reset --hard origin/$BRANCH # reset files to how they were before
@@ -354,7 +346,6 @@ function maincheck() {
354346 # Generate a gitcheck file for a update reference
355347 if [[ -n " $gitversioncheck " ]]; then
356348 cd " $DIR /packages/$GITDIR /$p "
357- echo -e " \e[2m[Git-Version Updated]\e[0m"
358349 rm -rf .onlinepkgbuild & > /dev/null
359350 return 1
360351 fi
@@ -366,19 +357,7 @@ function maincheck() {
366357
367358 echo " Package does not exist local, downloading ..."
368359
369- # Check for a internet connection
370- if [ -z " $( curl -f -s " $GITHUBURL " ) " ]; then # Check if CURL fails
371- echo " No online connection ..retrying"
372- sleep 2
373- if [ -z " $( curl -f -s " $GITHUBURL " ) " ]; then # Check if CURL fails
374- echo " No online connection ..retrying"
375- sleep 2
376- if [ -z " $( curl -f -s " $GITHUBURL " ) " ]; then # Check if CURL fails
377- echo " No online connection ..exit!"
378- exit 1
379- fi
380- fi
381- fi
360+ onlinecheck
382361 mkdir -p " $DIR /packages/$GITDIR /$p " && cd " $DIR /packages/$GITDIR /$p "
383362 git clone --single-branch --branch " $BRANCH " " $GITHUBCLONEURL " " $p " .git
384363 folder=" $( ls) "
@@ -407,7 +386,6 @@ function maincheck() {
407386 # Generate a gitcheck file for a update reference
408387 if [[ -n " $gitversioncheck " ]]; then
409388 cd " $DIR /packages/$GITDIR /$p "
410- echo -e " \e[2m[Git-Version]\e[0m"
411389 rm -rf .onlinepkgbuild & > /dev/null
412390 return 1
413391 fi
0 commit comments