-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush.sh
More file actions
executable file
·58 lines (55 loc) · 1.41 KB
/
Copy pathpush.sh
File metadata and controls
executable file
·58 lines (55 loc) · 1.41 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
STRING="{\"Themes\": {"
for f in */*; do
#f = themes/themename
declare -a DOWNLOADS=()
STRING=$STRING"\"$(basename $f)\":{"
for i in $f/*; do
N=$(basename $i)
#$N = items in theme folder
if [[ $(basename $f).jpg == $N ]] #if ThemeName.jpg = ThemeName.jpg
then
DOWNLOADS+=($N) #add images
STRING=$STRING"\"img\":\"$N\"," #image
elif [[ $N != *.* ]]; #if doesn't contain an extention looking for .
then
if [[ $N == *signalImages* ]]; #check if contains signalImages
then
#$i = themes/themeName/signalImages
for s in $i/*; do #loop over signalImages/
signal=$(basename $s) #get inner folder name
DOWNLOADS+=($signal/signalimages) #add to downloads
done
elif [[ $N == *wifiImages* ]]; #check if contains wifiImages
then
#$i = themes/themeName/wifiImages
for s in $i/*; do #loop over wifiImages/
wifi=$(basename $s) #get inner folder name
DOWNLOADS+=($wifi/wifiimages) #add to downloads
done
else
DOWNLOADS+=($N/weathericons)
fi
else
DOWNLOADS+=($N)
fi
done
STRING=$STRING"\"downloads\":\"["
pos=$(( ${#DOWNLOADS[*]} - 1 ))
last=${DOWNLOADS[$pos]}
for d in "${DOWNLOADS[@]}"; do
if [[ $d == $last ]]
then
STRING=$STRING$d
else
STRING=$STRING$d,
fi
done
STRING=$STRING"]\"},"
done
STRING=$STRING"}}"
echo $STRING > themes.json
git add .
git commit -m "$*"
git branch -M main
git push -u origin main