aboutsummaryrefslogtreecommitdiff
path: root/bin/gse
blob: e67921d61ac243fea2a4936eab1dc39529e5e781 (plain)
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
#!/bin/bash

##																						     ##
#																						      #
# Gentoo Stateless Environment project													      #
#																						      #
# Everything inside this directory has been created during Gentoo-soc 2017 and is distributed #
# under General Public License version 2.												      #
#																						      #
##																						     ##

if echo "${_flag_tty}" | grep -q 'sshd'; then
	LC_COLLATE="C"
	LC_ALL="en_US.UTF-8"
	LC_CTYPE="en_US.UTF-8"
fi

# DEFINITION OF CWORKDIR AND IT'S SUBDIRECTORIES
export CWORKDIR="$(dirname ${PWD})"
export CCONFDIR="${CWORKDIR}/config.d"
export CDISTDIR="${CWORKDIR}/dist.d"
export CLOCALLG="${CWORKDIR}/local"
export CREL="$(grep ^NAME /etc/*release | awk -F '=' '{ print $2 }')"

# PATH DEFINITION FOR THE SCRIPTS WHICH WILL AID THE PROCESS
export PATH=${PATH}:${CWORKDIR}/scripts/functions

source "${CWORKDIR}/scripts/functions/sinit_functions" || { echo -e "\e[32mMissing scripts\e[0m" && exit 1; }
source "${CWORKDIR}/scripts/functions/catalyst_functions" || { echo -e "\e[32mMissing scripts\e[0m" && exit 1; }
source "${CWORKDIR}/etc/gentoo.conf" || { echo -e "\e[32mMissing gentoo.conf\e[0m" && exit 1; }

STAT_VAR=''

#set -o

# CHECK IF BASH IS THE DEFAULT {CURRENT} SHELL, ISSUE A WARNING OTHERIWSE
shl_f() {
	SHL=$SHELL
	ISITBASH=$(echo "${SHL}" |  awk -F "bin/" '{ print $2}')
	if [[ ${ISITBASH} != "bash" ]]; then
		echo "Seems like you are not using bash"
		echo "Keep in mind that all scripts from this project are written for bash interpretation"
		while true; do
			echo "Do you want to continue?: "
			read -rp "Input :: <= " S
			case ${S} in
				[Yy][eE][sS]|[yY]) clear; break;;
				[Nn][oO]|[nN]) echo "Exiting..."; exit;;
				* ) echo  "Select Y/N";;
			esac
		done
	fi
}

# ROOT CHECK FUNCTION, IS NEEDED FOR THE CATALYST AND CHROOT PROCESS
amiroot() {
	if [[ "$1" != "0" ]]
	then
		echo "This operation requires root privileges"
		echo "Returning back..."
		sleep 2
		BACKTO="MM"
	fi
}

subterm_f() {
	echo -e "\e[33mCalling bash subshell\e[0m"
	sleep 2
	echo 'echo -e "\e[33mInside Subshell\e[0m"' >> /root/.bashrc
	echo 'echo -e "\e[33mExit to return back to parent\e[0m"' >> /root/.bashrc
	(clear; exec /bin/bash "${lppar[@]}";)
	sed -i "/Inside Subshell/d" "/root/.bashrc"
	sed -i "/Exit to return back to parent/d" "/root/.bashrc"
	echo -e "\e[33mYou are back to parent\e[0m"
}

# MAIN MENU FUNCTION
main_f() {
	while true; do
		clear; men_opt 1
		read -rp "Input :: <= " SELCT
		case ${SELCT:-6} in
			I|i|1|-I|-i|-1			)
				# CALL BUILDER SUBMENU
				bs_menu_f "${lppar[@]}"; break;;
			II|ii|2|-II|-ii|-2		)
				# CALL CONTROLLER SUBMENU
				con_f; break;;
	 		III|iii|3|-III|-iii|-3	)
				# GSE TOOLS SUBMENU: RENEW & VERSION CHECK
				gse_t "${lppar[@]}"; break;;
			IV|iv|4|-IV|-iv|-4		)
				# CALL DOCUMENTATION SUBMENU
				doc_f; break;;
			V|v|5|-V|-v|-5			)
				# CALL ABOUT SUBMENU
				about_f; break;;
			VI|vi|6|-VI|-vi|-6|[Qq][uU][iI][tT]|[Ee][Xx][Ii][tT]|[qQ])
 				echo -e "\e[32mExiting\e[39m..."; BACKTO="Q"
 				break;;
 			[tT]					)
				subterm_f "${lppar[@]}"
				echo "Presh any key to return"
				read -r 1>&-;BACKTO="MM" 
  				clear; break;;
			* ) clear; men_opt 1;;
		esac
	done
}

gse_t() {
	while true; do
		clear; men_opt 11
		read -rp "Input :: <= " SELCT
		case ${SELCT:-6} in
			I|i|1|-I|-i|-1			)
				# RENEW ALL MODIFIED ITEMS
				# THE LIST WILL INCLUDE ONLY THE MAIN SCRIPTS IN THE END
				#./"${CWORKDIR}/functions/renew" & 
				exit 0;;
			II|ii|2|-II|-ii|-2		)
				# VERSION CHECK
				source "${CWORKDIR}/functions/gse_sources"
				echo "Presh any key to return"
				read -r 1>&-;BACKTO="GSET"; break;;
	 		III|iii|3|-III|-iii|-3	)
				BACKTO="MM"
				break;;
 			[tT]					)
				subterm_f "${lppar[@]}"
				echo "Presh any key to return"
				read -r 1>&-;BACKTO="GSET" 
  				clear; break;;
			* ) clear; men_opt 11;;
		esac
	done
}
# BUILDER SUBMENU
bs_menu_f() {
	clear; men_opt 5
	while true; do
		read -rp "Input :: <= " SELCT
		case ${SELCT:-4} in
			I|i|1|-I|-i|-1			)
				# CALL BUILD SYSTEM SUBMENU
				clear; bs_f "${lppar[@]}"
				break;;
			II|ii|2|-II|-ii|-2		)
				# CALL CONFIGURATION SUBMENU
				clear; config_f "${lppar[@]}"
				break;;
			III|iii|3|-III|-iii|-3	)
				subterm_f "${lppar[@]}"
				# CALL SELECT DEFAULT SYSTEM SUBMENU
				clear; selectdef_f "${lppar[@]}"
				break;;
			IV|iv|4|-IV|-iv|-4		)
				# TBU: WILL INCLUDE A STAGE4 TARBALL CREATION
				echo "Presh any key to return"
				read -r 1>&-;BACKTO="BSM";
				break;;
			V|v|5					)
				clear; BACKTO="MM"; break;;
			[tT]					)
				subterm_f "${lppar[@]}"
				echo "Presh any key to return"
				read -r 1>&-;BACKTO="BSM";
  				clear; break;;
			* ) clear; men_opt 5;;
		esac
	done
}

# BUILD SYSTEM SUBMENU
bs_f() {
clear; men_opt 6
	while true; do
		read -rp "Input :: <= " SELCT
		case ${SELCT:-3} in
			I|i|1|-I|-i|-1			)
				# CALL PORTAGE SUBMENU
				portage_men_f "${lppar[@]}"
				break;;
			II|ii|2|-II|-ii|-2		)
				# CALL CATALYST SUBMENU
				catalyst_f "${lppar[@]}"
				break;;
			III|iii|3|-III|-iii|-3	)
				# START PRE PRECOMPILED
				clear; warp "--base=precomp" "${lppar[@]}"
				echo "Presh any key to return"
				read -r 1>&-;BACKTO="SM";
				break;;
			IV|iv|4|-IV|-iv|-4		)
				clear; BACKTO="BSM"; break;;
			[tT]					)
				subterm_f "${lppar[@]}"
				echo "Presh any key to return"
				read -r 1>&-;BACKTO="SM";
  				clear; break;;
			* ) clear; men_opt 6;;
		esac
	done
}

