Browse code

Added a Roster Include Manager and Roster Lib Manager, and updated Choose Default Version to run those managers.

Apollia authored on10/29/2018 06:08:30
Showing3 changed files
... ...
@@ -67,6 +67,11 @@ fi
67 67
 readonly Follpath____Apphoard="$Follpath____Possible_Apphoard_Home"
68 68
 
69 69
 readonly Fillepath____Roster_Bin_Manager="$Follpath____Roster/Roster Bin Manager/AppRun"
70
+readonly Fillepath____Roster_Include_Manager="$Follpath____Roster/Roster Include Manager/AppRun"
71
+
72
+echo "Fillepath____Roster_Include_Manager: $Fillepath____Roster_Include_Manager"
73
+
74
+readonly Fillepath____Roster_Lib_Manager="$Follpath____Roster/Roster Lib Manager/AppRun"
70 75
 readonly Fillepath____Roster_Perl_Inc_Manager="$Follpath____Roster/Roster Perl-Inc Manager/AppRun"
71 76
 
72 77
 
... ...
@@ -159,9 +164,23 @@ Possibly_Switch_to_App_Version()
159 164
 	echo
160 165
 	echo
161 166
 	echo "Now telling Roster Bin Manager to unsymlink..."
167
+	echo "Fillepath____Roster_Bin_Manager: $Fillepath____Roster_Bin_Manager"
162 168
 	
163 169
 	bash "$Fillepath____Roster_Bin_Manager" "unsymlink" "$App_Name" "Default-Version"
164 170
 	
171
+	
172
+	echo "Now telling Roster Include Manager to unsymlink..."
173
+	
174
+	echo "Fillepath____Roster_Include_Manager: $Fillepath____Roster_Include_Manager"
175
+	
176
+	bash "$Fillepath____Roster_Include_Manager" "unsymlink" "$App_Name" "Default-Version"
177
+
178
+
179
+	echo "Now telling Roster Lib Manager to unsymlink..."
180
+	
181
+	bash "$Fillepath____Roster_Lib_Manager" "unsymlink" "$App_Name" "Default-Version"
182
+	
183
+	
165 184
 	if [ -f "$Fillepath____Roster_Perl_Inc_Manager" ]
166 185
 	then
167 186
 		
... ...
@@ -191,6 +210,21 @@ Possibly_Switch_to_App_Version()
191 210
 		
192 211
 		bash "$Fillepath____Roster_Bin_Manager" "symlink" "$App_Name" "Default-Version" 
193 212
 		
213
+		
214
+		echo
215
+		echo
216
+		echo "Now telling Roster Include Manager to symlink..."
217
+		
218
+		bash "$Fillepath____Roster_Include_Manager" "symlink" "$App_Name" "Default-Version" 
219
+		
220
+		
221
+		echo
222
+		echo
223
+		echo "Now telling Roster Lib Manager to symlink..."
224
+		
225
+		bash "$Fillepath____Roster_Lib_Manager" "symlink" "$App_Name" "Default-Version" 
226
+		
227
+		
194 228
 		if [ -f "$Fillepath____Roster_Perl_Inc_Manager" ]
195 229
 		then
196 230
 		
... ...
@@ -319,6 +353,8 @@ List____Vars_to_Export=(
319 353
 		"Foldername____This_Script"
320 354
 		"App_Name"
321 355
 		"Fillepath____Roster_Bin_Manager"
356
+		"Fillepath____Roster_Include_Manager"
357
+		"Fillepath____Roster_Lib_Manager"
322 358
 		"Fillepath____Roster_Perl_Inc_Manager"
323 359
 		"Symlink_Follpath____Default_Version"
324 360
 )
