-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgeneratelinks
35 lines (32 loc) · 1.14 KB
/
generatelinks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# this script takes two parameters: the full version to be used and the branch
branch=$2
version=$1
#if the branch is "dev" then the files are expected to be in /var/www/files_ffm/ffm/firmware/dev/factory
dir="/var/www/files_ffm/ffm/firmware/$branch/factory /var/www/files_ffm/ffm/firmware/$branch/sysupgrade"
target=/var/www/files_ffm/ffm/external/$branch
for base_dir in $dir
do
files=$(find $base_dir -type f -name "*$version*.bin")
cd $target
for i in $files
do
# Beispiel: gluon-ffffm-ffmdev-3.8-tp-link-tl-mr3020-v1.bin
# Aufbau des Namens: gluon-ffffm-$VERSION-MAJOR.MINOR-GERAET.bin
geraet=${i##*${version}}
# die firmware hatte früher kein -nd im Gerätenamen. Damit die links stabil bleiben müssen wir den inhaltlich falschen aber früher eingesetzten Namen weiter nutzen.
tmp=${geraet//-tp-link/}
geraet=${tmp//n-nd-/nd-}
tmp=${geraet//-sysupgrade/}
geraet=$tmp
if [[ ${i} == *factory* ]]
then
type=factory
else
type=sysupgrade
fi
ln -sf ${i} ffffm${geraet%.bin}-latest-${branch}-${type}.bin
done
done
md5sum *.bin >MD5SUMS
sha256sum *.bin >SHA256SUMS