mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
stretch compatibility
This commit is contained in:
parent
f62fdede0a
commit
20026923b0
5 changed files with 59 additions and 11 deletions
26
config
Normal file
26
config
Normal file
|
@ -0,0 +1,26 @@
|
|||
# Interface réseau principale de l'hôte
|
||||
iface=
|
||||
|
||||
# Adresse du dns
|
||||
dns=
|
||||
|
||||
# Forçage du dns
|
||||
dnsforce=
|
||||
|
||||
# Plage IP du conteneur
|
||||
PLAGE_IP=
|
||||
|
||||
# Domaine de test
|
||||
DOMAIN=
|
||||
|
||||
# Mot de passe
|
||||
YUNO_PWD=
|
||||
|
||||
# Nom du conteneur
|
||||
LXC_NAME=
|
||||
|
||||
# Nom du bridge
|
||||
LXC_BRIDGE=
|
||||
|
||||
# Distribution debian
|
||||
DISTRIB=
|
|
@ -319,7 +319,7 @@ fi
|
|||
|
||||
if [ -z "$main_iface" ]; then
|
||||
# Try to determine the main iface
|
||||
main_iface=$(sudo route | grep default | awk '{print $8;}')
|
||||
main_iface=$(sudo ip route | grep default | awk '{print $5;}')
|
||||
if [ -z $main_iface ]
|
||||
then
|
||||
echo -e "\e[91mUnable to find the name of the main iface.\e[0m"
|
||||
|
@ -376,7 +376,6 @@ test_user=package_checker
|
|||
source "$script_dir/sub_scripts/launcher.sh"
|
||||
source "$script_dir/sub_scripts/testing_process.sh"
|
||||
source "$script_dir/sub_scripts/log_extractor.sh"
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# Check LXC
|
||||
|
|
|
@ -15,6 +15,7 @@ then
|
|||
dns=$(cat "$pcheck_config" | grep dns= | cut -d '=' -f2)
|
||||
dnsforce=$(cat "$pcheck_config" | grep dnsforce= | cut -d '=' -f2)
|
||||
main_iface=$(cat "$pcheck_config" | grep iface= | cut -d '=' -f2)
|
||||
DISTRIB=$(cat "$pcheck_config" | grep DISTRIB= | cut -d '=' -f2)
|
||||
fi
|
||||
|
||||
LOG_BUILD_LXC="$script_dir/Build_lxc.log"
|
||||
|
@ -24,12 +25,14 @@ test -n "$YUNO_PWD" || YUNO_PWD=admin
|
|||
test -n "$LXC_NAME" || LXC_NAME=pchecker_lxc
|
||||
test -n "$LXC_BRIDGE" || LXC_BRIDGE=lxc-pchecker
|
||||
test -n "$dnsforce" || dnsforce=1
|
||||
test -n "$DISTRIB" || DISTRIB=jessie
|
||||
ARG_SSH="-t"
|
||||
|
||||
# Tente de définir l'interface réseau principale
|
||||
if [ -z $main_iface ] # Si main_iface est vide, tente de le trouver.
|
||||
then
|
||||
main_iface=$(sudo route | grep default.*0.0.0.0 -m1 | awk '{print $8;}') # Prend l'interface réseau défini par default
|
||||
# main_iface=$(sudo route | grep default.*0.0.0.0 -m1 | awk '{print $8;}') # Prend l'interface réseau défini par default
|
||||
main_iface=$(sudo ip route | grep default | awk '{print $5;}') # Prend l'interface réseau défini par default
|
||||
if [ -z $main_iface ]; then
|
||||
echo -e "\e[91mImpossible de déterminer le nom de l'interface réseau de l'hôte.\e[0m"
|
||||
exit 1
|
||||
|
@ -38,7 +41,8 @@ fi
|
|||
|
||||
if [ -z $dns ] # Si l'adresse du dns est vide, tente de le déterminer à partir de la passerelle par défaut.
|
||||
then
|
||||
dns=$(sudo route -n | grep ^0.0.0.0.*$main_iface | awk '{print $2;}')
|
||||
# dns=$(sudo route -n | grep ^0.0.0.0.*$main_iface | awk '{print $2;}')
|
||||
dns=$(sudo ip route | grep default | awk '{print $3;}')
|
||||
if [ -z $dns ]; then
|
||||
echo -e "\e[91mImpossible de déterminer l'adresse de la passerelle.\e[0m"
|
||||
exit 1
|
||||
|
@ -60,11 +64,15 @@ echo -e "# Domaine de test\nDOMAIN=$DOMAIN\n" >> "$pcheck_config"
|
|||
echo -e "# Mot de passe\nYUNO_PWD=$YUNO_PWD\n" >> "$pcheck_config"
|
||||
echo -e "# Nom du conteneur\nLXC_NAME=$LXC_NAME\n" >> "$pcheck_config"
|
||||
echo -e "# Nom du bridge\nLXC_BRIDGE=$LXC_BRIDGE\n" >> "$pcheck_config"
|
||||
echo -e "# Distribution debian\nDISTRIB=$DISTRIB\n" >> "$pcheck_config"
|
||||
|
||||
echo -e "\e[1m> Update et install lxc lxctl\e[0m" | tee "$LOG_BUILD_LXC"
|
||||
sudo apt-get update >> "$LOG_BUILD_LXC" 2>&1
|
||||
sudo apt-get install -y lxc lxctl >> "$LOG_BUILD_LXC" 2>&1
|
||||
|
||||
echo -e "\e[1m> Install git curl\e[0m" | tee "$LOG_BUILD_LXC"
|
||||
sudo apt-get install -y git curl >> "$LOG_BUILD_LXC" 2>&1
|
||||
|
||||
sudo mkdir -p /var/lib/lxcsnaps # Créer le dossier lxcsnaps, pour s'assurer que lxc utilisera ce dossier, même avec lxc 2.
|
||||
|
||||
if sudo lxc-info -n $LXC_NAME > /dev/null 2>&1
|
||||
|
@ -75,8 +83,8 @@ then # Si le conteneur existe déjà
|
|||
sudo lxc-destroy -n $LXC_NAME -f | tee -a "$LOG_BUILD_LXC"
|
||||
fi
|
||||
|
||||
echo -e "\e[1m> Création d'une machine debian jessie minimaliste.\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||
sudo lxc-create -n $LXC_NAME -t debian -- -r jessie >> "$LOG_BUILD_LXC" 2>&1
|
||||
echo -e "\e[1m> Création d'une machine debian $DISTRIB minimaliste.\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||
sudo lxc-create -n $LXC_NAME -t debian -- -r $DISTRIB >> "$LOG_BUILD_LXC" 2>&1
|
||||
|
||||
echo -e "\e[1m> Autoriser l'ip forwarding, pour router vers la machine virtuelle.\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||
echo "net.ipv4.ip_forward=1" | sudo tee /etc/sysctl.d/lxc_pchecker.conf >> "$LOG_BUILD_LXC" 2>&1
|
||||
|
@ -140,7 +148,7 @@ if [ -e $HOME/.ssh/$LXC_NAME ]; then
|
|||
rm -f $HOME/.ssh/$LXC_NAME $HOME/.ssh/$LXC_NAME.pub
|
||||
ssh-keygen -f $HOME/.ssh/known_hosts -R $PLAGE_IP.2
|
||||
fi
|
||||
ssh-keygen -t dsa -f $HOME/.ssh/$LXC_NAME -P '' >> "$LOG_BUILD_LXC" 2>&1
|
||||
ssh-keygen -t rsa -f $HOME/.ssh/$LXC_NAME -P '' >> "$LOG_BUILD_LXC" 2>&1
|
||||
sudo mkdir /var/lib/lxc/$LXC_NAME/rootfs/home/pchecker/.ssh >> "$LOG_BUILD_LXC" 2>&1
|
||||
sudo cp $HOME/.ssh/$LXC_NAME.pub /var/lib/lxc/$LXC_NAME/rootfs/home/pchecker/.ssh/authorized_keys >> "$LOG_BUILD_LXC" 2>&1
|
||||
sudo lxc-attach -n $LXC_NAME -- chown pchecker: -R /home/pchecker/.ssh >> "$LOG_BUILD_LXC" 2>&1
|
||||
|
@ -159,7 +167,12 @@ if [ "$?" -ne 0 ]; then # Si l'utilisateur tarde trop, la connexion sera refusé
|
|||
ssh $ARG_SSH $LXC_NAME "exit 0" # Initie une premier connexion SSH pour valider la clé.
|
||||
fi
|
||||
|
||||
ssh $ARG_SSH $LXC_NAME "git clone https://github.com/YunoHost/install_script /tmp/install_script" >> "$LOG_BUILD_LXC" 2>&1
|
||||
if [ "$DISTRIB" == "stretch" ]; then
|
||||
branch="--branch stretch"
|
||||
else
|
||||
branch=""
|
||||
fi
|
||||
ssh $ARG_SSH $LXC_NAME "git clone https://github.com/YunoHost/install_script $branch /tmp/install_script" >> "$LOG_BUILD_LXC" 2>&1
|
||||
echo -e "\e[1m> Installation de Yunohost...\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||
ssh $ARG_SSH $LXC_NAME "cd /tmp/install_script; sudo ./install_yunohost -a" | tee -a "$LOG_BUILD_LXC" 2>&1
|
||||
echo -e "\e[1m> Post install Yunohost\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||
|
|
|
@ -42,7 +42,7 @@ if [ -z "$LXC_BRIDGE" ]; then
|
|||
fi
|
||||
if [ -z "$main_iface" ]; then
|
||||
# Tente de définir l'interface réseau principale
|
||||
main_iface=$(sudo route | grep default | awk '{print $8;}') # Prend l'interface réseau défini par default
|
||||
main_iface=$(sudo ip route | grep default | awk '{print $5;}') # Prend l'interface réseau défini par default
|
||||
if [ -z $main_iface ]; then
|
||||
echo -e "\e[91mImpossible de déterminer le nom de l'interface réseau de l'hôte.\e[0m"
|
||||
exit 1
|
||||
|
|
|
@ -1332,7 +1332,12 @@ set_witness_files () {
|
|||
create_witness_file "/var/log/witnessfile" file
|
||||
|
||||
# Config fpm
|
||||
if [ -d "/etc/php5" ]; then
|
||||
create_witness_file "/etc/php5/fpm/pool.d/witnessfile.conf" file
|
||||
fi
|
||||
if [ -d "/etc/php/7.0" ]; then
|
||||
create_witness_file "/etc/php/7.0/fpm/pool.d/witnessfile.conf" file
|
||||
fi
|
||||
|
||||
# Config logrotate
|
||||
create_witness_file "/etc/logrotate.d/witnessfile" file
|
||||
|
@ -1378,7 +1383,12 @@ check_witness_files () {
|
|||
check_file_exist "/var/log/witnessfile"
|
||||
|
||||
# Config fpm
|
||||
check_file_exist "/etc/php5/fpm/pool.d/witnessfile.conf"
|
||||
if [ -d "/etc/php5" ]; then
|
||||
check_file_exist "/etc/php5/fpm/pool.d/witnessfile.conf" file
|
||||
fi
|
||||
if [ -d "/etc/php/7.0" ]; then
|
||||
check_file_exist "/etc/php/7.0/fpm/pool.d/witnessfile.conf" file
|
||||
fi
|
||||
|
||||
# Config logrotate
|
||||
check_file_exist "/etc/logrotate.d/witnessfile"
|
||||
|
|
Loading…
Add table
Reference in a new issue