# PORTAGE SUBMENU
portage_men_f() {
	clear; men_opt 7
	while true; do
		read -rp "Input :: <= " SELCT
		case ${SELCT:-5} in
			I|i|1|-I|-i|-1			)
				# MAKE MAKE.CONF: AUTOMATIC OR GUIDED CONFIGURATION
				makeconf_ed &&{ clear; echo -e "[\e[32m*\e[0m] Configurations was successful!"
				echo "Presh any key to return"; } || { cho -e "[\e[31m*\e[0m] Something went wrong"; }
				read -r 1>&-; BACKTO="PORT_M"; break;;
			II|ii|2|-II|-ii|-2		)
				# MANUAL EDIT OF MAKE.CONF
				cp "${CCONFDIR}/system/portage/makeconf.backup" "${CCONFDIR}/system/portage/make.conf"
				vim "${CCONFDIR}/system/portage/make.conf"
				clear; echo "Presh any key to return"
				read -r 1>&-; BACKTO="PORT_M"; break;;
			III|iii|3|-III|-iii|-3	)
				# FEATURES & CCACHE
				vim "${CCONFDIR}/system/coptions"
				clear; echo "Presh any key to return"
				read -r 1>&-; BACKTO="PORT_M"; break;;
			IV|iv|4|-IV|-iv|-4		)
				# EDIT DISTCC
				vim "${CCONFDIR}/system/portage/hosts"
				clear; echo "Presh any key to return"
				read -r 1>&-; BACKTO="PORT_M"; break;;
			V|v|5|-V|-v|-5			)
				# MANUAL EDIT OF USEFLAGS
				vim "${CCONFDIR}/system/portage/package.use/sysbuild"
				clear; echo "Presh any key to return"
				read -r 1>&-; BACKTO="PORT_M"; break;;
			VI|vi|6|-VI|-vi|-6		)
				# PREVIEW OF USEFLAGS: WILL BE REMOVED AS AN OPTION
				less "${CCONFDIR}/system/portage/package.use/sysbuild"
				clear; echo "Presh any key to return"
				read -r 1>&-; BACKTO="PORT_M"; break;;
			VII|vii|7|-VII|-vii|-7	)
				# REGENERATES MAKE.CONF TO DEFAULT
				cp "${CCONFDIR}/system/portage/package.use/sysbuild.backup" "${CCONFDIR}/system/portage/package.use/sysbuild"
				clear; echo "Presh any key to return"
				read -r 1>&-; BACKTO="PORT_M"; break;;
			VIII|viii|8				)
				BACKTO="SM"; break;;
			[tT]					)
				subterm_f "${lppar[@]}"
				echo "Presh any key to return"
				read -r 1>&-;BACKTO="PORT_M";
  				clear; break;;
			* ) clear; men_opt 7;;
		esac
	done
}

catalyst_f() {
	clear; men_opt 10
	while true; do
		read -rp "Input :: <= " SELCT
		case ${SELCT:-6} in
			I|i|1|-I|-i|-1			)
				# CONFIGURE CATALYST.CONF
				vim "${CCONFDIR}/system/catalyst/catalyst.conf"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CATA_M"; break;;
			II|ii|2|-II|-ii|-2		)
				# CONFIGURE CATALYSTRC
				vim "${CCONFDIR}/system/catalyst/catalystrc"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CATA_M"; break;;
			III|iii|3|-III|-iii|-3	)
				# CONFIGURE STAGE1.SPEC
				vim "${CCONFDIR}/system/catalyst/stage1.spec"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CATA_M"; break;;
			IV|iv|4|-IV|-iv|-4		)
				# CONFIGURE STAGE2.SPEC
				vim "${CCONFDIR}/system/catalyst/stage2.spec"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CATA_M"; break;;
			V|v|5|-V|-v|-5			)
				# CONFIGURE STAGE3.SPEC
				vim "${CCONFDIR}/system/catalyst/stage3.spec"
				clear; echo "Presh any key to return"
				read -r 1>&-; BACKTO="CATA_M"; break;;
			VI|vi|6|-VI|-vi|-6		)
				# START MAIN BUILDER PROCESS
				clear; warp "--base=catalyst" "${lppar[@]}"
				echo "Presh any key to return"
				read -r 1>&-;BACKTO="CATA_M";
				break;;
			VII|vii|7				)
				BACKTO="SM"; break;;
			[tT]					)
				subterm_f "${lppar[@]}"
				echo "Presh any key to return"
				read -r 1>&-;BACKTO="PORT_M";
  				clear; break;;
			* ) clear; men_opt 7;;
		esac
	done
}

