Skip to content

Commit de58a8a

Browse files
committed
hcpp_rebooted now apart of pluginable
1 parent 4248bda commit de58a8a

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

hooks/install_hcpp_reboot.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
# Define the path to the target script
4+
target_script="/usr/local/bin/hcpp_rebooted.sh"
5+
6+
# Check if the target script already exists
7+
if [ ! -f "$target_script" ]; then
8+
cat <<EOT >> "$target_script"
9+
#!/bin/bash
10+
11+
# Wait for the mount point to be available
12+
while [ ! -d "/media/appFolder" ]; do
13+
sleep 1
14+
done
15+
16+
# Throw a reboot event to trigger the HCPP rebooted hook
17+
/usr/local/hestia/bin/v-invoke-plugin hcpp_rebooted
18+
19+
EOT
20+
chmod +x "$target_script"
21+
echo "Installed hcpp_rebooted.sh"
22+
else
23+
echo "hcpp_rebooted.sh already exists. Skipping installation."
24+
fi
25+
26+
# Check if the service file already exists
27+
service_file="/etc/systemd/system/hcpp_rebooted.service"
28+
if [ ! -f "$service_file" ]; then
29+
cat <<EOT >> "$service_file"
30+
[Unit]
31+
Description=Trigger hcpp_rebooted hook
32+
After=network.target
33+
34+
[Service]
35+
Type=oneshot
36+
ExecStartPre=/bin/sleep 10
37+
ExecStart=$target_script
38+
39+
[Install]
40+
WantedBy=multi-user.target
41+
42+
EOT
43+
systemctl enable hcpp_rebooted.service
44+
echo "Installed hcpp_rebooted.service"
45+
else
46+
echo "hcpp_rebooted.service already exists. Skipping installation."
47+
fi

hooks/post_install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
// Copy pluginable.php to /usr/local/hestia/web/pluginable.php
1414
copy( '/etc/hestiacp/hooks/pluginable.php', '/usr/local/hestia/web/pluginable.php' );
15-
shell_exec('cd /usr/local/hestia/web/js/dist && wget https://code.jquery.com/jquery-3.7.0.min.js' );
15+
shell_exec( __DIR__ . '/install_hcpp_reboot.sh' && cd /usr/local/hestia/web/js/dist && wget https://code.jquery.com/jquery-3.7.0.min.js' );
1616

1717
// Ensure log is present and writable when needed
1818
if ( ! file_exists( '/tmp/hcpp.log' ) ) {

0 commit comments

Comments
 (0)