#!/bin/sh # ===================================================================== # Projet : DARKCONTAINER # Fichier : services/installAptBuild # Auteur : Nicolas "DarkHack" Chapuis (c) 2026 # ================== DARKHACK ================== # [ darkweb.fr - system online ] # Powered by Perplexity, your AI assistant # 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 # # 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. # ===================================================================== if ! type "shInclude" > /dev/null 2>&1 ; then racineSh="${racineSh:-/etc/darksh}";. "$racineSh/lib/shTools";shDebugEnable="${shDebugEnable:-1}";fi rootDarkContainer="${rootDarkContainer:-/etc/darkcontainer}" [ ! -d "$rootDarkContainer" ] && shDebug 0 "exit cause rootDarkContainer is not dir:$rootDarkContainer" && exit 0 shLog="$pName-install:" shDebug "[ INFO ] $rootDarkContainer/lib/chroot && $rootDarkContainer/systemctl/lib/systemctl && shInclude $rootDarkContainer/lib/rsyslog" $( shInclude $rootDarkContainer/lib/chroot ) && $( shInclude $rootDarkContainer/lib/systemctl ) && $( shInclude $rootDarkContainer/lib/rsyslog ) #|-----------------------------------------------------------------------| #| which "directory" tools : mkdir | chmod | chgrp | mount | umount | #|-----------------------------------------------------------------------| shDebug "[ INFO ] $rootDarkContainer/which/lib/directory" $(shInclude $rootDarkContainer/which/lib/directory) shDebug "[ INFO ] which :sh touch kill $pName" cmdSh="$(which sh)" cmdTouch="$(which touch)" cmdKill="$(which kill)" shLog="${shLog:-"service-install $pName"}" if [ -z "$cmdDaemon" ];then cmdDaemon="$(which $pName)";fi if [ -z "$cmdDaemon" ];then cmdDaemon="$pFolder/$pName";fi if [ -z "$cmdDaemonFull" ];then cmdDaemonFull="$cmdDaemon";fi log="${log:-darkcontainer/services/installAptBuild}" shDebug 1 ""$log" $* ----------------- SERVICES INSTALL APT BUILD" #|------------------------------------------------| #| "PARAMS BASE" | #| pName | pServiceInfo | pServiceDoc | cmdDaemon | #|------------------------------------------------| PARAMS_BASE="pName pServiceInfo pServiceDoc cmdDaemon" shErrorOnMissing "$PARAMS_BASE" if [ -n "$pChrootDir" ];then #|------------------------------------------| #| "PARAMS CHROOT" | #| pUser | pGroup | pChrootDir | pDebugFile | #|------------------------------------------| PARAMS_CHROOT="pUser pGroup pMountFolders pDebugFile" shErrorOnMissing "$PARAMS_CHROOT" fi #|---------------------------------------------------------------------------| #| "PARAMS SYSTEMCTL" | #| pSystemCtlWants | pSystemCtlBefore | pSystemCtlAfter | pSystemCtlRequires | #|---------------------------------------------------------------------------| PARAMS_SYSTEMCTL="pSystemCtlWants pSystemCtlBefore pSystemCtlAfter pSystemCtlRequires" shWarnOnMissing "$PARAM_SYSTEMCTL" #|----------------------------------------------| #| "PARAMS INITV" | #| pInitVRequiredStart | pInitVRequiredStop | #| pInitVShouldStart | pInitVShouldStop | #| pInitVDefaultStart | pInitVDefaultStop | #|----------------------------------------------| PARAMS_INITV="pInitVRequiredStart pInitVRequiredStop" PARAMS_INITV="$PARAMS_INITV pInitVShouldStart pInitVShouldStop" PARAMS_INITV="$PARAMS_INITV pInitVDefaultStart pInitVDefaultStop" shWarnOnMissing "$PARAMS_INITV" # extra-params : # pLibFiles pLibFolders PARAMS_EXTRA="pLibFiles pLibFolders pDirStruct pDirUserGroupRight pIdFile serviceType pStart" PARAMS_EXTRA="$PARAMS_EXTRA cmdDaemonFull pCopyLib pStop pParamStart pParamStartDebug pCacheDir" shWarnOnMissing "$PARAMS_EXTRA" #|-------------------------------------------------------------| #| which "base" tools : cp | rm | echo | head | tail | #|-------------------------------------------------------------| # &&&&& #|-----------------------------------------------------------------------| #| which "directory" tools : mkdir | chmod | chgrp | mount | umount | #|-----------------------------------------------------------------------| # &&&&& #|------------------------------------------------------------------------------------| #| which "user right" tools : chmod | chown | chgrp | groupadd | useradd | chroot | #|------------------------------------------------------------------------------------| $( shInclude $rootDarkContainer/which/lib/base ) && $( shInclude $rootDarkContainer/which/lib/directory ) && $( shInclude $rootDarkContainer/which/lib/userRight ) $( shInclude $rootDarkContainer/lib/nodeServiceApt ) #pName="$pName" \ nodeService_create cmdSh="${cmdSh:-$(which sh)}" pStartDebug="${pStartDebug:-$cmdSh -c \"$cmdDaemonFull $pParamStartDebug\"}" pStart="${pStart:-$cmdSh -c \"$cmdDaemonFull $pParamStart\"}" if [ -n "$pChrootDir" ];then cmdChroot="${cmdChroot:-$(which chroot)}" pStart="$cmdChroot --userspec=$pUser:$pGroup $pChrootDir $pStart" pDebugFile="${pDebugFile:-$pConfDir/debug-$pName}" # pChrootDir="$pChrootDir" pUser="$pUser" pGroup="$pGroup" pName="$pName"\ # pCacheDir="$pCacheDir" pServiceInfo="$pServiceInfo" cmdDaemon="$cmdDaemon"\ # pLibFiles="$pLibFiles" pLibFolders="$pLibFolders" pCopyLib="$pCopyLib" pDirStruct="$pDirStruct"\ # nodeService_chroot_init_apt # chroot_init shDebug 2 "$log [ $pChrootDir ] forBuild=${forBuild} $pName $pUser $pGroup $pBaseDir $pUserComment" apt_init_clear "$pChrootDir" "$pName" "$pUser" "$pGroup" "$pBaseDir" "$pUserComment" "-U -r" # pChrootDir="$pChrootDir" pName="$pName" pUser="$pUser" pGroup="$pGroup"\ # pCacheDir="$pCacheDir" pServiceInfo="$pServiceInfo" cmdDaemon="$cmdDaemon"\ # pLibFiles="$pLibFiles" pLibFolders="$pLibFolders" pCopyLib="$pCopyLib" pDirStruct="$pDirStruct"\ # chroot_umount $pChrootDir chroot_mount "$pChrootDir" /proc chroot_mount "$pChrootDir" /sys chroot_mount "$pChrootDir" /dev # if [ -n "${forBuild}" ];then essentialPackagesList="/usr/share/build-essential/essential-packages-list" [ ! -f "$essentialPackagesList" ] && sh $rootDarkMake/pkg/bin/aptCheck build-essential # sh $rootDarkMake/pkg/bin/aptCheck gnulib autoconf-archive gnu-standards autoconf-doc bison-doc gettext-doc libasprintf-dev libgettextpo-dev \ # clisp libtool-doc gfortran doc-base gdb clisp-doc slime clisp-module-berkeley-db clisp-module-clx clisp-module-dbus clisp-module-gdbm clisp-module-pcre \ # clisp-module-zlib gfortran-multilib gfortran-doc libcoarrays-dev libxml-sax-expatxs-perl m4-doc debhelper \ # texlive-base texlive-latex-base texlive-plain-generic texlive-fonts-recommended gawk mailutils-mh mailutils-doc libmail-box-perl hyperspec \ # xzdec texlive-fonts-recommended-doc texlive-latex-base-doc packageAfter="multiarch-support libacl1 coreutils debconf libc-bin libc libc6" packageAfter="$packageAfter findutils binutils locales coreutils procps bash-completion" packageAfter="$packageAfter unrar-free gettext bison gawk dialog dpkg tar libbz2-1.0" # for packageToList in $packageAfter;do # chroot_apt_stage0 $pChrootDir $packageToList 2>&1 | tee "$pChrootDir/chroot_apt_install_first_$packageToList.log" ## chroot_apt_install $pChrootDir $packageToList 2>&1 | tee "$pChrootDir/chroot_apt_install_first_$packageToList.log" # done for packageToList in $packageAfter;do chroot_apt_install $pChrootDir $packageToList 2>&1 | tee "$pChrootDir/chroot_aptBuildEssential_install.log" done packageAfter="libc-dev-bin libc-dev linux-libc-dev libc6-dev" packageAfter="$packageAfter build-essential" # perlVersion="$( apt-cache policy perl-base | grep Install | cut -d: -f2 |tr -d ' ' | cut -d. -f1,2 )" # libperlvers="$( apt-file search threads.pm | grep perl | cut -f1 -d\: | tr -d '\n' )" # packageAfter="$packageAfter perl-base perl-modules libperl$perlVersion perl-modules-$perlVersion libtext-unidecode-perl ${libperlvers} libthreads-perl libthreads-shared-perl" # gccDevVersion="$( apt-cache policy gcc | grep Install | cut -d: -f3 |tr -d ' ' | cut -d. -f1 )" # packageAfter="$packageAfter libgcc-${gccDevVersion}-dev libstdc++-${gccDevVersion}-dev cpp-${gccDevVersion}" packageAfter="$packageAfter gcc g++ m4 dpkg make autoconf autoconf-archive automake autopoint autogen pkg-config pkgconf" packageAfter="$packageAfter texinfo texlive" packageAfter="$packageAfter flex bison gengetopt" packageAfter="$packageAfter help2man" if [ -z "${withoutGNULIB}" ];then packageAfter="$packageAfter gnulib libtool-bin libtool libltdl-dev" fi if [ -n "${withLinuxKernel}" ];then unameR="$( uname -r )" packageAfter="$packageAfter linux-image-$unameR linux-headers-$unameR" fi packageAfter="$packageAfter $( cat $essentialPackagesList | tail -n +4 )" for packageToList in $packageAfter;do chroot_apt_install $pChrootDir $packageToList 2>&1 | tee "$pChrootDir/chroot_aptBuildEssential_install.log" done chroot_umount $pChrootDir # fi fi shDebug 1 ""$log" nodeService_install" # pName="$pName" pServiceInfo="$pServiceInfo" pServiceDoc="$pServiceDoc"\ # cmdDaemon="$cmdDaemon" cmdDaemonFull="$cmdDaemonFull"\ # pChrootDir="$pChrootDir" pUser="$pUser" pGroup="$pGroup" pMountFolders="$pMountFolders" pDirUserGroupRight="$pDirUserGroupRight"\ # pStart="$pStart" pPreStart="$pPreStart" pStop="$pStop" pReload="$pReload" pIdFile="$pIdFile" serviceType="$serviceType"\ # pSystemCtlWants="$pSystemCtlWants" pSystemCtlBefore="$pSystemCtlBefore" pSystemCtlAfter="$pSystemCtlAfter" pSystemCtlRequires="$pSystemCtlRequires"\ # pInitVRequiredStart="$pInitVRequiredStart" pInitVRequiredStop="$pInitVRequiredStop" pInitVShouldStart="$pInitVShouldStart" pInitVShouldStop="$pInitVShouldStop" pInitVDefaultStart="$pInitVDefaultStart" pInitVDefaultStop="$pInitVDefaultStop"\ nodeService_install # pDebugFile="$pDebugFile" pName="$pName" pChrootDir="$pChrootDir"\ # pUser="$pUser" pGroup="$pGroup" pStartDebug="$pStartDebug" pMountFolders="$pMountFolders"\ # pDirUserGroupRight="$pDirUserGroupRight"\ ExecStart="$pStart" nodeService_install_debug if [ -n "$(echo $pParamStart | grep %i)" ];then shDebug 1 ""$log" nodeService service multi" pParamStart="start %i" pParamStartDebug="start %i" pStop="$cmdSh -c \"/etc/node/$pName stop %i\"" else shDebug 1 ""$log" nodeService service mono $paramStart" pParamStart="start" pParamStartDebug="start" pStop="$cmdSh -c \"/etc/node/$pName stop\"" fi echo " . $rootDarkContainer/bin/service-install" #|----------------------------------------------------------------| #| "PARAMS BASE" | #| pName | pServiceInfo | pServiceDoc | cmdDaemon | cmdDaemonFull | #|----------------------------------------------------------------| #|------------------------------------------------------| #| "PARAMS SYSTEMCTL" | #| pSystemCtlWants | pSystemCtlBefore | pSystemCtlAfter | #|------------------------------------------------------| #|----------------------------------------------| #| "PARAMS INITV" | #| pInitVRequiredStart | pInitVRequiredStop | #| pInitVShouldStart | pInitVShouldStop | #| pInitVDefaultStart | pInitVDefaultStop | #|----------------------------------------------| #|------------------------------------------| #| "PARAMS CHROOT" | #| pUser | pGroup | pChrootDir | pDebugFile | #|------------------------------------------| # shLog="$shLog"\ pServiceInfo="[nodeService/$pName]$pServiceInfo"\ pServiceDoc="[nodeService/$pName]$pServiceDoc"\ cmdDaemon="/etc/node/$pName" cmdDaemonFull="/etc/node/$pName"\ pParamStart="$pParamStart" pParamStartDebug="$pParamStartDebug" pStop="$pStop"\ pIdFile="$pChrootDir/$pIdFile"\ pName="nodeService-$pName"\ pSystemCtlWants="$pSystemCtlWants" pSystemCtlBefore="$pSystemCtlBefore" pSystemCtlAfter="$pSystemCtlAfter" pSystemCtlRequires="$pSystemCtlRequires"\ pInitVRequiredStart="$pInitVRequiredStart" pInitVRequiredStop="$pInitVRequiredStop"\ pInitVShouldStart="$pInitVShouldStart" pInitVShouldStop="$pInitVShouldStop"\ pInitVDefaultStart="$pInitVDefaultStart" pInitVDefaultStop="$pInitVDefaultStop"\ pPreStart="" pStart="" pStartDebug="" pCacheDir=""\ pChrootDir="" pUser="root" pGroup="root" pMountFolders="" pDebugFile=""\ pLibFiles="" pLibFolders="" pDirStruct="" pCopyLib=""\ . $rootDarkContainer/bin/service-install