Skip to content
Snippets Groups Projects
Select Git revision
  • 66902c71f542190c2b754ffc0635c4f9f14850ec
  • experimental default protected
  • v2023.2.5-ffs
  • nrb/ex400-remove-wps
  • nrb/airmax-test
  • v2023.2.4-ffs
  • nrb/ar9344-reset-sequence
  • autinerd/experimental-openwrt-24.10
  • v2023.2.3-ffs
  • v2023.2.2-ffs
  • v2023.2-ffs
  • v2023.1-ffs
  • v2022.1.4-ffs
  • feature/addMikrotikwAP
  • v2022.1.3-ffs
  • v2021.1.2-ffs
  • v2022.1.1-ffs
  • master protected
  • v2021.1.1-ffs
  • nrb/gluon-master-cpe510
  • v2021.1-ffs
  • experimental-2025-10-23
  • experimental-2025-10-23-base
  • experimental-2025-10-22
  • experimental-2025-10-22-base
  • experimental-2025-10-19
  • experimental-2025-10-19-base
  • experimental-2025-10-15
  • experimental-2025-10-15-base
  • experimental-2025-10-12
  • experimental-2025-10-12-base
  • experimental-2025-10-06
  • experimental-2025-10-06-base
  • experimental-2025-10-02
  • experimental-2025-10-02-base
  • experimental-2025-09-19
  • experimental-2025-09-19-base
  • experimental-2025-09-15
  • experimental-2025-09-15-base
  • experimental-2025-09-12
  • experimental-2025-09-12-base
41 results

modules

Blame
  • zzz-gluon-upgrade 1.62 KiB
    #!/bin/sh
    
    
    UPGRADE_DIR=/lib/gluon/upgrade
    VERSION_DIR=/lib/gluon/version
    
    
    version_of() {
    	opkg status "gluon-$1" | grep '^Version: ' | cut -d' ' -f 2
    }
    
    oldversion_of() {
    	oldversion="$(cat "$VERSION_DIR"/"$1" 2>/dev/null)"
    
    	# Legacy support
    	if [ -z "$oldversion" ]; then oldversion="$(cat /etc/.freifunk_version_keep 2>/dev/null)"; fi
    	if [ -z "$oldversion" ]; then oldversion="$(cat /etc/.lff_version_keep 2>/dev/null)"; fi
    	if [ -z "$oldversion" ]; then oldversion="$(cat /etc/.kff_version_keep 2>/dev/null)"; fi
    
    	echo "$oldversion"
    }
    
    do_dir() {
    	if [ -d "$1" ]; then
    		local s
    		for s in "$1"/*; do "$s"; done
    	fi
    }
    
    
    version="$(version_of gluon-core)"
    
    oldversion="$(cat "$VERSION_FILE" 2>/dev/null)"
    if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_FREIFUNK" 2>/dev/null)"; fi
    if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_LFF" 2>/dev/null)"; fi
    if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_KFF" 2>/dev/null)"; fi
    
    (
    	cd "$UPGRADE_DIR"
    
    	for component in *; do (
    		local version="$(version_of "$component")"
    		if [ -z "$version" ]; then continue; fi
    
    		cd "$component"
    
    		local oldversion="$(oldversion_of "$component")"
    		if [ -z "$oldversion" ]; then
    			do_dir initial
    		else
    			local v
    
    			for v in *; do
    				if [ "$v" = initial -o "$v" = invariant -o "$v" = version ]; then continue; fi
    
    				# The return value of opkg compare-versions is negated
    				if ! opkg compare-versions "$v" '>>' "$oldversion"; then
    					do_dir "$v"
    				fi
    			done
    		fi
    
    		do_dir invariant
    
    		echo "$version" > "$VERSION_DIR"/"$component"
    	) done
    )
    
    rm -f "$VERSION_FILE_FREIFUNK" "$VERSION_FILE_LFF" "$VERSION_FILE_KFF"