Skip to content

Commit

Permalink
hcpp_rebooted now apart of pluginable
Browse files Browse the repository at this point in the history
  • Loading branch information
Steveorevo committed Aug 19, 2023
1 parent 4248bda commit de58a8a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
47 changes: 47 additions & 0 deletions hooks/install_hcpp_reboot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Define the path to the target script
target_script="/usr/local/bin/hcpp_rebooted.sh"

# Check if the target script already exists
if [ ! -f "$target_script" ]; then
cat <<EOT >> "$target_script"
#!/bin/bash
# Wait for the mount point to be available
while [ ! -d "/media/appFolder" ]; do
sleep 1
done
# Throw a reboot event to trigger the HCPP rebooted hook
/usr/local/hestia/bin/v-invoke-plugin hcpp_rebooted
EOT
chmod +x "$target_script"
echo "Installed hcpp_rebooted.sh"
else
echo "hcpp_rebooted.sh already exists. Skipping installation."
fi

# Check if the service file already exists
service_file="/etc/systemd/system/hcpp_rebooted.service"
if [ ! -f "$service_file" ]; then
cat <<EOT >> "$service_file"
[Unit]
Description=Trigger hcpp_rebooted hook
After=network.target
[Service]
Type=oneshot
ExecStartPre=/bin/sleep 10
ExecStart=$target_script
[Install]
WantedBy=multi-user.target
EOT
systemctl enable hcpp_rebooted.service
echo "Installed hcpp_rebooted.service"
else
echo "hcpp_rebooted.service already exists. Skipping installation."
fi
2 changes: 1 addition & 1 deletion hooks/post_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

// Copy pluginable.php to /usr/local/hestia/web/pluginable.php
copy( '/etc/hestiacp/hooks/pluginable.php', '/usr/local/hestia/web/pluginable.php' );
shell_exec('cd /usr/local/hestia/web/js/dist && wget https://code.jquery.com/jquery-3.7.0.min.js' );
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' );

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

0 comments on commit de58a8a

Please sign in to comment.