325 361
new file mode 100755
... ...
@@ -0,0 +1,399 @@
1
+#!/bin/bash
2
+#
3
+# Roster Include Manager
4
+#
5
+# Part of APSK App Manager
6
+#
7
+# by Apollia - http://apollia.com/
8
+
9
+
10
+# 10:02:02 04/12/2018.  Like Ramize-Physave - https://github.com/Apollia/Ramize-Physave -
11
+# running this script via a symlink changes this script's behavior!
12
+
13
+
14
+readonly Script_Title="Roster Include Manager"
15
+
16
+readonly Fillepath____This_Script=$(realpath "${BASH_SOURCE[0]}")
17
+readonly Follpath____This_Script=$(dirname "$Fillepath____This_Script")
18
+
19
+
20
+echo
21
+echo
22
+echo "		-------------------------------------------"
23
+
24
+echo "		$Script_Title"
25
+
26
+echo "		-------------------------------------------"
27
+
28
+readonly Full_Uncanon_Unreal_Folpath____This_Script=$(dirname "${BASH_SOURCE[0]}")
29
+
30
+readonly Original_Working_Dir=$(pwd)
31
+
32
+
33
+first_char_of_uncanon_folpath=$(echo "${Full_Uncanon_Unreal_Folpath____This_Script:0:1}")
34
+
35
+
36
+if [ "$first_char_of_uncanon_folpath" != "/" ]
37
+then
38
+	readonly Full_Canon_Unreal_Folpath____This_Script=$(readlink -m "$Original_Working_Dir/$Full_Uncanon_Unreal_Folpath____This_Script")
39
+else
40
+	readonly Full_Canon_Unreal_Folpath____This_Script=$(readlink -m "$Full_Uncanon_Unreal_Folpath____This_Script")
41
+fi
42
+
43
+
44
+if [ "$Full_Canon_Unreal_Folpath____This_Script" != "$Follpath____This_Script" ]
45
+then
46
+	#readonly Follpath____Possible_Apphoard_Home=$(readlink -m "$Full_Canon_Unreal_Folpath____This_Script/../..")
47
+	Follpath____Possible_Apphoard_Home=$(readlink -m "$Full_Canon_Unreal_Folpath____This_Script/../..")
48
+	
49
+	readonly Foldername____This_Script=$(basename "$Full_Canon_Unreal_Folpath____This_Script")
50
+
51
+else
52
+	#readonly Follpath____Possible_Apphoard_Home=$(realpath "$Follpath____This_Script/../..")
53
+	Follpath____Possible_Apphoard_Home=$(realpath "$Follpath____This_Script/../..")
54
+	
55
+	readonly Foldername____This_Script=$(basename "$Follpath____This_Script")
56
+
57
+fi
58
+
59
+Follpath____Possible_Apphoard_Home="/root/apbin/APSK-GLMP-GTK"
60
+
61
+readonly Follpath____Roster="$Follpath____Possible_Apphoard_Home/00-Roster of Apps"
62
+
63
+readonly Follpath____Roster_Perl_Inc="$Follpath____Roster/perl-inc"
64
+readonly Follpath____Roster_Lib="$Follpath____Roster/lib"
65
+readonly Follpath____Roster_Include="$Follpath____Roster/include"
66
+
67
+
68
+if [ ! -d "$Follpath____Roster" ]
69
+then
70
+	echo
71
+	echo "Seems this manager isn't located near a roster.  So, just opening its folder."
72
+	
73
+	rox --dir "$Follpath____This_Script"
74
+	
75
+	
76
+	#!!!!
77
+	exit 0
78
+fi
79
+
80
+readonly Follpath____Apphoard="$Follpath____Possible_Apphoard_Home"
81
+
82
+
83
+# 07:04:13 04/23/2018.  Arg 1 is a command - either "symlink" or "unsymlink".
84
+#
85
+# Arg 2 is the name of the app that this manager is going to symlink or unsymlink
86
+# a version of.
87
+#
88
+# Arg 3 is the app version to symlink or unsymlink.
89
+#
90
+#
91
+# Since all app settings are supposed to be in predictable locations, this manager
92
+# can find the roster lib symlinks list without being given a path to it.
93
+
94
+
95
+
96
+
97
+readonly Arg____Command="$1"
98
+
99
+#echo "Arg____Command: $Arg____Command"
100
+
101
+case "$Arg____Command" in
102
+	"symlink")
103
+		;;
104
+	"unsymlink")
105
+		
106
+		;;
107
+	"")
108
+		echo
109
+		echo "No command was provided, so just opening this $Script_Title's folder."
110
+		
111
+		rox --dir "$Follpath____This_Script"
112
+		
113
+		
114
+		#!!!!
115
+		exit 0
116
+		;;
117
+	
118
+	*)
119
+		echo "Unrecognized command: $Arg____Command"
120
+		rox --dir "$Follpath____This_Script"
121
+		
122
+		
123
+		#!!!!
124
+		exit 1
125
+		;;
126
+esac
127
+
128
+
129
+
130
+Abort_If_String_Contains_Chars_Inappropriate_for_a_Filename()
131
+{
132
+	# 22:24:46 05/12/2018.  Must build later.
133
+	exit_code="$2"
134
+	
135
+	
136
+#	exit "$exit_code"
137
+	:
138
+}
139
+
140
+############################################################
141
+#
142
+# 18:02:20 10/28/2018.  Valichecking args.
143
+#
144
+#-------------------
145
+
146
+readonly Arg____App="$2"
147
+
148
+	#!!!!
149
+	[ -z "$Arg____App" ] && { echo; echo "Can't proceed - no app name was provided."; exit 2; }
150
+
151
+
152
+	#!!!!
153
+	Abort_If_String_Contains_Chars_Inappropriate_for_a_Filename "$Arg____App" 3
154
+	
155
+
156
+
157
+	readonly Follpath____App="$Follpath____Apphoard/$Arg____App"
158
+	
159
+		#!!!!
160
+		[ ! -d "$Follpath____App" ] && { echo; echo "This app folder doesn't exist:
161
+
162
+	$Follpath____App"; exit 4; }
163
+
164
+
165
+		
166
+#-------------------
167
+
168
+
169
+readonly Arg____App_Version="$3"
170
+
171
+	#!!!!
172
+	[ -z "$Arg____App_Version" ] && { echo; echo "Can't proceed - no app version was provided."; exit 4; }
173
+	
174
+	#!!!!
175
+	Abort_If_String_Contains_Chars_Inappropriate_for_a_Filename "$Arg____App_Version" 5
176
+
177
+
178
+
179
+	readonly Follpath____App_Version="$Follpath____App/$Arg____App_Version"
180
+
181
+		#!!!!
182
+		[ ! -d "$Follpath____App_Version" ] && { echo; echo "This app version folder doesn't exist:
183
+
184
+	$Follpath____App_Version"; exit 6; }
185
+	
186
+
187
+
188
+############################################################
189
+#
190
+# 18:03:53 10/28/2018.  Looking for required folders.
191
+#
192
+#-------------------
193
+
194
+Follpath____Appversion_Include="$Follpath____App_Version/include"
195
+
196
+
197
+	#!!!!
198
+	[ ! -d "$Follpath____Appversion_Include" ] && { echo; echo "This app version folder's \"include\" folder doesn't exist:
199
+
200
+	$Follpath____Appversion_Include"; exit 7; }
201
+
202
+
203
+
204
+
205
+############
206
+# Function
207
+Convert_Newline_Separated_String_to_Array()
208
+{
209
+	string="$1"
210
+
211
+	# 2016-03-15 04:45:41.  addlater.  should trim final newline before processing.
212
+	
213
+#	echo "Orig string: \"$string\""
214
+	string="${string%$'\n'}"
215
+
216
+	#string="${string%\$'\\n'}"
217
+
218
+#	echo "Trimmed string: \"$string\""	
219
+	
220
+	
221
+	retcount=0
222
+	retval=()
223
+	
224
+	local array=()
225
+	
226
+	if [ -z "$string" ]
227
+	then
228
+		retcount=0
229
+		return 0
230
+	fi
231
+	
232
+	while read -r line; do
233
+		#echo "Line: '$line' "
234
+		array+=("$line")
235
+	done <<< "$string"
236
+	
237
+	retval=( "${array[@]}" )
238
+	# 2016-01-29 04:58:07.  Yep, it's that tough in Bash just to set a variable equal to an array.
239
+	
240
+	
241
+	retcount=${#retval[@]}		
242
+#	arraystring=$(printf '%s\n' "${array[@]}")
243
+#	echo "array: $array"
244
+#	echo "arraystring: $arraystring"
245
+}
246
+readonly -f Convert_Newline_Separated_String_to_Array
247
+
248
+# End of
249
+# Function
250
+############
251
+
252
+
253
+
254
+############################################################
255
+#
256
+# 05:08:09 05/12/2018.  Unlike the simpler Roster Bin Manager,
257
+# the Roster Perl-Inc Manager (16:37:19 10/28/2018.  And the
258
+# similar Roster Lib Manager) will have to create folders as
259
+# well as symlinks.
260
+#
261
+# For example, the roster perl-inc folder's symlink to Wrap.pm
262
+# (from the Perl module Text::Wrap) has to go in a folder named
263
+# Text, or else Perl won't be able to find Text::Wrap.
264
+#
265
+#
266
+# 16:41:31 10/28/2018.  Roster Lib Manager will actually be simpler
267
+# in a way than Roster Perl-Inc Manager, since it won't be parsing
268
+# a text file containing a list of symlinks and folders to make.
269
+#
270
+# Instead, Roster Lib Manager will just use "find" on the appversion
271
+# folder's "lib" folder, and build a mirror of everything it finds.
272
+#
273
+#
274
+# 21:57:53 10/28/2018.  Roster Include Manager acts almost the same
275
+# as Roster Lib Manager.
276
+
277
+readonly EOL=$'\n'
278
+
279
+cd "$Follpath____Appversion_Include"
280
+
281
+	#!!!!
282
+	result_code="$?"; [ "$result_code" != 0 ] && { echo "Couldn't change directory to $Follpath____Appversion_Include - aborting."; exit 9; }
283
+
284
+
285
+
286
+Get_Fiollpath_Depth()
287
+{
288
+	# 22:44:09 05/12/2018.  Slightly modified code from:
289
+	# https://stackoverflow.com/questions/48816827/find-the-depth-of-the-current-path
290
+	
291
+	echo "$1" | grep -o '/' - | wc -l
292
+}
293
+
294
+perl_repeat()
295
+{
296
+	perl -E "say '$1' x $2"
297
+}
298
+
299
+
300
+
301
+# 20:13:48 10/28/2018.  Now, we'll make symlinks to files,
302
+# and symlinks to symlinks.
303
+#
304
+# 21:35:33 10/28/2018.  Folders will be made at the same time.
305
+
306
+Stringlist____Include_Files_and_Symlinks=$(find . -type f -not -name "*$EOL*" -printf '%P\n')
307
+Stringlist____Include_Files_and_Symlinks+=$(find . -type l -not -name "*$EOL*" -printf '%P\n')
308
+
309
+Convert_Newline_Separated_String_to_Array "$Stringlist____Include_Files_and_Symlinks"
310
+	readonly List____Include_Files_and_Symlinks=( "${retval[@]}" )
311
+	readonly Count____List____Include_Files_and_Symlinks="$retcount"
312
+
313
+
314
+folder_depth_of_Roster_Include=$(Get_Fiollpath_Depth "$Follpath____Roster_Include")
315
+
316
+for fylepath in "${List____Include_Files_and_Symlinks[@]}"
317
+do
318
+
319
+	cd "$Follpath____Roster_Include"
320
+	extra_pathdots=""
321
+	count_of_extra_pathdot_sets=0
322
+	should_create_symlink_position_folders=false
323
+	
324
+	echo "fylepath: $fylepath"
325
+	
326
+	
327
+	if [ -z "$fylepath" ]
328
+	then
329
+		echo "Empty one"
330
+		continue
331
+	fi
332
+	
333
+	symlink_position="$fylepath"
334
+	
335
+	
336
+	if [[ "$symlink_position" == */* ]]
337
+	then
338
+		echo "$Script_Title: symlink position contains slash!"
339
+		
340
+		should_create_symlink_position_folders=true
341
+		
342
+		symlink_folders_to_create=$(dirname "$symlink_position")
343
+			
344
+		symlink_name=$(basename "$symlink_position")
345
+		
346
+		Follpath____Folders_to_Create=$(readlink -m "$symlink_folders_to_create")
347
+			folder_depth_of_folders_to_create=$(Get_Fiollpath_Depth "$Follpath____Folders_to_Create")
348
+		
349
+				count_of_extra_pathdot_sets=$((folder_depth_of_folders_to_create-folder_depth_of_Roster_Include))
350
+	else
351
+		symlink_name="$symlink_position"
352
+	fi
353
+	
354
+
355
+	if [ "$Arg____Command" = "unsymlink" ]
356
+	then
357
+		if [ -L "$symlink_position" ]
358
+		then
359
+			echo "Unlinking Roster Include symlink at $symlink_position"
360
+			unlink "$symlink_position"
361
+			
362
+			continue
363
+		fi
364
+		# 15:38:46 05/12/2018.  We leave folders alone, since deleting folders
365
+		# seems too risky (especially if done recursively).
366
+		
367
+	else
368
+		echo "$Script_Title: symlink command."
369
+		
370
+		symlink_target="include/$symlink_position"
371
+			
372
+		
373
+		if [ ! -L "$symlink_position" ]
374
+		then
375
+			
376
+			if [ "$should_create_symlink_position_folders" = true ]
377
+			then
378
+				echo "Symlink position contains slash!  Must create folders."
379
+				
380
+				mkdirperms 700 "$symlink_folders_to_create" "$Follpath____Roster_Include"
381
+				
382
+				extra_pathdots=$(perl_repeat "../" "$count_of_extra_pathdot_sets")
383
+				
384
+				final_symlink_target="../../$extra_pathdots$Arg____App/$Arg____App_Version/$symlink_target"
385
+			else
386
+				final_symlink_target="../../$Arg____App/$Arg____App_Version/$symlink_target"
387
+			fi
388
+			
389
+			cd "$symlink_folders_to_create"
390
+			
391
+			echo "Making roster include symlink $symlink_position pointing to $final_symlink_target"
392
+			ln --symbolic "$final_symlink_target" "$symlink_name"
393
+		fi
394
+	fi
395
+	
396
+
397
+done
398
+
399
+
0 400
new file mode 100755
... ...
@@ -0,0 +1,449 @@
1
+#!/bin/bash
2
+#
3
+# Roster Lib Manager
4
+#
5
+# Part of APSK App Manager
6
+#
7
+# by Apollia - http://apollia.com/
8
+
9
+
10
+# 10:02:02 04/12/2018.  Like Ramize-Physave - https://github.com/Apollia/Ramize-Physave -
11
+# running this script via a symlink changes this script's behavior!
12
+
13
+
14
+readonly Script_Title="Roster Lib Manager"
15
+
16
+readonly Fillepath____This_Script=$(realpath "${BASH_SOURCE[0]}")
17
+readonly Follpath____This_Script=$(dirname "$Fillepath____This_Script")
18
+
19
+
20
+echo
21
+echo
22
+echo "		-------------------------------------------"
23
+
24
+echo "		$Script_Title"
25
+
26
+echo "		-------------------------------------------"
27
+
28
+readonly Full_Uncanon_Unreal_Folpath____This_Script=$(dirname "${BASH_SOURCE[0]}")
29
+
30
+readonly Original_Working_Dir=$(pwd)
31
+
32
+
33
+first_char_of_uncanon_folpath=$(echo "${Full_Uncanon_Unreal_Folpath____This_Script:0:1}")
34
+
35
+
36
+if [ "$first_char_of_uncanon_folpath" != "/" ]
37
+then
38
+	readonly Full_Canon_Unreal_Folpath____This_Script=$(readlink -m "$Original_Working_Dir/$Full_Uncanon_Unreal_Folpath____This_Script")
39
+else
40
+	readonly Full_Canon_Unreal_Folpath____This_Script=$(readlink -m "$Full_Uncanon_Unreal_Folpath____This_Script")
41
+fi
42
+
43
+
44
+if [ "$Full_Canon_Unreal_Folpath____This_Script" != "$Follpath____This_Script" ]
45
+then
46
+	#readonly Follpath____Possible_Apphoard_Home=$(readlink -m "$Full_Canon_Unreal_Folpath____This_Script/../..")
47
+	Follpath____Possible_Apphoard_Home=$(readlink -m "$Full_Canon_Unreal_Folpath____This_Script/../..")
48
+	
49
+	readonly Foldername____This_Script=$(basename "$Full_Canon_Unreal_Folpath____This_Script")
50
+
51
+else
52
+	#readonly Follpath____Possible_Apphoard_Home=$(realpath "$Follpath____This_Script/../..")
53
+	Follpath____Possible_Apphoard_Home=$(realpath "$Follpath____This_Script/../..")
54
+	
55
+	readonly Foldername____This_Script=$(basename "$Follpath____This_Script")
56
+
57
+fi
58
+
59
+#Follpath____Possible_Apphoard_Home="/root/apbin/APSK-GLMP-GTK"
60
+
61
+readonly Follpath____Roster="$Follpath____Possible_Apphoard_Home/00-Roster of Apps"
62
+
63
+readonly Follpath____Roster_Perl_Inc="$Follpath____Roster/perl-inc"
64
+readonly Follpath____Roster_Lib="$Follpath____Roster/lib"
65
+
66
+
67
+if [ ! -d "$Follpath____Roster" ]
68
+then
69
+	echo
70
+	echo "Seems this manager isn't located near a roster.  So, just opening its folder."
71
+	
72
+	rox --dir "$Follpath____This_Script"
73
+	
74
+	
75
+	#!!!!
76
+	exit 0
77
+fi
78
+
79
+readonly Follpath____Apphoard="$Follpath____Possible_Apphoard_Home"
80
+
81
+
82
+# 07:04:13 04/23/2018.  Arg 1 is a command - either "symlink" or "unsymlink".
83
+#
84
+# Arg 2 is the name of the app that this manager is going to symlink or unsymlink
85
+# a version of.
86
+#
87
+# Arg 3 is the app version to symlink or unsymlink.
88
+#
89
+#
90
+# Since all app settings are supposed to be in predictable locations, this manager
91
+# can find the roster lib symlinks list without being given a path to it.
92
+
93
+
94
+
95
+
96
+readonly Arg____Command="$1"
97
+
98
+#echo "Arg____Command: $Arg____Command"
99
+
100
+case "$Arg____Command" in
101
+	"symlink")
102
+		;;
103
+	"unsymlink")
104
+		
105
+		;;
106
+	"")
107
+		echo
108
+		echo "No command was provided, so just opening this Roster Lib Manager's folder."
109
+		
110
+		rox --dir "$Follpath____This_Script"
111
+		
112
+		
113
+		#!!!!
114
+		exit 0
115
+		;;
116
+	
117
+	*)
118
+		echo "Unrecognized command: $Arg____Command"
119
+		rox --dir "$Follpath____This_Script"
120
+		
121
+		
122
+		#!!!!
123
+		exit 1
124
+		;;
125
+esac
126
+
127
+
128
+
129
+Abort_If_String_Contains_Chars_Inappropriate_for_a_Filename()
130
+{
131
+	# 22:24:46 05/12/2018.  Must build later.
132
+	exit_code="$2"
133
+	
134
+	
135
+#	exit "$exit_code"
136
+	:
137
+}
138
+
139
+############################################################
140
+#
141
+# 18:02:20 10/28/2018.  Valichecking args.
142
+#
143
+#-------------------
144
+
145
+readonly Arg____App="$2"
146
+
147
+	#!!!!
148
+	[ -z "$Arg____App" ] && { echo; echo "Can't proceed - no app name was provided."; exit 2; }
149
+
150
+
151
+	#!!!!
152
+	Abort_If_String_Contains_Chars_Inappropriate_for_a_Filename "$Arg____App" 3
153
+	
154
+
155
+
156
+	readonly Follpath____App="$Follpath____Apphoard/$Arg____App"
157
+	
158
+		#!!!!
159
+		[ ! -d "$Follpath____App" ] && { echo; echo "This app folder doesn't exist:
160
+
161
+	$Follpath____App"; exit 4; }
162
+
163
+
164
+		
165
+#-------------------
166
+
167
+
168
+readonly Arg____App_Version="$3"
169
+
170
+	#!!!!
171
+	[ -z "$Arg____App_Version" ] && { echo; echo "Can't proceed - no app version was provided."; exit 4; }
172
+	
173
+	#!!!!
174
+	Abort_If_String_Contains_Chars_Inappropriate_for_a_Filename "$Arg____App_Version" 5
175
+
176
+
177
+
178
+	readonly Follpath____App_Version="$Follpath____App/$Arg____App_Version"
179
+
180
+		#!!!!
181
+		[ ! -d "$Follpath____App_Version" ] && { echo; echo "This app version folder doesn't exist:
182
+
183
+	$Follpath____App_Version"; exit 6; }
184
+	
185
+
186
+
187
+############################################################
188
+#
189
+# 18:03:53 10/28/2018.  Looking for required folders.
190
+#
191
+#-------------------
192
+
193
+Follpath____Appversion_Lib="$Follpath____App_Version/lib"
194
+
195
+
196
+	#!!!!
197
+	[ ! -d "$Follpath____Appversion_Lib" ] && { echo; echo "This app version folder's \"lib\" folder doesn't exist:
198
+
199
+	$Follpath____Appversion_Lib"; exit 7; }
200
+
201
+
202
+#-------------------
203
+
204
+readonly Follpath____Installers="$Follpath____App_Version/.Installers/Used by APSK Apphoards"
205
+
206
+	#!!!!
207
+	[ ! -d "$Follpath____Installers" ] && { echo; echo "The app's .Installers folder doesn't exist:
208
+
209
+	$Follpath____Installers"; exit 8; }
210
+
211
+
212
+
213
+############################################################
214
+#
215
+# 18:05:18 10/28/2018.  Roster Lib Manager will abort if
216
+# this is a Perl-Inc app.
217
+#
218
+#-------------------
219
+
220
+readonly Fillepath____Roster_Perl_Inc_Symlinks_to_Make="$Follpath____Installers/Roster Perl-Inc Symlinks to Make"
221
+
222
+
223
+	#!!!!
224
+	[ -f "$Fillepath____Roster_Perl_Inc_Symlinks_to_Make" ] && { echo; echo "This app version has a \"Roster Perl-Inc Symlinks to Make\" file:
225
+
226
+	$Fillepath____Roster_Perl_Inc_Symlinks_to_Make
227
+
228
+So, Roster Lib Manager is now aborting."; exit 0; }
229
+		# 11:07:31 04/23/2018.  Apps are allowed to not have that settings file.
230
+
231
+
232
+
233
+############
234
+# Function
235
+Convert_Newline_Separated_String_to_Array()
236
+{
237
+	string="$1"
238
+
239
+	# 2016-03-15 04:45:41.  addlater.  should trim final newline before processing.
240
+	
241
+#	echo "Orig string: \"$string\""
242
+	string="${string%$'\n'}"
243
+
244
+	#string="${string%\$'\\n'}"
245
+
246
+#	echo "Trimmed string: \"$string\""	
247
+	
248
+	
249
+	retcount=0
250
+	retval=()
251
+	
252
+	local array=()
253
+	
254
+	if [ -z "$string" ]
255
+	then
256
+		retcount=0
257
+		return 0
258
+	fi
259
+	
260
+	while read -r line; do
261
+		#echo "Line: '$line' "
262
+		array+=("$line")
263
+	done <<< "$string"
264
+	
265
+	retval=( "${array[@]}" )
266
+	# 2016-01-29 04:58:07.  Yep, it's that tough in Bash just to set a variable equal to an array.
267
+	
268
+	
269
+	retcount=${#retval[@]}		
270
+#	arraystring=$(printf '%s\n' "${array[@]}")
271
+#	echo "array: $array"
272
+#	echo "arraystring: $arraystring"
273
+}
274
+readonly -f Convert_Newline_Separated_String_to_Array
275
+
276
+# End of
277
+# Function
278
+############
279
+
280
+
281
+
282
+############################################################
283
+#
284
+# 05:08:09 05/12/2018.  Unlike the simpler Roster Bin Manager,
285
+# the Roster Perl-Inc Manager (16:37:19 10/28/2018.  And the
286
+# similar Roster Lib Manager) will have to create folders as
287
+# well as symlinks.
288
+#
289
+# For example, the roster perl-inc folder's symlink to Wrap.pm
290
+# (from the Perl module Text::Wrap) has to go in a folder named
291
+# Text, or else Perl won't be able to find Text::Wrap.
292
+#
293
+#
294
+# 16:41:31 10/28/2018.  Roster Lib Manager will actually be simpler
295
+# in a way than Roster Perl-Inc Manager, since it won't be parsing
296
+# a text file containing a list of symlinks and folders to make.
297
+#
298
+# Instead, Roster Lib Manager will just use "find" on the appversion
299
+# folder's "lib" folder, and build a mirror of everything it finds.
300
+
301
+readonly EOL=$'\n'
302
+
303
+cd "$Follpath____Appversion_Lib"
304
+
305
+	#!!!!
306
+	result_code="$?"; [ "$result_code" != 0 ] && { echo "Couldn't change directory to $Follpath____Appversion_Lib - aborting."; exit 9; }
307
+
308
+
309
+# 19:56:06 10/28/2018.  Here's an easy part - making all the needed folders.
310
+
311
+#~ readonly Stringlist____Lib_Folders=$(find . -type d -not -name "*$EOL*" -printf '%P\n')
312
+#~ 
313
+#~ echo "Stringlist____Lib_Folders: $Stringlist____Lib_Folders" | sort
314
+#~ 
315
+#~ 
316
+#~ Convert_Newline_Separated_String_to_Array "$Stringlist____Lib_Folders"
317
+	#~ readonly List____Lib_Folders=( "${retval[@]}" )
318
+	#~ readonly Count____List____Lib_Folders="$retcount"
319
+#~ 
320
+#~ 
321
+#~ for folpath in "${List____Lib_Folders[@]}"
322
+#~ do
323
+	#~ if [ -z "$folpath" ]
324
+	#~ then
325
+		#~ echo "Empty one"
326
+		#~ continue
327
+	#~ fi
328
+	#~ 
329
+	#~ Follpath="$Follpath____Roster_Lib/$folpath"
330
+#~ 
331
+	#~ mkdirperms 700 "$Follpath" "$Follpath____Roster_Lib"
332
+#~ done
333
+
334
+
335
+
336
+Get_Fiollpath_Depth()
337
+{
338
+	# 22:44:09 05/12/2018.  Slightly modified code from:
339
+	# https://stackoverflow.com/questions/48816827/find-the-depth-of-the-current-path
340
+	
341
+	echo "$1" | grep -o '/' - | wc -l
342
+}
343
+
344
+perl_repeat()
345
+{
346
+	perl -E "say '$1' x $2"
347
+}
348
+
349
+
350
+
351
+# 20:13:48 10/28/2018.  Now, we'll make symlinks to files,
352
+# and symlinks to symlinks.
353
+#
354
+# 21:35:33 10/28/2018.  Folders will be made at the same time.
355
+
356
+Stringlist____Lib_Files_and_Symlinks=$(find . -type f -not -name "*$EOL*" -printf '%P\n')
357
+Stringlist____Lib_Files_and_Symlinks+=$(find . -type l -not -name "*$EOL*" -printf '%P\n')
358
+
359
+Convert_Newline_Separated_String_to_Array "$Stringlist____Lib_Files_and_Symlinks"
360
+	readonly List____Lib_Files_and_Symlinks=( "${retval[@]}" )
361
+	readonly Count____List____Lib_Files_and_Symlinks="$retcount"
362
+
363
+
364
+folder_depth_of_Roster_Lib=$(Get_Fiollpath_Depth "$Follpath____Roster_Lib")
365
+
366
+for fylepath in "${List____Lib_Files_and_Symlinks[@]}"
367
+do
368
+
369
+	cd "$Follpath____Roster_Lib"
370
+	extra_pathdots=""
371
+	count_of_extra_pathdot_sets=0
372
+	should_create_symlink_position_folders=false
373
+	
374
+	echo "fylepath: $fylepath"
375
+	
376
+	
377
+	if [ -z "$fylepath" ]
378
+	then
379
+		echo "Empty one"
380
+		continue
381
+	fi
382
+	
383
+	symlink_position="$fylepath"
384
+	
385
+	
386
+	if [[ "$symlink_position" == */* ]]
387
+	then
388
+		echo "$Script_Title: symlink position contains slash!"
389
+		
390
+		should_create_symlink_position_folders=true
391
+		
392
+		symlink_folders_to_create=$(dirname "$symlink_position")
393
+			
394
+		symlink_name=$(basename "$symlink_position")
395
+		
396
+		Follpath____Folders_to_Create=$(readlink -m "$symlink_folders_to_create")
397
+			folder_depth_of_folders_to_create=$(Get_Fiollpath_Depth "$Follpath____Folders_to_Create")
398
+		
399
+				count_of_extra_pathdot_sets=$((folder_depth_of_folders_to_create-folder_depth_of_Roster_Lib))
400
+	else
401
+		symlink_name="$symlink_position"
402
+	fi
403
+	
404
+
405
+	if [ "$Arg____Command" = "unsymlink" ]
406
+	then
407
+		if [ -L "$symlink_position" ]
408
+		then
409
+			echo "Unlinking Rosterlib symlink at $symlink_position"
410
+			unlink "$symlink_position"
411
+			
412
+			continue
413
+		fi
414
+		# 15:38:46 05/12/2018.  We leave folders alone, since deleting folders
415
+		# seems too risky (especially if done recursively).
416
+		
417
+	else
418
+		echo "$Script_Title: symlink command."
419
+		
420
+		symlink_target="lib/$symlink_position"
421
+			
422
+		
423
+		if [ ! -L "$symlink_position" ]
424
+		then
425
+			
426
+			if [ "$should_create_symlink_position_folders" = true ]
427
+			then
428
+				echo "Symlink position contains slash!  Must create folders."
429
+				
430
+				mkdirperms 700 "$symlink_folders_to_create" "$Follpath____Roster_Lib"
431
+				
432
+				extra_pathdots=$(perl_repeat "../" "$count_of_extra_pathdot_sets")
433
+				
434
+				final_symlink_target="../../$extra_pathdots$Arg____App/$Arg____App_Version/$symlink_target"
435
+			else
436
+				final_symlink_target="../../$Arg____App/$Arg____App_Version/$symlink_target"
437
+			fi
438
+			
439
+			cd "$symlink_folders_to_create"
440
+			
441
+			echo "Making roster lib symlink $symlink_position pointing to $final_symlink_target"
442
+			ln --symbolic "$final_symlink_target" "$symlink_name"
443
+		fi
444
+	fi
445
+	
446
+
447
+done
448
+
449
+