From b755e06f96e4612a1c247601ea12900f1e34e767 Mon Sep 17 00:00:00 2001 From: SohKa Date: Mon, 18 Nov 2019 21:02:01 +0100 Subject: [PATCH] Execute custom script (#66) Allow execution of a custom script at the end of the installation. --- script/hypercube/hypercube.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/script/hypercube/hypercube.sh b/script/hypercube/hypercube.sh index a9b50d4..ac0eacc 100644 --- a/script/hypercube/hypercube.sh +++ b/script/hypercube/hypercube.sh @@ -457,6 +457,12 @@ function configure_vpnclient() { ynh-vpnclient-loadcubefile.sh -u "${settings[yunohost,user]}" -p "${settings[yunohost,user_password]}" -c "${tmp_dir}/config.cube" &>> $log_file || true } +function execute_customscript() { + logfile ${FUNCNAME[0]} + + bash "$custom_script" &>> $log_file +} + function monitoring_ip() { logfile ${FUNCNAME[0]} set +E @@ -623,6 +629,7 @@ function end_installation() { declare -A settings tmp_dir=$(mktemp -dp /tmp/ labriqueinternet-installhypercube-XXXXX) hypercube_file="${tmp_dir}/install.hypercube" +custom_script="/usr/local/bin/hypercube_custom.sh" exit_status=0 webserver_pid= is_dyndns_useful=false @@ -764,6 +771,11 @@ else info "Configuring Wifi Hotspot..." configure_hotspot + if [ -f "$custom_script" ]; then + info "Execute custom script..." + execute_customscript + fi + info "Rebooting..." if [ -f /etc/crypttab ]; then