Преглед изворни кода

Selecting apps from variant name

Bob Mottram пре 8 година
родитељ
комит
a5b1812e28

+ 2
- 1
src/freedombone-app-babel Прегледај датотеку

@@ -28,7 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
-# Babel mesh
31
+VARIANTS=''
32
+
32 33
 ENABLE_BABEL="no"
33 34
 BABEL_PORT=6696
34 35
 

+ 2
- 1
src/freedombone-app-batman Прегледај датотеку

@@ -28,7 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
-# B.A.T.M.A.N settings
31
+VARIANTS='mesh'
32
+
32 33
 ENABLE_BATMAN="no"
33 34
 BATMAN_CELLID='any'
34 35
 

+ 2
- 0
src/freedombone-app-blog Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS="full writer"
32
+
31 33
 FULLBLOG_DOMAIN_NAME=
32 34
 FULLBLOG_CODE=
33 35
 FULLBLOG_ONION_PORT=8086

+ 2
- 1
src/freedombone-app-cjdns Прегледај датотеку

@@ -28,7 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
-# cjdns settings
31
+VARIANTS=''
32
+
32 33
 ENABLE_CJDNS="no"
33 34
 CJDNS_PRIVATE_KEY=
34 35
 CJDNS_PUBLIC_KEY=

+ 2
- 0
src/freedombone-app-dlna Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS='full media'
32
+
31 33
 function upgrade_dlna {
32 34
     echo ''
33 35
 }

+ 2
- 0
src/freedombone-app-emacs Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS='all'
32
+
31 33
 function upgrade_emacs {
32 34
     echo ''
33 35
 }

+ 2
- 0
src/freedombone-app-gnusocial Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS='full media'
32
+
31 33
 MICROBLOG_DOMAIN_NAME=
32 34
 MICROBLOG_CODE=
33 35
 MICROBLOG_ONION_PORT=8087

+ 2
- 0
src/freedombone-app-gogs Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS='full developer'
32
+
31 33
 GIT_DOMAIN_NAME=
32 34
 GIT_CODE=
33 35
 GIT_ONION_PORT=8090

+ 2
- 0
src/freedombone-app-hubzilla Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS='full social'
32
+
31 33
 HUBZILLA_DOMAIN_NAME=
32 34
 HUBZILLA_CODE=
33 35
 HUBZILLA_ONION_PORT=8085

+ 2
- 0
src/freedombone-app-ipfs Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS='mesh'
32
+
31 33
 IPFS_GO_REPO="https://github.com/ipfs/go-ipfs"
32 34
 IPFS_COMMIT='20b06a4cbce8884f5b194da6e98cb11f2c77f166'
33 35
 IPFS_PORT=4001

+ 2
- 0
src/freedombone-app-irc Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS='full chat'
32
+
31 33
 IRC_PORT=6697
32 34
 IRC_ONION_PORT=6697
33 35
 

+ 2
- 0
src/freedombone-app-mediagoblin Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS=''
32
+
31 33
 MEDIAGOBLIN_DOMAIN_NAME=
32 34
 MEDIAGOBLIN_CODE=
33 35
 MEDIAGOBLIN_REPO="git://git.savannah.gnu.org/mediagoblin.git"

+ 2
- 0
src/freedombone-app-mumble Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS='full chat'
32
+
31 33
 # Password used for VoIP server
32 34
 VOIP_SERVER_PASSWORD=
33 35
 # Port on which VoIP server listens

+ 2
- 0
src/freedombone-app-rss Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS='full writer'
32
+
31 33
 RSS_READER_REPO="https://tt-rss.org/git/tt-rss.git"
32 34
 RSS_READER_COMMIT='9e84bab449f9ed55e02e60378b0af1521026f3b8'
33 35
 RSS_READER_ADMIN_PASSWORD=

+ 2
- 0
src/freedombone-app-searx Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS=''
32
+
31 33
 SEARX_REPO="https://github.com/asciimoo/searx"
32 34
 SEARX_COMMIT='fee556c9904637051a9ba874ba7e71cd9f10789f'
33 35
 SEARX_PATH=/etc

+ 2
- 0
src/freedombone-app-sip Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS='full chat'
32
+
31 33
 SIP_SERVER_PASSWORD=
32 34
 SIP_PORT=5060
33 35
 SIP_TLS_PORT=5061

+ 2
- 0
src/freedombone-app-syncthing Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS='full cloud'
32
+
31 33
 SYNCTHING_ID=
32 34
 SYNCTHING_CONFIG_PATH=/root/.config/syncthing
33 35
 SYNCTHING_CONFIG_FILE=$SYNCTHING_CONFIG_PATH/config.xml

