-
Notifications
You must be signed in to change notification settings - Fork 53
/
icon_download.sh
executable file
·135 lines (100 loc) · 3.11 KB
/
icon_download.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # Download custom vm icons from github and add them to Unraid server # #
# # by - SpaceinvaderOne # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # Variables - (other variables set in container template # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Directory for downloaded icons to be stored
DIR="/config/icons"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # Functions # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Delete icon store if present and delete is set to yes in template
shall_i_delete() {
if [ -d $DIR ] && [ $delete == "yes" ]; then
rm -r $DIR
echo "I have deleted the icon directories ready for new"
echo "."
echo "."
else
echo " ......continuing."
fi
}
# Create icon directory if not present if directory exists sync contents to vm manger and exit
download_or_sync() {
if [ ! -d $DIR ] ; then
mkdir -vp $DIR
echo "I have created the icon store directory & now will start downloading selected icons"
if [ -d /config/unraid_vm_icons ] ; then
rm -r /config/unraid_vm_icons
fi
git -C /config clone https://github.com/SpaceinvaderOne/unraid_vm_icons.git
downloadwindows
downloadlinux
downloadfreebsd
downloadother
downloadmacos
echo "."
echo "."
echo "icons downloaded and synced"
else
echo "."
echo "."
echo "Icons downloaded previously."
echo "icons synced"
fi
rsync -a $DIR/* /unraid_vm_icons
}
# Download windows based OS icons if set in template
downloadwindows() {
if [ $windows == "yes" ] ; then
rsync -a /config/unraid_vm_icons/icons/Windows/* $DIR
else
echo " windows based os icons not wanted......continuing."
echo "."
echo "."
fi
}
# Download linux based OS icons if set in template
downloadlinux() {
if [ $linux == "yes" ] ; then
rsync -a /config/unraid_vm_icons/icons/Linux/* $DIR
else
echo " linux based os icons not wanted......continuing."
echo "."
echo "."
fi
}
# Download freebsd based OS icons if set in template
downloadfreebsd() {
if [ $freebsd == "yes" ] ; then
rsync -a /config/unraid_vm_icons/icons/Freebsd/* $DIR
else
echo " freebsd based os icons not wanted......continuing."
echo "."
echo "."
fi
}
# Download other OS icons if set in template
downloadother() {
if [ $other == "yes" ] ; then
rsync -a /config/unraid_vm_icons/icons/Other/* $DIR
else
echo " other os icons not wanted......continuing."
echo "."
echo "."
fi
}
# Download macOS based OS icons if set in template
downloadmacos() {
if [ $macos == "yes" ] ; then
rsync -a /config/unraid_vm_icons/icons/macOS/* $DIR
else
echo " macos based os icons not wanted......continuing."
echo "."
echo "."
fi
}
shall_i_delete
download_or_sync