mirror of
https://github.com/YunoHost-Apps/hotspot_ynh.git
synced 2024-09-03 19:25:53 +02:00
Fix conflict with future vpnclient app
This commit is contained in:
parent
76245a8b11
commit
4b33a1209f
3 changed files with 29 additions and 27 deletions
|
@ -37,14 +37,6 @@
|
||||||
"example": "wlan0",
|
"example": "wlan0",
|
||||||
"default": "wlan0"
|
"default": "wlan0"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "Wired device",
|
|
||||||
"ask": {
|
|
||||||
"en": "Select your wired interface (internet side)"
|
|
||||||
},
|
|
||||||
"example": "eth0",
|
|
||||||
"default": "eth0"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "IPv6 network",
|
"name": "IPv6 network",
|
||||||
"ask": {
|
"ask": {
|
||||||
|
|
|
@ -4,40 +4,44 @@
|
||||||
wifi_ssid=$1
|
wifi_ssid=$1
|
||||||
wifi_passphrase=$2
|
wifi_passphrase=$2
|
||||||
wifi_device=$3
|
wifi_device=$3
|
||||||
wired_device=$4
|
ip6_net=$4
|
||||||
ip6_net=$5
|
ip6_dns0=$5
|
||||||
ip6_dns0=$6
|
ip6_dns1=$6
|
||||||
ip6_dns1=$7
|
ip4_dns0=$7
|
||||||
ip4_dns0=$8
|
ip4_dns1=$8
|
||||||
ip4_dns1=$9
|
|
||||||
|
|
||||||
# Check arguments
|
# Check arguments
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
# Save arguments for future upgrades
|
|
||||||
sudo yunohost app setting hotspot wifi_ssid -v $wifi_ssid
|
|
||||||
sudo yunohost app setting hotspot wifi_passphrase -v $wifi_passphrase
|
|
||||||
sudo yunohost app setting hotspot wifi_device -v $wifi_device
|
|
||||||
sudo yunohost app setting hotspot wired_device -v $wired_device
|
|
||||||
sudo yunohost app setting hotspot ip6_net -v $ip6_net
|
|
||||||
sudo yunohost app setting hotspot ip6_dns0 -v $ip6_dns0
|
|
||||||
sudo yunohost app setting hotspot ip6_dns1 -v $ip6_dns1
|
|
||||||
sudo yunohost app setting hotspot ip4_dns0 -v $ip4_dns0
|
|
||||||
sudo yunohost app setting hotspot ip4_dns1 -v $ip4_dns1
|
|
||||||
|
|
||||||
# Install packages
|
# Install packages
|
||||||
sudo apt-get --assume-yes --force-yes install hostapd radvd isc-dhcp-server
|
# TODO: Replace isc-dhcp-server by dnsmasq (currently negotiating with the YunoHost team to
|
||||||
|
# also replace bind9 by dnsmasq)
|
||||||
|
sudo apt-get --assume-yes --force-yes install hostapd radvd isc-dhcp-server iptables
|
||||||
|
|
||||||
# Install extra packages
|
# Install extra packages
|
||||||
sudo apt-get --assume-yes --force-yes install sipcalc
|
sudo apt-get --assume-yes --force-yes install sipcalc
|
||||||
|
|
||||||
# Compute extra arguments
|
# Compute extra arguments
|
||||||
|
wired_device=$(ip r | awk '/default via/ { print $NF; }')
|
||||||
ip6_expanded_net=$(sipcalc ${ip6_net} | grep Expanded | awk '{ print $NF; }')
|
ip6_expanded_net=$(sipcalc ${ip6_net} | grep Expanded | awk '{ print $NF; }')
|
||||||
ip6_net=$(sipcalc ${ip6_net} | grep Compressed | awk '{ print $NF; }')
|
ip6_net=$(sipcalc ${ip6_net} | grep Compressed | awk '{ print $NF; }')
|
||||||
ip6_addr=$(echo "$(echo ${ip6_expanded_net} | cut -d: -f1-7):42")
|
ip6_addr=$(echo "$(echo ${ip6_expanded_net} | cut -d: -f1-7):42")
|
||||||
ip6_addr=$(sipcalc ${ip6_addr} | grep Compressed | awk '{ print $NF; }')
|
ip6_addr=$(sipcalc ${ip6_addr} | grep Compressed | awk '{ print $NF; }')
|
||||||
ip4_nat_prefix=10.0.242
|
ip4_nat_prefix=10.0.242
|
||||||
|
|
||||||
|
# Save arguments for future upgrades
|
||||||
|
sudo yunohost app setting hotspot wifi_ssid -v ${wifi_ssid}
|
||||||
|
sudo yunohost app setting hotspot wifi_passphrase -v ${wifi_passphrase}
|
||||||
|
sudo yunohost app setting hotspot wifi_device -v ${wifi_device}
|
||||||
|
sudo yunohost app setting hotspot wired_device -v ${wired_device}
|
||||||
|
sudo yunohost app setting hotspot ip6_addr -v ${ip6_addr}
|
||||||
|
sudo yunohost app setting hotspot ip6_net -v ${ip6_net}
|
||||||
|
sudo yunohost app setting hotspot ip6_dns0 -v ${ip6_dns0}
|
||||||
|
sudo yunohost app setting hotspot ip6_dns1 -v ${ip6_dns1}
|
||||||
|
sudo yunohost app setting hotspot ip4_dns0 -v ${ip4_dns0}
|
||||||
|
sudo yunohost app setting hotspot ip4_dns1 -v ${ip4_dns1}
|
||||||
|
sudo yunohost app setting hotspot ip4_nat_prefix -v ${ip4_nat_prefix}
|
||||||
|
|
||||||
# Copy confs
|
# Copy confs
|
||||||
sudo install -b -o root -g root -m 0644 ../conf/hostapd.conf /etc/hostapd/
|
sudo install -b -o root -g root -m 0644 ../conf/hostapd.conf /etc/hostapd/
|
||||||
sudo install -b -o root -g root -m 0644 ../conf/radvd.conf /etc/
|
sudo install -b -o root -g root -m 0644 ../conf/radvd.conf /etc/
|
||||||
|
@ -74,6 +78,12 @@ sudo sed "s|<TPL:WIRED_DEVICE>|${wired_device}|g" -i /etc/init.d/ynh-hotspot
|
||||||
## hostapd
|
## hostapd
|
||||||
sudo sed 's|^DAEMON_CONF=$|&/etc/hostapd/hostapd.conf|' -i /etc/init.d/hostapd
|
sudo sed 's|^DAEMON_CONF=$|&/etc/hostapd/hostapd.conf|' -i /etc/init.d/hostapd
|
||||||
|
|
||||||
|
# Remove IPv6 address if vpnclient is installed because from now this one is handle by this app
|
||||||
|
yunohost app list -f vpnclient --json | grep -q '"installed": true'
|
||||||
|
if [ "$?" -eq 0 ]; then
|
||||||
|
ip a d ${ip6_addr}/128 dev tun0 &> /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
# Set default inits
|
# Set default inits
|
||||||
# The boot order of these services are important, so they are disabled by default
|
# The boot order of these services are important, so they are disabled by default
|
||||||
# and the ynh-hotspot service handles them.
|
# and the ynh-hotspot service handles them.
|
||||||
|
|
|
@ -10,7 +10,7 @@ sudo rm -rf /etc/hostapd/ /etc/radvd.conf /etc/dhcp/dhcpd.conf
|
||||||
|
|
||||||
# Remove packets
|
# Remove packets
|
||||||
# The yunohost policy is currently to not uninstall packets (dependency problems)
|
# The yunohost policy is currently to not uninstall packets (dependency problems)
|
||||||
## sudo apt-get --assume-yes --force-yes remove hostapd radvd isc-dhcp-server
|
## sudo apt-get --assume-yes --force-yes remove hostapd radvd isc-dhcp-server iptables
|
||||||
## sudo apt-get --assume-yes --force-yes remove sipcalc
|
## sudo apt-get --assume-yes --force-yes remove sipcalc
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue