Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ffnw-firmware/siteconf
  • pic/siteconf
  • PowerPan/siteconf
  • netmon-sc/siteconf
  • floh1111/siteconf
  • lrnzo/siteconf
  • florian.lottes/siteconf
7 results
Show changes
Commits on Source (848)
Showing with 1379 additions and 0 deletions
#!/bin/bash
# Exit script on error
set -e
# Required environment variables
required_env_vars=(
"UPSTREAM_GLUON_BRANCH"
"ECDSA_PRIVAT_KEY"
"SSH_PRIVATE_KEY"
"GLUON_COMMIT_ID_FROM_PREVIOUS_RUN"
"ACCESS_TOKEN"
)
# Function to check if required environment variables are set
check_required_env_vars() {
for var in "${required_env_vars[@]}"; do
if [ -z "${!var}" ]; then
echo "ENV Variable $var is unset"
exit 1
fi
done
echo "All ENV Variables are present"
}
echo ""
echo "##################################"
echo "Check required environment variables"
echo "##################################"
echo ""
check_required_env_vars
#!/bin/bash
# Determine parent directory
PARENT_DIR=$(dirname "$GIT_CLONE_PATH")
# Function to delete contents of the gluon directory except for the site directory
delete_gluon_contents() {
find "$PARENT_DIR" -mindepth 1 -maxdepth 1 ! \( -name 'site' -o -name 'site.tmp' \) -exec rm -rf {} +
}
# Function to clone the Gluon repository
clone_gluon_repository() {
git clone https://github.com/freifunk-gluon/gluon.git "$GIT_CLONE_PATH/gluon_temp"
delete_gluon_contents
local available_space
available_space=$(df -h / | awk 'NR==2 {print $4}') # Get available space in the root directory
local required_space="200G" # Set the required minimum space (adjust as needed)
echo "Available space: $available_space"
if [[ "$available_space" < "$required_space" ]]; then
echo "Error: Insufficient disk space. Required at least $required_space, but only $available_space is available."
exit 1
fi
rsync -a "$GIT_CLONE_PATH/gluon_temp/" "$PARENT_DIR"
rm -rf "$GIT_CLONE_PATH/gluon_temp"
# Checkout the specified branch
cd "$PARENT_DIR" || exit
git checkout "$UPSTREAM_GLUON_BRANCH"
}
# Clone or update Gluon repository
if [ ! -d "$PARENT_DIR/.git" ]; then
clone_gluon_repository
else
cd "$PARENT_DIR" || exit
# Get the current branch in Gluon repository
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
# Compare the current branch with the specified branch
if [ "$CURRENT_BRANCH" != "$UPSTREAM_GLUON_BRANCH" ]; then
# Re-clone the Gluon repository
clone_gluon_repository
else
git fetch origin
git reset --hard origin/"$UPSTREAM_GLUON_BRANCH"
fi
fi
#!/bin/bash
# Exit script on error
set -e
# OS Program lists
debian_progarr=(
shellcheck
yamllint
git
subversion
python3
python3-distutils
build-essential
gawk
unzip
libncurses5-dev
zlib1g-dev
libssl-dev
libelf-dev
wget
qemu-utils
time
ecdsautils
rsync
)
arch_progarr=(
shellcheck
yamllint
git
svn
python
python-distutils-extra
gawk
unzip
ncurses
zlib
openssl
wget
time
ecdsautils
rsync
qemu-base
)
echop() {
echo "$1 detected ..."
}
command_exists() {
command -v "$1" > /dev/null 2>&1
}
check_dependencies() {
local os_name=$1
local -a progarr=()
local ret=0
case $os_name in
debian)
progarr=("${debian_progarr[@]}")
;;
arch)
progarr=("${arch_progarr[@]}")
;;
*)
echo "OS is not supported"
exit 1
;;
esac
for prog in "${progarr[@]}"; do
if command_exists "$prog"; then
echop "$prog"
elif [ "$os_name" == "debian" ] && dpkg -s "$prog" > /dev/null 2>&1; then
echop "$prog"
elif [ "$os_name" == "arch" ] && pacman -Qi "$prog" > /dev/null 2>&1; then
echop "$prog"
else
echo "$prog is not installed"
ret=1
fi
done
return $ret
}
# Main script
echo ""
echo "##################################"
echo "Check dependencies"
echo "##################################"
echo ""
# Determine OS and check dependencies
if [ -f /etc/debian_version ]; then
check_dependencies "debian"
elif [ -f /etc/arch-release ]; then
check_dependencies "arch"
else
echo "OS is not supported"
exit 1
fi
#!/bin/bash
CI_BUILD_REF_NAME="$1"
if ! [ -e ".GLUON_RELEASE" ]; then
exit 1
fi
GLUON_RELEASE="$(cat ".GLUON_RELEASE")"
if ! [ -e ".GLUON_AUTOUPDATER_BRANCH" ]; then
exit 1
fi
GLUON_AUTOUPDATER_BRANCH="$(cat ".GLUON_AUTOUPDATER_BRANCH")"
ssh runner@firmware.ffnw.de -C "rm -rf /var/www/dev/firmware/fastd/nightly/$CI_BUILD_REF_NAME"
ssh runner@firmware.ffnw.de -C "rm -rf /var/www/dev/firmware/l2tp/nightly/$CI_BUILD_REF_NAME"
rsync -av ../output/images/fastd/"$GLUON_RELEASE"/factory/* runner@firmware.ffnw.de:/var/www/dev/firmware/fastd/nightly/"$CI_BUILD_REF_NAME"
rsync -av ../output/images/fastd/"$GLUON_RELEASE"/other/* runner@firmware.ffnw.de:/var/www/dev/firmware/fastd/nightly/"$CI_BUILD_REF_NAME"
rsync -av ../output/images/fastd/"$GLUON_RELEASE"/sysupgrade/* runner@firmware.ffnw.de:/var/www/dev/firmware/fastd/nightly/"$CI_BUILD_REF_NAME"
ssh runner@firmware.ffnw.de -C "ln -sr /var/www/dev/firmware/fastd/nightly/$CI_BUILD_REF_NAME/$GLUON_AUTOUPDATER_BRANCH.manifest /var/www/dev/firmware/fastd/nightly/$CI_BUILD_REF_NAME/manifest"
rsync -av ../output/images/l2tp/"$GLUON_RELEASE"/factory/* runner@firmware.ffnw.de:/var/www/dev/firmware/l2tp/nightly/"$CI_BUILD_REF_NAME"
rsync -av ../output/images/l2tp/"$GLUON_RELEASE"/other/* runner@firmware.ffnw.de:/var/www/dev/firmware/l2tp/nightly/"$CI_BUILD_REF_NAME"
rsync -av ../output/images/l2tp/"$GLUON_RELEASE"/sysupgrade/* runner@firmware.ffnw.de:/var/www/dev/firmware/l2tp/nightly/"$CI_BUILD_REF_NAME"
ssh runner@firmware.ffnw.de -C "ln -sr /var/www/dev/firmware/l2tp/nightly/$CI_BUILD_REF_NAME/$GLUON_AUTOUPDATER_BRANCH.manifest /var/www/dev/firmware/l2tp/nightly/$CI_BUILD_REF_NAME/manifest"
#!/bin/sh
echo "Executing pre-commit hook..."
gitRootDir=$(git rev-parse --show-toplevel)
if ! "$gitRootDir"/.ci/dependencies.sh ; then exit 1; fi
if ! "$gitRootDir"/.ci/shelllint.sh ; then exit 1; fi
if ! "$gitRootDir"/.ci/yamllint.sh ; then exit 1; fi
exit 0
#!/bin/sh
echo "Running ShellLint..."
ret=0
filelist="$(find . -type d -name .git -prune -o -type f -exec sh -c 'for file do file "$file" | grep -q -E "shell|bash|dash|ksh" && echo "$file"; done' sh {} +)"
for line in $filelist; do
shellcheck "$line"
[ $? -eq 1 ] && ret=1
done
exit $ret
#!/bin/bash
if ! [ -e ".GLUON_RELEASE" ]; then
exit 1
fi
GLUON_RELEASE="$(cat ".GLUON_RELEASE")"
if ! [ -e ".GLUON_AUTOUPDATER_BRANCH" ]; then
exit 1
fi
GLUON_AUTOUPDATER_BRANCH="$(cat ".GLUON_AUTOUPDATER_BRANCH")"
ECDSA_PRIVAT_KEY="$1"
echo "$ECDSA_PRIVAT_KEY" > ecdsa.priv
ret=0
echo "$PWD"/ecdsa.priv
if [ -d "../output/images/fastd" ]; then
echo "Signing fastd manifest..."
../contrib/sign.sh "$PWD"/ecdsa.priv "$PWD/../output/images/fastd/$GLUON_RELEASE/sysupgrade/$GLUON_AUTOUPDATER_BRANCH.manifest"
ret=$?
else
echo "Fastd directory not found."
fi
if [ -d "../output/images/l2tp" ]; then
echo "Signing l2tp manifest..."
../contrib/sign.sh "$PWD"/ecdsa.priv "$PWD/../output/images/l2tp/$GLUON_RELEASE/sysupgrade/$GLUON_AUTOUPDATER_BRANCH.manifest"
ret=$?
else
echo "L2tp directory not found."
fi
rm ecdsa.priv
exit $ret
---
extends: default
rules:
line-length:
level: error
max: 100
allow-non-breakable-inline-mappings: true
#!/bin/sh
echo "Running yamllint..."
ret=0
filelist="$(find . -type d -name .git -prune -o -type f -name '*.yaml' -o -name '*.yml')"
for file in $filelist; do
lint_output="$(yamllint --strict -d ./.ci/yaml_rules.yaml "$file")"
if [ -n "$lint_output" ]; then
echo "$lint_output"
ret=1
fi
done
exit $ret
.GLUON_AUTOUPDATER_BRANCH
.GLUON_RELEASE
.patched
.prepare
.BROKEN
---
variables:
GIT_CLONE_PATH: $CI_BUILDS_DIR/gluon/site
stages:
- dependencies
- lint
- patch
- parameters
- build
- sign
- deploy
- cleanup
# check all needed dependencies.
dependencies:
stage: dependencies
tags:
- firmware
before_script:
# check for required environment variables
- ./.ci/check_env_variables.sh
# Clone or update Gluon repository
- ./.ci/clone_or_update_gluon.sh
- |
(
if [[ "$CI_PIPELINE_SOURCE" == "schedule" ]]; then
cd ..
HEAD_COMMIT_ID=$(git rev-parse HEAD)
cd $GIT_CLONE_PATH
if [ "$HEAD_COMMIT_ID" == "$GLUON_COMMIT_ID_FROM_PREVIOUS_RUN" ]; then
touch skip_pipeline
fi
fi
)
script:
- if [ -f skip_pipeline ]; then exit 0; fi # Exit the job if marker file exists
- ./.ci/dependencies.sh
artifacts:
paths:
- skip_pipeline
expire_in: 1 day
# lint all common shell scripts
shelllint:
stage: lint
tags:
- firmware
script:
- if [ -f skip_pipeline ]; then exit 0; fi # Exit the job if marker file exists
- ./.ci/shelllint.sh
# lint all common yamel files
yamllint:
stage: lint
tags:
- firmware
script:
- if [ -f skip_pipeline ]; then exit 0; fi # Exit the job if marker file exists
- ./.ci/yamllint.sh
# update and patch gluon
prepare_gluon:
stage: patch
tags:
- firmware
artifacts:
paths:
- .patched
expire_in: 1 day
script:
- if [ -f skip_pipeline ]; then exit 0; fi # Exit the job if marker file exists
- touch .patched
- ./buildscript.sh clean_patches
- ./buildscript.sh patch
parameters:
stage: parameters
tags:
- firmware
artifacts:
paths:
- .GLUON_AUTOUPDATER_BRANCH
- .GLUON_RELEASE
expire_in: 1 day
script:
- if [ -f skip_pipeline ]; then exit 0; fi # Exit the job if marker file exists
- ./buildscript.sh prepare GLUON_AUTOUPDATER_BRANCH nightly_master
- ./buildscript.sh prepare GLUON_RELEASE $(date +%Y%m%d)
build:
stage: build
only:
- master
tags:
- firmware
script:
- if [ -f skip_pipeline ]; then exit 0; fi # Exit the job if marker file exists
- touch .prepare
- ./buildscript.sh build all
sign:
stage: sign
only:
- master
tags:
- firmware
script:
- if [ -f skip_pipeline ]; then exit 0; fi # Exit the job if marker file exists
- ./.ci/sign.sh $ECDSA_PRIVAT_KEY
deploy:
stage: deploy
only:
- master
tags:
- firmware
script:
- if [ -f skip_pipeline ]; then exit 0; fi # Exit the job if marker file exists
- ./.ci/deploy.sh $CI_COMMIT_REF_NAME
cleanup:
stage: cleanup
only:
- master
tags:
- firmware
script:
- if [ -f skip_pipeline ]; then exit 0; fi # Exit the job if marker file exists
- touch .patched
- ./buildscript.sh clean_patches
- rm -rf ../output
- |
(
cd ..
export HEAD_COMMIT_ID=$(git rev-parse HEAD)
cd $GIT_CLONE_PATH
curl --request PUT --header "PRIVATE-TOKEN: $ACCESS_TOKEN" \
"https://git.ffnw.de/api/v4/projects/$CI_PROJECT_ID/variables/GLUON_COMMIT_ID_FROM_PREVIOUS_RUN?value=$HEAD_COMMIT_ID"
)
## Als Entwickler tätig werden
Falls dich das Thema der Softwareentwicklung begeistert und du gerne bereit bist dich in komplexe Strukturen einzuarbeiten, sowie gerne einen Beitrag zu Freifunk leisten möchtest kannst du dich unter folgendem Link über einen Einstieg erkundigen:
https://wiki.ffnw.de/Entwicklung/Als\_Entwickler\_t%C3%A4tig\_werden
## Firmware Kompilieren
### Voraussetzungen (Stand Gluon v2023.2.x):
Folgende Pakete müssen auf dem Rechner installiert sein. Hier Beispiel Debian:
apt-get install git subversion python build-essential gawk unzip libncurses-dev libz-dev libssl-dev wget time
### Gluon kompilieren
Auf dieser Seite wird beschrieben, wie man die Gluon Firmware für das Freifunk Nordwest Netzwerk kompiliert. Um die Firmware zu kompilieren wird ein Rechner mit einem Linux Betriebssystem und ca. 70-100GB freier Speicher benötigt. Der make Befehl passt sich automatisch an die Anzahl von cores an.
*Wichtig* Je nach Entwicklungsstand muss die Branch Version angepasst werden.
git clone https://github.com/freifunk-gluon/gluon.git -b v2023.2.x && cd gluon
git clone https://git.ffnw.de/ffnw-firmware/siteconf.git site && cd site
./buildscript.sh patch
./buildscript.sh prepare GLUON_AUTOUPDATER_BRANCH <autoupdater-branch, also zB "stable" oder "testing">
./buildscript.sh prepare GLUON_RELEASE <Releasecodename, zB das aktuelle Datum im Format YYYYMMDD>
./buildscript.sh prepare <vpn, zB "fastd" oder "l2tp">
./buildscript.sh build <target, zB "x86-generic"> fast
*Hinweis* Auf Multicoresystemen sorgt die option `fast` dafür, dass alle vefügbaren CPU-Kerne für den Build genutzt werden.
### Manifest und initiale Signatur erstellen
./buildscript.sh create_manifest manifest
./contrib/sign.sh ../firmware/release_keys/ecdsa-privatekey ./output/images/sysupgrade/stable.manifest
Weitere Informationen z.B. zu automatischen Builds auch unter https://gluon.readthedocs.org/en/latest/features/autoupdater.html
### Prüfsummen erstellen
Die Prüfsummen werden auf dem Server automatisiert generiert.
### Referenzen
* https://wiki.openwrt.org/doc/howto/build
* https://buildroot.org/downloads/manual/manual.html
#!/bin/bash
# get location of executed file.
EXECDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# global list of gluon targets
TARGET_LIST=()
help_print(){
echo "Usage: $0 <command>"
echo "command:"
echo " patch Apply patches on gluon build ENV"
echo " clean_patches Remove applied patches from gluon repo"
echo " update_patches Create patches from local gluon commits"
echo " prepare <command>"
echo " GLUON_AUTOUPDATER_BRANCH <str> Set ENV variable"
echo " GLUON_RELEASE <str> Set ENV variable"
# echo " fastd Prepare site repo for fastd build"
echo " l2tp prepare site repo for l2tp build"
echo " BROKEN y or n (default n)"
echo " build <target> targets provided by gluon"
echo " target_list build all gluon targets"
echo " all build all gluon targets for each VPN"
echo " (optional) add \"fast\" as a parameter to build on multicore"
echo " (optional) add \"silent\" as a parameter to avoid loads of output"
echo " clean <target> targets provided by gluon"
echo " all clean all targets"
echo " (optional) add \"fast\" as a parameter to clean on multicore"
echo " create_manifest create manifest"
echo
}
patch_gluon() {
if ! [ -f "$EXECDIR/.patched" ]; then
if [ "$(find "$EXECDIR"/gluon_patches/*.patch 2> /dev/null | wc -l)" -ge 1 ]; then
local base="$EXECDIR"
cd "$EXECDIR"/.. || exit 1
for patch in "$EXECDIR"/gluon_patches/*.patch; do
git am --ignore-space-change --ignore-whitespace "$patch"
done
cd "$base" || exit 1
else
echo "No patches found"
fi
touch "$EXECDIR/.patched"
else
echo "gluon is already patched!"
echo "Please run clean_patches first to reset gluon git repo"
fi
}
clean_patches(){
if [ -f "$EXECDIR/.patched" ]; then
local base="$EXECDIR"
cd "$EXECDIR"/.. || exit 1
git reset --hard "origin/$(git rev-parse --abbrev-ref HEAD)"
cd "$EXECDIR" || exit 1
rm "$EXECDIR/.patched"
else
echo "gluon is not patched"
fi
}
update_patches() {
local base="$EXECDIR"
cd "$EXECDIR"/.. || exit 1
git format-patch "origin/$(git rev-parse --abbrev-ref HEAD)" -o "$EXECDIR/gluon_patches"
cd "$base" || exit 1
}
init_prepare(){
local vpn="$1"
local file="$2"
if ! [ -w "$EXECDIR/$file" ]; then
echo "$EXECDIR/$file not exsis or writeable"
exit 1
fi
echo "prepare $file for $vpn build ..."
# ensure reset possible local file changes
git checkout "$EXECDIR/$file"
}
prepare_siteconf(){
local vpn="$1"
init_prepare "$vpn" "site.conf"
# Start prepare site.conf for build
if grep -q "%A" < "$EXECDIR"/site.conf; then
sed -i "/^%A$/c\\modules = \\'http://mirror.ffnw.de/modules/$vpn/gluon-%GS-%GR/%S\\'," "$EXECDIR"/site.conf
echo "Set opkg modules URL ..."
else
echo "Placeholder %A not found"
fi
if grep -q "%B" < "$EXECDIR"/site.conf; then
sed -i "/^%B$/c\\\\'http://autoupdate-lede.ffnw/v1/$vpn/stable\\'," "$EXECDIR"/site.conf
echo "Set autoupdater stable URL ..."
else
echo "Placeholder %B not found"
fi
if grep -q "%C" < "$EXECDIR"/site.conf; then
sed -i "/^%C$/c\\\\'http://autoupdate-lede.ffnw/v1/$vpn/rc\\'," "$EXECDIR"/site.conf
echo "Set autoupdater rc URL ..."
else
echo "Placeholder %C not found"
fi
if grep -q "%D" < "$EXECDIR"/site.conf; then
sed -i "/^%D$/c\\\\'http://autoupdate-lede.ffnw/v1/$vpn/testing\\'," "$EXECDIR"/site.conf
echo "Set autoupdater testing URL ..."
else
echo "Placeholder %D not found"
fi
if grep -q "%E" < "$EXECDIR"/site.conf; then
sed -i "/^%E$/c\\\\'http://autoupdate-lede.ffnw/v1/$vpn/nightly/master\\'," "$EXECDIR"/site.conf
echo "Set autoupdater nightly_master URL ..."
else
echo "Placeholder %E not found"
fi
}
prepare_sitemk(){
local vpn="$1"
init_prepare "$vpn" "site.mk"
# Start prepare site.mk for build
if grep -q "%A" < "$EXECDIR"/image-customization.lua; then
if [ "$vpn" == "l2tp" ]; then
sed -i "/^%A$/c\\\\t'mesh-vpn-tunneldigger'," "$EXECDIR"/image-customization.lua
echo "Set mesh-vpn-tunneldigger feature ..."
fi
if [ "$vpn" == "fastd" ]; then
sed -i "/^%A$/c\\\\tweb-mesh-vpn-fastd" "$EXECDIR"/image-customization.lua
echo "Set web-mesh-vpn-fastd feature ..."
fi
else
echo "Placeholder %A not found"
fi
if grep -q "%B" < "$EXECDIR"/site.mk; then
sed -i "/^%B$/c\\GLUON_RELEASE ?= $(cat "$EXECDIR/.GLUON_RELEASE")" "$EXECDIR"/site.mk
echo "Set GLUON_RELEASE ..."
else
echo "Placeholder %B not found"
fi
if grep -q "%C" < "$EXECDIR"/site.mk; then
sed -i "/^%C$/c\\GLUON_AUTOUPDATER_BRANCH ?= $(cat "$EXECDIR/.GLUON_AUTOUPDATER_BRANCH")" "$EXECDIR"/site.mk
echo "Set GLUON_AUTOUPDATER_BRANCH ..."
else
echo "Placeholder %C not found"
fi
}
gluon_build(){
preflags=( -C "$EXECDIR"/..)
midflags=()
postflags=(GLUON_TARGET="$1" GLUON_AUTOUPDATER_ENABLED=1 GLUON_IMAGEDIR=output/images/"$(cat "$EXECDIR"/.prepare)"/"$(cat "$EXECDIR"/.GLUON_RELEASE)" GLUON_PACKAGEDIR=output/packages/"$(cat "$EXECDIR"/.prepare)")
error_build=0
if [ "$2" == "fast" ] && [ -a "/proc/cpuinfo" ]; then
midflags=("${midflags[@]}" -j $(($(grep -c processor /proc/cpuinfo)+1)))
fi
if [ "$3" == "silent" ]; then
preflags=( --silent "${preflags[@]}")
fi;
if [ -a "$EXECDIR/.BROKEN" ]; then
midflags=("${midflags[@]}" BROKEN=1)
fi;
if ! make "${preflags[@]}" "${midflags[@]}" "${postflags[@]}"; then
error_build=1
fi;
if [ $error_build -eq 1 ]; then
exit 1
fi
}
gluon_clean(){
preflags=( -C "$EXECDIR"/..)
midflags=()
postflags=(GLUON_TARGET="$1" GLUON_IMAGEDIR=output/images/"$(cat "$EXECDIR"/.prepare)"/"$(cat "$EXECDIR"/.GLUON_RELEASE)" GLUON_PACKAGEDIR=output/packages/"$(cat "$EXECDIR"/.prepare)")
if [ "$2" == "fast" ] && [ -a "/proc/cpuinfo" ]; then
midflags=("${midflags[@]}" -j $(($(grep -c processor /proc/cpuinfo)+1)))
fi
if [ -a "$EXECDIR/.BROKEN" ]; then
midflags=("${midflags[@]}" BROKEN=1)
fi
make "${preflags[@]}" "${midflags[@]}" "${postflags[@]}" clean
}
prepare_precondition(){
if ! [ -s "$EXECDIR/.GLUON_AUTOUPDATER_BRANCH" ]; then
echo "please run '$0 prepare GLUON_AUTOUPDATER_BRANCH' first"
exit 1
fi
if ! [ -s "$EXECDIR/.GLUON_RELEASE" ]; then
echo "please run '$0 prepare GLUON_RELEASE' first"
exit 1
fi
}
get_target_list(){
while read -r line; do
if [[ $line == *GluonTarget* ]]; then
# extract arcitecture parameter value
local targ
targ="$(echo "$line" | sed -e 's/^.*GluonTarget,//' -e 's/)).*//' -r -e 's/([^,]+,[^,]*).*/\1/' -e 's/[,]/-/')"
if [ -n "$targ" ]; then
TARGET_LIST[${#TARGET_LIST[@]}]="$targ"
fi
else
if [[ $line == *BROKEN* ]] && ! [[ $line == *GLUON_WLAN_MESH_11s* ]] && ! [ -a "$EXECDIR/.BROKEN" ]; then
break
fi
fi
done < "$EXECDIR/../targets/targets.mk"
}
if ! git -C "$EXECDIR"/.. rev-parse --abbrev-ref HEAD | grep -q "$GLUON_AUTOUPDATER_BRANCH"; then
echo "no gluon repo found or wrong branch. Please clone this git repository into the gluon git repository"
exit 1
fi
case "$1" in
"patch")
patch_gluon
;;
"clean_patches")
clean_patches
;;
"update_patches")
update_patches
;;
"prepare")
case "$2" in
# "fastd")
# prepare_precondition
# if ! [ -f "$EXECDIR/.patched" ]; then
# patch_gluon
# fi
# prepare_siteconf "$2"
# prepare_sitemk "$2"
# make -C "$EXECDIR"/.. update
# echo "$2" > "$EXECDIR/.prepare"
# ;;
"l2tp")
prepare_precondition
if ! [ -f "$EXECDIR/.patched" ]; then
patch_gluon
fi
prepare_siteconf "$2"
prepare_sitemk "$2"
make -C "$EXECDIR/.." update
echo "$2" > "$EXECDIR/.prepare"
;;
"GLUON_AUTOUPDATER_BRANCH")
if [ -n "$3" ]; then
echo "$3" > "$EXECDIR/.GLUON_AUTOUPDATER_BRANCH"
else
echo "$2 needs a parameter e.g. testing"
fi
;;
"GLUON_RELEASE")
if [ -n "$3" ]; then
echo "$3" > "$EXECDIR/.GLUON_RELEASE"
else
echo "$2 needs a parameter e.g. 20170104"
fi
;;
"BROKEN")
if [ "$3" == "y" ]; then
touch "$EXECDIR/.BROKEN"
elif [ "$3" == "n" ]; then
if [ -a "$EXECDIR/.BROKEN" ]; then
rm "$EXECDIR/.BROKEN"
fi
else
echo "$2 needs the parameter: y or n"
fi
;;
*)
help_print
;;
esac
;;
"build")
if ! [ -r "$EXECDIR"/.prepare ]; then
echo "please run the prepare mode first"
exit 1
fi
get_target_list
case "$2" in
"target_list")
for targ in "${TARGET_LIST[@]}"; do
if [ "$3" == "fast" ]; then
if [ "$4" == "silent" ]; then
gluon_build "$targ" "fast" "silent"
else
gluon_build "$targ" "fast"
fi
else
gluon_build "$targ"
fi
done
;;
"all")
# "$EXECDIR/$0" prepare fastd
# "$EXECDIR/$0" build target_list "fast" "silent"
# "$EXECDIR/$0" create_manifest
"$EXECDIR/$0" prepare l2tp
"$EXECDIR/$0" build target_list "fast" "silent"
"$EXECDIR/$0" create_manifest
;;
*)
err="yes"
for targ in "${TARGET_LIST[@]}"; do
if [ "$targ" == "$2" ]; then
err="no"
if [ "$3" == "fast" ]; then
gluon_build "$targ" "fast"
else
gluon_build "$targ"
fi
fi
done
if [ "$err" == "yes" ]; then
echo "Please use targets from the following list as parameter:"
for targ in "${TARGET_LIST[@]}"; do
echo "$targ"
done
fi
;;
esac
;;
"clean")
if ! [ -r "$EXECDIR"/.prepare ]; then
echo "please run the prepare mode first"
exit 1
fi
get_target_list
case "$2" in
"all")
for targ in "${TARGET_LIST[@]}"; do
if [ "$3" == "fast" ]; then
gluon_clean "$targ" "fast"
else
gluon_clean "$targ"
fi
done
;;
*)
err="yes"
for targ in "${TARGET_LIST[@]}"; do
if [ "$targ" == "$2" ]; then
err="no"
if [ "$3" == "fast" ]; then
gluon_clean "$targ" "fast"
else
gluon_clean "$targ"
fi
fi
done
if [ "$err" == "yes" ]; then
echo "Please use targets from the following list as parameter:"
for targ in "${TARGET_LIST[@]}"; do
echo "$targ"
done
fi
;;
esac
;;
"create_manifest")
if ! [ -r "$EXECDIR"/.prepare ]; then
echo "please run the prepare mode first"
exit 1
fi
preflags=(-C "$EXECDIR"/..)
midflags=()
postflags=( GLUON_IMAGEDIR=output/images/"$(cat "$EXECDIR"/.prepare)"/"$(cat "$EXECDIR"/.GLUON_RELEASE)" GLUON_PACKAGEDIR=output/packages/"$(cat "$EXECDIR"/.prepare)")
if [ -a "$EXECDIR/.BROKEN" ]; then
midflags=("${midflags[@]}" BROKEN=1)
fi;
make "${preflags[@]}" manifest "${midflags[@]}" "${postflags[@]}"
# create rc branch manifest
if [ -f "$EXECDIR/../output/images/$(cat "$EXECDIR"/.prepare)/$(cat "$EXECDIR"/.GLUON_RELEASE)/sysupgrade/$(cat "$EXECDIR"/.GLUON_AUTOUPDATER_BRANCH).manifest" ]; then
cp "$EXECDIR/../output/images/$(cat "$EXECDIR"/.prepare)/$(cat "$EXECDIR"/.GLUON_RELEASE)/sysupgrade/$(cat "$EXECDIR"/.GLUON_AUTOUPDATER_BRANCH).manifest" "$EXECDIR/../output/images/$(cat "$EXECDIR"/.prepare)/$(cat "$EXECDIR"/.GLUON_RELEASE)/sysupgrade/rc.manifest"
sed -i 's/BRANCH=stable/BRANCH=rc/g' "$EXECDIR/../output/images/$(cat "$EXECDIR"/.prepare)/$(cat "$EXECDIR"/.GLUON_RELEASE)/sysupgrade/rc.manifest"
fi;
;;
*)
help_print
;;
esac
{
domain_names = { aurich = 'Aurich' },
domain_seed = 'e985c7b8f3174811cd2f9e4cd2ccbf899adbc8f2b3ce0f3f28c8289c2b9599cb',
prefix6 = '2a0f:b506:ff01::/64',
extra_prefixes6 = { 'fd74:fdaa:9dc4::/64', '2a06:e881:2000:4c01::/64', },
prefix4 = '10.18.24.0/21',
wifi24 = {
ap = {
ssid = 'test.nordwest.freifunk.net',
owe_ssid = 'owe.test.nordwest.freifunk.net',
owe_transition_mode = true,
},
mesh = {
id = 't-ffnw-mesh_02:00:0a:12:18:00',
},
},
wifi5 = {
ap = {
ssid = 'test.nordwest.freifunk.net',
owe_ssid = 'owe.test.nordwest.freifunk.net',
owe_transition_mode = true,
},
mesh = {
id = 't-ffnw-mesh_02:00:0a:12:18:00',
},
},
next_node = {
name = { 'node.ffnw', 'nextnode', 'nn' },
ip6 = 'fd74:fdaa:9dc4::127',
mac = '16:41:95:40:f7:dc',
},
mesh_vpn = {
tunneldigger = {
brokers = {'leer01.sn.ffnw.de:9001'}
},
},
hoodselector = {
shapes = {
{
{
lat = 53.32,
lon = 6.981
},
{
lat = 53.32,
lon = 7.322
},
{
lat = 53.372,
lon = 7.322
},
{
lat = 53.372,
lon = 7.825
},
{
lat = 53.436,
lon = 7.825
},
{
lat = 53.436,
lon = 7.648
},
{
lat = 53.806,
lon = 7.648
},
{
lat = 53.806,
lon = 6.624
},
{
lat = 53.436,
lon = 6.624
},
{
lat = 53.436,
lon = 6.981
},
{
lat = 53.32,
lon = 6.981
}
}
}
}
}
{
domain_names = { bad_iburg = 'Bad Iburg' },
domain_seed = '8aa86f0990b0c386bc70426c8afe19f783c181a87b6670c4ac83fb302cfb5de9',
prefix6 = '2a0f:b506:ff02::/64',
extra_prefixes6 = { 'fd74:fdaa:9dc4::/64', '2a06:e881:2000:4303::/64' },
prefix4 = '10.18.88.0/21',
wifi24 = {
ap = {
ssid = 'test.nordwest.freifunk.net',
owe_ssid = 'owe.test.nordwest.freifunk.net',
owe_transition_mode = true,
},
mesh = {
id = 't-ffnw-mesh_02:00:0a:12:58:00',
},
},
wifi5 = {
ap = {
ssid = 'test.nordwest.freifunk.net',
owe_ssid = 'owe.test.nordwest.freifunk.net',
owe_transition_mode = true,
},
mesh = {
id = 't-ffnw-mesh_02:00:0a:12:58:00',
},
},
next_node = {
name = { 'node.ffnw', 'nextnode', 'nn' },
ip6 = 'fd74:fdaa:9dc4::127',
mac = '16:41:95:40:f7:dc',
},
mesh_vpn = {
tunneldigger = {
brokers = {'os02.sn.ffnw.de:9001'}
},
},
hoodselector = {
shapes = {
{
{
lat = 52.07,
lon = 7.9
},
{
lat = 52.07,
lon = 8.42
},
{
lat = 52.23,
lon = 8.42
},
{
lat = 52.23,
lon = 8.16
},
{
lat = 52.19,
lon = 8.16
},
{
lat = 52.19,
lon = 7.9
},
{
lat = 52.07,
lon = 7.9
}
}
}
}
}
{
domain_names = { bremen = 'Bremen' },
domain_seed = 'da213cd742af54c91a6840f381ab8aaaf9ed0b5ff175f88175c76c07e85872ba',
prefix6 = '2a0f:b506:ff03::/64',
extra_prefixes6 = { 'fd74:fdaa:9dc4::/64', '2a06:e881:2000:4830::/64' },
prefix4 = '10.72.48.0/21',
wifi24 = {
ap = {
ssid = 'test.nordwest.freifunk.net',
owe_ssid = 'owe.test.nordwest.freifunk.net',
owe_transition_mode = true,
},
mesh = {
id = 't-ffnw-mesh_02:00:0a:48:30:00',
},
},
wifi5 = {
ap = {
ssid = 'test.nordwest.freifunk.net',
owe_ssid = 'owe.test.nordwest.freifunk.net',
owe_transition_mode = true,
},
mesh = {
id = 't-ffnw-mesh_02:00:0a:48:30:00',
},
},
next_node = {
name = { 'node.ffnw', 'nextnode', 'nn' },
ip6 = 'fd74:fdaa:9dc4::127',
mac = '16:41:95:40:f7:dc',
},
mesh_vpn = {
tunneldigger = {
brokers = {'bre01.sn.ffnw.de:9001'}
},
},
hoodselector = {
shapes = {
{
{
lat = 53.22,
lon = 8.51
},
{
lat = 52.944,
lon = 8.51
},
{
lat = 52.944,
lon = 8.800048828125
},
{
lat = 53.03543290697411,
lon = 8.977890014648438
},
{
lat = 53.095673355930195,
lon = 8.993682861328125
},
{
lat = 53.160770182808506,
lon = 8.966217041015625
},
{
lat = 53.13400178113812,
lon = 8.865966796875
},
{
lat = 53.16324027106289,
lon = 8.834381103515625
},
{
lat = 53.1842302823796,
lon = 8.719711303710936
},
{
lat = 53.18505321083605,
lon = 8.675765991210938
},
{
lat = 53.22,
lon = 8.59405517578125
},
{
lat = 53.22,
lon = 8.51
}
}
}
}
}
{
domain_names = { butjadingen = 'Butjadingen' },
domain_seed = '951aab38a95615e4803084ab6aac24f6722f316a2a7e482488df9bfa39908bd2',
prefix6 = '2a0f:b506:ff04::/64',
extra_prefixes6 = { 'fd74:fdaa:9dc4::/64', '2a06:e881:2000:4500::/64' },
prefix4 = '10.18.176.0/21',
wifi24 = {
ap = {
ssid = 'test.nordwest.freifunk.net',
owe_ssid = 'owe.test.nordwest.freifunk.net',
owe_transition_mode = true,
},
mesh = {
id = 't-ffnw-mesh_02:00:0a:12:b0:00',
},
},
wifi5 = {
ap = {
ssid = 'test.nordwest.freifunk.net',
owe_ssid = 'owe.test.nordwest.freifunk.net',
owe_transition_mode = true,
},
mesh = {
id = 't-ffnw-mesh_02:00:0a:12:b0:00',
},
},
next_node = {
name = { 'node.ffnw', 'nextnode', 'nn' },
ip6 = 'fd74:fdaa:9dc4::127',
mac = '16:41:95:40:f7:dc',
},
mesh_vpn = {
tunneldigger = {
brokers = {'bra01.sn.ffnw.de:9000'}
},
},
hoodselector = {
shapes = {
{
{
lat = 53.5,
lon = 8.315
},
{
lat = 53.5,
lon = 8.403
},
{
lat = 53.63,
lon = 8.403
},
{
lat = 53.63,
lon = 8.315
},
{
lat = 53.5,
lon = 8.315
}
}
}
}
}
{
domain_names = { default = 'default', },
domain_seed = '67e4ecc921bc95678c1db7fcf3f684b82976b5b86c43e41511bb76b72c075b7b',
prefix6 = '2a0f:b506:ff05::/64',
extra_prefixes6 = { 'fd74:fdaa:9dc4::/64', '2a06:e881:2000:4800::/64' },
prefix4 = '10.18.224.0/21',
wifi24 = {
ap = {
ssid = 'test.nordwest.freifunk.net',
owe_ssid = 'owe.test.nordwest.freifunk.net',
owe_transition_mode = true,
},
mesh = {
id = 't-ffnw-mesh_02:00:0a:12:e0:00',
},
},
wifi5 = {
ap = {
ssid = 'test.nordwest.freifunk.net',
owe_ssid = 'owe.test.nordwest.freifunk.net',
owe_transition_mode = true,
},
mesh = {
id = 't-ffnw-mesh_02:00:0a:12:e0:00',
},
},
next_node = {
name = { 'node.ffnw', 'nextnode', 'nn' },
ip6 = 'fd74:fdaa:9dc4::127',
mac = '16:41:95:40:f7:dc',
},
mesh_vpn = {
tunneldigger = {
brokers = {'default06.ffnw.de:9000'}
},
},
}
{
domain_names = { grafschaft_bentheim = 'Grafschaft Bentheim' },
domain_seed = '5cf1fbc9e917174cc157870116183da68e1994ac75cce4cfe612a26b4fef606c',
prefix6 = '2a0f:b506:ff07::/64',
extra_prefixes6 = { 'fd74:fdaa:9dc4::/64', '2a06:e881:2000:4a01::/64' },
prefix4 = '10.18.80.0/21',
wifi24 = {
ap = {
ssid = 'test.nordwest.freifunk.net',
owe_ssid = 'owe.test.nordwest.freifunk.net',
owe_transition_mode = true,
},
mesh = {
id = 't-ffnw-mesh_02:00:0a:12:50:00',
},
},
wifi5 = {
ap = {
ssid = 'test.nordwest.freifunk.net',
owe_ssid = 'owe.test.nordwest.freifunk.net',
owe_transition_mode = true,
},
mesh = {
id = 't-ffnw-mesh_02:00:0a:12:50:00',
},
},
next_node = {
name = { 'node.ffnw', 'nextnode', 'nn' },
ip6 = 'fd74:fdaa:9dc4::127',
mac = '16:41:95:40:f7:dc',
},
mesh_vpn = {
tunneldigger = {
brokers = {'clp01.sn.ffnw.de:9001'}
},
},
hoodselector = {
shapes = {
{
{
lat = 52.178,
lon = 6.652
},
{
lat = 52.178,
lon = 7.41
},
{
lat = 52.35,
lon = 7.41
},
{
lat = 52.35,
lon = 7.244
},
{
lat = 52.69,
lon = 7.244
},
{
lat = 52.69,
lon = 6.652
},
{
lat = 52.178,
lon = 6.652
}
}
}
}
}
{
domain_names = { ibbenbueren = 'Ibbenbüren' },
domain_seed = 'ed7168fd157f2c00e26bedbd6ae533700030d9eb61f8877c3b168243c573c6c1',
prefix6 = '2a0f:b506:ff08::/64',
extra_prefixes6 = { 'fd74:fdaa:9dc4::/64', '2a06:e881:2000:4201::/64' },
prefix4 = '10.18.72.0/21',
wifi24 = {
ap = {
ssid = 'test.nordwest.freifunk.net',
owe_ssid = 'owe.test.nordwest.freifunk.net',
owe_transition_mode = true,
},
mesh = {
id = 't-ffnw-mesh_02:00:0a:12:48:00',
},
},
wifi5 = {
ap = {
ssid = 'test.nordwest.freifunk.net',
owe_ssid = 'owe.test.nordwest.freifunk.net',
owe_transition_mode = true,
},
mesh = {
id = 't-ffnw-mesh_02:00:0a:12:48:00',
},
},
next_node = {
name = { 'node.ffnw', 'nextnode', 'nn' },
ip6 = 'fd74:fdaa:9dc4::127',
mac = '16:41:95:40:f7:dc',
},
mesh_vpn = {
tunneldigger = {
brokers = {'lk-st01.sn.ffnw.de:9001'}
},
},
hoodselector = {
shapes = {
{
{
lat = 52.25,
lon = 7.66
},
{
lat = 52.25,
lon = 7.76
},
{
lat = 52.3,
lon = 7.76
},
{
lat = 52.3,
lon = 7.66
},
{
lat = 52.25,
lon = 7.66
}
}
}
}
}