-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfloflis
executable file
·235 lines (220 loc) · 7.5 KB
/
floflis
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
#!/bin/bash
# < --------------------- take extra attention, ensure compatibility on init and install ------------
# load definitions & settings ---->
if [[ $(echo $PREFIX | grep -o "com.termux") == "com.termux" ]];
then
. /data/data/com.termux/files/usr/lib/floflis/./config
else
. /usr/lib/floflis/./config
fi
export FLOPREFIX
export flofmach && export flofdistro && export flofarch && export osfullname && export osname && export osversion && export osbuild && export osbuildcodename && export updatepatch && export year && export layer && export nxtlayer && export distrobase && export user && export specialbuildattempt
# <---- load definitions & settings
# supports 'flo' short command
if [ -e "$FLOPREFIX"usr/bin/flo ]
then
flo="flo"
else
flo="floflis"
fi
# --------------------- take extra attention, ensure compatibility on init and install ------------ >
versionshow=" \e[101m $osname \e[0m\e[100m build $osbuild \e[0m"
# shows presentation if user just types 'floflis/flo':
if [ "$1" = "" ]; then
cat "$FLOPREFIX"usr/lib/floflis/layers/$layer/presentation
echo -e "$versionshow | $osbuildcodename - $year"
echo "Type '$flo --help' (without quotes) to see a list of available commands."
# detect version 071 and fix>
if [ -e "$FLOPREFIX"usr/sbin/floflis ]
then
echo "- Floflis build 071 detected. It uses a old folder structure. Fixing..."
sudo mkdir "$FLOPREFIX"usr/lib/floflis && sudo mv -f "$FLOPREFIX"usr/sbin/layers "$FLOPREFIX"usr/lib/floflis
sudo mv -f "$FLOPREFIX"usr/sbin/floflis "$FLOPREFIX"usr/bin
echo "Fixed."
fi
# <detect 071 version and fix
fi
# re-enable after upgrade feature is implemented. also, should detect if Core is already installed before asking
# if [ ! -e "$FLOPREFIX"usr/lib/floflis/layers/core ]
# then
# echo -e "\e[101m NOTE: FLOFLIS DNA IS NOW UPGRADEABLE TO FLOFLIS CORE! \e[0m"
#fi
#fi
# displays help message with a list of commands:
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
cat << "EOF"
-. .-. .-. .-. .-. .-. .
\ \ / \ \ / \ \ /
/ \ \ / \ \ / \ \
~ `-~ `-` `-~ `-` `-~ `-
EOF
echo "Use these commands after/together with '$flo' command."
echo "Available commands:"
echo "Information:"
echo " --help, -h Shows all available commands"
echo " --version, -v Shows info about OS name, version and build version"
# echo "Upgrade:"
# echo " upgrade, upg Upgrades Floflis"
fi
# load modules
# -
if [ -e "$FLOPREFIX"usr/lib/floflis/layers/dna/modules ]
then
. "$FLOPREFIX"usr/lib/floflis/layers/dna/./modules.sh
fi
# load information and modules from layers
# -
# Core
if [ -e "$FLOPREFIX"usr/lib/floflis/layers/core ]
then
# sudo sed -i 's/dna/core/g' "$FLOPREFIX"usr/lib/floflis/config
# layernm="Floflis Core"
. "$FLOPREFIX"usr/lib/floflis/layers/core/./floflis
#else
# layernm="Floflis DNA"
fi
# -
# Server
if [ -e "$FLOPREFIX"usr/lib/floflis/layers/server ]
then
# sudo sed -i 's/dna/core/g' "$FLOPREFIX"usr/lib/floflis/config
# layernm="Floflis Core"
. "$FLOPREFIX"usr/lib/floflis/layers/server/./floflis
#else
# layernm="Floflis DNA"
fi
# -
# Soil
if [ -e "$FLOPREFIX"usr/lib/floflis/layers/soil ]
then
# sudo sed -i 's/dna/core/g' "$FLOPREFIX"usr/lib/floflis/config
# layernm="Floflis Core"
. "$FLOPREFIX"usr/lib/floflis/layers/soil/./floflis
#else
# layernm="Floflis DNA"
fi
# -
# Grass
if [ -e "$FLOPREFIX"usr/lib/floflis/layers/grass ]
then
# sudo sed -i 's/dna/core/g' "$FLOPREFIX"usr/lib/floflis/config
# layernm="Floflis Core"
. "$FLOPREFIX"usr/lib/floflis/layers/grass/./floflis
#else
# layernm="Floflis DNA"
fi
# -
# Base
if [ -e "$FLOPREFIX"usr/lib/floflis/layers/base ]
then
# sudo sed -i 's/dna/core/g' "$FLOPREFIX"usr/lib/floflis/config
# layernm="Floflis Core"
. "$FLOPREFIX"usr/lib/floflis/layers/base/./floflis
#else
# layernm="Floflis DNA"
fi
# -
# Home
if [ -e "$FLOPREFIX"usr/lib/floflis/layers/home ]
then
# sudo sed -i 's/dna/core/g' "$FLOPREFIX"usr/lib/floflis/config
# layernm="Floflis Core"
. "$FLOPREFIX"usr/lib/floflis/layers"$FLOPREFIX"home/./floflis
#else
# layernm="Floflis DNA"
fi
# -
# Ultimate
if [ -e "$FLOPREFIX"usr/lib/floflis/layers/ultimate ]
then
# sudo sed -i 's/dna/core/g' "$FLOPREFIX"usr/lib/floflis/config
# layernm="Floflis Core"
. "$FLOPREFIX"usr/lib/floflis/layers/ultimate/./floflis
#else
# layernm="Floflis DNA"
fi
# -
# Planetary
if [ -e "$FLOPREFIX"usr/lib/floflis/layers/planetary ]
then
# sudo sed -i 's/dna/core/g' "$FLOPREFIX"usr/lib/floflis/config
# layernm="Floflis Core"
. "$FLOPREFIX"usr/lib/floflis/layers/planetary/./floflis
#else
# layernm="Floflis DNA"
fi
if [ "$1" = "--version" ] || [ "$1" = "-v" ]; then
echo -e "$versionshow | $osbuildcodename ($layer layer) - $year"
fi
#if [ "$nxtlayer" = "core" ]; then
# nxtlayernm="Floflis Core"
#fi
#if [ "$1" = "upgrade" ] || [ "$1" = "upgrd" ] || [ "$1" = "pgrd" ] || [ "$1" = "upgr" ] || [ "$1" = "upg" ]; then
# if [ "$layer" = "core" ]
# then
# echo "You're already on the highest layer available for now ($layernm)."
# echo ""
# echo "Subscribe to our blog to know about new layers: https://floflis.github.io/blog"
# else
# cat << "EOF"
#
#-. .-. .-. .-. .-. .-. .
# \ \ / \ \ / \ \ /
# / \ \ / \ \ / \ \
#~ `-~ `-` `-~ `-` `-~ `-
#
#EOF
# echo "You're requesting to upgrade from $layernm to $nxtlayernm. You could do it by manually downloading/clonning $nxtlayernm and running its install.sh, or directly from a git service."
# echo ""
# echo "What do you want to do?"
# echo "1 = I want do download its release package (IPFS available alongside GitHub)"
# echo "2 = I want to clone it from a git service"
# echo "3 = I want to directly upgrade it from a git service"
# echo "Please reply by typping a number (according to your choice) and press [ENTER]:"
# read choosetoupgrade
# if [ "$choosetoupgrade" = "1" ]; then
# cat << "EOF"
#
#-. .-. .-. .-. .-. .-. .
# \ \ / \ \ / \ \ /
# / \ \ / \ \ / \ \
#~ `-~ `-` `-~ `-` `-~ `-
#
#EOF
# echo "You can choose a package to install, here:"
# echo "https://floflis.github.io/download/"
# echo "After downloading $nxtlayernm, run its 'init.sh' (if the downloaded version isn't Lite), move the folder to the target device, then run its 'install.sh'."
#fi
# if [ "$choosetoupgrade" = "2" ]; then
# cat << "EOF"
#
#-. .-. .-. .-. .-. .-. .
# \ \ / \ \ / \ \ /
# / \ \ / \ \ / \ \
#~ `-~ `-` `-~ `-` `-~ `-
#
#EOF
# echo "You can choose a git service to clone, here:"
# echo "https://floflis.github.io/download#clone"
# echo "After clonning $nxtlayernm, run its 'init.sh', move the folder to the target device, then run its 'install.sh'."
#fi
# if [ "$choosetoupgrade" = "3" ]; then
# cat << "EOF"
#
#-. .-. .-. .-. .-. .-. .
# \ \ / \ \ / \ \ /
# / \ \ / \ \ / \ \
#~ `-~ `-` `-~ `-` `-~ `-
#
#EOF
# echo "Please note P2P isn't yet available."
# echo "- Upgrading to Core layer from GitLab..."
# cd "$FLOPREFIX"usr/lib/floflis/layers
# sudo git clone https://gitlab.com/Floflis/Floflis-Core.git core
# sudo sed -i 's/dna/core/g' "$FLOPREFIX"usr/lib/floflis/layers/dna/config.sh
# echo "(✓) Floflis DNA has been upgraded to Floflis Core." && exit
#fi
#fi
#fi
# todo:support updates if Dat is installed
# todo:read-more lib