Selecting apps from variant name

This commit is contained in:
Bob Mottram 2016-07-06 16:47:55 +01:00
parent 3d83d1636b
commit a5b1812e28
25 changed files with 98 additions and 6 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -82,6 +82,50 @@ function detect_apps {
get_apps_installed
}
# creates the APPS_AVAILABLE and APPS_CHOSEN arrays based on
# the given variant name
function choose_apps_for_variant {
variant_name="$1"
FILES=$PROJECT_INSTALL_DIR/${PROJECT_NAME}-app-*
APPS_AVAILABLE=()
APPS_CHOSEN=()
# for all the app scripts
for filename in $FILES
do
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
if [[ $(item_in_array ${app_name} ${APPS_AVAILABLE[@]}) != 0 ]]; then
APPS_AVAILABLE+=("${app_name}")
if grep -q "VARIANTS=" ${filename}; then
variants_list=$(cat ${filename} | grep "VARIANTS=" | awk -F '=' '{print $2}' | awk -F "'" '{print $2}')
if [[ ${variants_list} == "$variant_name "* || ${variants_list} == *" $variant_name "* || ${variants_list} == *" $variant_name" ]]; then
APPS_CHOSEN+=("1")
else
APPS_CHOSEN+=("0")
fi
else
APPS_CHOSEN+=("0")
fi
fi
done
get_apps_installed
}
function list_chosen_apps {
app_index=0
for a in "${APPS_AVAILABLE[@]}"
do
if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
echo $"${a}"
fi
app_index=$[app_index+1]
done
}
function remove_apps {
app_index=0
for a in "${APPS_AVAILABLE[@]}"

View File

@ -319,10 +319,15 @@ function setup_web {
}
function setup_apps {
function_check detect_apps
detect_apps
function_check choose_apps_for_variant
choose_apps_for_variant "$SYSTEM_TYPE"
# TODO choose apps based upon variants
echo $"System variant: $SYSTEM_TYPE"
echo $'The following apps have been selected'
echo ''
function_check list_chosen_apps
list_chosen_apps
echo ''
function_check install_apps
install_apps