Browse code

Now apsk-create-apphoard can optionally add a Roster Perl-INC Manager.

This is only needed if you want the new apphoard to be capable of
making its Perl modules available to Perl.

Apollia authored on05/12/2018 08:33:40
Showing3 changed files
... ...
@@ -4,7 +4,7 @@
4 4
 
5 5
 ############
6 6
 # Function
7
-Parse_Script_Options()
7
+Parse_Switch_Args()
8 8
 {
9 9
 	
10 10
 #-------------------------------------------------------------------------------
... ...
@@ -15,11 +15,11 @@ Parse_Script_Options()
15 15
 #
16 16
 # Thanks to the authors, especially for the tip about using eval to properly handle quoting!
17 17
 
18
-	count_of_args_before_parsing_options="$#"
18
+	count_of_args_before_parsing_switches="$#"
19 19
 	
20
-	#echo "count_of_args_before_parsing_options: $count_of_args_before_parsing_options"
20
+	#echo "count_of_args_before_parsing_switches: $count_of_args_before_parsing_switches"
21 21
 	
22
-	PARSED_OPTIONS=$(getopt --alternative --options h,f:,d:,m:,p:,s: --longoptions help,folder:,folderpath:,folderpath-to-make:,dir:,make:,mode:,modes:,perm:,perms:,permissions:,stopping-point-parent-folder:,stopping-point:,stop-at:,stop:, --name "$Short_Command_Name" -- "$@" )
22
+	PARSED_SWITCHES=$(getopt --alternative --options h,p --longoptions help,perlinc,perl-inc --name "$Short_Command_Name" -- "$@" )
23 23
 
24 24
 	if [ $? != 0 ]
25 25
 	then
... ...
@@ -33,47 +33,25 @@ Parse_Script_Options()
33 33
 	fi
34 34
 
35 35
 
36
-	eval set -- "$PARSED_OPTIONS"
37
-	# Use eval with "$PARSED_OPTIONS" to properly handle the quoting.
36
+	eval set -- "$PARSED_SWITCHES"
37
+	# Use eval with "$PARSED_SWITCHES" to properly handle the quoting.
38 38
 
39
-	Arg____Modes=""
40
-	Arg____Folderpath_to_Make=""
41
-	Arg____Stopping_Point_Parent_Folder=""
39
+	
42 40
 
41
+	should_add_Roster_Perl_INC_Manager=false
42
+	
43 43
 
44 44
 	for arg
45 45
 	do
46 46
 		#echo "Arg: $arg"
47 47
 		case "$arg" in
48
-		
49
-			-f|-d|--folder|--folderpath|--folderpath-to-make|--make|--dir)
50
-				Arg____Folderpath_to_Make="$2"
51
-				#echo "Arg____Folderpath_to_Make: $Arg____Folderpath_to_Make"
52
-				shift
53
-				shift
54
-				;;
55 48
 			
56
-			-m|--mode|--modes|-p|--perm|--perms|--permission|--permissions)
57
-				Arg____Modes="$2"
58
-				#echo "Arg____Modes: $Arg____Modes"
59
-				shift
60
-				shift
61
-				;;
62
-			-s|--stopping-point-parent-folder|--stopping-point|--stop-at|--stop)
63
-				Arg____Stopping_Point_Parent_Folder="$2"
64
-				#echo "Arg____Stopping_Point_Parent_Folder: $Arg____Stopping_Point_Parent_Folder"
49
+			-p|--perlinc|--perl-inc)
65 50
 				shift
66
-				shift
67
-				;;
68
-			
69
-			-h|--help)
70
-				Help_Message
71 51
 				
72
-				
73
-				#!!!!
74
-				exit 0
52
+				should_add_Roster_Perl_INC_Manager=true
75 53
 				;;
76
-				
54
+
77 55
 			--)
78 56
 			#	echo "Dashes!"
79 57
 				shift
... ...
@@ -84,13 +62,13 @@ Parse_Script_Options()
84 62
 	Positional_Args=( "$@" )
85 63
 	count_of_positional_args="$#"
86 64
 	
87
-	count_of_args_after_parsing_options="$#"
65
+	count_of_args_after_parsing_switches="$#"
88 66
 	
89
-	#echo "count_of_args_after_parsing_options: $count_of_args_after_parsing_options"
67
+	#echo "count_of_args_after_parsing_switches: $count_of_args_after_parsing_switches"
90 68
 	#echo "count_of_positional_args: $count_of_positional_args"
91 69
 	
92 70
 }
93
-readonly -f Parse_Script_Options
71
+readonly -f Parse_Switch_Args
94 72
 
95 73
 # End of
96 74
 # Function
... ...
@@ -100,23 +78,23 @@ readonly -f Parse_Script_Options
100 78
 
101 79
 ############
102 80
 # Function
103
-Parse_Script_Positional_Args()
81
+Parse_Positional_Args()
104 82
 {
105
-	# 08:07:24 04/18/2017.  Now, the positional args (if there are any):
83
+	# 14:13:20 04/27/2018.  If any of these conflict with switches, these win.
106 84
 
107 85
 	ARG1=${@:$OPTIND:1}
108
-	ARG2=${@:$OPTIND+1:1}
109
-	ARG3=${@:$OPTIND+2:1}
86
+	#ARG2=${@:$OPTIND+1:1}
110 87
 
88
+	
111 89
 	# 11:30 07/24/2016.  The below are basically abbreviated if/then statements.
112 90
 	#
113 91
 	# If ARG1 is not empty, then Arg____File gets set to $ARG1.  Etc.
114 92
 
115
-	[ ! -z "$ARG1" ] && Arg____Modes="$ARG1"
116
-	[ ! -z "$ARG2" ] && Arg____Folderpath_to_Make="$ARG2"
117
-	[ ! -z "$ARG3" ] && Arg____Stopping_Point_Parent_Folder="$ARG3"
93
+	[ ! -z "$ARG1" ] && Arg____Apphoard_Folpath="$ARG1"
94
+
95
+	
118 96
 }
119
-readonly -f Parse_Script_Positional_Args
97
+readonly -f Parse_Positional_Args
120 98
 
121 99
 # End of
122 100
 # Function
... ...
@@ -1,9 +1,15 @@
1
-Usage: apsk-bootstrap-first-apphoard [Folderpath for Apphoard]
1
+Usage: apsk-create-apphoard [Folderpath for Apphoard]
2 2
 
3
-Requires 1 argument - the folderpath where the first apphoard
4
-should be created.
3
+You can use switches (also known as command line options or flags), positional arguments, or a mixture of the two.
4
+
5
+
6
+Requires 1 argument - the folderpath where the apphoard should be created.
5 7
 
6 8
 The folderpath must not be / (slashroot).
7 9
 
8
-But, anywhere else is OK, though it would probably be best to put it
9
-somewhere in the ramdisk.
10 10
\ No newline at end of file
11
+But, anywhere else is OK, though it would probably be best to put it somewhere in the ramdisk.
12
+
13
+
14
+-p, --perlinc
15
+Adds a Roster Perl-INC Manager to the new apphoard, so Perl modules can be stored there.
16
+
... ...
@@ -25,13 +25,13 @@ readonly Follpath____Helpers="$Follpath____This_Script/Helpers"
25 25
 	readonly Fillepath____Main_Library="$Follpath____Helpers/Main Library"
26 26
 	readonly Fillepath____Translation_Functions="$Follpath____Helpers/Translation Functions"
27 27
 	readonly Fillepath____This_App_s_Translations="$Follpath____Helpers/This App's Translations"
28
-	#readonly Fillepath____This_App_s_Args="$Follpath____Helpers/This App's Args"
28
+	readonly Fillepath____This_App_s_Args="$Follpath____Helpers/This App's Args"
29 29
 	readonly Fillepath____Message_Functions="$Follpath____Helpers/Message Functions"
30 30
 	
31 31
 		source "$Fillepath____Main_Library"
32 32
 		source "$Fillepath____Translation_Functions"
33 33
 		source "$Fillepath____This_App_s_Translations"
34
-		#source "$Fillepath____This_App_s_Args"
34
+		source "$Fillepath____This_App_s_Args"
35 35
 		source "$Fillepath____Message_Functions"
36 36
 
37 37
 #-------------------------------------------------------------------------------
... ...
@@ -51,10 +51,39 @@ Figure_Out_Translation_To_Use
51 51
 Declare_Paths____Translation_Related
52 52
 
53 53
 
54
+#-------------------------------------------------------------------------------
55
+
56
+if [ -z "$1" ]
57
+# 14:10:38 04/27/2018.  If there's no Arg #1, we can already abort.
58
+then
59
+	
60
+	Help_Message
61
+	
62
+	
63
+	#!!!!
64
+	exit 1
65
+fi
66
+
67
+
68
+#-------------------------------------------------------------------------------
69
+
70
+declare -a Positional_Args
71
+
72
+Parse_Switch_Args "$@"
73
+
74
+#printf 'pos arg %s\n' "${Positional_Args[@]}"
75
+
76
+
77
+Parse_Positional_Args "${Positional_Args[@]}"
78
+
79
+
80
+#-------------------------------------------------------------------------------
81
+
82
+
54 83
 readonly Command_Summary____Apphoard_Folpath="($I18n____Arg #1, the folderpath for a new apphoard)"
55 84
 
56 85
 
57
-Arg____Apphoard_Folpath="$1"
86
+#~ Arg____Apphoard_Folpath="$1"
58 87
 echo "Arg____Apphoard_Folpath: $Arg____Apphoard_Folpath"
59 88
 
60 89
 #!!!!
... ...
@@ -120,6 +149,25 @@ Fillepath____Choose_App_Manager_Version="$Follpath____Apphoard_App_Manager/Choos
120 149
 
121 150
 bash "$Fillepath____Choose_App_Manager_Version" "Official" "rechoose even if same version"
122 151
 
152
+
153
+if [ "$should_add_Roster_Perl_INC_Manager" = true ]
154
+then
155
+	Follpath____Roster_Perl_INC="$Follpath____Roster/perl-inc"
156
+	Follpath____Roster_Perl_INC_Manager="$Follpath____Roster/Roster Perl-INC Manager"
157
+	
158
+	mkdir -m 700 "$Follpath____Roster_Perl_INC"
159
+	mkdir -m 700 "$Follpath____Roster_Perl_INC_Manager"
160
+	#Fillepath____Original_Roster_Perl_INC_Manager="$Follpath____Apphoard_App_Manager/Default-Version/Other Managers/Roster Perl-INC Manager/AppRun"
161
+	
162
+	echo "Making Roster Perl-INC Manager symlink..."
163
+	
164
+	cd "$Follpath____Roster_Perl_INC_Manager"
165
+	
166
+	ln --symbolic "../../00-App Manager/Default-Version/Other Managers/Roster Perl-INC Manager/AppRun" "AppRun"
167
+
168
+
169
+	
170
+fi
123 171
 #echo "Making Roster Bin Manager symlink..."
124 172
 #
125 173
 #ln --symbolic "../../00-App Manager/Default-Version/Other Managers/Roster Bin Manager/AppRun" "AppRun"