mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Reorder helper files
This commit is contained in:
parent
4dfbbd6986
commit
775d3540e1
4 changed files with 98 additions and 93 deletions
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
source lib/lxc.sh
|
||||
source lib/ynh_lxd
|
||||
source lib/ynh_lxd_package_check
|
||||
source lib/tests.sh
|
||||
source lib/witness.sh
|
||||
|
||||
readonly complete_log="./Complete-${WORKER_ID}.log"
|
||||
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
|
||||
set_witness_files () {
|
||||
# Create files to check if the remove script does not remove them accidentally
|
||||
log_debug "Create witness files..."
|
||||
|
||||
create_witness_file () {
|
||||
[ "$2" = "file" ] && local action="touch" || local action="mkdir -p"
|
||||
RUN_INSIDE_LXC $action $1
|
||||
}
|
||||
|
||||
# Nginx conf
|
||||
create_witness_file "/etc/nginx/conf.d/$DOMAIN.d/witnessfile.conf" file
|
||||
create_witness_file "/etc/nginx/conf.d/$SUBDOMAIN.d/witnessfile.conf" file
|
||||
|
||||
# /etc
|
||||
create_witness_file "/etc/witnessfile" file
|
||||
|
||||
# /opt directory
|
||||
create_witness_file "/opt/witnessdir" directory
|
||||
|
||||
# /var/www directory
|
||||
create_witness_file "/var/www/witnessdir" directory
|
||||
|
||||
# /home/yunohost.app/
|
||||
create_witness_file "/home/yunohost.app/witnessdir" directory
|
||||
|
||||
# /var/log
|
||||
create_witness_file "/var/log/witnessfile" file
|
||||
|
||||
# Config fpm
|
||||
create_witness_file "/etc/php/$DEFAULT_PHP_VERSION/fpm/pool.d/witnessfile.conf" file
|
||||
|
||||
# Config logrotate
|
||||
create_witness_file "/etc/logrotate.d/witnessfile" file
|
||||
|
||||
# Config systemd
|
||||
create_witness_file "/etc/systemd/system/witnessfile.service" file
|
||||
|
||||
# Database
|
||||
RUN_INSIDE_LXC mysqladmin --wait status > /dev/null 2>&1
|
||||
echo "CREATE DATABASE witnessdb" | RUN_INSIDE_LXC mysql --wait > /dev/null 2>&1
|
||||
}
|
||||
|
||||
check_witness_files () {
|
||||
# Check all the witness files, to verify if them still here
|
||||
|
||||
check_file_exist () {
|
||||
if RUN_INSIDE_LXC test ! -e "$1"
|
||||
then
|
||||
log_error "The file $1 is missing ! Something gone wrong !"
|
||||
SET_RESULT "failure" witness
|
||||
fi
|
||||
}
|
||||
|
||||
# Nginx conf
|
||||
check_file_exist "/etc/nginx/conf.d/$DOMAIN.d/witnessfile.conf"
|
||||
check_file_exist "/etc/nginx/conf.d/$SUBDOMAIN.d/witnessfile.conf"
|
||||
|
||||
# /etc
|
||||
check_file_exist "/etc/witnessfile"
|
||||
|
||||
# /opt directory
|
||||
check_file_exist "/opt/witnessdir"
|
||||
|
||||
# /var/www directory
|
||||
check_file_exist "/var/www/witnessdir"
|
||||
|
||||
# /home/yunohost.app/
|
||||
check_file_exist "/home/yunohost.app/witnessdir"
|
||||
|
||||
# /var/log
|
||||
check_file_exist "/var/log/witnessfile"
|
||||
|
||||
# Config fpm
|
||||
check_file_exist "/etc/php/$DEFAULT_PHP_VERSION/fpm/pool.d/witnessfile.conf"
|
||||
|
||||
# Config logrotate
|
||||
check_file_exist "/etc/logrotate.d/witnessfile"
|
||||
|
||||
# Config systemd
|
||||
check_file_exist "/etc/systemd/system/witnessfile.service"
|
||||
|
||||
# Database
|
||||
if ! RUN_INSIDE_LXC mysqlshow witnessdb > /dev/null 2>&1
|
||||
then
|
||||
log_error "The database witnessdb is missing ! Something gone wrong !"
|
||||
SET_RESULT "failure" witness
|
||||
return 1
|
||||
fi
|
||||
}
|
6
lib/ynh_lxd
Normal file
6
lib/ynh_lxd
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# LXD HELPERS
|
||||
#=================================================
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# RUNNING SNAPSHOT
|
||||
# PACKAGE_CHECK HELPERS
|
||||
#=================================================
|
||||
|
||||
LXC_CREATE () {
|
||||
|
@ -221,3 +221,92 @@ RUN_INSIDE_LXC() {
|
|||
lxc exec $LXC_NAME -- "$@"
|
||||
}
|
||||
|
||||
set_witness_files () {
|
||||
# Create files to check if the remove script does not remove them accidentally
|
||||
log_debug "Create witness files..."
|
||||
|
||||
create_witness_file () {
|
||||
[ "$2" = "file" ] && local action="touch" || local action="mkdir -p"
|
||||
RUN_INSIDE_LXC $action $1
|
||||
}
|
||||
|
||||
# Nginx conf
|
||||
create_witness_file "/etc/nginx/conf.d/$DOMAIN.d/witnessfile.conf" file
|
||||
create_witness_file "/etc/nginx/conf.d/$SUBDOMAIN.d/witnessfile.conf" file
|
||||
|
||||
# /etc
|
||||
create_witness_file "/etc/witnessfile" file
|
||||
|
||||
# /opt directory
|
||||
create_witness_file "/opt/witnessdir" directory
|
||||
|
||||
# /var/www directory
|
||||
create_witness_file "/var/www/witnessdir" directory
|
||||
|
||||
# /home/yunohost.app/
|
||||
create_witness_file "/home/yunohost.app/witnessdir" directory
|
||||
|
||||
# /var/log
|
||||
create_witness_file "/var/log/witnessfile" file
|
||||
|
||||
# Config fpm
|
||||
create_witness_file "/etc/php/$DEFAULT_PHP_VERSION/fpm/pool.d/witnessfile.conf" file
|
||||
|
||||
# Config logrotate
|
||||
create_witness_file "/etc/logrotate.d/witnessfile" file
|
||||
|
||||
# Config systemd
|
||||
create_witness_file "/etc/systemd/system/witnessfile.service" file
|
||||
|
||||
# Database
|
||||
RUN_INSIDE_LXC mysqladmin --wait status > /dev/null 2>&1
|
||||
echo "CREATE DATABASE witnessdb" | RUN_INSIDE_LXC mysql --wait > /dev/null 2>&1
|
||||
}
|
||||
|
||||
check_witness_files () {
|
||||
# Check all the witness files, to verify if them still here
|
||||
|
||||
check_file_exist () {
|
||||
if RUN_INSIDE_LXC test ! -e "$1"
|
||||
then
|
||||
log_error "The file $1 is missing ! Something gone wrong !"
|
||||
SET_RESULT "failure" witness
|
||||
fi
|
||||
}
|
||||
|
||||
# Nginx conf
|
||||
check_file_exist "/etc/nginx/conf.d/$DOMAIN.d/witnessfile.conf"
|
||||
check_file_exist "/etc/nginx/conf.d/$SUBDOMAIN.d/witnessfile.conf"
|
||||
|
||||
# /etc
|
||||
check_file_exist "/etc/witnessfile"
|
||||
|
||||
# /opt directory
|
||||
check_file_exist "/opt/witnessdir"
|
||||
|
||||
# /var/www directory
|
||||
check_file_exist "/var/www/witnessdir"
|
||||
|
||||
# /home/yunohost.app/
|
||||
check_file_exist "/home/yunohost.app/witnessdir"
|
||||
|
||||
# /var/log
|
||||
check_file_exist "/var/log/witnessfile"
|
||||
|
||||
# Config fpm
|
||||
check_file_exist "/etc/php/$DEFAULT_PHP_VERSION/fpm/pool.d/witnessfile.conf"
|
||||
|
||||
# Config logrotate
|
||||
check_file_exist "/etc/logrotate.d/witnessfile"
|
||||
|
||||
# Config systemd
|
||||
check_file_exist "/etc/systemd/system/witnessfile.service"
|
||||
|
||||
# Database
|
||||
if ! RUN_INSIDE_LXC mysqlshow witnessdb > /dev/null 2>&1
|
||||
then
|
||||
log_error "The database witnessdb is missing ! Something gone wrong !"
|
||||
SET_RESULT "failure" witness
|
||||
return 1
|
||||
fi
|
||||
}
|
Loading…
Add table
Reference in a new issue