D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
share
/
lve
/
modlscapi
/
utils
/
Filename :
cpanel-hooks-lve
back
Copy
#!/bin/bash # Copyright (c) Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2018 All Rights Reserved # # 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. ################################################### # Utils for hooks installation or removing # ################################################### . /usr/share/lve/modlscapi/include/cpanel-common-lve function createHookHeader(){ #1 - hook name if [ ! -e "$common_path_of_cpanel/tmp" ]; then mkdir -p "$common_path_of_cpanel/tmp" fi if [ ! -e "$1" ];then touch "$1" fi if [ -e "$1" ];then chmod 755 "$1" tmp=$(cat "$1" | grep "#!/bin/bash") if [ -z "$tmp" ];then echo "#!/bin/bash" > "$common_path_of_cpanel/tmp/future_hook.tmp.$$" cat "$1" >> "$common_path_of_cpanel/tmp/future_hook.tmp.$$" cat "$common_path_of_cpanel/tmp/future_hook.tmp.$$" > "$1" rm -f "$common_path_of_cpanel/tmp/future_hook.tmp.$$" fi fi } function checkHookString(){ #1 - hook name #2 - pattern string #3 - comment srting if [ -e "$1" ];then tmp=$(cat "$1" | grep "$2") if [ -z "$tmp" ];then echo "$2 #$3" >> "$1" fi fi } function addHookStringFirst(){ #1 - hook name #2 - pattern string #3 - comment srting #4 - short hook name if [ -e "$1" ];then cat "$1" | sed /$4/d | sed 1a"$2 #$3" > "$common_path_of_cpanel/tmp/future_hook.tmp.$$" cat "$common_path_of_cpanel/tmp/future_hook.tmp.$$" > "$1" rm -f "$common_path_of_cpanel/tmp/future_hook.tmp.$$" fi } #################################################### # EasyApache hooks # #################################################### before_apache_make="/scripts/before_apache_make" before_httpd_restart_tests="/scripts/before_httpd_restart_tests" postupcp="/scripts/postupcp" after_apache_make_install="/scripts/after_apache_make_install" posteasyapache="/scripts/posteasyapache" #################################################### # Hooks list # #################################################### lsapi_HOOK="$common_path_of_cpanel/hooks/lsapi.hook" cpanelpostupcp_HOOK="$common_path_of_cpanel/hooks/cpanelpostupcp.hook" clearconf_HOOK="$common_path_of_cpanel/hooks/clearconf.hook" posteasyapache_HOOK="$common_path_of_cpanel/hooks/buildlsphp.hook" writeToLog "Install cPanel hooks" showBar 1 #Install new hooks createHookHeader "$before_apache_make" createHookHeader "$before_httpd_restart_tests" createHookHeader "$postupcp" createHookHeader "$after_apache_make_install" createHookHeader "$posteasyapache" showBar 2 writeToLog "Headers checked" addHookStringFirst "$before_apache_make" "$clearconf_HOOK" "mod_lsapi Version $VERSION. Required for LVE module recompilation" "clearconf.hook" removeEmptyStringsFromFile "$before_apache_make" showBar 3 writeToLog "before_apache_make checked" checkHookString "$before_httpd_restart_tests" "$lsapi_HOOK" "mod_lsapi Version $VERSION mod_lsapi module installation" checkHookString "$before_httpd_restart_tests" "$cpanelpostupcp_HOOK" "mod_lsapi Version $VERSION Rebuild Apache config hook" removeEmptyStringsFromFile "$before_httpd_restart_tests" showBar 4 writeToLog "before_httpd_restart_tests checked" checkHookString "$postupcp" "$cpanelpostupcp_HOOK" "mod_lsapi Version $VERSION Rebuild Apache config hook" removeEmptyStringsFromFile "$postupcp" showBar 5 writeToLog "postupcp checked" showBar 6 writeToLog "after_apache_make_install checked" checkHookString "$after_apache_make_install" "$lsapi_HOOK" "mod_lsapi Version $VERSION mod_lsapi module installation" removeEmptyStringsFromFile "$after_apache_make_install" showBar 7 writeToLog "after_apache_make_install checked" showBar 8 checkHookString "$posteasyapache" "$posteasyapache_HOOK" "mod_lsapi Version $VERSION mod_lsapi module installation" checkHookString "$posteasyapache" "$cpanelpostupcp_HOOK" "mod_lsapi Version $VERSION Rebuild Apache config hook" removeEmptyStringsFromFile "$posteasyapache" writeToLog "posteasyapache checked" showBar 9 writeToLog "Done installing hooks" echo
Name
Size
Last Modified
Owner
Permissions
Actions
checkconfdutil.pm
2.536
KB
April 10 2025 3:29:31
root
0755
cpanel-delete-lve
1.928
KB
April 10 2025 3:29:31
root
0755
cpanel-hooks-lve
4.474
KB
April 10 2025 3:29:31
root
0755
cpanel-make-lve
0.961
KB
April 10 2025 3:29:31
root
0755
cpanel_hooks_manage.py
3.498
KB
April 10 2025 3:29:31
root
0755
getdocroot.pm
2.822
KB
April 10 2025 3:29:31
root
0755
getdocroots.pm
1.26
KB
April 10 2025 3:29:31
root
0755
getuserdomains.pm
1.354
KB
April 10 2025 3:29:31
root
0755
inserphpconf.pm
2.534
KB
April 10 2025 3:29:31
root
0755
lsapi-cache
1.041
KB
April 10 2025 3:29:32
root
0755
2017 © D7net | D704T team