#!/bin/sh # ===================================================================== # Projet : DARKMAKE # Fichier : getsource # 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. # ===================================================================== pkgUrl="${pkgUrl:-https://toqqee6cwewdumm4aubkcc02f5oou0tktial01i4wa3.darkweb.fr/pkg/git}" # Identifiants non embarqués : définir pkgUser / pkgPass dans l'environnement # ou dans la configuration locale (ex: /etc/darksh), jamais dans les sources. pkgUser="${pkgUser:-}" pkgPass="${pkgPass:-}" . /etc/darksh/lib/shTools shLog="${shLog:-"getsource"}" shDebugEnable="1" shDebug 1 ""$log" $* ----------------- start" # params : # pkgUrl pkgName pkgVersion for myParams in pkgUrl pkgName pkgVersion pkgSrc;do if [ -z "$(eval echo \$$myParams)" ];then shDebug 0 ""$log":missing :$myParams";exit 1;fi done # extra-params : # pkgGitRepo pkgFossilRepo #for myParams in pkgGitRepo pkgFossilRepo pkgWgetRepo pkgTarballDir;do # if [ -z "$(eval echo \$$myParams)" ];then shDebug 1 ""$log":optionnal not defined :$myParams";fi #done shLog="getsource $pkgName-$pkgVersion:" if [ -d $pkgSrc ];then cd $pkgSrc fi if [ -n "$pkgWgetRepo" ];then # pkgTarballPath="${pkgSrc}/.." pkgTarballPath="$(echo $pkgSrc | rev | cut -f2- -d/ | rev)" if [ ! -d "$pkgTarballPath" ];then mkdir -p "$pkgTarballPath";fi pkgTarballFile="${pkgTarballPath}/${pkgName}-${pkgVersion}.tar.gz" shDebug 1 ""$log":wget "$pkgWgetRepo" -O "$pkgTarballFile"" wget "$pkgWgetRepo" -O "$pkgTarballFile" shDebug 1 ""$log":cd ${pkgTarballPath}" cd "$pkgTarballPath" shDebug 1 ""$log":tar -xvf "$pkgTarballFile"" tar -xvf "$pkgTarballFile" if [ -d "$pkgSrc" ];then rm -R "$pkgSrc";fi shDebug 1 ""$log":mv "$pkgTarballPath/$pkgTarballDir" "$pkgSrc"" mv "$pkgTarballPath/$pkgTarballDir" "$pkgSrc" elif [ -n "$pkgGitRepo" ]; then gitCredentialHelper="" if [ -n "$pkgUser" ]; then gitCredentialHelper="!f() { test \\"\$1\\" = get || exit 0 printf '%s\n' 'username=$pkgUser' printf '%s\n' 'password=$pkgPass' }; f" fi if [ -n "$forceRecursive" ] && [ "$forceRecursive" -eq 1 ]; then shDebug 1 "$shLog git clone authentifié recursive: $pkgGitRepo -> $pkgSrc" GIT_TERMINAL_PROMPT=0 git \ -c http.sslVerify=false \ -c credential.helper= \ -c "credential.helper=$gitCredentialHelper" \ clone --recursive --branch "$pkgVersion" \ "$pkgGitRepo" "$pkgSrc" else shDebug 1 "$shLog git clone authentifié: $pkgGitRepo -> $pkgSrc" GIT_TERMINAL_PROMPT=0 git \ -c http.sslVerify=false \ -c credential.helper= \ -c "credential.helper=$gitCredentialHelper" \ clone --single-branch --depth 1 --branch "$pkgVersion" \ "$pkgGitRepo" "$pkgSrc" fi gitRet=$? if [ "$gitRet" -ne 0 ]; then shDebug 0 "$shLog échec de git clone (code $gitRet): $pkgGitRepo" exit "$gitRet" else if [ -n "$pkgGitVersion" ];then shDebug 1 ""$log": git checkout "$pkgGitVersion"" oldpwd="$(pwd)" cd "$pkgSrc" git checkout "$pkgGitVersion" cd "$oldpwd" fi fi #elif [ -n "$pkgGitRepo" ];then ## git clone "$pkgGitRepo" "$pkgSrc" ## git clone --depth 1 --branch "$pkgVersion" "$pkgGitRepo" "$pkgSrc" # gitCredentialHelper="!f() { # test \"\$1\" = get || exit 0 # printf '%s\n' 'username=$pkgUser' # printf '%s\n' 'password=$pkgPass' #}; f" # gitParams=" -c http.sslVerify=false -c credential.helper= " # cmdGit="git" # echo ============================================================ $cmdGit $gitParams # if [ -n "$forceRecursive" ] && [ "$forceRecursive" -eq 1 ];then # shDebug 1 ""$log": git clone $gitParams -c "credential.helper=$gitCredentialHelper" --branch "$pkgVersion" "$pkgGitRepo" "$pkgSrc"" # GIT_TERMINAL_PROMPT=0 $cmdGit $gitParams -c "credential.helper=$gitCredentialHelper" clone --branch "$pkgVersion" "$pkgGitRepo" "$pkgSrc" ## $cmdGit -c http.sslVerify=false clone --recursive --branch "$pkgVersion" "$pkgGitRepo" "$pkgSrc" # else # shDebug 1 ""$log": git clone $gitParams -c "credential.helper=$gitCredentialHelper" --single-branch --depth 1 --branch "$pkgVersion" "$pkgGitRepo" "$pkgSrc"" # GIT_TERMINAL_PROMPT=0 $cmdGit $gitParams -c "credential.helper=$gitCredentialHelper" clone --single-branch --depth 1 --branch "$pkgVersion" "$pkgGitRepo" "$pkgSrc" ## $cmdGit -c http.sslVerify=false clone --recursive --single-branch --depth 1 --branch "$pkgVersion" "$pkgGitRepo" "$pkgSrc" # fi # if [ -n "$pkgGitVersion" ];then # shDebug 1 ""$log": git checkout "$pkgGitVersion"" # oldpwd="$(pwd)" # cd "$pkgSrc" # git checkout "$pkgGitVersion" # cd "$oldpwd" # fi elif [ -n "$pkgWgetRepo" ];then if [ ! -d "${pkgSrc}/${pkgName}-${pkgVersion}" ];then tarlBall="${pkgSrc}/${pkgName}-${pkgVersion}.tar.gz" if [ ! -f "${tarlBall}" ];then wget --output-document="$tarlBall" "${pkgWgetRepo}" fi tar -xvf "$tarlBall" fi elif [ -n "$pkgFossilRepo" ];then # pkgVersion="trunk" # pkgUrlFossilRepos="https://pkg.darkweb.fr/fossil/repo" # pkgFossilRepo="${pkgUrlFossilRepos}/${pkgName}/tarball/${pkgVersion}/${pkgName}-${pkgVersion}.tar.gz # ${pkgSrc}/${pkgName}-${pkgVersion} if [ ! -d "${pkgSrc}/${pkgName}-${pkgVersion}" ];then tarlBall="${pkgSrc}/${pkgName}-${pkgVersion}.tar.gz" if [ ! -f "${tarlBall}" ];then wget --output-document="$tarlBall" "${pkgFossilRepo}" fi tar -xvf "$tarlBall" fi else echo "not one pkg repo found no git no fossil" exit -1 fi cd $pkgSrc