Skip to content

Commit

Permalink
Merge branch 'migration_for_v1.0.1'
Browse files Browse the repository at this point in the history
This brings pre-v1.0.0 and v1.0.0 together to something v1.0.1.
It also adds a setting ffberlin-uplink.preset which stores the current
and previous uplink-preset used. This can be used to automate the
transition between different types.
  • Loading branch information
SvenRoederer committed May 26, 2018
2 parents 0541ad0 + 60a6861 commit 2c74219
Show file tree
Hide file tree
Showing 12 changed files with 130 additions and 23 deletions.
6 changes: 2 additions & 4 deletions defaults/freifunk-berlin-openvpn-files/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=freifunk-berlin-openvpn-files
PKG_VERSION:=0.0.7
PKG_RELEASE:=2
PKG_VERSION:=0.0.8
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)

Expand Down Expand Up @@ -40,8 +40,6 @@ define Package/freifunk-berlin-openvpn-files/install
$(CP) ./openvpn/ffvpn-up.sh $(1)/lib/freifunk
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(CP) ./openvpn/60-ffopenvpn $(1)/etc/hotplug.d/iface
$(INSTALL_DIR) $(1)/etc/config
$(CP) ./files/ffberlin-uplink $(1)/etc/config
endef

$(eval $(call BuildPackage,freifunk-berlin-openvpn-files))
4 changes: 0 additions & 4 deletions defaults/freifunk-berlin-openvpn-files/files/ffberlin-uplink

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/sh

# set set auth-type required for this uplink-type, e.g. for freifunk-wizard
uci -q get ffberlin-uplink || echo "" | uci import ffberlin-uplink
uci set ffberlin-uplink.uplink=settings
uci set ffberlin-uplink.uplink.auth=x509
uci commit ffberlin-uplink.uplink

