#!/bin/sh # ===================================================================== # Projet : DARKCONTAINER # Fichier : bin/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"}" shDebug "$*" $( shInclude $rootDarkContainer/lib/services ) $( shInclude $rootDarkContainer/lib/chroot ) if [ -z "$cmdDaemon" ];then cmdDaemon="$(which $pName)";fi if [ -z "$cmdDaemon" ];then cmdDaemon="$pFolder/$pName";fi if [ -z "$cmdDaemonFull" ];then cmdDaemonFull="$cmdDaemon";fi shDebug 1 ""$log" $* ----------------- SERVICES INSTALL" #|------------------------------------------------| #| "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" services_create "$pName" 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" pName="$pName" pUser="$pUser" pGroup="$pGroup"\ # pCacheDir="$pCacheDir" pServiceInfo="$pServiceInfo" cmdDaemon="$cmdDaemon"\ # pLibFiles="$pLibFiles" pLibFolders="$pLibFolders" pCopyLib="$pCopyLib" pDirStruct="$pDirStruct"\ # chroot_init #fi shDebug 1 ""$log" services_install :$pStart" ##services_install $pName $pServiceInfo $pServiceDoc $pStart $pPreStart $pStop $pReload $pIdFile $serviceType\ ## $pSystemCtlWants $pSystemCtlBefore $pSystemCtlAfter\ ## $pInitVRequiredStart $pInitVRequiredStop $pInitVShouldStart $pInitVShouldStop $pInitVDefaultStart $pInitVDefaultStop # pServiceInfo="[bakuba/$pName]$pServiceInfo"\ # pServiceDoc="[bakuba/$pName]$pServiceDoc"\ # cmdDaemon="/etc/bakuba/$pName" cmdDaemonFull="/etc/bakuba/$pName"\ # pParamStart="$pParamStart" pParamStartDebug="$pParamStartDebug" pStop="$pStop"\ # pIdFile="$pChrootDir/$pIdFile"\ # pName="bakuba-$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=""\ services_install #services_install "$pName" "$pServiceInfo" "$pServiceDoc" "$pStart" "$pPreStart" "$pStop" "$pReload" "$pIdFile" "$serviceType"\ # "$pSystemCtlWants" "$pSystemCtlBefore" "$pSystemCtlAfter"\ # "$pInitVRequiredStart" "$pInitVRequiredStop" "$pInitVShouldStart" "$pInitVShouldStop" "$pInitVDefaultStart" "$pInitVDefaultStop" if [ -n "$pDebugFile" ];then shDebug 1 ""$log" services_install_debug :$pStartDebug" #services_install_debug "$debugFile" "$pName" "$pStart" debugFile="$pDebugFile" pName="$pName" pStart="$pStartDebug"\ services_install_debug # services_install_debug "$pDebugFile" "$pName" "$pStartDebug" fi