# CONFIGURATION SUBMENU
config_f() {
	clear; men_opt 8
	while true; do
		read -rp "Input :: <= " SELCT
		case ${SELCT} in
			I|i|1|-I|-i|-1			)
				# GUIDED FSTAB EDITOR
				drv_interface
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CO_F"; break;;
			II|ii|2|-II|-ii|-2		)
				# MANUAL FSTAB EDIT
				vim "${CCONFDIR}/system/fstab"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CO_F"; break;;
			III|iii|3|-III|-iii|-3	)
				# DEVICES FOR BOOT, SYSTEM, USERDATA: RELATED ONLY WITH THE HOSTS
				vim "${CCONFDIR}/system/devname.info"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CO_F"; break;;
			IV|iv|4|-IV|-iv|-4		)
				# HOSTNAME
				vim "${CCONFDIR}/system/hostname"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CO_F"; break;;
			V|v|5|-V|-v|-5			)
				# NETWORKING
				vim "${CCONFDIR}/system/net"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CO_F"; break;;
			VI|vi|6|-VI|-vi|-6		)
				# LOCALES
				vim "${CCONFDIR}/system/locale.gen"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CO_F"; break;;
			VII|vii|7				)
				# CONSOLEFONTS
				vim "${CCONFDIR}/system/consolefont"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CO_F"; break;;
			VIII|viii|8				)
				# SSHD CONFIGURATION FILE
				vim "${CCONFDIR}/system/sshd"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CO_F"; break;;
			IX|ix|9					)
				# SSH PUBLIC KEY: WILL BE INCLUDED ON THE HOSTS
				vim "${CCONFDIR}/system/ssh.pub"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CO_F"; break;;
			X|x|10					)
				# SETS SYMLINKS, BIND MOUNTS, TMPFS AND OVERLAYS
				vim "${CCONFDIR}/system/system_links"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CO_F"; break;;
			XI|xi|11				)
				# SETS CUSTOM USER SCRIPTS ON BOOTUP
				vim "${CCONFDIR}/system/custom_scripts"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CO_F"; break;;
			XII|xii|12				)
				# LIST FOR CUSTOM PACKAGES TO BE INSTALLED DURING THE PROCESS
				vim "${CCONFDIR}/system/custom_pacl"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CO_F"; break;;
			XIII|xiii|13			)
				# EDIT DEFAULT GRUB
				vim "${CCONFDIR}/system/grub"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CO_F"; break;;
			XIV|xiv|14				)
				# UPDATES RUNLEVEL ENTRIES
				vim "${CCONFDIR}/system/runlevels"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CO_F"; break;;
			XV|xv|15				)
				# INJECT CUSTOM FILES
				vim "${CCONFDIR}/system/inject_files"
				clear; echo -e "[\e[32m*\e[0m] Presh any key to return"
				read -r 1>&-; BACKTO="CO_F"; break;;
			XVI|xvi|16				)
				BACKTO="BSM"; break;;
			[tT]					)
				subterm_f "${lppar[@]}"
				echo "Presh any key to return"
				read -r 1>&-;BACKTO="CO_F";
  				clear; break;;
			* ) clear; men_opt 8;;
		esac
	done
}

# SELECT DEFAULT SYSTEM MENU
selectdef_f() {
	#show list of local builds
	#add imput for setting default
		#will change the dist system-arch-version to system-arch-version-default
		#same for kernel-arch-version
	clear; men_opt 9
	while true; do
		read -rp "Input :: <= " SELCT
		case ${SELCT:-3} in
			I|i|1|-I|-i|-1			)
				clear; echo "Documentations submenu option a)"
				echo "Presh any key to return"
				read -r 1>&-; BACKTO="SELDEF"; break;;
			II|ii|2|-II|-ii|-2		)
				clear; echo "Documentations submenu option b)"
				echo "Presh any key to return"
				read -r 1>&-; BACKTO="SELDEF"; break;;
			III|iii|3|-III|-iii|-3	)
				clear; BACKTO="BSM"; break;;
			[tT]					)
				subterm_f "${lppar[@]}"
				echo "Presh any key to return"
				read -r 1>&-;BACKTO="SELDEF";
  				clear; break;;
			* ) clear; men_opt 9;;
		esac
	done
}

