Inhaltsverzeichnis

Kontroll-Datei für Ruckus

Die Kontroll-Datei wird benutzt um bei Standalon-AP's Update bzw. die Umwandlung in Unleashed-Systemen durchführen.

Aufbau

Hier nun der Aufbau:

[rcks_fw.main] Einleitung in die Datei
0.0.0.0 Quellen-IP
R500_200.3.9.13.228.bl7 Firmware
22087676 Grösse der Firmware (in Byte) (du -b R500_200.3.9.13.228.bl7)

Beispiel

[rcks_fw.main]
0.0.0.0
R500_200.3.9.13.228.bl7
22087676

Bash-Script

Hier noch ein kleines Bash-Script, mit welchem die Kontroll-Dateien automatisch erstellt werden können.

#/bin/bash
#Beschreibung
#Automatische Erstellung der Ruckus Controll-Datei
#by Gregor holzfeind <gholzfeind@heiniger-ag.ch>
#Version: 0.1
#Datum: 2018.04.12

#Variablen
path="/home/gregor/Ruckus" #Ursprungspfad
path_tftp="/srv/tftp" #TFTP-Pfad  / Zielpfad

#Funktionen
function func_analyse() {
    find $path -name "*.bl7" | sort > liste.tmp.$$
    while read input
    do
	model=$(echo $input | cut -d"/" -f7 | cut -d"_" -f1)
        version=$(echo $input | cut -d"/" -f7 | cut -d"_" -f2 | cut -d"." -f1-5)
        file=$(echo $input | cut -d"/" -f7)
        space=$(du -b $input | cut -d"/" -f1)
        file_name="$path_tftp""$model""_""$version""_cntrl.rcks"
        echo "[rcks_fw.main]" > $file_name
        echo "0.0.0.0 " >> $file_name
        echo "$file" >> $file_name
        echo "$space" >> $file_name
        if [ ! -e "$path_tftp/$file" ]
        then
            cp $input $path_tftp
        fi
    done < liste.tmp.$$
}

function func_new() {
    find $path_tftp -name "*.bl7" | sort -V > liste.tmp.$$
    while read input
    do
        model=$(echo $input | cut -d"/" -f4 | cut -d"_" -f1)
        type=$(echo $input | cut -d"/" -f4 | cut -d"_" -f2 | cut -d"." -f1)
        file=$(echo $input | cut -d"/" -f4)
        space=$(du -b $input | cut -d"/" -f1)
        if [ "$type" -ge "200" ]
        then
            file_name="$path_tftp""$model""_u""_cntrl.rcks"
        elif [ "$type" -lt "200" ]
        then
            file_name="$path_tftp""$model""_cntrl.rcks"
        fi
        echo "[rcks_fw.main]" > $file_name
        echo "0.0.0.0 " >> $file_name
	echo "$file" >> $file_name
	echo "$space" >> $file_name
    done < liste.tmp.$$
}

#Programm
func_analyse
func_new
rm liste.tmp.$$