uci -q delete openvpn.custom_config
uci -q delete openvpn.sample_server
uci -q delete openvpn.sample_client
Expand Down
4 changes: 1 addition & 3 deletions uplinks/freifunk-berlin-uplink-no-tunnel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=freifunk-berlin-uplink-notunnel-files
PKG_VERSION:=0.0.5
PKG_VERSION:=0.0.6
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
Expand Down Expand Up @@ -40,8 +40,6 @@ define Package/$(PKG_NAME)/install
$(CP) ./uci-defaults/* $(1)/etc/uci-defaults
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(CP) ./files/60-ffuplink $(1)/etc/hotplug.d/iface
$(INSTALL_DIR) $(1)/etc/config
$(CP) ./files/ffberlin-uplink $(1)/etc/config
endef

$(eval $(call BuildPackage,$(PKG_NAME)))

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,31 @@
uci set firewall.zone_ffuplink.masq=1
uci commit firewall

# create ffberlin-uplink file an fill with basic settings
uci -q get ffberlin-uplink || echo "" | uci import ffberlin-uplink
uci >/dev/null -q get ffberlin-uplink.preset || uci set ffberlin-uplink.preset=settings
uci >/dev/null -q get ffberlin-uplink.preset.current || uci set ffberlin-uplink.preset.current="no-tunnel"
if [[ $(uci get ffberlin-uplink.preset.current) != "no-tunnel" ]]; then
uci rename ffberlin-uplink.preset.current=previous
uci set ffberlin-uplink.preset.current="no-tunnel"
fi
# set set auth-type required for this uplink-type, e.g. for freifunk-wizard
uci set ffberlin-uplink.uplink=settings
uci set ffberlin-uplink.uplink.auth=none

uci commit ffberlin-uplink

. /lib/functions/guard.sh
guard "notunnel"

uci delete network.ffuplink_dev
uci set network.ffuplink_dev=device
uci set network.ffuplink_dev.type=veth
uci set network.ffuplink_dev.name=ffuplink
uci set network.ffuplink_dev.peer_name=ffuplink_wan
# add ffuplink_dev to br-wan
uci set network.wan.ifname="$(uci get network.wan.ifname) ffuplink_wan"
uci commit network

. /lib/functions/guard.sh
guard "notunnel"
uci commit network.ffuplink_dev

uci delete network.ffuplink
uci set network.ffuplink=interface
Expand Down
2 changes: 1 addition & 1 deletion uplinks/freifunk-berlin-uplink-tunnelberlin-files/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=freifunk-berlin-uplink-tunnelberlin-files
PKG_VERSION:=0.0.2
PKG_VERSION:=0.0.3
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
uci set firewall.zone_ffuplink.masq=1
uci commit firewall

uci -q get ffberlin-uplink || echo "" | uci import ffberlin-uplink
uci >/dev/null -q get ffberlin-uplink.preset || uci set ffberlin-uplink.preset=settings
uci >/dev/null -q get ffberlin-uplink.preset.current || uci set ffberlin-uplink.preset.current="tunnelberlin_openvpn"
if [[ $(uci get ffberlin-uplink.preset.current) != '"tunnelberlin_openvpn"' ]]; then
uci rename ffberlin-uplink.preset.current=previous
uci set ffberlin-uplink.preset.current="tunnelberlin_openvpn"
fi
uci commit ffberlin-uplink

. /lib/functions/guard.sh
guard "tunnelberlin_openvpn"

Expand Down
2 changes: 1 addition & 1 deletion uplinks/freifunk-berlin-uplink-vpn03-files/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=freifunk-berlin-uplink-vpn03-files
PKG_VERSION:=0.0.4
PKG_VERSION:=0.0.5
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
uci set firewall.zone_ffuplink.masq=0
uci commit firewall

uci -q get ffberlin-uplink || echo "" | uci import ffberlin-uplink
uci >/dev/null -q get ffberlin-uplink.preset || uci set ffberlin-uplink.preset=settings
uci >/dev/null -q get ffberlin-uplink.preset.current || uci set ffberlin-uplink.preset.current="vpn03_openvpn"
if [[ $(uci get ffberlin-uplink.preset.current) != 'vpn03_openvpn' ]]; then
uci rename ffberlin-uplink.preset.current=previous
uci set ffberlin-uplink.preset.current="vpn03_openvpn"
fi
uci commit ffberlin-uplink

. /lib/functions/guard.sh
guard "vpn03_openvpn"

Expand Down
2 changes: 1 addition & 1 deletion utils/freifunk-berlin-migration/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=freifunk-berlin-migration
PKG_VERSION:=0.4.5
PKG_VERSION:=0.4.7
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ set_ipversion_olsrd6() {
r1_0_0_vpn03_splitconfig() {
log "changing guard-entry for VPN03 from openvpn to vpn03-openvpn (config-split for VPN03)"
guard_rename openvpn vpn03_openvpn # to guard the current settings of package "freifunk-berlin-vpn03-files"
guard openvpn # to guard the current settings of package "freifunk-berlin-openvpn-files"
}

r1_0_0_no_wan_restart() {
Expand Down Expand Up @@ -281,6 +280,17 @@ r1_0_0_change_to_ffuplink() {
return 1
fi
}
remove_routingpolicy() {
local config=$1
case "$config" in
olsr_*_ffvpn_ipv4*)
log " network.$config"
uci delete network.$config
;;
*) ;;
esac
}

log "changing interface ffvpn to ffuplink"
log " setting wan as bridge"
uci set network.wan.type=bridge
Expand All @@ -304,8 +314,72 @@ r1_0_0_change_to_ffuplink() {
reset_cb
config_load olsrd
config_foreach change_olsrd_dygw_ping_iface LoadPlugin
log " removing deprecated IP-rules"
reset_cb
config_load network
config_foreach remove_routingpolicy rule
}

r1_0_0_update_preliminary_glinet_names() {
case `uci get system.led_wlan.sysfs` in
"gl_ar150:wlan")
log "correcting system.led_wlan.sysfs for GLinet AR150"
uci set system.led_wlan.sysfs="gl-ar150:wlan"
;;
"gl_ar300:wlan")
log "correcting system.led_wlan.sysfs for GLinet AR300"
uci set system.led_wlan.sysfs="gl-ar300:wlan"
;;
"domino:blue:wlan")
log "correcting system.led_wlan.sysfs for GLinet Domino"
uci set system.led_wlan.sysfs="gl-domino:blue:wlan"
;;
esac
}

r1_0_0_upstream() {
log "applying upstream changes / sync with upstream"
grep -q "^kernel.core_pattern=" /etc/sysctl.conf || echo >>/etc/sysctl.conf "kernel.core_pattern=/tmp/%e.%t.%p.%s.core"
sed -i '/^net.ipv4.tcp_ecn=0/d' /etc/sysctl.conf
grep -q "^128" /etc/iproute2/rt_tables || echo >>/etc/iproute2/rt_tables "128 prelocal"
cp /rom/etc/inittab /etc/inittab
cp /rom/etc/profile /etc/profile
cp /rom/etc/hosts /etc/hosts
log " checking for user dnsmasq"
group_exists "dnsmasq" || group_add "dnsmasq" "453"
user_exists "dnsmasq" || user_add "dnsmasq" "453" "453"
}

r1_0_0_set_uplinktype() {
log "storing used uplink-type"
log " migrating from Kathleen-release, assuming VPN03 as uplink-preset"
echo "" | uci import ffberlin-uplink
uci set ffberlin-uplink.preset=settings
uci set ffberlin-uplink.preset.current="vpn03_openvpn"
}

r1_0_1_set_uplinktype() {
uci >/dev/null -q get ffberlin-uplink.preset && return 0

log "storing used uplink-type for Hedy"
uci set ffberlin-uplink.preset=settings
uci set ffberlin-uplink.preset.current="unknown"
if [ "$(uci -q get network.ffuplink_dev.type)" = "veth" ]; then
uci set ffberlin-uplink.preset.current="no-tunnel"
else
case "$(uci -q get openvpn.ffuplink.remote)" in
\'vpn03.berlin.freifunk.net*)
uci set ffberlin-uplink.preset.current="vpn03_openvpn"
;;
\'tunnel-gw.berlin.freifunk.net*)
uci set ffberlin-uplink.preset.current="tunnelberlin_openvpn"
;;
esac
fi
log " type set to $(uci get ffberlin-uplink.preset.current)"
}


migrate () {
log "Migrating from ${OLD_VERSION} to ${VERSION}."

Expand Down Expand Up @@ -350,6 +424,13 @@ migrate () {
r1_0_0_no_wan_restart
r1_0_0_firewallzone_uplink
r1_0_0_change_to_ffuplink
r1_0_0_update_preliminary_glinet_names
r1_0_0_upstream
r1_0_0_set_uplinktype
fi

if semverLT ${OLD_VERSION} "1.0.1"; then
r1_0_1_set_uplinktype
fi

# overwrite version with the new version
Expand Down

0 comments on commit 2c74219

Please sign in to comment.