#!/bin/sh # ===================================================================== # Projet : DARKMAKE # Fichier : initProjectFromGitHubToGit # Auteur : Nicolas "DarkHack" Chapuis (c) 2026 # ================== DARKHACK ================== # [ darkweb.fr - system online ] # Powered by Perplexity, your AI assistant # [https://www.perplexity.ai](https://www.perplexity.ai) # ============================================== # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===================================================================== racine="/etc/darksrv" . $racine/lib-sh/shTools shLog="$0($$):" shDebugEnable="1" shDebug "$*" #$(shInclude $racine/firewall/lib-sh/firewall) projectName="$1" projectUrl="$2" # initProjectFromGitHub miniupnp https://github.com/miniupnp/miniupnp.git if [ -z "$projectName" ] || [ -z "$projectUrl" ];then shDebug " init from github project, [name:$projectName] [url source:$projectUrl]" exit 1 fi chrootDir="/srv/httpd" pkgSourceDirectory="/var/www/darkweb.fr/https/pkg" pkgApacheConfDir="$pkgSourceDirectory/config.chance" pkgProjectDir="$pkgSourceDirectory/$projectName" if [ ! -d "$pkgSourceDirectory" ];then if [ -d "$chrootDir" ];then $racine/chroot/bin/execute "$chrootDir" "$(which mkdir)" -p "/tmp" $racine/chroot/bin/execute "$chrootDir" "$(which chmod)" -R 1777 "/tmp" $racine/chroot/bin/execute "$chrootDir" "$(which mkdir)" -p "$pkgSourceDirectory" else mkdir -p "$pkgSourceDirectory" fi fi if [ -d "$pkgProjectDir" ];then echo "clean project?" read answer if [ "$answer" = "y" ];then rm -R "$pkgProjectDir";fi fi if [ ! -d "$pkgProjectDir" ];then shDebug " create pkgProjectDir directory:$pkgProjectDir" if [ -d "$chrootDir" ];then $racine/chroot/bin/execute "$chrootDir" "$(which mkdir)" -p "$pkgProjectDir" else mkdir -p "$pkgProjectDir" fi fi cd "$pkgProjectDir" if [ ! -d "$pkgProjectDir/$projectName.git" ];then shDebug " clone git repository :$pkgProjectDir/$projectName.git" mkdir "$pkgProjectDir/$projectName.git" cd "$pkgProjectDir/$projectName.git" echo git clone "$projectUrl" . git clone "$projectUrl" . # cp hooks/post-update.sample hooks/post-update git update-server-info git config --bool core.bare true git config --bool core.sharedRepository true # git init --bare --shared # cp hooks/post-update.sample hooks/post-update # git update-server-info # echo git remote add origin "$projectUrl" # git remote add origin "$projectUrl" git fetch if [ -d "$chrootDir" ];then $racine/chroot/bin/execute "$chrootDir" "$(which chown)" -R www-data:www-data "$pkgProjectDir/$projectName.git" $racine/chroot/bin/execute "$chrootDir" "$(which chmod)" -R a+rw "$pkgProjectDir/$projectName.git" else chown -R www-data:www-data "$pkgProjectDir/$projectName.git" chmod -R a+rw "$pkgProjectDir/$projectName.git" fi fi if [ ! -d "$pkgProjectDir/$projectName/svn" ];then shDebug " create svn repository :$pkgProjectDir/svn" if [ -d "$chrootDir" ];then $racine/chroot/bin/execute "$chrootDir" "$(which svnadmin)" create "$pkgProjectDir/svn" $racine/chroot/bin/execute "$chrootDir" "$(which chown)" -R www-data:www-data "$pkgProjectDir/svn" $racine/chroot/bin/execute "$chrootDir" "$(which chmod)" -R a+rw "$pkgProjectDir/svn" else svnadmin create "$pkgProjectDir/svn" chown -R www-data:www-data "$pkgProjectDir/svn" fi fi cd "$pkgProjectDir" if [ ! -d "$pkgApacheConfDir" ];then shDebug " create config apache folder :$pkgApacheConfDir" mkdir -p "$pkgApacheConfDir" fi if [ ! -d "$pkgSourceDirectory/root" ];then shDebug " create root folder : $pkgSourceDirectory/root" mkdir -p "$pkgSourceDirectory/root" fi indexRootFile="$pkgSourceDirectory/root/index.php" if [ -f "$indexRootFile" ];then echo "======== HAVE TO ERASE $indexRootFile,Press any key to continue... ";read REPLY fi cp $racine/pkg/php/index.php "$indexRootFile" rootConfigFile="$pkgApacheConfDir/root" if [ -f "$rootConfigFile" ];then echo "======== HAVE TO ERASE $rootConfigFile,Press any key to continue... ";read REPLY fi echo " \n\ DocumentRoot $pkgSourceDirectory/root \n\ #------------ \n\ # webfolder : /root \n\ #------------ \n\ \n\ \n\ Options Indexes FollowSymLinks MultiViews \n\ Include $racine/web/apache2/commonConfig/denybase.include\n\ \n\ AuthName \"SVN Area for Darkweb Pkg\" \n\ Include $racine/web/apache2/commonConfig/pgsql.include \n\ #Require valid-user \n\ Require group svn_darkweb \n\ \n\ Include $racine/web/apache2/commonConfig/modphp.include \n\ \n\ " > "$rootConfigFile" projectConfigFile="$pkgApacheConfDir/$projectName" if [ -f "$projectConfigFile" ];then echo "======== HAVE TO ERASE $projectConfigFile,Press any key to continue... ";read REPLY fi echo "projectConfigFile:$projectConfigFile" echo " \n\ SetEnv GIT_PROJECT_ROOT $pkgProjectDir/$projectName.git \n\ SetEnv GIT_HTTP_EXPORT_ALL \n\ #SetEnv REMOTE_USER=\$REDIRECT_REMOTE_USER \n\ \n\ " > $projectConfigFile $(which echo) -e "ScriptAliasMatch \"(?x)^/$projectName/$projectName.git(.*/(HEAD | info/refs | objects/(info/[^/]+ | [0-9a-f]{2}/[0-9a-f]{38} | pack/pack-[0-9a-f]{40}\.(pack|idx)) | git-(upload|receive)-pack))\$\" \"/usr/lib/git-core/git-http-backend/\$1\"" >> $projectConfigFile echo " \n\ Alias /$projectName/$projectName.git $pkgProjectDir/$projectName.git \n\ \n\ Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch \n\ AllowOverride None \n\ \n\ Include $racine/web/apache2/commonConfig/denybase.include \n\ \n\ \n\ Options Indexes FollowSymLinks MultiViews \n\ AllowOverride None \n\ \n\ Include $racine/web/apache2/commonConfig/denybase.include \n\ \n\ Alias /$projectName/svn $pkgProjectDir/svn \n\ \n\ Options Indexes FollowSymLinks MultiViews \n\ AllowOverride None \n\ \n\ Include $racine/web/apache2/commonConfig/denybase.include \n\ \n\ \n\ #------------ \n\ # svnfolder : /$projectName/svn \n\ #------------ \n\ \n\ Include $racine/web/apache2/commonConfig/denybase.include \n\ \n\ AuthName \"SVN Pkg DarkWeb Area for "$projectName" dev\" \n\ Include /etc/darksrv/web/apache2/commonConfig/pgsql.include \n\ Require group svn_darkweb \n\ \n\ DAV svn \n\ SVNPath $pkgProjectDir/svn \n\ \n\ " >> $projectConfigFile #echo "wait restart";read answer systemctl restart httpd #svn co "https://pkg.darkweb.fr/$projectName" $pkgProjectDir/svn_work if [ -d "/tmp/testgit" ];then rm -R "/tmp/testgit";fi git clone "https://pkg.darkweb.fr/$projectName/$projectName.git" "/tmp/testgit" echo git clone "https://pkg.darkweb.fr/$projectName/$projectName.git" "/tmp/testgit" exit 0 svn mkdir --parents https://pkg.darkweb.fr/$projectName/trunk/$projectName -m "trunk dir" svn mkdir --parents https://pkg.darkweb.fr/$projectName/tags/$projectName -m "tag dir" svn mkdir --parents https://pkg.darkweb.fr/$projectName/branches/$projectName -m "branches dir" #echo "git svn clone" echo "cd $pkgProjectDir/$projectName.git" cd $pkgProjectDir/$projectName.git if [ ! -f ../authors ];then echo "chapuis = Chapuis " > ../authors;fi git svn init "https://pkg.darkweb.fr/$projectName" -T trunk/$projectName -t tags/$projectName -b branches/$projectName --prefix=svn/ echo "git config svn.authorsfile ../authors" git config svn.authorsfile ../authors # $pkgProjectDir/svn_work git svn fetch exit 0 cd $pkgProjectDir/svn_work echo "git svn rebase" git svn rebase echo "git svn dcommit" git svn dcommit echo "git remote add origin ../git" git remote add origin ../git echo "git pull origin master" git pull origin master echo "git svn rebase" git svn rebase echo "git svn dcommit" git svn dcommit echo "git remote delete origin" git remote delete origin #cd $pkgProjectDir/git #for path in $(find -maxdepth 1 | grep -v '^\./\.git');do # if [ ! "$path" = "." ];then # cp -R $path $pkgProjectDir/svn_work # fi #done #svn add $pkgProjectDir/svn_work/* ##svn status $pkgProjectDir/svn_work #svn commit -m "initial commit" $pkgProjectDir/svn_work