+ 2
- 0
src/freedombone-app-tox Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS='full chat'
32
+
31 33
 TOX_PORT=33445
32 34
 TOXCORE_REPO="git://github.com/irungentoo/toxcore.git"
33 35
 TOXCORE_COMMIT='532629d486e3361c7d8d95b38293cc7d61dc4ee5'

+ 2
- 0
src/freedombone-app-vpn Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS=''
32
+
31 33
 function upgrade_vpn {
32 34
     echo ''
33 35
 }

+ 2
- 0
src/freedombone-app-webmail Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS=''
32
+
31 33
 WEBMAIL_REPO="https://github.com/roundcube/roundcubemail"
32 34
 WEBMAIL_COMMIT='78cf9c2e5cff2d78cd8beb647d60570f195a2a9c'
33 35
 WEBMAIL_ONION_HOSTNAME=

+ 2
- 0
src/freedombone-app-wiki Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS='full writer'
32
+
31 33
 WIKI_DOMAIN_NAME=
32 34
 WIKI_ADMIN_PASSWORD=
33 35
 WIKI_TITLE="${PROJECT_NAME} Wiki"

+ 2
- 0
src/freedombone-app-xmpp Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS='full chat'
32
+
31 33
 # Directory where XMPP settings are stored
32 34
 XMPP_DIRECTORY="/var/lib/prosody"
33 35
 XMPP_PASSWORD=

+ 2
- 0
src/freedombone-app-zeronet Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
+VARIANTS='mesh'
32
+
31 33
 ZERONET_REPO="https://github.com/HelloZeroNet/ZeroNet.git"
32 34
 ZERONET_COMMIT='675bd462556c541d65e2d95f91f899146a373aad'
33 35
 ZERONET_BLOG_REPO="https://github.com/HelloZeroNet/ZeroBlog"

+ 44
- 0
src/freedombone-utils-selector Прегледај датотеку

@@ -82,6 +82,50 @@ function detect_apps {
82 82
 	get_apps_installed
83 83
 }
84 84
 
85
+# creates the APPS_AVAILABLE and APPS_CHOSEN arrays based on
86
+# the given variant name
87
+function choose_apps_for_variant {
88
+	variant_name="$1"
89
+
90
+	FILES=$PROJECT_INSTALL_DIR/${PROJECT_NAME}-app-*
91
+
92
+	APPS_AVAILABLE=()
93
+	APPS_CHOSEN=()
94
+
95
+	# for all the app scripts
96
+	for filename in $FILES
97
+	do
98
+		app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
99
+		if [[ $(item_in_array ${app_name} ${APPS_AVAILABLE[@]}) != 0 ]]; then
100
+			APPS_AVAILABLE+=("${app_name}")
101
+
102
+			if grep -q "VARIANTS=" ${filename}; then
103
+				variants_list=$(cat ${filename} | grep "VARIANTS=" | awk -F '=' '{print $2}' | awk -F "'" '{print $2}')
104
+				if [[ ${variants_list} == "$variant_name "* || ${variants_list} == *" $variant_name "* || ${variants_list} == *" $variant_name" ]]; then
105
+					APPS_CHOSEN+=("1")
106
+				else
107
+					APPS_CHOSEN+=("0")
108
+				fi
109
+			else
110
+				APPS_CHOSEN+=("0")
111
+			fi
112
+
113
+		fi
114
+	done
115
+	get_apps_installed
116
+}
117
+
118
+function list_chosen_apps {
119
+	app_index=0
120
+	for a in "${APPS_AVAILABLE[@]}"
121
+	do
122
+		if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
123
+			echo $"${a}"
124
+		fi
125
+		app_index=$[app_index+1]
126
+	done
127
+}
128
+
85 129
 function remove_apps {
86 130
 	app_index=0
87 131
 	for a in "${APPS_AVAILABLE[@]}"

+ 9
- 4
src/freedombone-utils-setup Прегледај датотеку

@@ -319,10 +319,15 @@ function setup_web {
319 319
 }
320 320
 
321 321
 function setup_apps {
322
-	function_check detect_apps
323
-	detect_apps
324
-
325
-	# TODO choose apps based upon variants
322
+	function_check choose_apps_for_variant
323
+	choose_apps_for_variant "$SYSTEM_TYPE"
324
+
325
+	echo $"System variant: $SYSTEM_TYPE"
326
+	echo $'The following apps have been selected'
327
+	echo ''
328
+	function_check list_chosen_apps
329
+	list_chosen_apps
330
+	echo ''
326 331
 
327 332
 	function_check install_apps
328 333
 	install_apps