mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Add pre-install script feature
This commit is contained in:
parent
40c1c1b7f2
commit
33f261d858
4 changed files with 33 additions and 3 deletions
|
@ -1,5 +1,8 @@
|
|||
;; Nom du test
|
||||
# Commentaire ignoré
|
||||
; pre-install
|
||||
echo -n "Here your commands to execute in the container"
|
||||
echo ", before each installation of the app."
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
|
|
|
@ -840,7 +840,7 @@ then
|
|||
break;
|
||||
fi
|
||||
# Copy the line in the partial check_process
|
||||
echo $line >> "$partial_check_process"
|
||||
echo "$line" >> "$partial_check_process"
|
||||
fi
|
||||
|
||||
# Search for the first line
|
||||
|
@ -899,9 +899,14 @@ then
|
|||
|
||||
# Extract the section of the current tests serie
|
||||
extract_section "^$tests_serie" "^;;" "$check_process"
|
||||
partial_check_process=$partial1
|
||||
|
||||
# Check if there a pre-install instruction for this serie
|
||||
extract_section "^; pre-install" "^;" "$partial2"
|
||||
pre_install="$(cat "$partial_check_process")"
|
||||
|
||||
# Parse all infos about arguments of manifest
|
||||
# Extract the manifest arguments section from the second partial file
|
||||
partial_check_process=$partial1
|
||||
extract_section "^; Manifest" "^; " "$partial2"
|
||||
|
||||
# Initialize the arguments list
|
||||
|
|
|
@ -38,4 +38,4 @@ echo "Pour établir une connexion ssh:"
|
|||
if [ $(cat "$script_dir/setup_user") = "root" ]; then
|
||||
echo -ne "\e[1msudo "
|
||||
fi
|
||||
echo -e "\e[1mssh -t $LXC_NAME\e[0m"
|
||||
echo -e "\e[1mssh -t $LXC_NAME 'bash -i'\e[0m"
|
||||
|
|
|
@ -31,6 +31,28 @@ SETUP_APP () {
|
|||
# Uses the default snapshot
|
||||
current_snapshot=snap0
|
||||
|
||||
# Exec the pre-install instruction, if there one
|
||||
if [ -n "$pre_install" ]
|
||||
then
|
||||
ECHO_FORMAT "Pre installation request\n" "white" "bold" clog
|
||||
# Start the lxc container
|
||||
LXC_START "true"
|
||||
# Copy all the instructions into a script
|
||||
echo "$pre_install" > "$script_dir/preinstall.sh"
|
||||
chmod +x "$script_dir/preinstall.sh"
|
||||
# Replace variables
|
||||
sed -i "s/\$USER/$test_user/" "$script_dir/preinstall.sh"
|
||||
sed -i "s/\$DOMAIN/$main_domain/" "$script_dir/preinstall.sh"
|
||||
sed -i "s/\$SUBDOMAIN/$sub_domain/" "$script_dir/preinstall.sh"
|
||||
sed -i "s/\$PASSWORD/$yuno_pwd/" "$script_dir/preinstall.sh"
|
||||
# Copy the pre-install script into the container.
|
||||
scp -rq "$script_dir/preinstall.sh" "$lxc_name":
|
||||
# Then execute the script to execute the pre-install commands.
|
||||
LXC_START "./preinstall.sh >&2"
|
||||
# Print the log to print the results
|
||||
ECHO_FORMAT "$(cat "$temp_log")\n" clog
|
||||
fi
|
||||
|
||||
# Install the application in a LXC container
|
||||
LXC_START "sudo yunohost --debug app install \"$package_dir\" -a \"$manifest_args_mod\""
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue