forked from linux-surface/surface-uefi-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prep.sh
executable file
·43 lines (34 loc) · 781 Bytes
/
prep.sh
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
35
36
37
38
39
40
41
42
43
#!/bin/sh
setmodel()
{
BASENAME=$(basename $1)
NEWNAME="$2_$(echo $BASENAME | cut -d'_' -f2-)"
mv $1 $(dirname $1)/$NEWNAME
echo " > New filename is $NEWNAME"
}
match()
{
echo $1 | grep -q $2
}
FILE=$1
NAME=$(basename $FILE)
MODEL=""
if match $NAME SurfaceGo && match $NAME WiFi; then
setmodel $FILE SurfaceGo-WiFi
exit
fi
if match $NAME SurfaceGo && match $NAME LTE; then
setmodel $FILE SurfaceGo-LTE
exit
fi
# Matching for SurfacePro_ avoids any false positives when checking
# other Surface Pros with proper naming on their firmware MSIs
if match $NAME SurfacePro_ && match $NAME LTE; then
setmodel $FILE SurfacePro5-LTE
exit
fi
if match $NAME SurfacePro_; then
setmodel $FILE SurfacePro5-WiFi
exit
fi
echo " > No changes neccessary! Filename stays $NAME"