mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Fix arguments parsing
This commit is contained in:
parent
e3fd48f2ac
commit
23bef139d3
2 changed files with 60 additions and 54 deletions
|
@ -67,6 +67,8 @@ else
|
||||||
arguments=${arguments//--bash-mode/-y}
|
arguments=${arguments//--bash-mode/-y}
|
||||||
|
|
||||||
# Read and parse all the arguments
|
# Read and parse all the arguments
|
||||||
|
# Use a function here, to use standart arguments $@ and use more simply getopts and shift.
|
||||||
|
parse_arg () {
|
||||||
while [ $# -ne 0 ]
|
while [ $# -ne 0 ]
|
||||||
do
|
do
|
||||||
# Initialize the index of getopts
|
# Initialize the index of getopts
|
||||||
|
@ -114,6 +116,10 @@ else
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Call parse_arg and pass the modified list of args.
|
||||||
|
parse_arg $arguments
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prevent a conflict between --interrupt and --bash-mode
|
# Prevent a conflict between --interrupt and --bash-mode
|
||||||
|
|
|
@ -82,7 +82,7 @@ LXC_START () {
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Failed if the container failed to start
|
# Fail if the container failed to start
|
||||||
if [ $i -eq $max_try ] && [ $failstart -eq 1 ]
|
if [ $i -eq $max_try ] && [ $failstart -eq 1 ]
|
||||||
then
|
then
|
||||||
ECHO_FORMAT "The container failed to start $max_try times...\nIf this problem is persistent, try to fix it with lxc_check.sh." "red" "bold"
|
ECHO_FORMAT "The container failed to start $max_try times...\nIf this problem is persistent, try to fix it with lxc_check.sh." "red" "bold"
|
||||||
|
@ -92,7 +92,7 @@ LXC_START () {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Count the number of line of the current yunohost log file.
|
# Count the number of lines of the current yunohost log file.
|
||||||
COPY_LOG 1
|
COPY_LOG 1
|
||||||
|
|
||||||
# Copy the package into the container.
|
# Copy the package into the container.
|
||||||
|
@ -142,9 +142,9 @@ LXC_STOP () {
|
||||||
}
|
}
|
||||||
|
|
||||||
LXC_TURNOFF () {
|
LXC_TURNOFF () {
|
||||||
# Deactivate LXC network
|
# Disable LXC network
|
||||||
|
|
||||||
echo "Deactivate iptables rules."
|
echo "Disable iptables rules."
|
||||||
if sudo iptables --check FORWARD --in-interface $lxc_bridge --out-interface $main_iface --jump ACCEPT 2> /dev/null
|
if sudo iptables --check FORWARD --in-interface $lxc_bridge --out-interface $main_iface --jump ACCEPT 2> /dev/null
|
||||||
then
|
then
|
||||||
sudo iptables --delete FORWARD --in-interface $lxc_bridge --out-interface $main_iface --jump ACCEPT >> "$test_result" 2>&1
|
sudo iptables --delete FORWARD --in-interface $lxc_bridge --out-interface $main_iface --jump ACCEPT >> "$test_result" 2>&1
|
||||||
|
@ -158,7 +158,7 @@ LXC_TURNOFF () {
|
||||||
sudo iptables --table nat --delete POSTROUTING --source $ip_range.0/24 --jump MASQUERADE | tee --append "$test_result" 2>&1
|
sudo iptables --table nat --delete POSTROUTING --source $ip_range.0/24 --jump MASQUERADE | tee --append "$test_result" 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Deactivate the network bridge."
|
echo "Disable the network bridge."
|
||||||
if sudo ifquery $lxc_bridge --state > /dev/null
|
if sudo ifquery $lxc_bridge --state > /dev/null
|
||||||
then
|
then
|
||||||
sudo ifdown --force $lxc_bridge | tee --append "$test_result" 2>&1
|
sudo ifdown --force $lxc_bridge | tee --append "$test_result" 2>&1
|
||||||
|
@ -168,7 +168,7 @@ LXC_TURNOFF () {
|
||||||
LXC_CONNECT_INFO () {
|
LXC_CONNECT_INFO () {
|
||||||
# Print access information
|
# Print access information
|
||||||
|
|
||||||
echo "> For access the container:"
|
echo "> To access the container:"
|
||||||
echo "To execute one command:"
|
echo "To execute one command:"
|
||||||
echo -e "\e[1msudo lxc-attach -n $lxc_name -- command\e[0m"
|
echo -e "\e[1msudo lxc-attach -n $lxc_name -- command\e[0m"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue