Tidying
This commit is contained in:
parent
c2c0fa0631
commit
acd8a706d8
|
@ -252,6 +252,7 @@ function parse_args {
|
|||
read_config_param 'DEFAULT_DOMAIN_NAME'
|
||||
read_config_param 'MY_USERNAME'
|
||||
read_config_param 'SYSTEM_TYPE'
|
||||
read_config_param 'ONION_ONLY'
|
||||
|
||||
if [ ! -d /home/$MY_USERNAME ]; then
|
||||
echo $"There is no user '$MY_USERNAME' on the system. Use 'adduser $MY_USERNAME' to create the user."
|
||||
|
|
|
@ -165,21 +165,9 @@ function install_interactive_blog {
|
|||
fi
|
||||
done
|
||||
|
||||
if grep -q "MY_BLOG_TITLE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|MY_BLOG_TITLE=.*|MY_BLOG_TITLE=$MY_BLOG_TITLE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "MY_BLOG_TITLE=$MY_BLOG_TITLE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "FULLBLOG_DOMAIN_NAME=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|FULLBLOG_DOMAIN_NAME=.*|FULLBLOG_DOMAIN_NAME=$FULLBLOG_DOMAIN_NAME|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "FULLBLOG_DOMAIN_NAME=$FULLBLOG_DOMAIN_NAME" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "FULLBLOG_CODE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|FULLBLOG_CODE=.*|FULLBLOG_CODE=$FULLBLOG_CODE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "FULLBLOG_CODE=$FULLBLOG_CODE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
write_config_param "MY_BLOG_TITLE" "$MY_BLOG_TITLE"
|
||||
write_config_param "FULLBLOG_DOMAIN_NAME" "$FULLBLOG_DOMAIN_NAME"
|
||||
write_config_param "FULLBLOG_CODE" "$FULLBLOG_CODE"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -165,26 +165,10 @@ function install_interactive_gnusocial {
|
|||
fi
|
||||
done
|
||||
# save the results in the config file
|
||||
if grep -q "MICROBLOG_DOMAIN_NAME=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|MICROBLOG_DOMAIN_NAME=.*|MICROBLOG_DOMAIN_NAME=$MICROBLOG_DOMAIN_NAME|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "MICROBLOG_DOMAIN_NAME=$MICROBLOG_DOMAIN_NAME" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "MICROBLOG_CODE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|MICROBLOG_CODE=.*|MICROBLOG_CODE=$MICROBLOG_CODE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "MICROBLOG_CODE=$MICROBLOG_CODE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "MICROBLOG_WELCOME_MESSAGE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|MICROBLOG_WELCOME_MESSAGE=.*|MICROBLOG_WELCOME_MESSAGE=$MICROBLOG_WELCOME_MESSAGE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "MICROBLOG_WELCOME_MESSAGE=$MICROBLOG_WELCOME_MESSAGE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "MICROBLOG_BACKGROUND_IMAGE_URL=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|MICROBLOG_BACKGROUND_IMAGE_URL=.*|MICROBLOG_BACKGROUND_IMAGE_URL=$MICROBLOG_BACKGROUND_IMAGE_URL|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "MICROBLOG_BACKGROUND_IMAGE_URL=$MICROBLOG_BACKGROUND_IMAGE_URL" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
write_config_param "MICROBLOG_DOMAIN_NAME" "$MICROBLOG_DOMAIN_NAME"
|
||||
write_config_param "MICROBLOG_CODE" "$MICROBLOG_CODE"
|
||||
write_config_param "MICROBLOG_WELCOME_MESSAGE" "$MICROBLOG_WELCOME_MESSAGE"
|
||||
write_config_param "MICROBLOG_BACKGROUND_IMAGE_URL" "$MICROBLOG_BACKGROUND_IMAGE_URL"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -104,16 +104,8 @@ function install_interactive_gogs {
|
|||
done
|
||||
|
||||
# save the results in the config file
|
||||
if grep -q "GIT_DOMAIN_NAME=" ${CONFIGURATION_FILE}; then
|
||||
sed -i "s|GIT_DOMAIN_NAME=.*|GIT_DOMAIN_NAME=$GIT_DOMAIN_NAME|g" ${CONFIGURATION_FILE}
|
||||
else
|
||||
echo "GIT_DOMAIN_NAME=$GIT_DOMAIN_NAME" >> ${CONFIGURATION_FILE}
|
||||
fi
|
||||
if grep -q "GIT_CODE=" ${CONFIGURATION_FILE}; then
|
||||
sed -i "s|GIT_CODE=.*|GIT_CODE=$GIT_CODE|g" ${CONFIGURATION_FILE}
|
||||
else
|
||||
echo "GIT_CODE=$GIT_CODE" >> ${CONFIGURATION_FILE}
|
||||
fi
|
||||
write_config_param "GIT_DOMAIN_NAME" "$GIT_DOMAIN_NAME"
|
||||
write_config_param "GIT_CODE" "$GIT_CODE"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -185,16 +185,8 @@ function install_interactive_hubzilla {
|
|||
fi
|
||||
done
|
||||
# save the results in the config file
|
||||
if grep -q "HUBZILLA_DOMAIN_NAME=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|HUBZILLA_DOMAIN_NAME=.*|HUBZILLA_DOMAIN_NAME=$HUBZILLA_DOMAIN_NAME|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "HUBZILLA_DOMAIN_NAME=$HUBZILLA_DOMAIN_NAME" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "HUBZILLA_CODE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|HUBZILLA_CODE=.*|HUBZILLA_CODE=$HUBZILLA_CODE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "HUBZILLA_CODE=$HUBZILLA_CODE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
write_config_param "HUBZILLA_DOMAIN_NAME" "$HUBZILLA_DOMAIN_NAME"
|
||||
write_config_param "HUBZILLA_CODE" "$HUBZILLA_CODE"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -97,17 +97,10 @@ function install_interactive_mediagoblin {
|
|||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# save the results in the config file
|
||||
if grep -q "MEDIAGOBLIN_DOMAIN_NAME=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|MEDIAGOBLIN_DOMAIN_NAME=.*|MEDIAGOBLIN_DOMAIN_NAME=$MEDIAGOBLIN_DOMAIN_NAME|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "MEDIAGOBLIN_DOMAIN_NAME=$MEDIAGOBLIN_DOMAIN_NAME" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "MEDIAGOBLIN_CODE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|MEDIAGOBLIN_CODE=.*|MEDIAGOBLIN_CODE=$MEDIAGOBLIN_CODE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "MEDIAGOBLIN_CODE=$MEDIAGOBLIN_CODE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
write_config_param "MEDIAGOBLIN_DOMAIN_NAME" "$MEDIAGOBLIN_DOMAIN_NAME"
|
||||
write_config_param "MEDIAGOBLIN_CODE" "$MEDIAGOBLIN_CODE"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -99,21 +99,9 @@ function install_interactive_wiki {
|
|||
done
|
||||
|
||||
# save the results in the config file
|
||||
if grep -q "WIKI_TITLE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|WIKI_TITLE=.*|WIKI_TITLE=$WIKI_TITLE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "WIKI_TITLE=$WIKI_TITLE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "WIKI_DOMAIN_NAME=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|WIKI_DOMAIN_NAME=.*|WIKI_DOMAIN_NAME=$WIKI_DOMAIN_NAME|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "WIKI_DOMAIN_NAME=$WIKI_DOMAIN_NAME" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "WIKI_CODE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|WIKI_CODE=.*|WIKI_CODE=$WIKI_CODE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "WIKI_CODE=$WIKI_CODE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
write_config_param "WIKI_TITLE" "$WIKI_TITLE"
|
||||
write_config_param "WIKI_DOMAIN_NAME" "$WIKI_DOMAIN_NAME"
|
||||
write_config_param "WIKI_CODE" "$WIKI_CODE"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -40,6 +40,23 @@ function read_config_param {
|
|||
fi
|
||||
}
|
||||
|
||||
function write_config_param {
|
||||
param_name="$1"
|
||||
param_value="$2"
|
||||
|
||||
if [ $CONFIGURATION_FILE ]; then
|
||||
if [ -f $CONFIGURATION_FILE ]; then
|
||||
if grep -q "${param_name}=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|${param_name}=.*|${param_name}=${param_value}|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "${param_name}=${param_value}" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
else
|
||||
echo "${param_name}=${param_value}" > $CONFIGURATION_FILE
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function read_configuration {
|
||||
# if not installing on a Beaglebone then use sdb as the USB drive by default
|
||||
if [ ! $INSTALLING_ON_BBB ]; then
|
||||
|
|
|
@ -92,6 +92,24 @@ function item_in_array {
|
|||
return 1
|
||||
}
|
||||
|
||||
# returns a list of available system variants
|
||||
# based upon the variants string in each app script
|
||||
function available_system_variants {
|
||||
FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
|
||||
|
||||
for filename in $FILES
|
||||
do
|
||||
variants_list=$(app_variants $filename)
|
||||
variants_array=($variants_list)
|
||||
for variant_str in "${vars[@]}"
|
||||
do
|
||||
if [[ $(item_in_array "$variant_str" ${available_variants_list[@]}) == "0" ]]; then
|
||||
available_variants_list+=("$variant_str")
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
# mark a given app as having been removed so that it doesn't get reinstalled on updates
|
||||
function remove_app {
|
||||
app_name=$1
|
||||
|
|
Loading…
Reference in New Issue