#!/bin/sh # ===================================================================== # Projet : DARKMAKE # Fichier : initProjectFromGitHubToSvn # 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 shDebug " init from github project, [name:$projectName] [url source:$projectUrl]" 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 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/git" ];then shDebug " clone git repository :$pkgProjectDir/git" git clone "$projectUrl" "$pkgProjectDir/git" fi if [ ! -d "$pkgProjectDir/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 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\ Order allow,deny \n\ Allow from all \n\ \n\ AuthName \"SVN Area for Darkweb Pkg\" \n\ Include /etc/darksrv/web/apache2/commonConfig/pgsql.include \n\ #Require valid-user \n\ Require group svn_darkweb \n\ \n\ \n\ AddType application/x-httpd-php .php \n\ php_flag register_globals off \n\ # suppression de l'affichage des erreurs php \n\ php_flag display_startup_errors off \n\ php_flag display_errors off \n\ php_flag html_errors off \n\ php_value docref_root 0 \n\ php_value docref_ext 0 \n\ php_flag magic_quotes_gpc Off \n\ php_flag track_vars On \n\ php_flag register_globals Off \n\ php_value include_path . \n\ php_value upload_max_filesize 10000M \n\ php_value post_max_size 10000M \n\ \n\ \n\ " > "$rootConfigFile" projectConfigFile="$pkgApacheConfDir/$projectName" if [ -f "$projectConfigFile" ];then echo "======== HAVE TO ERASE $projectConfigFile,Press any key to continue... ";read REPLY fi echo " \n\ \n\ Options Indexes FollowSymLinks MultiViews \n\ AllowOverride None \n\ \n\ Order allow,deny \n\ allow from all \n\ \n\ \n\ #------------ \n\ # svnfolder : /$projectName \n\ #------------ \n\ \n\ Order allow,deny \n\ Allow from all \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 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/git" cd $pkgProjectDir/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