[RFC PATCH] buildscript: remove community config

Adrian Schmutzler mail at adrianschmutzler.de
Mo Feb 12 18:58:34 CET 2018


Sehr schön, daran bin ich immer gescheitert.

Erste Kommentare unten.

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces at freifunk.net] On Behalf
> Of Tim Niemeyer
> Sent: Montag, 12. Februar 2018 18:04
> To: franken-dev at freifunk.net
> Subject: [RFC PATCH] buildscript: remove community config
> 
> The community file is not used anymore.
> 
> Signed-off-by: Tim Niemeyer <tim at tn-x.org>
> ---
> 
>  buildscript                                        | 47
++--------------------
>  community/franken.cfg                              |  8 ----
>  .../fff/fff-nodewatcher/files/usr/sbin/nodewatcher |  1 -
>  .../fff/fff-sysupgrade/files/etc/sysupgrade.sh     |  4 +-
>  .../fff/fff-web/files/www/ssl/cgi-bin/header       |  3 +-
>  5 files changed, 6 insertions(+), 57 deletions(-)  delete mode 100644
> community/franken.cfg
> 
> diff --git a/buildscript b/buildscript
> index ab092da..898120e 100755
> --- a/buildscript
> +++ b/buildscript
> @@ -195,18 +195,14 @@ prebuild() {
>      if [ 0 -ne $? ]; then
>          version=$(git log -1 --pretty=format:%h)
>      fi
> -    community=$(basename "$(realpath selected_community)" .cfg)
> 
>      {
>          echo "FIRMWARE_VERSION=\"$version\""
> -        echo "FIRMWARE_COMMUNITY=\"$community\""
>          echo "BUILD_DATE=\"build date: $(date)\""
>          echo "OPENWRT_CORE_REVISION=\"${OPENWRTREV}\""
>          echo "OPENWRT_FEEDS_PACKAGES_REVISION=\"${PACKAGEREV}\""
>      } > "$target"/files/etc/firmware_release
> 
> -    cp selected_community "$target"/files/etc/community.cfg
> -
>      opath=$(pwd)
>      cd "$target"
>      make defconfig
> @@ -274,9 +270,7 @@ config() {
>  }
> 
>  cp_firmware() {
> -    if [ "$community" = "franken" ]; then
> -        local community="fff"
> -    fi
> +    local community="fff"

"$community" wird in dem Block nur ein einziges Mal genutzt, würde ich da
hardcoden und die Variable rausschmeißen.

Falls "fff" noch an mehreren Stellen genutzt wird (ich konnte auf die
schnelle keine finden) könnte man auch überlegen, die Variable
"community="fff"" einmal am Anfang von buildscript zu setzen.

> 
>      [ -n "$subtarget" ] || subtarget="generic"
> 
> @@ -350,18 +344,6 @@ loadBSP()
>      . selected_bsp
>  }
> 
> -loadCommunity()
> -{
> -    echo "Working with $(/bin/ls -l selected_community | awk '{ print $11
}')"
> -    tpl_translate=$(awk -F= 'BEGIN{printf("sed")} /^.+$/{gsub("/", "\\/",
$0);
> printf(" -es/\\${%s}/%s/g",$1,$2)}' selected_community)
> -}
> -
> -setCommunity() {
> -    /bin/rm -rf selected_community
> -    /bin/ln -s "$1" selected_community
> -    loadCommunity
> -}
> -
>  setBSP()
>  {
>      /bin/rm -rf selected_bsp
> @@ -382,19 +364,13 @@ if [ "$(/usr/bin/id -u)" -eq 0 ]; then
>  	exit 1
>  fi
> 
> -if [ "$1" != "selectbsp" -a "$1" != "selectcommunity" ]; then
> +if [ "$1" != "selectbsp" ]; then
>      if [ ! -h selected_bsp ]; then
>          echo "Please select a Board-Support-Package using:"
>          echo "$0 selectbsp"
>          exit
>      fi
> -    if [ ! -h selected_community ]; then
> -        echo "Please select a community file using:"
> -        echo "$0 selectcommunity"
> -        exit
> -    fi
>      loadBSP
> -    loadCommunity
>      echo
>  fi
> 
> @@ -415,22 +391,6 @@ case "$1" in
>              fi
>          fi
>          ;;
> -    "selectcommunity")
> -        if [ "$2" = "help" ] || [ "$2" = "" ]; then
> -            echo "Select a Community-File:"
> -            echo
> -            echo "Usage: $0 $1 <community-file>"
> -            echo "available community-files: "
> -            /bin/ls community/*.cfg
> -            echo
> -        else
> -            if [ ! -f "$2" ]; then
> -                echo "Could not find $2"
> -            else
> -                setCommunity "$2"
> -            fi
> -        fi
> -        ;;
>      "prepare")
>          if [ "$2" = "help" ] || [ "$2" = "x" ]; then
>              echo "This option fetches the sources for the images and
configurates
> the build so that it can be compiled"
> @@ -478,7 +438,7 @@ case "$1" in
>          ;;
>      "buildall")
>          if [ "$2" = "help" ]; then
> -            echo "This option builds the firmware for all routers of a
given
> community."
> +            echo "This option builds the firmware for all routers."
>              echo
>              echo "Usage: $0 $1 [fast]"
>              echo
> @@ -501,7 +461,6 @@ case "$1" in
>          echo
>          echo "Usage: $0 command"
>          echo "command:"
> -        echo "  selectcommunity <community-file>"
>          echo "  selectbsp <bsp-file>"
>          echo "  prepare"
>          echo "  config openwrt"
> diff --git a/community/franken.cfg b/community/franken.cfg deleted file
> mode 100644 index 833e98e..0000000
> --- a/community/franken.cfg
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -BATMAN_CHANNEL=1
> -BATMAN_CHANNEL_5GHZ=36
> -ESSID_AP=franken.freifunk.net
> -ESSID_MESH=batman.franken.freifunk.net
> -BSSID_MESH=02:CA:FF:EE:BA:BE
> -VPN_PROJECT=fff
> -NTPD_IP=fe80::ff:feee:1%br-mesh
> -UPGRADE_PATH=http://[fe80::ff:feee:1%br-mesh]/dev/firmware/current
> diff --git a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> index 3b60500..7b7bbd0 100755
> --- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> +++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> @@ -155,7 +155,6 @@ crawl() {
>      SYSTEM_DATA=$SYSTEM_DATA"$fastd_version"
> 
> SYSTEM_DATA=$SYSTEM_DATA"<nodewatcher_version>$nodewatcher_ver
> sion</nodewatcher_version>"
> 
> SYSTEM_DATA=$SYSTEM_DATA"<firmware_version>$FIRMWARE_VERSION
> </firmware_version>"
> -
> SYSTEM_DATA=$SYSTEM_DATA"<firmware_community>$FIRMWARE_COM
> MUNITY</firmware_community>"

Ich würde das im XML drinlassen und fest "fff" oder "franken" senden.

> 
> SYSTEM_DATA=$SYSTEM_DATA"<firmware_revision>$BUILD_DATE</firmwa
> re_revision>"
> 
> SYSTEM_DATA=$SYSTEM_DATA"<openwrt_core_revision>$OPENWRT_COR
> E_REVISION</openwrt_core_revision>"
> 
> SYSTEM_DATA=$SYSTEM_DATA"<openwrt_feeds_packages_revision>$OPE
> NWRT_FEEDS_PACKAGES_REVISION</openwrt_feeds_packages_revision>"
> diff --git a/src/packages/fff/fff-sysupgrade/files/etc/sysupgrade.sh
> b/src/packages/fff/fff-sysupgrade/files/etc/sysupgrade.sh
> index 8ef4949..ba42f25 100755
> --- a/src/packages/fff/fff-sysupgrade/files/etc/sysupgrade.sh
> +++ b/src/packages/fff/fff-sysupgrade/files/etc/sysupgrade.sh
> @@ -67,9 +67,7 @@ if [ "$VERSION" -eq "$FIRMWARE_VERSION" ]; then
>    done
>  fi
> 
> -if [ "$FIRMWARE_COMMUNITY" = "franken" ]; then
> -    FIRMWARE_COMMUNITY="fff"
> -fi
> +FIRMWARE_COMMUNITY="fff"

Wie oben beim buildscript: $ FIRMWARE_COMMUNITY wird nur einmal benutzt,
würde ich in in "FILE=" hardcoden.

> 
>  FILE="${FIRMWARE_COMMUNITY}-${VERSION}-${SOC}-g-${BOARD}-
> squashfs-sysupgrade.bin"
>  echo "Downloading $FILE"
> diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
> b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
> index dbfb00a..0262054 100755
> --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
> +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
> @@ -1,7 +1,7 @@
>  #!/usr/bin/haserl
> 
>  <%
> -. /etc/community.cfg
> +. /lib/functions/fff/keyxchange
>  . /etc/firmware_release
>  echo -en "Content-Type: text/html\r\n\r\n"
>  nav_entry() {
> @@ -12,6 +12,7 @@ nav_entry() {
>  	echo -ne "\t<li${class_active}><a
> href=\"${script_file}\">$2</a></li>\n\t\t"
>  }
> 
> +UPGRADE_PATH="$(getUpgradePath)"

Das sollte man vll. noch separat als BugFix-Patch machen, damit die
Update-Notification für V2 geht?

Grüße

Adrian

>  HOSTNAME="$(uci -q get "fff.system.hostname")"
>  hood="$(uci -q get "system. at system[0].hood")"
> 
> --
> 2.11.0
> 
> --
> franken-dev mailing list
> franken-dev at freifunk.net
> http://lists.freifunk.net/mailman/listinfo/franken-dev-freifunk.net



Mehr Informationen über die Mailingliste franken-dev