#!/bin/sh # ===================================================================== # Projet : DARKCONTAINER # Fichier : services/install # 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="${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/installApt}" shDebug 1 ""$log" $* ----------------- SERVICES INSTALL APT" #|------------------------------------------------| #| "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 $pChrootDir $pStart" # 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 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