# THE CONTROLLER MENU
con_f() {
	clear; amiroot "$UID"; echo "You selected: build the controller image"; echo
	source cinit.sh
	BACKTO="MM"
}

# DOCUMENTATIONS MENU
doc_f(){
	clear; echo "	      Documentations. Please enjoy yourself!"; echo
	men_opt 2
	while true; do
		read -rp "Choose a document you wish to read: " SELCT
		case ${SELCT:-5} in
			I|i|1|-I|-i|-1			)
				clear; echo "Documentations submenu option a)"
				echo "Presh any key to return"
				read -r 1>&-; BACKTO="DOC"; break;;
			II|ii|2|-II|-ii|-2		)
				clear; echo "Documentations submenu option b)"
				echo "Presh any key to return"
				read -r 1>&-; BACKTO="DOC"; break;;
			III|iii|3|-III|-iii|-3	)
				clear; echo "Documentations submenu option c)"
				echo "Presh any key to return"
				read -r 1>&-; BACKTO="DOC"; break;;
			IV|iv|4|-IV|-iv|-4		)
				clear; echo "Documentations submenu option d)"
				echo "Presh any key to return"
				read -r 1>&-; BACKTO="DOC"; break;;
			V|v|5|-V|-v|-5			)
				clear; echo "Documentations submenu option e)"
				BACKTO="MM"; break;;
			* ) clear; men_opt 2;;
		esac
	done
}

# ABOUT MENU
about_f() {
	clear; echo "		     Welcome to About Menu"; echo
	men_opt 3
	while true; do
		read -rp "Choose a journey: " SELCT
		case ${SELCT:-4} in
			I|i|1|-I|-i|-1			)
				clear; echo "About submenu option a)"
				echo "Presh any key to return"
				read -r 1>&-; BACKTO="AB"; break;;
			II|ii|2|-II|-ii|-2		)
				clear; echo "About submenu option b)"
				echo "Presh any key to return"
				read -r 1>&-; BACKTO="AB"; break;;
			III|iii|3|-III|-iii|-3	)
				clear; echo "About submenu option c)"
				echo "Presh any key to return"
				read -r 1>&-; BACKTO="AB"; break;;
			IV|iv|4|-IV|-iv|-4		)
				clear; echo "About submenu option d)"
				BACKTO="MM"; break;;
			* ) clear; men_opt 3;;
		esac
	done
}

# MAIN LOOP FUNCTION
mainlp_f() {
BACKTO="$1"
while true; do
	case "${BACKTO:-MM}" in
		MM 		)
			# PULLS MAIN MENU FUNCTION
			main_f "${lppar[@]}";;
		DOC 	)
			# PULLS DOCUMENTATION MENU FUNCTION
			doc_f;;
		AB 		)
			# PULLS ABOUT MENU FUNCTION
			about_f;;
		PORT_M 	)
			# PULLS PORTAGE SUBMENU FUNCTION
			portage_men_f "${lppar[@]}";;
		CATA_M 	)
			catalyst_f "${lppar[@]}";;
		SM 		)
			# PULLS BUILD SYSTEM SUBMENU: THIS IS A SUBMENU OF BULDERS MENU
			bs_f "${lppar[@]}";;
		BSM 	)
			# PULLS BUILDER MENU
			bs_menu_f "${lppar[@]}";;
		CO_F 	)
			# PULLS CONFIGURATION SUBMENU: SUBMENU OF BUILDERS MENU
			config_f "${lppar[@]}";;
		SELDEF 	)
			# PULLS SELECT DEFAULT SYSTEM SUBMENU: SUBMENU OF BUILDERS MENU
			selectdef_f "${lppar[@]}";;
		GSET 	)
			# PULL GSE TOOLS SUBMENU
			gse_t "${lppar[@]}";;
		Q 		)
			# EXIT
			sleep 1
			break;;
	esac
done
}

if echo "$@" | grep -q '\--time-warp' && [[ "$#" != 1 ]]; then
	die "Error: Time Warp must be the only entry"
fi

lppar=()
for i in "$@"; do
	lppar+=("$i")
done

if [[ -z "$@" ]] || echo "$@" | grep -q '\-mm'; then
	mainlp_f "MM" "${lppar[@]}" && unset BACKTO && exit 0
else
	warp "$@"
fi