Browse code

Found out even the unlink command doesn't exist in a just-rebooted, uncustomized, default Lighthouse 64 Puppy Linux 6.02 Beta 2.

So, replaced that with "rm". Also replaced the "yes" command for
the same reason.

Made output text less cluttery and more informative.

And added a missing bit of code to Roster Perl-Inc Manager, since
before, it was failing to create some symlinks.

Apollia authored on05/17/2018 03:46:37
Showing3 changed files
... ...
@@ -10,10 +10,19 @@
10 10
 # 10:02:02 04/12/2018.  Like Ramize-Physave - https://github.com/Apollia/Ramize-Physave -
11 11
 # running this script via a symlink changes this script's behavior!
12 12
 
13
-
13
+readonly Script_Title="Choose Default Version - 00-App Manager Edition"
14 14
 readonly Fillepath____This_Script=$(realpath "${BASH_SOURCE[0]}")
15 15
 readonly Follpath____This_Script=$(dirname "$Fillepath____This_Script")
16 16
 
17
+
18
+echo
19
+echo
20
+echo "	-------------------------------------------"
21
+
22
+echo "	$Script_Title"
23
+
24
+echo "	-------------------------------------------"
25
+
17 26
 readonly Full_Uncanon_Unreal_Folpath____This_Script=$(dirname "${BASH_SOURCE[0]}")
18 27
 
19 28
 readonly Original_Working_Dir=$(pwd)
... ...
@@ -73,6 +82,7 @@ readonly GUI_Message="Which version of $App_Name should be the default?"
73 82
 
74 83
 readonly EOL=$'\n'
75 84
 
85
+echo "App_Name: $App_Name"
76 86
 
77 87
 readonly Arg____App_Version="$1"
78 88
 
... ...
@@ -98,7 +108,7 @@ Possibly_Replace_Symlink____Default_Version()
98 108
 	then
99 109
 		if [ -L "Default-Version" ]
100 110
 		then
101
-			unlink "Default-Version"
111
+			rm "Default-Version"
102 112
 		fi
103 113
 		ln --symbolic "$folname" "Default-Version"
104 114
 		result_code="$?"
... ...
@@ -146,19 +156,50 @@ Possibly_Switch_to_App_Version()
146 156
 	fi
147 157
 	
148 158
 
159
+	echo
160
+	echo
161
+	echo "Now telling Roster Bin Manager to unsymlink..."
149 162
 	
150 163
 	bash "$Fillepath____Roster_Bin_Manager" "unsymlink" "$App_Name" "Default-Version"
151
-	bash "$Fillepath____Roster_Perl_Inc_Manager" "unsymlink" "$App_Name" "Default-Version"
164
+	
165
+	if [ -f "$Fillepath____Roster_Perl_Inc_Manager" ]
166
+	then
167
+		
168
+		echo
169
+		echo
170
+		echo "Now telling Roster Perl-Inc Manager to unsymlink..."
171
+		
172
+		bash "$Fillepath____Roster_Perl_Inc_Manager" "unsymlink" "$App_Name" "Default-Version"
173
+	fi
174
+	
175
+	echo
176
+	echo
177
+	echo "Now back in Choose Default Version..."
152 178
 	
153 179
 	Possibly_Replace_Symlink____Default_Version "$app_version"
154 180
 		result_code="$?"
155 181
 	
156 182
 	if [ "$result_code" = 0 ]
157 183
 	then
184
+		echo
185
+		echo
158 186
 		echo "$App_Name default version is now: $retval"
159 187
 		
188
+		echo
189
+		echo
190
+		echo "Now telling Roster Bin Manager to symlink..."
191
+		
160 192
 		bash "$Fillepath____Roster_Bin_Manager" "symlink" "$App_Name" "Default-Version" 
161
-		bash "$Fillepath____Roster_Perl_Inc_Manager" "symlink" "$App_Name" "Default-Version"
193
+		
194
+		if [ -f "$Fillepath____Roster_Perl_Inc_Manager" ]
195
+		then
196
+		
197
+			echo
198
+			echo
199
+			echo "Now telling Roster Perl-Inc Manager to symlink..."
200
+		
201
+			bash "$Fillepath____Roster_Perl_Inc_Manager" "symlink" "$App_Name" "Default-Version"
202
+		fi
162 203
 		
163 204
 		#!!!!
164 205
 		exit 0
... ...
@@ -10,10 +10,20 @@
10 10
 # 10:02:02 04/12/2018.  Like Ramize-Physave - https://github.com/Apollia/Ramize-Physave -
11 11
 # running this script via a symlink changes this script's behavior!
12 12
 
13
+readonly Script_Title="Roster Bin Manager"
13 14
 
14 15
 readonly Fillepath____This_Script=$(realpath "${BASH_SOURCE[0]}")
15 16
 readonly Follpath____This_Script=$(dirname "$Fillepath____This_Script")
16 17
 
18
+
19
+echo
20
+echo
21
+echo "		-------------------------------------------"
22
+
23
+echo "		$Script_Title"
24
+
25
+echo "		-------------------------------------------"
26
+
17 27
 readonly Full_Uncanon_Unreal_Folpath____This_Script=$(dirname "${BASH_SOURCE[0]}")
18 28
 
19 29
 readonly Original_Working_Dir=$(pwd)
... ...
@@ -77,7 +87,7 @@ readonly Follpath____Apphoard="$Follpath____Possible_Apphoard_Home"
77 87
 
78 88
 readonly Arg____Command="$1"
79 89
 
80
-echo "Arg____Command: $Arg____Command"
90
+#echo "Arg____Command: $Arg____Command"
81 91
 
82 92
 case "$Arg____Command" in
83 93
 	"symlink")
... ...
@@ -298,7 +308,7 @@ cd "$Follpath____Roster_Bin"
298 308
 
299 309
 for line in "${List____Roster_Bin_Symlinks_to_Make[@]}"
300 310
 do
301
-	echo "Symlink line: $line"
311
+	#echo "Symlink line: $line"
302 312
 	
303 313
 	symlink_name=${line%%[[:space:]][[:space:]][[:space:]]*}
304 314
 	
... ...
@@ -306,8 +316,10 @@ do
306 316
 	then
307 317
 		if [ -L "$symlink_name" ]
308 318
 		then
309
-			echo "Unlinking rosterbin symlink to $symlink_name"
310
-			unlink "$symlink_name"
319
+			echo
320
+			echo "Unlinking rosterbin symlink:
321
+	$symlink_name"
322
+			rm "$symlink_name"
311 323
 			
312 324
 			continue
313 325
 		fi
... ...
@@ -321,7 +333,15 @@ do
321 333
 		
322 334
 		if [ ! -L "$symlink_name" ]
323 335
 		then
324
-			echo "Making rosterbin symlink $symlink_name pointing to $final_symlink_target"
336
+			echo
337
+			echo
338
+			echo "Making rosterbin symlink:
339
+
340
+	$symlink_name
341
+
342
+...pointing to:
343
+
344
+	$final_symlink_target"
325 345
 			ln --symbolic "$final_symlink_target" "$symlink_name"
326 346
 		fi
327 347
 	fi
... ...
@@ -11,9 +11,20 @@
11 11
 # running this script via a symlink changes this script's behavior!
12 12
 
13 13
 
14
+readonly Script_Title="Roster Perl-Inc Manager"
15
+
14 16
 readonly Fillepath____This_Script=$(realpath "${BASH_SOURCE[0]}")
15 17
 readonly Follpath____This_Script=$(dirname "$Fillepath____This_Script")
16 18
 
19
+
20
+echo
21
+echo
22
+echo "		-------------------------------------------"
23
+
24
+echo "		$Script_Title"
25
+
26
+echo "		-------------------------------------------"
27
+
17 28
 readonly Full_Uncanon_Unreal_Folpath____This_Script=$(dirname "${BASH_SOURCE[0]}")
18 29
 
19 30
 readonly Original_Working_Dir=$(pwd)
... ...
@@ -77,7 +88,7 @@ readonly Follpath____Apphoard="$Follpath____Possible_Apphoard_Home"
77 88
 
78 89
 readonly Arg____Command="$1"
79 90
 
80
-echo "Arg____Command: $Arg____Command"
91
+#echo "Arg____Command: $Arg____Command"
81 92
 
82 93
 case "$Arg____Command" in
83 94
 	"symlink")
... ...
@@ -120,6 +131,7 @@ readonly Follpath____App="$Follpath____Apphoard/$Arg____App"
120 131
 
121 132
 if [ ! -d "$Follpath____App" ]
122 133
 then
134
+	echo
123 135
 	echo "This app folder doesn't exist:
124 136
 
125 137
 	$Follpath____App"
... ...
@@ -281,18 +293,22 @@ Get_Fiollpath_Depth()
281 293
 }
282 294
 
283 295
 
284
-repeat()
296
+#~ repeat()
297
+#~ {
298
+	#~ # 02:55:24 05/12/2018.  A slightly modified version of code from:
299
+	#~ # https://stackoverflow.com/questions/5349718/how-can-i-repeat-a-character-in-bash
300
+	#~ 
301
+	#~ yes "$1" | head -"$2" | tr -d "\n"
302
+	#~ 
303
+		#~ #seq  -f "$1" -s '' "$2"; echo
304
+			#~ # 02:58:33 05/12/2018.  Doesn't work in GNU/Linux.
305
+#~ }
306
+
307
+perl_repeat()
285 308
 {
286
-	# 02:55:24 05/12/2018.  A slightly modified version of code from:
287
-	# https://stackoverflow.com/questions/5349718/how-can-i-repeat-a-character-in-bash
288
-	
289
-	yes "$1" | head -"$2" | tr -d "\n"
290
-	
291
-		#seq  -f "$1" -s '' "$2"; echo
292
-			# 02:58:33 05/12/2018.  Doesn't work in GNU/Linux.
309
+	perl -E "say '$1' x $2"
293 310
 }
294 311
 
295
-
296 312
 folder_depth_of_Roster_Perl_Inc=$(Get_Fiollpath_Depth "$Follpath____Roster_Perl_Inc")
297 313
 
298 314
 for line in "${List____Roster_Perl_Inc_Symlinks_to_Make[@]}"
... ...
@@ -366,9 +382,11 @@ do
366 382
 				
367 383
 				mkdirperms 700 "$symlink_folders_to_create" "$Follpath____Roster_Perl_Inc"
368 384
 				
369
-				extra_pathdots=$(repeat "../" "$count_of_extra_pathdot_sets")
385
+				extra_pathdots=$(perl_repeat "../" "$count_of_extra_pathdot_sets")
370 386
 				
371 387
 				final_symlink_target="../../$extra_pathdots$Arg____App/$Arg____App_Version/$symlink_target"
388
+			else
389
+				final_symlink_target="../../$Arg____App/$Arg____App_Version/$symlink_target"
372 390
 			fi
373 391
 			
374 392
 			cd "$symlink_folders_to_create"