Loading of app variables

This commit is contained in:
Bob Mottram 2016-10-05 22:33:41 +01:00
parent cc2e08b5c0
commit 3ab2687019
31 changed files with 759 additions and 888 deletions

View File

@ -216,6 +216,7 @@ for app_name in "${APPS_INSTALLED_NAMES[@]}"
do
if [[ $(function_exists add_user_${app_name}) == "1" ]]; then
echo $"Adding user to ${app_name}"
app_load_variables ${app_name}
retval=$(add_user_${app_name} "$MY_USERNAME" "$NEW_USER_PASSWORD")
if [[ $retval != '0' ]]; then
echo $"Failed with error code ${retval}"

View File

@ -33,6 +33,8 @@ VARIANTS=''
ENABLE_BABEL="no"
BABEL_PORT=6696
babel_variables=()
function install_interactive_babel {
echo -n ''
}

View File

@ -33,6 +33,9 @@ VARIANTS=''
ENABLE_BATMAN="no"
BATMAN_CELLID='any'
batman_variables=(MY_USERNAME
BATMAN_CELLID)
function install_interactive_batman {
echo -n ''
}

View File

@ -38,10 +38,19 @@ FULLBLOG_COMMIT='bf5fe9486160be4da86d8987d3e5c977e1dc6d32'
MY_BLOG_TITLE="My Blog"
MY_BLOG_SUBTITLE="Another ${PROJECT_NAME} Blog"
blog_variables=(FULLBLOG_REPO
FULLBLOG_COMMIT
FULLBLOG_DOMAIN_NAME
FULLBLOG_CODE
MY_BLOG_TITLE
MY_BLOG_SUBTITLE
ONION_ONLY
DDNS_PROVIDER
MY_USERNAME)
function remove_user_blog {
remove_username="$1"
FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "blog domain" | head -n 1 | awk -F ':' '{print $2}')
if [ -f /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/config/users/${remove_username}.ini ]; then
rm /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/config/users/${remove_username}.ini
fi
@ -56,7 +65,6 @@ function add_user_blog {
new_username="$1"
new_user_password="$2"
FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "blog domain" | head -n 1 | awk -F ':' '{print $2}')
if [ ! -d /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users ]; then
echo '2'
return
@ -100,21 +108,6 @@ function install_interactive_blog {
if [ ! $ONION_ONLY ]; then
ONION_ONLY='no'
fi
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "MY_BLOG_TITLE" $CONFIGURATION_FILE; then
MY_BLOG_TITLE=$(grep "MY_BLOG_TITLE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "FULLBLOG_DOMAIN_NAME" $CONFIGURATION_FILE; then
FULLBLOG_DOMAIN_NAME=$(grep "FULLBLOG_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "FULLBLOG_CODE" $CONFIGURATION_FILE; then
FULLBLOG_CODE=$(grep "FULLBLOG_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if [[ $ONION_ONLY != "no" ]]; then
MY_BLOG_TITLE='My Blog'
@ -351,6 +344,7 @@ function remove_blog {
if [[ $(app_is_installed blog) == "0" ]]; then
return
fi
if grep -q "FULLBLOG_DOMAIN_NAME" $CONFIGURATION_FILE; then
FULLBLOG_DOMAIN_NAME=$(grep "FULLBLOG_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
@ -630,24 +624,6 @@ function install_blog {
if [ ! $ONION_ONLY ]; then
ONION_ONLY='no'
fi
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "FULLBLOG_DOMAIN_NAME" $CONFIGURATION_FILE; then
FULLBLOG_DOMAIN_NAME=$(grep "FULLBLOG_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "FULLBLOG_CODE" $CONFIGURATION_FILE; then
FULLBLOG_CODE=$(grep "FULLBLOG_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "MY_BLOG_TITLE" $CONFIGURATION_FILE; then
MY_BLOG_TITLE=$(grep "MY_BLOG_TITLE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "MY_USERNAME" $CONFIGURATION_FILE; then
MY_USERNAME=$(grep "MY_USERNAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if [ ! $FULLBLOG_DOMAIN_NAME ]; then
echo $'The blog domain name was not specified'

View File

@ -35,6 +35,9 @@ PELICAN_THEMES_REPO="https://github.com/getpelican/pelican-themes"
PELICAN_PLUGINS_REPO="https://github.com/getpelican/pelican-plugins"
DEFAULT_BLOG_TITLE=$"Freedombone Blog"
blogstatic_variables=(MY_USERNAME
STATIC_BLOG_DOMAIN)
function configure_interactive_blogstatic {
echo -n ''
}

View File

@ -41,6 +41,16 @@ CJDNS_COMMIT='13189fde111d0500427a7a0ce06a970753527bca'
CJDCMD_REPO="https://github.com/inhies/cjdcmd"
CJDCMD_COMMIT='973cca6ed0eecf9041c3403a40193c0b1291b808'
cjdns_variables=(MY_USERNAME
CJDNS_PORT
CJDNS_REPO
CJDNS_COMMIT
CJDCMD_REPO
CJDCMD_COMMIT
CJDNS_IPV6
CJDNS_PUBLIC_KEY
CJDNS_PRIVATE_KEY)
function install_interactive_cjdns {
echo -n ''
}

View File

@ -30,6 +30,11 @@
VARIANTS='full media'
dlna_variables=(SYSTEM_TYPE
USB_MOUNT
INSTALLED_WITHIN_DOCKER
MY_USERNAME)
function configure_interactive_dlna {
while true
do

View File

@ -30,6 +30,9 @@
VARIANTS='all'
emacs_variables=(USB_MOUNT
MY_USERNAME)
function install_interactive_emacs {
echo -n ''
}

View File

@ -56,6 +56,21 @@ GNUSOCIAL_NSFW_COMMIT='a096bbe0cfae9a9b177682920ffb58d32a48e136'
# script which causes old posts to expire
gnusocial_expire_script=/usr/bin/gnusocial-expire
gnusocial_variables=(MICROBLOG_COMMIT
ONION_ONLY
MICROBLOG_DOMAIN_NAME
MICROBLOG_CODE
MICROBLOG_WELCOME_MESSAGE
MICROBLOG_BACKGROUND_IMAGE_URL
DDNS_PROVIDER
MICROBLOG_MARKDOWN_REPO
MICROBLOG_MARKDOWN_COMMIT
SHARINGS_REPO
SHARINGS_COMMIT
SHARINGS_THEME_REPO
SHARINGS_THEME_COMMIT
MY_USERNAME)
function remove_user_gnusocial {
remove_username="$1"
@ -86,14 +101,6 @@ function install_interactive_gnusocial {
ONION_ONLY='no'
fi
read_config_param "MICROBLOG_COMMIT"
read_config_param "ONION_ONLY"
read_config_param "MICROBLOG_DOMAIN_NAME"
read_config_param "MICROBLOG_CODE"
read_config_param "MICROBLOG_WELCOME_MESSAGE"
read_config_param "MICROBLOG_BACKGROUND_IMAGE_URL"
read_config_param "DDNS_PROVIDER"
if [[ $ONION_ONLY != "no" ]]; then
MICROBLOG_DOMAIN_NAME='microblog.local'
else
@ -241,7 +248,6 @@ function upgrade_gnusocial {
if grep -q "gnusocial domain" $COMPLETION_FILE; then
MICROBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
fi
read_config_param "MICROBLOG_COMMIT"
# update to the next commit
function_check set_repo_commit
@ -1031,13 +1037,6 @@ function install_gnusocial {
if [ ! $ONION_ONLY ]; then
ONION_ONLY='no'
fi
read_config_param "MICROBLOG_COMMIT"
read_config_param "ONION_ONLY"
read_config_param "MICROBLOG_DOMAIN_NAME"
read_config_param "MICROBLOG_CODE"
read_config_param "MICROBLOG_WELCOME_MESSAGE"
read_config_param "MICROBLOG_BACKGROUND_IMAGE_URL"
read_config_param "DDNS_PROVIDER"
install_gnusocial_main
expire_gnusocial_posts

View File

@ -39,22 +39,18 @@ GIT_ONION_PORT=8090
GIT_ADMIN_PASSWORD=
GOGS_BIN=
gogs_variables=(ONION_ONLY
GOGS_COMMIT
GIT_ADMIN_PASSWORD
GIT_DOMAIN_NAME
GIT_CODE
GIT_ONION_PORT
MY_USERNAME
GOGS_VERSION
DDNS_PROVIDER
ARCHITECTURE)
function install_interactive_gogs {
if [ ! $ONION_ONLY ]; then
ONION_ONLY='no'
fi
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "GIT_DOMAIN_NAME" $CONFIGURATION_FILE; then
GIT_DOMAIN_NAME=$(grep "GIT_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "GIT_CODE" $CONFIGURATION_FILE; then
GIT_CODE=$(grep "GIT_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if [[ $ONION_ONLY != "no" ]]; then
GIT_DOMAIN_NAME='git.local'
else
@ -84,17 +80,17 @@ function install_interactive_gogs {
255) exit 1;;
esac
GIT_DOMAIN_NAME=$(cat $data | sed -n 1p)
if [ $GIT_DOMAIN_NAME ]; then
if [ ${GIT_DOMAIN_NAME} ]; then
TEST_DOMAIN_NAME=$GIT_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $GIT_DOMAIN_NAME ]]; then
if [[ ${TEST_DOMAIN_NAME} != ${GIT_DOMAIN_NAME} ]]; then
GIT_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
dialog --title $"Domain name validation" --msgbox "${TEST_DOMAIN_NAME}" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ ${DDNS_PROVIDER} == "default@freedns.afraid.org" ]]; then
GIT_CODE=$(cat $data | sed -n 2p)
validate_freedns_code "$GIT_CODE"
if [ ! $VALID_CODE ]; then
if [ ! ${VALID_CODE} ]; then
GIT_DOMAIN_NAME=
fi
fi
@ -102,21 +98,21 @@ function install_interactive_gogs {
else
DEVELOPER_DETAILS_COMPLETE="yes"
fi
if [ $GIT_DOMAIN_NAME ]; then
if [ ${GIT_DOMAIN_NAME} ]; then
DEVELOPER_DETAILS_COMPLETE="yes"
fi
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
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
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
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
echo "GIT_CODE=$GIT_CODE" >> ${CONFIGURATION_FILE}
fi
fi
}
@ -126,25 +122,25 @@ function change_password_gogs {
}
function gogs_parameters {
if [[ $ARCHITECTURE == *"386" || $ARCHITECTURE == *"686" ]]; then
if [[ ${ARCHITECTURE} == *"386" || ${ARCHITECTURE} == *"686" ]]; then
CURR_ARCH=386
fi
if [[ $ARCHITECTURE == *"amd64" || $ARCHITECTURE == "x86_64" ]]; then
if [[ ${ARCHITECTURE} == *"amd64" || ${ARCHITECTURE} == "x86_64" ]]; then
CURR_ARCH=amd64
fi
if [[ $ARCHITECTURE == *"arm"* ]]; then
if [[ ${ARCHITECTURE} == *"arm"* ]]; then
CURR_ARCH=arm
fi
if [ ! $CURR_ARCH ]; then
if [ ! ${CURR_ARCH} ]; then
echo $'No architecture specified'
ARCHITECTURE=$(uname -m)
if [[ $ARCHITECTURE == "arm"* ]]; then
if [[ ${ARCHITECTURE} == "arm"* ]]; then
CURR_ARCH=arm
fi
if [[ $ARCHITECTURE == "amd"* || $ARCHITECTURE == "x86_64" ]]; then
if [[ ${ARCHITECTURE} == "amd"* || ${ARCHITECTURE} == "x86_64" ]]; then
CURR_ARCH=amd64
fi
if [[ $ARCHITECTURE == *"386" || $ARCHITECTURE == *"686" ]]; then
if [[ ${ARCHITECTURE} == *"386" || ${ARCHITECTURE} == *"686" ]]; then
CURR_ARCH=386
fi
fi
@ -153,9 +149,9 @@ function gogs_parameters {
}
function get_mariadb_git_admin_password {
if [ -f /home/$MY_USERNAME/README ]; then
if grep -q "Gogs admin user password" /home/$MY_USERNAME/README; then
GIT_ADMIN_PASSWORD=$(cat /home/$MY_USERNAME/README | grep "Gogs admin user password" | awk -F ':' '{print $2}' | sed 's/^ *//')
if [ -f /home/${MY_USERNAME}/README ]; then
if grep -q "Gogs admin user password" /home/${MY_USERNAME}/README; then
GIT_ADMIN_PASSWORD=$(cat /home/${MY_USERNAME}/README | grep "Gogs admin user password" | awk -F ':' '{print $2}' | sed 's/^ *//')
fi
fi
}
@ -163,8 +159,9 @@ function get_mariadb_git_admin_password {
function gogs_create_database {
function_check get_mariadb_git_admin_password
get_mariadb_git_admin_password
if [ ! $GIT_ADMIN_PASSWORD ]; then
if [ -f $IMAGE_PASSWORD_FILE ]; then
if [ ! ${GIT_ADMIN_PASSWORD} ]; then
if [ -f ${IMAGE_PASSWORD_FILE} ]; then
GIT_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
else
GIT_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
@ -188,7 +185,7 @@ function upgrade_gogs {
fi
CURR_GOGS_VERSION=$(cat $COMPLETION_FILE | grep "gogs version" | head -n 1 | awk -F ':' '{print $2}')
if [[ "$CURR_GOGS_VERSION" == "$GOGS_VERSION" ]]; then
if [[ "${CURR_GOGS_VERSION}" == "${GOGS_VERSION}" ]]; then
return
fi
@ -198,14 +195,14 @@ function upgrade_gogs {
mkdir -p ${INSTALL_DIR}
fi
cd ${INSTALL_DIR}
if [ -d $INSTALL_DIR/gogs ]; then
rm -rf $INSTALL_DIR/gogs
if [ -d ${INSTALL_DIR}/gogs ]; then
rm -rf ${INSTALL_DIR}/gogs
fi
GOGS_FILE=linux_${CURR_ARCH}.tar.gz
if [ ! -f $GOGS_FILE ]; then
if [ ! -f ${GOGS_FILE} ]; then
wget ${GOGS_BIN}
fi
if [ ! -f $GOGS_FILE ]; then
if [ ! -f ${GOGS_FILE} ]; then
GOGS_FILE=linux_${CURR_ARCH}.zip
GOGS_BIN="https://github.com/gogits/gogs/releases/download/v${GOGS_VERSION}/${GOGS_FILE}"
if [ ! -f ${GOGS_FILE} ]; then
@ -220,53 +217,49 @@ function upgrade_gogs {
else
tar -xzf ${INSTALL_DIR}/${GOGS_FILE}
fi
if [ ! -d $INSTALL_DIR/gogs ]; then
if [ ! -d ${INSTALL_DIR}/gogs ]; then
exit 37823
fi
rm -rf /home/$GOGS_USERNAME/*
cp -r $INSTALL_DIR/gogs/* /home/$GOGS_USERNAME
rm -rf /home/${GOGS_USERNAME}/*
cp -r ${INSTALL_DIR}/gogs/* /home/${GOGS_USERNAME}
if [ -f ${GOGS_FILE} ]; then
rm ${GOGS_FILE}
fi
sed -i "s|gogs version.*|gogs version:$GOGS_VERSION|g" $COMPLETION_FILE
sed -i "s|gogs version.*|gogs version:$GOGS_VERSION|g" ${COMPLETION_FILE}
systemctl restart gogs
}
function backup_local_gogs {
if ! grep -q "gogs domain" $COMPLETION_FILE; then
if ! grep -q "gogs domain" ${COMPLETION_FILE}; then
return
fi
if [ ! -d /home/$GOGS_USERNAME/gogs-repositories ]; then
if [ ! -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
return
fi
GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gogs domain" | awk -F ':' '{print $2}')
echo $"Backing up gogs"
function_check backup_database_to_usb
backup_database_to_usb gogs
function_check backup_directory_to_usb
backup_directory_to_usb /home/$GOGS_USERNAME/custom gogs
backup_directory_to_usb /home/$GOGS_USERNAME/gogs-repositories gogsrepos
backup_directory_to_usb /home/$GOGS_USERNAME/.ssh gogsssh
backup_directory_to_usb /home/${GOGS_USERNAME}/custom gogs
backup_directory_to_usb /home/${GOGS_USERNAME}/gogs-repositories gogsrepos
backup_directory_to_usb /home/${GOGS_USERNAME}/.ssh gogsssh
echo $"Gogs backup complete"
}
function restore_local_gogs {
if ! grep -q "gogs domain" $COMPLETION_FILE; then
if ! grep -q "gogs domain" ${COMPLETION_FILE}; then
return
fi
if [ ! -d /home/$GOGS_USERNAME/gogs-repositories ]; then
if [ ! -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
return
fi
GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gogs domain" | awk -F ':' '{print $2}')
if [ ${#GIT_DOMAIN_NAME} -gt 2 ]; then
function_check gogs_create_database
gogs_create_database
@ -274,12 +267,12 @@ function restore_local_gogs {
function_check restore_database
restore_database gogs ${GIT_DOMAIN_NAME}
temp_restore_dir=/root/tempgogs
if [ -d $USB_MOUNT/backup/gogs ]; then
if [ -d ${USB_MOUNT}/backup/gogs ]; then
echo $"Restoring Gogs settings"
if [ ! -d /home/$GOGS_USERNAME/custom ]; then
mkdir -p /home/$GOGS_USERNAME/custom
if [ ! -d /home/${GOGS_USERNAME}/custom ]; then
mkdir -p /home/${GOGS_USERNAME}/custom
fi
cp -r ${temp_restore_dir}/home/$GOGS_USERNAME/custom/* /home/$GOGS_USERNAME/custom
cp -r ${temp_restore_dir}/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom
if [ ! "$?" = "0" ]; then
function_check set_user_permissions
set_user_permissions
@ -290,7 +283,7 @@ function restore_local_gogs {
echo $"Restoring Gogs repos"
function_check restore_directory_from_usb
restore_directory_from_usb ${temp_restore_dir}repos gogsrepos
cp -r ${temp_restore_dir}repos/home/$GOGS_USERNAME/gogs-repositories/* /home/$GOGS_USERNAME/gogs-repositories/
cp -r ${temp_restore_dir}repos/home/${GOGS_USERNAME}/gogs-repositories/* /home/${GOGS_USERNAME}/gogs-repositories/
if [ ! "$?" = "0" ]; then
function_check set_user_permissions
set_user_permissions
@ -301,10 +294,10 @@ function restore_local_gogs {
echo $"Restoring Gogs authorized_keys"
function_check restore_directory_from_usb
restore_directory_from_usb ${temp_restore_dir}ssh gogsssh
if [ ! -d /home/$GOGS_USERNAME/.ssh ]; then
mkdir /home/$GOGS_USERNAME/.ssh
if [ ! -d /home/${GOGS_USERNAME}/.ssh ]; then
mkdir /home/${GOGS_USERNAME}/.ssh
fi
cp -r ${temp_restore_dir}ssh/home/$GOGS_USERNAME/.ssh/* /home/$GOGS_USERNAME/.ssh/
cp -r ${temp_restore_dir}ssh/home/${GOGS_USERNAME}/.ssh/* /home/${GOGS_USERNAME}/.ssh/
if [ ! "$?" = "0" ]; then
function_check set_user_permissions
set_user_permissions
@ -315,14 +308,13 @@ function restore_local_gogs {
rm -rf ${temp_restore_dir}
rm -rf ${temp_restore_dir}repos
rm -rf ${temp_restore_dir}ssh
chown -R $GOGS_USERNAME:$GOGS_USERNAME /home/$GOGS_USERNAME
chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
fi
fi
}
function backup_remote_gogs {
if [ -d /home/$GOGS_USERNAME ]; then
GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gogs domain" | awk -F ':' '{print $2}')
function_check suspend_site
suspend_site ${GIT_DOMAIN_NAME}
@ -358,34 +350,34 @@ function restore_remote_gogs {
gogs_create_database
function_check restore_database_from_friend
restore_database_from_friend gogs $GIT_DOMAIN_NAME
if [ -d $SERVER_DIRECTORY/backup/gogs ]; then
if [ ! -d /home/$GOGS_USERNAME/custom ]; then
mkdir -p /home/$GOGS_USERNAME/custom
restore_database_from_friend gogs ${GIT_DOMAIN_NAME}
if [ -d ${SERVER_DIRECTORY}/backup/gogs ]; then
if [ ! -d /home/${GOGS_USERNAME}/custom ]; then
mkdir -p /home/${GOGS_USERNAME}/custom
fi
cp -r /root/tempgogs/home/$GOGS_USERNAME/custom/* /home/$GOGS_USERNAME/custom/
cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
if [ ! "$?" = "0" ]; then
exit 58852
fi
echo $"Restoring Gogs repos"
restore_directory_from_friend /root/tempgogsrepos gogsrepos
cp -r /root/tempgogsrepos/home/$GOGS_USERNAME/gogs-repositories/* /home/$GOGS_USERNAME/gogs-repositories/
cp -r /root/tempgogsrepos/home/${GOGS_USERNAME}/gogs-repositories/* /home/${GOGS_USERNAME}/gogs-repositories/
if [ ! "$?" = "0" ]; then
exit 7649
fi
echo $"Restoring Gogs authorized_keys"
restore_directory_from_friend /root/tempgogsssh gogsssh
if [ ! -d /home/$GOGS_USERNAME/.ssh ]; then
mkdir /home/$GOGS_USERNAME/.ssh
if [ ! -d /home/${GOGS_USERNAME}/.ssh ]; then
mkdir /home/${GOGS_USERNAME}/.ssh
fi
cp -r /root/tempgogsssh/home/$GOGS_USERNAME/.ssh/* /home/$GOGS_USERNAME/.ssh/
cp -r /root/tempgogsssh/home/${GOGS_USERNAME}/.ssh/* /home/${GOGS_USERNAME}/.ssh/
if [ ! "$?" = "0" ]; then
exit 74239
fi
rm -rf /root/tempgogs
rm -rf /root/tempgogsrepos
rm -rf /root/tempgogsssh
chown -R $GOGS_USERNAME:$GOGS_USERNAME /home/$GOGS_USERNAME
chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
echo $"Restore of Gogs complete"
fi
fi
@ -396,44 +388,25 @@ function remove_gogs {
return
fi
if grep -q "GIT_DOMAIN_NAME" $CONFIGURATION_FILE; then
GIT_DOMAIN_NAME=$(grep "GIT_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
systemctl stop gogs
systemctl disable gogs
nginx_dissite $GIT_DOMAIN_NAME
if [ -d /var/www/$GIT_DOMAIN_NAME ]; then
rm -rf /var/www/$GIT_DOMAIN_NAME
nginx_dissite ${GIT_DOMAIN_NAME}
if [ -d /var/www/${GIT_DOMAIN_NAME} ]; then
rm -rf /var/www/${GIT_DOMAIN_NAME}
fi
if [ -f /etc/nginx/sites-available/$GIT_DOMAIN_NAME ]; then
rm /etc/nginx/sites-available/$GIT_DOMAIN_NAME
if [ -f /etc/nginx/sites-available/${GIT_DOMAIN_NAME} ]; then
rm /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
fi
function_check drop_database
drop_database gogs
rm /etc/systemd/system/gogs.service
rm -rf /home/$GOGS_USERNAME/*
rm -rf /home/${GOGS_USERNAME}/*
remove_onion_service gogs ${GIT_ONION_PORT} 9418
sed -i '/install_gogs/d' $COMPLETION_FILE
sed -i '/Gogs /d' $COMPLETION_FILE
sed -i '/gogs /d' $COMPLETION_FILE
}
function install_gogs {
if [ ! $ONION_ONLY ]; then
ONION_ONLY='no'
fi
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "GIT_DOMAIN_NAME" $CONFIGURATION_FILE; then
GIT_DOMAIN_NAME=$(grep "GIT_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "GIT_CODE" $CONFIGURATION_FILE; then
GIT_CODE=$(grep "GIT_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if [ ! $GIT_DOMAIN_NAME ]; then
return
fi
@ -466,24 +439,24 @@ function install_gogs {
else
tar -xzf ${INSTALL_DIR}/${GOGS_FILE}
fi
if [ ! -d $INSTALL_DIR/gogs ]; then
if [ ! -d ${INSTALL_DIR}/gogs ]; then
exit 37823
fi
rm -rf /home/$GOGS_USERNAME/*
cp -r $INSTALL_DIR/gogs/* /home/$GOGS_USERNAME
rm -rf /home/${GOGS_USERNAME}/*
cp -r ${INSTALL_DIR}/gogs/* /home/${GOGS_USERNAME}
if [ -f ${GOGS_FILE} ]; then
rm ${GOGS_FILE}
fi
if [ ! -f /home/$GOGS_USERNAME/gogs ]; then
if [ ! -f /home/${GOGS_USERNAME}/gogs ]; then
echo 'Gogs binary not installed'
exit 345562
fi
echo "export GOROOT=/home/go" >> /home/$GOGS_USERNAME/.bashrc
echo "export GOPATH=\$GOROOT/go${GO_VERSION}/bin" >> /home/$GOGS_USERNAME/.bashrc
echo 'export PATH=$PATH:$GOPATH' >> /home/$GOGS_USERNAME/.bashrc
chown -R $GOGS_USERNAME:$GOGS_USERNAME /home/$GOGS_USERNAME
echo "export GOROOT=/home/go" >> /home/${GOGS_USERNAME}/.bashrc
echo "export GOPATH=\$GOROOT/go${GO_VERSION}/bin" >> /home/${GOGS_USERNAME}/.bashrc
echo 'export PATH=$PATH:$GOPATH' >> /home/${GOGS_USERNAME}/.bashrc
chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
function_check install_mariadb
install_mariadb
@ -494,44 +467,44 @@ function install_gogs {
function_check gogs_create_database
gogs_create_database
if [ ! -f /home/$GOGS_USERNAME/scripts/mysql.sql ]; then
if [ ! -f /home/${GOGS_USERNAME}/scripts/mysql.sql ]; then
echo $'MySql template for Gogs was not found'
exit 72528
fi
if ! grep -q $"Gogs admin user password" /home/$MY_USERNAME/README; then
echo '' >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
echo 'Gogs' >> /home/$MY_USERNAME/README
echo '====' >> /home/$MY_USERNAME/README
echo $'Install Steps For First-time Run:' >> /home/$MY_USERNAME/README
echo $'Leave email service settings empty' >> /home/$MY_USERNAME/README
echo $'Check "Enable Register Confirmation"' >> /home/$MY_USERNAME/README
echo $'Check "Enable Mail Notification"' >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
echo $'If you want to disable new account registrations then append the following:' >> /home/$MY_USERNAME/README
echo ' [service]' >> /home/$MY_USERNAME/README
echo ' DISABLE_REGISTRATION = true' >> /home/$MY_USERNAME/README
echo $'Then restart with:' >> /home/$MY_USERNAME/README
echo ' systemctl restart gogs' >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
echo $"Note that there's a usability/security trade-off made here." >> /home/$MY_USERNAME/README
echo $"In order to allow git clone via http we don't redirect everything" >> /home/$MY_USERNAME/README
echo $'over https. Instead only critical things such as user login,' >> /home/$MY_USERNAME/README
echo $'settings and admin are encrypted.' >> /home/$MY_USERNAME/README
echo $'There are also potential security issues with cloning/pulling/pushing' >> /home/$MY_USERNAME/README
echo $'code over http, since a determined adversary could inject malware' >> /home/$MY_USERNAME/README
echo $'into the stream as it passes, so beware.' >> /home/$MY_USERNAME/README
echo $'If you have a bought domain and a non-self signed cert then you' >> /home/$MY_USERNAME/README
echo $"should change /etc/nginx/sites-available/$GIT_DOMAIN_NAME to redirect everything over https." >> /home/$MY_USERNAME/README
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
chmod 600 /home/$MY_USERNAME/README
if ! grep -q $"Gogs admin user password" /home/${MY_USERNAME}/README; then
echo '' >> /home/${MY_USERNAME}/README
echo '' >> /home/${MY_USERNAME}/README
echo 'Gogs' >> /home/${MY_USERNAME}/README
echo '====' >> /home/${MY_USERNAME}/README
echo $'Install Steps For First-time Run:' >> /home/${MY_USERNAME}/README
echo $'Leave email service settings empty' >> /home/${MY_USERNAME}/README
echo $'Check "Enable Register Confirmation"' >> /home/${MY_USERNAME}/README
echo $'Check "Enable Mail Notification"' >> /home/${MY_USERNAME}/README
echo '' >> /home/${MY_USERNAME}/README
echo $'If you want to disable new account registrations then append the following:' >> /home/${MY_USERNAME}/README
echo ' [service]' >> /home/${MY_USERNAME}/README
echo ' DISABLE_REGISTRATION = true' >> /home/${MY_USERNAME}/README
echo $'Then restart with:' >> /home/${MY_USERNAME}/README
echo ' systemctl restart gogs' >> /home/${MY_USERNAME}/README
echo '' >> /home/${MY_USERNAME}/README
echo $"Note that there's a usability/security trade-off made here." >> /home/${MY_USERNAME}/README
echo $"In order to allow git clone via http we don't redirect everything" >> /home/${MY_USERNAME}/README
echo $'over https. Instead only critical things such as user login,' >> /home/${MY_USERNAME}/README
echo $'settings and admin are encrypted.' >> /home/${MY_USERNAME}/README
echo $'There are also potential security issues with cloning/pulling/pushing' >> /home/${MY_USERNAME}/README
echo $'code over http, since a determined adversary could inject malware' >> /home/${MY_USERNAME}/README
echo $'into the stream as it passes, so beware.' >> /home/${MY_USERNAME}/README
echo $'If you have a bought domain and a non-self signed cert then you' >> /home/${MY_USERNAME}/README
echo $"should change /etc/nginx/sites-available/${GIT_DOMAIN_NAME} to redirect everything over https." >> /home/${MY_USERNAME}/README
chown ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/README
chmod 600 /home/${MY_USERNAME}/README
fi
function_check initialise_database
initialise_database gogs /home/$GOGS_USERNAME/scripts/mysql.sql
initialise_database gogs /home/${GOGS_USERNAME}/scripts/mysql.sql
chown -R $GOGS_USERNAME:$GOGS_USERNAME /home/$GOGS_USERNAME
chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
echo '[Unit]' > /etc/systemd/system/gogs.service
echo 'Description=Gogs (Go Git Service)' >> /etc/systemd/system/gogs.service
@ -545,11 +518,11 @@ function install_gogs {
echo 'Type=simple' >> /etc/systemd/system/gogs.service
echo 'User=gogs' >> /etc/systemd/system/gogs.service
echo 'Group=gogs' >> /etc/systemd/system/gogs.service
echo "WorkingDirectory=/home/$GOGS_USERNAME" >> /etc/systemd/system/gogs.service
echo "ExecStart=/home/$GOGS_USERNAME/gogs web" >> /etc/systemd/system/gogs.service
echo "WorkingDirectory=/home/${GOGS_USERNAME}" >> /etc/systemd/system/gogs.service
echo "ExecStart=/home/${GOGS_USERNAME}/gogs web" >> /etc/systemd/system/gogs.service
echo 'Restart=always' >> /etc/systemd/system/gogs.service
echo 'RestartSec=10' >> /etc/systemd/system/gogs.service
echo "Environment=\"USER=$GOGS_USERNAME\" \"HOME=/home/$GOGS_USERNAME\" \"GOPATH=/home/go/go${GO_VERSION}\"" >> /etc/systemd/system/gogs.service
echo "Environment=\"USER=${GOGS_USERNAME}\" \"HOME=/home/${GOGS_USERNAME}\" \"GOPATH=/home/go/go${GO_VERSION}\"" >> /etc/systemd/system/gogs.service
echo '' >> /etc/systemd/system/gogs.service
echo '[Install]' >> /etc/systemd/system/gogs.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/gogs.service
@ -558,86 +531,86 @@ function install_gogs {
systemctl daemon-reload
systemctl start gogs
if [ ! -d /var/www/$GIT_DOMAIN_NAME ]; then
mkdir /var/www/$GIT_DOMAIN_NAME
if [ ! -d /var/www/${GIT_DOMAIN_NAME} ]; then
mkdir /var/www/${GIT_DOMAIN_NAME}
fi
if [ -d /var/www/$GIT_DOMAIN_NAME/htdocs ]; then
rm -rf /var/www/$GIT_DOMAIN_NAME/htdocs
if [ -d /var/www/${GIT_DOMAIN_NAME}/htdocs ]; then
rm -rf /var/www/${GIT_DOMAIN_NAME}/htdocs
fi
if [[ $ONION_ONLY == "no" ]]; then
if [[ ${ONION_ONLY} == "no" ]]; then
function_check nginx_http_redirect
nginx_http_redirect $GIT_DOMAIN_NAME
echo 'server {' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' listen 443 ssl;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo " root /var/www/$GIT_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo " server_name $GIT_DOMAIN_NAME;" >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' access_log off;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo " error_log /var/log/nginx/${GIT_DOMAIN_NAME}_error.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
nginx_http_redirect ${GIT_DOMAIN_NAME}
echo 'server {' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' listen 443 ssl;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo " root /var/www/${GIT_DOMAIN_NAME}/htdocs;" >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo " server_name ${GIT_DOMAIN_NAME};" >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' access_log off;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo " error_log /var/log/nginx/${GIT_DOMAIN_NAME}_error.log ${WEBSERVER_LOG_LEVEL};" >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo '' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
function_check nginx_ssl
nginx_ssl $GIT_DOMAIN_NAME
nginx_ssl ${GIT_DOMAIN_NAME}
function_check nginx_disable_sniffing
nginx_disable_sniffing $GIT_DOMAIN_NAME
echo ' add_header Strict-Transport-Security max-age=0;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' location / {' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
nginx_disable_sniffing ${GIT_DOMAIN_NAME}
echo ' add_header Strict-Transport-Security max-age=0;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo '' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' location / {' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
function_check nginx_limits
nginx_limits $GIT_DOMAIN_NAME '10G'
echo ' proxy_pass http://localhost:3000;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' fastcgi_buffers 64 4K;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' error_page 403 /core/templates/403.php;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' error_page 404 /core/templates/404.php;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' location = /robots.txt {' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' allow all;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' log_not_found off;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' access_log off;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo '}' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
nginx_limits ${GIT_DOMAIN_NAME} '10G'
echo ' proxy_pass http://localhost:3000;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' }' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo '' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' fastcgi_buffers 64 4K;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo '' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' error_page 403 /core/templates/403.php;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' error_page 404 /core/templates/404.php;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo '' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' location = /robots.txt {' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' allow all;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' log_not_found off;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' access_log off;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' }' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo '}' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo '' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
else
echo -n '' > /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo -n '' > /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
fi
echo 'server {' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo " listen 127.0.0.1:${GIT_ONION_PORT} default_server;" >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo " root /var/www/$GIT_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo " server_name $GIT_DOMAIN_NAME;" >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' access_log off;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo " error_log /var/log/nginx/${GIT_DOMAIN_NAME}_error.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo 'server {' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo " listen 127.0.0.1:${GIT_ONION_PORT} default_server;" >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo " root /var/www/$GIT_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo " server_name $GIT_DOMAIN_NAME;" >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' access_log off;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo " error_log /var/log/nginx/${GIT_DOMAIN_NAME}_error.log ${WEBSERVER_LOG_LEVEL};" >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo '' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
function_check nginx_disable_sniffing
nginx_disable_sniffing $GIT_DOMAIN_NAME
echo ' add_header Strict-Transport-Security max-age=0;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' location / {' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
nginx_disable_sniffing ${GIT_DOMAIN_NAME}
echo ' add_header Strict-Transport-Security max-age=0;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo '' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' location / {' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
function_check nginx_limits
nginx_limits $GIT_DOMAIN_NAME '10G'
echo ' proxy_pass http://localhost:3000;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' fastcgi_buffers 64 4K;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' error_page 403 /core/templates/403.php;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' error_page 404 /core/templates/404.php;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' location = /robots.txt {' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' allow all;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' log_not_found off;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' access_log off;' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
echo '}' >> /etc/nginx/sites-available/$GIT_DOMAIN_NAME
nginx_limits ${GIT_DOMAIN_NAME} '10G'
echo ' proxy_pass http://localhost:3000;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' }' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo '' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' fastcgi_buffers 64 4K;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo '' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' error_page 403 /core/templates/403.php;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' error_page 404 /core/templates/404.php;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo '' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' location = /robots.txt {' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' allow all;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' log_not_found off;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' access_log off;' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo ' }' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
echo '}' >> /etc/nginx/sites-available/${GIT_DOMAIN_NAME}
function_check configure_php
configure_php
function_check create_site_certificate
create_site_certificate $GIT_DOMAIN_NAME 'yes'
create_site_certificate ${GIT_DOMAIN_NAME} 'yes'
nginx_ensite $GIT_DOMAIN_NAME
nginx_ensite ${GIT_DOMAIN_NAME}
if [ ! -d /var/lib/tor ]; then
echo $'No Tor installation found. Gogs onion site cannot be configured.'
@ -660,105 +633,105 @@ function install_gogs {
systemctl restart php5-fpm
systemctl restart nginx
if ! grep -q "Gogs onion domain" /home/$MY_USERNAME/README; then
echo "Gogs onion domain: ${GIT_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
chmod 600 /home/$MY_USERNAME/README
if ! grep -q "Gogs onion domain" /home/${MY_USERNAME}/README; then
echo "Gogs onion domain: ${GIT_ONION_HOSTNAME}" >> /home/${MY_USERNAME}/README
echo '' >> /home/${MY_USERNAME}/README
chown ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/README
chmod 600 /home/${MY_USERNAME}/README
fi
if ! grep -q "gogs onion domain" $COMPLETION_FILE; then
echo "gogs onion domain:${GIT_ONION_HOSTNAME}" >> $COMPLETION_FILE
if ! grep -q "gogs onion domain" ${COMPLETION_FILE}; then
echo "gogs onion domain:${GIT_ONION_HOSTNAME}" >> ${COMPLETION_FILE}
else
sed -i "s|gogs onion domain.*|gogs onion domain:${GIT_ONION_HOSTNAME}|g" $COMPLETION_FILE
sed -i "s|gogs onion domain.*|gogs onion domain:${GIT_ONION_HOSTNAME}|g" ${COMPLETION_FILE}
fi
function_check add_ddns_domain
add_ddns_domain $GIT_DOMAIN_NAME
add_ddns_domain ${GIT_DOMAIN_NAME}
# obtain the secret key
GOGS_SECRET_KEY=
if grep -q "Gogs secret key:" /home/$MY_USERNAME/README; then
GOGS_SECRET_KEY=$(cat /home/$MY_USERNAME/README | grep "Gogs secret key:" | awk -F ':' '{print $2}' | sed 's/^ *//')
if grep -q "Gogs secret key:" /home/${MY_USERNAME}/README; then
GOGS_SECRET_KEY=$(cat /home/${MY_USERNAME}/README | grep "Gogs secret key:" | awk -F ':' '{print $2}' | sed 's/^ *//')
else
GOGS_SECRET_KEY="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
echo "Gogs secret key:$GOGS_SECRET_KEY" >> /home/$MY_USERNAME/README
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
echo "Gogs secret key:${GOGS_SECRET_KEY}" >> /home/${MY_USERNAME}/README
chown $MY_USERNAME:$MY_USERNAME /home/${MY_USERNAME}/README
fi
# create the configuration
GOGS_CONFIG_PATH=/home/$GOGS_USERNAME/custom/conf
if [ ! -d $GOGS_CONFIG_PATH ]; then
mkdir -p $GOGS_CONFIG_PATH
GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
if [ ! -d ${GOGS_CONFIG_PATH} ]; then
mkdir -p ${GOGS_CONFIG_PATH}
fi
GOGS_CONFIG_FILE=$GOGS_CONFIG_PATH/app.ini
echo "RUN_USER = $GOGS_USERNAME" > $GOGS_CONFIG_FILE
echo 'RUN_MODE = prod' >> $GOGS_CONFIG_FILE
echo '' >> $GOGS_CONFIG_FILE
echo '[database]' >> $GOGS_CONFIG_FILE
echo 'DB_TYPE = mysql' >> $GOGS_CONFIG_FILE
echo 'HOST = 127.0.0.1:3306' >> $GOGS_CONFIG_FILE
echo 'NAME = gogs' >> $GOGS_CONFIG_FILE
echo 'USER = root' >> $GOGS_CONFIG_FILE
echo "PASSWD = $MARIADB_PASSWORD" >> $GOGS_CONFIG_FILE
echo 'SSL_MODE = disable' >> $GOGS_CONFIG_FILE
echo 'PATH = data/gogs.db' >> $GOGS_CONFIG_FILE
echo '' >> $GOGS_CONFIG_FILE
echo '[repository]' >> $GOGS_CONFIG_FILE
echo "ROOT = /home/$GOGS_USERNAME/gogs-repositories" >> $GOGS_CONFIG_FILE
echo '' >> $GOGS_CONFIG_FILE
echo '[server]' >> $GOGS_CONFIG_FILE
if [[ $ONION_ONLY == 'no' ]]; then
echo "DOMAIN = ${GIT_DOMAIN_NAME}" >> $GOGS_CONFIG_FILE
GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
echo "RUN_USER = $GOGS_USERNAME" > ${GOGS_CONFIG_FILE}
echo 'RUN_MODE = prod' >> ${GOGS_CONFIG_FILE}
echo '' >> ${GOGS_CONFIG_FILE}
echo '[database]' >> ${GOGS_CONFIG_FILE}
echo 'DB_TYPE = mysql' >> ${GOGS_CONFIG_FILE}
echo 'HOST = 127.0.0.1:3306' >> ${GOGS_CONFIG_FILE}
echo 'NAME = gogs' >> ${GOGS_CONFIG_FILE}
echo 'USER = root' >> ${GOGS_CONFIG_FILE}
echo "PASSWD = $MARIADB_PASSWORD" >> ${GOGS_CONFIG_FILE}
echo 'SSL_MODE = disable' >> ${GOGS_CONFIG_FILE}
echo 'PATH = data/gogs.db' >> ${GOGS_CONFIG_FILE}
echo '' >> ${GOGS_CONFIG_FILE}
echo '[repository]' >> ${GOGS_CONFIG_FILE}
echo "ROOT = /home/$GOGS_USERNAME/gogs-repositories" >> ${GOGS_CONFIG_FILE}
echo '' >> ${GOGS_CONFIG_FILE}
echo '[server]' >> ${GOGS_CONFIG_FILE}
if [[ ${ONION_ONLY} == 'no' ]]; then
echo "DOMAIN = ${GIT_DOMAIN_NAME}" >> ${GOGS_CONFIG_FILE}
else
echo "DOMAIN = ${GIT_ONION_HOSTNAME}" >> $GOGS_CONFIG_FILE
echo "DOMAIN = ${GIT_ONION_HOSTNAME}" >> ${GOGS_CONFIG_FILE}
fi
echo 'HTTP_PORT = 3000' >> $GOGS_CONFIG_FILE
echo "ROOT_URL = http://$GIT_DOMAIN_NAME/" >> $GOGS_CONFIG_FILE
echo "SSH_PORT = $SSH_PORT" >> $GOGS_CONFIG_FILE
echo 'SSH_DOMAIN = %(DOMAIN)s' >> $GOGS_CONFIG_FILE
echo "CERT_FILE = /etc/ssl/certs/${GIT_DOMAIN_NAME}.pem" >> $GOGS_CONFIG_FILE
echo "KEY_FILE = /etc/ssl/private/${GIT_DOMAIN_NAME}.key" >> $GOGS_CONFIG_FILE
echo 'DISABLE_ROUTER_LOG = true' >> $GOGS_CONFIG_FILE
echo '' >> $GOGS_CONFIG_FILE
echo '[session]' >> $GOGS_CONFIG_FILE
echo 'PROVIDER = file' >> $GOGS_CONFIG_FILE
echo '' >> $GOGS_CONFIG_FILE
echo '[log]' >> $GOGS_CONFIG_FILE
echo 'MODE = file' >> $GOGS_CONFIG_FILE
echo 'LEVEL = Info' >> $GOGS_CONFIG_FILE
echo '' >> $GOGS_CONFIG_FILE
echo '[security]' >> $GOGS_CONFIG_FILE
echo 'INSTALL_LOCK = true' >> $GOGS_CONFIG_FILE
echo "SECRET_KEY = $GOGS_SECRET_KEY" >> $GOGS_CONFIG_FILE
echo '' >> $GOGS_CONFIG_FILE
echo '[service]' >> $GOGS_CONFIG_FILE
echo 'DISABLE_REGISTRATION = false' >> $GOGS_CONFIG_FILE
echo 'SHOW_REGISTRATION_BUTTON = true' >> $GOGS_CONFIG_FILE
echo 'REQUIRE_SIGNIN_VIEW = false' >> $GOGS_CONFIG_FILE
echo 'ENABLE_CAPTCHA = false' >> $GOGS_CONFIG_FILE
echo '' >> $GOGS_CONFIG_FILE
echo '[other]' >> $GOGS_CONFIG_FILE
echo 'SHOW_FOOTER_BRANDING = false' >> $GOGS_CONFIG_FILE
echo 'SHOW_FOOTER_VERSION = false' >> $GOGS_CONFIG_FILE
echo 'HTTP_PORT = 3000' >> ${GOGS_CONFIG_FILE}
echo "ROOT_URL = http://$GIT_DOMAIN_NAME/" >> ${GOGS_CONFIG_FILE}
echo "SSH_PORT = $SSH_PORT" >> ${GOGS_CONFIG_FILE}
echo 'SSH_DOMAIN = %(DOMAIN)s' >> ${GOGS_CONFIG_FILE}
echo "CERT_FILE = /etc/ssl/certs/${GIT_DOMAIN_NAME}.pem" >> ${GOGS_CONFIG_FILE}
echo "KEY_FILE = /etc/ssl/private/${GIT_DOMAIN_NAME}.key" >> ${GOGS_CONFIG_FILE}
echo 'DISABLE_ROUTER_LOG = true' >> ${GOGS_CONFIG_FILE}
echo '' >> ${GOGS_CONFIG_FILE}
echo '[session]' >> ${GOGS_CONFIG_FILE}
echo 'PROVIDER = file' >> ${GOGS_CONFIG_FILE}
echo '' >> ${GOGS_CONFIG_FILE}
echo '[log]' >> ${GOGS_CONFIG_FILE}
echo 'MODE = file' >> ${GOGS_CONFIG_FILE}
echo 'LEVEL = Info' >> ${GOGS_CONFIG_FILE}
echo '' >> ${GOGS_CONFIG_FILE}
echo '[security]' >> ${GOGS_CONFIG_FILE}
echo 'INSTALL_LOCK = true' >> ${GOGS_CONFIG_FILE}
echo "SECRET_KEY = $GOGS_SECRET_KEY" >> ${GOGS_CONFIG_FILE}
echo '' >> ${GOGS_CONFIG_FILE}
echo '[service]' >> ${GOGS_CONFIG_FILE}
echo 'DISABLE_REGISTRATION = false' >> ${GOGS_CONFIG_FILE}
echo 'SHOW_REGISTRATION_BUTTON = true' >> ${GOGS_CONFIG_FILE}
echo 'REQUIRE_SIGNIN_VIEW = false' >> ${GOGS_CONFIG_FILE}
echo 'ENABLE_CAPTCHA = false' >> ${GOGS_CONFIG_FILE}
echo '' >> ${GOGS_CONFIG_FILE}
echo '[other]' >> ${GOGS_CONFIG_FILE}
echo 'SHOW_FOOTER_BRANDING = false' >> ${GOGS_CONFIG_FILE}
echo 'SHOW_FOOTER_VERSION = false' >> ${GOGS_CONFIG_FILE}
chmod 750 $GOGS_CONFIG_FILE
chown -R $GOGS_USERNAME:$GOGS_USERNAME /home/$GOGS_USERNAME
chmod 750 ${GOGS_CONFIG_FILE}
chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
systemctl restart gogs
if ! grep -q "gogs domain:" $COMPLETION_FILE; then
echo "gogs domain:$GIT_DOMAIN_NAME" >> $COMPLETION_FILE
if ! grep -q "gogs domain:" ${COMPLETION_FILE}; then
echo "gogs domain:${GIT_DOMAIN_NAME}" >> ${COMPLETION_FILE}
else
sed -i "s|gogs domain.*|gogs domain:$GIT_DOMAIN_NAME|g" $COMPLETION_FILE
sed -i "s|gogs domain.*|gogs domain:${GIT_DOMAIN_NAME}|g" ${COMPLETION_FILE}
fi
function_check configure_firewall_for_git
configure_firewall_for_git
if ! grep -q "gogs version:" $COMPLETION_FILE; then
echo "gogs version:$GOGS_VERSION" >> $COMPLETION_FILE
if ! grep -q "gogs version:" ${COMPLETION_FILE}; then
echo "gogs version:${GOGS_VERSION}" >> ${COMPLETION_FILE}
else
sed -i "s|gogs version.*|gogs version:$GOGS_VERSION|g" $COMPLETION_FILE
sed -i "s|gogs version.*|gogs version:${GOGS_VERSION}|g" ${COMPLETION_FILE}
fi
}

View File

@ -40,6 +40,16 @@ HUBZILLA_ADMIN_PASSWORD=
HUBZILLA_COMMIT='8aee932525d0bc341713fe7052e2a5ab318a69c0'
HUBZILLA_ADDONS_COMMIT='4456f097e3faf2adeab696ad08e3f213e82199bd'
hubzilla_variables=(ONION_ONLY
HUBZILLA_DOMAIN_NAME
HUBZILLA_CODE
DDNS_PROVIDER
MY_USERNAME
HUBZILLA_REPO
HUBZILLA_COMMIT
HUBZILLA_ADDONS_REPO
HUBZILLA_ADDONS_COMMIT)
function hubzilla_renew_cert {
dialog --title $"Renew SSL certificate" \
--backtitle $"Freedombone Control Panel" \
@ -126,21 +136,6 @@ function configure_interactive_hubzilla {
}
function install_interactive_hubzilla {
if [ ! $ONION_ONLY ]; then
ONION_ONLY='no'
fi
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE; then
HUBZILLA_DOMAIN_NAME=$(grep "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "HUBZILLA_CODE" $CONFIGURATION_FILE; then
HUBZILLA_CODE=$(grep "HUBZILLA_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if [[ $ONION_ONLY != "no" ]]; then
HUBZILLA_DOMAIN_NAME='hubzilla.local'
else
@ -250,10 +245,6 @@ function reconfigure_hubzilla {
}
function upgrade_hubzilla {
if grep -q "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE; then
HUBZILLA_DOMAIN_NAME=$(grep "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
HUBZILLA_PATH=/var/www/$HUBZILLA_DOMAIN_NAME/htdocs
function_check set_repo_commit
@ -269,28 +260,16 @@ function upgrade_hubzilla {
}
function backup_local_hubzilla {
if grep -q "hubzilla domain" $COMPLETION_FILE; then
HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "hubzilla domain" | awk -F ':' '{print $2}')
hubzilla_path=/var/www/${HUBZILLA_DOMAIN_NAME}/htdocs
if [ -d $hubzilla_path ]; then
echo $"Backing up Hubzilla"
function_check backup_database_to_usb
backup_database_to_usb hubzilla
backup_directory_to_usb $hubzilla_path hubzilla
echo $"Hubzilla backup complete"
fi
fi
}
function restore_local_hubzilla {
if ! grep -q "hubzilla domain" $COMPLETION_FILE; then
return
fi
HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "hubzilla domain" | awk -F ':' '{print $2}')
if [ $HUBZILLA_DOMAIN_NAME ]; then
echo $"Restoring Hubzilla"
temp_restore_dir=/root/temphubzilla
hubzilla_dir=/var/www/${HUBZILLA_DOMAIN_NAME}/htdocs
@ -308,13 +287,9 @@ function restore_local_hubzilla {
rm -rf $temp_restore_dir
fi
fi
echo $"Restore of Hubzilla complete"
fi
}
function backup_remote_hubzilla {
if grep -q "hubzilla domain" $COMPLETION_FILE; then
HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "hubzilla domain" | awk -F ':' '{print $2}')
temp_backup_dir=/var/www/${HUBZILLA_DOMAIN_NAME}/htdocs
if [ -d $temp_backup_dir ]; then
suspend_site ${HUBZILLA_DOMAIN_NAME}
@ -327,13 +302,9 @@ function backup_remote_hubzilla {
echo $"Hubzilla domain specified but not found in /var/www/${HUBZILLA_DOMAIN_NAME}"
exit 2578
fi
fi
}
function restore_remote_hubzilla {
if grep -q "hubzilla domain" $COMPLETION_FILE; then
echo $"Restoring Hubzilla"
HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "hubzilla domain" | awk -F ':' '{print $2}')
function_check restore_database_from_friend
function_check hubzilla_create_database
@ -350,8 +321,6 @@ function restore_remote_hubzilla {
if [ -d /root/temphubzilla ]; then
rm -rf /root/temphubzilla
fi
echo $"Restore of Hubzilla complete"
fi
}
function remove_hubzilla {
@ -359,7 +328,6 @@ function remove_hubzilla {
return
fi
echo $'Removing Hubzilla'
HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "hubzilla domain" | awk -F ':' '{print $2}')
nginx_dissite $HUBZILLA_DOMAIN_NAME
if [ -d /var/www/$HUBZILLA_DOMAIN_NAME ]; then
rm -rf /var/www/$HUBZILLA_DOMAIN_NAME
@ -376,22 +344,6 @@ function remove_hubzilla {
}
function install_hubzilla {
if [ ! $ONION_ONLY ]; then
ONION_ONLY='no'
fi
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE; then
HUBZILLA_DOMAIN_NAME=$(grep "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "HUBZILLA_CODE" $CONFIGURATION_FILE; then
HUBZILLA_CODE=$(grep "HUBZILLA_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if [ ! $HUBZILLA_DOMAIN_NAME ]; then
return
fi

View File

@ -41,6 +41,11 @@ IPFS_JS_RONIN_VERSION='0.3.11'
IPFS_KEY_LENGTH=2048
IPFS_GO_VERSION=0.4.2
ipfs_variables=(IPFS_COMMIT
IPFS_GO_VERSION
IPFS_KEY_LENGTH
IPFS_PORT)
function install_interactive_ipfs {
echo -n ''
}

View File

@ -36,14 +36,22 @@ IRC_ONION_PORT=6697
# An optional password to log into IRC. This applies to all users
IRC_PASSWORD=
irc_variables=(MY_USERNAME
MY_NAME
IRC_PORT
IRC_PASSWORD
DEFAULT_DOMAIN_NAME
INSTALLED_WITHIN_DOCKER
ONION_ONLY)
function remove_user_irc {
remove_username="$1"
if [ -d /home/$remove_username/.irssi ]; then
rm -rf /home/$remove_username/.irssi
if [ -d /home/${remove_username}/.irssi ]; then
rm -rf /home/${remove_username}/.irssi
fi
if [ -d /home/$remove_username/irclogs ]; then
rm -rf /home/$remove_username/irclogs
if [ -d /home/${remove_username}/irclogs ]; then
rm -rf /home/${remove_username}/irclogs
fi
}
@ -51,74 +59,71 @@ function add_user_irc {
new_username="$1"
new_user_password="$2"
if grep -q "IRC_PORT" $CONFIGURATION_FILE; then
IRC_PORT=$(grep "IRC_PORT" $CONFIGURATION_FILE | head -n 1 | awk -F '=' '{print $2}')
fi
IRC_PASSWORD=$(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}')
if [ ${#IRC_PASSWORD} -lt 2 ]; then
IRC_PASSWORD=
fi
if [ ! -d /home/$new_username/.irssi ]; then
mkdir /home/$new_username/.irssi
if [ ! -d /home/${new_username}/.irssi ]; then
mkdir /home/${new_username}/.irssi
fi
echo 'servers = (' > /home/$new_username/.irssi/config
echo ' {' >> /home/$new_username/.irssi/config
echo ' address = "chat.freenode.net";' >> /home/$new_username/.irssi/config
echo ' chatnet = "Freenode";' >> /home/$new_username/.irssi/config
echo ' port = "6667";' >> /home/$new_username/.irssi/config
echo ' autoconnect = "no";' >> /home/$new_username/.irssi/config
echo ' },' >> /home/$new_username/.irssi/config
echo ' {' >> /home/$new_username/.irssi/config
echo ' address = "irc.oftc.net";' >> /home/$new_username/.irssi/config
echo ' chatnet = "OFTC";' >> /home/$new_username/.irssi/config
echo ' port = "6667";' >> /home/$new_username/.irssi/config
echo ' autoconnect = "yes";' >> /home/$new_username/.irssi/config
echo ' },' >> /home/$new_username/.irssi/config
echo ' {' >> /home/$new_username/.irssi/config
echo " address = \"${HOSTNAME}\";" >> /home/$new_username/.irssi/config
echo ' chatnet = "Freedombone";' >> /home/$new_username/.irssi/config
echo " port = \"${IRC_PORT}\";" >> /home/$new_username/.irssi/config
echo ' use_ssl = "yes";' >> /home/$new_username/.irssi/config
echo ' ssl_verify = "no";' >> /home/$new_username/.irssi/config
echo ' autoconnect = "yes";' >> /home/$new_username/.irssi/config
echo 'servers = (' > /home/${new_username}/.irssi/config
echo ' {' >> /home/${new_username}/.irssi/config
echo ' address = "chat.freenode.net";' >> /home/${new_username}/.irssi/config
echo ' chatnet = "Freenode";' >> /home/${new_username}/.irssi/config
echo ' port = "6667";' >> /home/${new_username}/.irssi/config
echo ' autoconnect = "no";' >> /home/${new_username}/.irssi/config
echo ' },' >> /home/${new_username}/.irssi/config
echo ' {' >> /home/${new_username}/.irssi/config
echo ' address = "irc.oftc.net";' >> /home/${new_username}/.irssi/config
echo ' chatnet = "OFTC";' >> /home/${new_username}/.irssi/config
echo ' port = "6667";' >> /home/${new_username}/.irssi/config
echo ' autoconnect = "yes";' >> /home/${new_username}/.irssi/config
echo ' },' >> /home/${new_username}/.irssi/config
echo ' {' >> /home/${new_username}/.irssi/config
echo " address = \"${HOSTNAME}\";" >> /home/${new_username}/.irssi/config
echo ' chatnet = "Freedombone";' >> /home/${new_username}/.irssi/config
echo " port = \"${IRC_PORT}\";" >> /home/${new_username}/.irssi/config
echo ' use_ssl = "yes";' >> /home/${new_username}/.irssi/config
echo ' ssl_verify = "no";' >> /home/${new_username}/.irssi/config
echo ' autoconnect = "yes";' >> /home/${new_username}/.irssi/config
echo ' }' >> /home/$new_username/.irssi/config
echo ');' >> /home/$new_username/.irssi/config
echo '' >> /home/$new_username/.irssi/config
echo 'chatnets = {' >> /home/$new_username/.irssi/config
echo ' Freedombone = {' >> /home/$new_username/.irssi/config
echo ' type = "IRC";' >> /home/$new_username/.irssi/config
echo ' max_kicks = "1";' >> /home/$new_username/.irssi/config
echo ' max_msgs = "4";' >> /home/$new_username/.irssi/config
echo ' max_whois = "1";' >> /home/$new_username/.irssi/config
echo ' }' >> /home/${new_username}/.irssi/config
echo ');' >> /home/${new_username}/.irssi/config
echo '' >> /home/${new_username}/.irssi/config
echo 'chatnets = {' >> /home/${new_username}/.irssi/config
echo ' Freedombone = {' >> /home/${new_username}/.irssi/config
echo ' type = "IRC";' >> /home/${new_username}/.irssi/config
echo ' max_kicks = "1";' >> /home/${new_username}/.irssi/config
echo ' max_msgs = "4";' >> /home/${new_username}/.irssi/config
echo ' max_whois = "1";' >> /home/${new_username}/.irssi/config
echo ' };' >> /home/${new_username}/.irssi/config
echo ' Freenode = {' >> /home/${new_username}/.irssi/config
echo ' type = "IRC";' >> /home/${new_username}/.irssi/config
echo ' max_kicks = "1";' >> /home/${new_username}/.irssi/config
echo ' max_msgs = "4";' >> /home/${new_username}/.irssi/config
echo ' max_whois = "1";' >> /home/${new_username}/.irssi/config
echo ' };' >> /home/${new_username}/.irssi/config
echo ' OFTC = {' >> /home/${new_username}/.irssi/config
echo ' type = "IRC";' >> /home/${new_username}/.irssi/config
echo ' max_kicks = "1";' >> /home/${new_username}/.irssi/config
echo ' max_msgs = "1";' >> /home/${new_username}/.irssi/config
echo ' max_whois = "1";' >> /home/${new_username}/.irssi/config
echo ' };' >> /home/${new_username}/.irssi/config
echo '};' >> /home/${new_username}/.irssi/config
echo '' >> /home/${new_username}/.irssi/config
echo 'channels = (' >> /home/${new_username}/.irssi/config
echo ' { name = "#freedombone"; chatnet = "Freedombone"; autojoin = "Yes"; },' >> /home/${new_username}/.irssi/config
echo ');' >> /home/${new_username}/.irssi/config
echo '' >> /home/${new_username}/.irssi/config
echo 'settings = {' >> /home/${new_username}/.irssi/config
echo " core = { real_name = \"$MY_NAME\"; user_name = \"$new_username\"; nick = \"$new_username\"; };" >> /home/${new_username}/.irssi/config
echo ' "fe-text" = { actlist_sort = "refnum"; };' >> /home/${new_username}/.irssi/config
echo '};' >> /home/$new_username/.irssi/config
echo ' Freenode = {' >> /home/$new_username/.irssi/config
echo ' type = "IRC";' >> /home/$new_username/.irssi/config
echo ' max_kicks = "1";' >> /home/$new_username/.irssi/config
echo ' max_msgs = "4";' >> /home/$new_username/.irssi/config
echo ' max_whois = "1";' >> /home/$new_username/.irssi/config
echo ' };' >> /home/$new_username/.irssi/config
echo ' OFTC = {' >> /home/$new_username/.irssi/config
echo ' type = "IRC";' >> /home/$new_username/.irssi/config
echo ' max_kicks = "1";' >> /home/$new_username/.irssi/config
echo ' max_msgs = "1";' >> /home/$new_username/.irssi/config
echo ' max_whois = "1";' >> /home/$new_username/.irssi/config
echo ' };' >> /home/$new_username/.irssi/config
echo '};' >> /home/$new_username/.irssi/config
echo '' >> /home/$new_username/.irssi/config
echo 'channels = (' >> /home/$new_username/.irssi/config
echo ' { name = "#freedombone"; chatnet = "Freedombone"; autojoin = "Yes"; },' >> /home/$new_username/.irssi/config
echo ');' >> /home/$new_username/.irssi/config
echo '' >> /home/$new_username/.irssi/config
echo 'settings = {' >> /home/$new_username/.irssi/config
echo " core = { real_name = \"$MY_NAME\"; user_name = \"$new_username\"; nick = \"$new_username\"; };" >> /home/$new_username/.irssi/config
echo ' "fe-text" = { actlist_sort = "refnum"; };' >> /home/$new_username/.irssi/config
echo '};' >> /home/$new_username/.irssi/config
echo 'ignores = ( { level = "CTCPS"; } );' >> /home/$new_username/.irssi/config
echo 'ignores = ( { level = "CTCPS"; } );' >> /home/${new_username}/.irssi/config
chown -R $new_username:$new_username /home/$new_username/.irssi
chown -R ${new_username}:${new_username} /home/${new_username}/.irssi
echo '0'
}
@ -149,9 +154,9 @@ function irc_set_global_password {
for d in /home/*/ ; do
IRC_USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $(is_valid_user "$IRC_USERNAME") == "1" ]]; then
if [ -f /home/$IRC_USERNAME/.irssi/config ]; then
sed -i "s|$EXISTING_IRC_PASSWORD|$NEW_IRC_PASSWORD|g" /home/$IRC_USERNAME/.irssi/config
chown -R $IRC_USERNAME:$IRC_USERNAME /home/$IRC_USERNAME/.irssi
if [ -f /home/${IRC_USERNAME}/.irssi/config ]; then
sed -i "s|$EXISTING_IRC_PASSWORD|$NEW_IRC_PASSWORD|g" /home/${IRC_USERNAME}/.irssi/config
chown -R ${IRC_USERNAME}:${IRC_USERNAME} /home/${IRC_USERNAME}/.irssi
fi
fi
done
@ -238,38 +243,38 @@ function remove_irc {
if [ -d /etc/ngircd ]; then
rm -rf /etc/ngircd
fi
iptables -D INPUT -p tcp --dport $IRC_PORT -j ACCEPT
iptables -D INPUT -p tcp --dport 1024:65535 --sport $IRC_PORT -j ACCEPT
iptables -D INPUT -p tcp --dport ${IRC_PORT} -j ACCEPT
iptables -D INPUT -p tcp --dport 1024:65535 --sport ${IRC_PORT} -j ACCEPT
function_check save_firewall_settings
save_firewall_settings
function_check remove_onion_service
remove_onion_service irc ${IRC_ONION_PORT}
sed -i '/install_irc/d' $COMPLETION_FILE
sed -i '/IRC /d' $COMPLETION_FILE
sed -i '/configure_firewall_for_irc/d' $COMPLETION_FILE
sed -i '/install_irc/d' ${COMPLETION_FILE}
sed -i '/IRC /d' ${COMPLETION_FILE}
sed -i '/configure_firewall_for_irc/d' ${COMPLETION_FILE}
}
function configure_firewall_for_irc {
if [ ! -d /etc/ngircd ]; then
return
fi
if grep -Fxq "configure_firewall_for_irc" $COMPLETION_FILE; then
if grep -Fxq "configure_firewall_for_irc" ${COMPLETION_FILE}; then
return
fi
if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
if [[ ${INSTALLED_WITHIN_DOCKER} == "yes" ]]; then
# docker does its own firewalling
return
fi
if [[ $ONION_ONLY != "no" ]]; then
if [[ ${ONION_ONLY} != "no" ]]; then
return
fi
iptables -A INPUT -p tcp --dport $IRC_PORT -j ACCEPT
iptables -I INPUT -p tcp --dport 1024:65535 --sport $IRC_PORT -j ACCEPT
iptables -A INPUT -p tcp --dport ${IRC_PORT} -j ACCEPT
iptables -I INPUT -p tcp --dport 1024:65535 --sport ${IRC_PORT} -j ACCEPT
function_check save_firewall_settings
save_firewall_settings
OPEN_PORTS+=("IRC $IRC_PORT")
echo 'configure_firewall_for_irc' >> $COMPLETION_FILE
echo 'configure_firewall_for_irc' >> ${COMPLETION_FILE}
}
function install_irc_server {
@ -284,18 +289,18 @@ function install_irc_server {
fi
if [ ! -f /etc/ssl/certs/ngircd.dhparam ]; then
${PROJECT_NAME}-addcert -h ngircd --dhkey $DH_KEYLENGTH
${PROJECT_NAME}-addcert -h ngircd --dhkey ${DH_KEYLENGTH}
function_check check_certificates
check_certificates ngircd
fi
DEFAULTDOMAIN=$DEFAULT_DOMAIN_NAME
if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
DEFAULTDOMAIN=${DEFAULT_DOMAIN_NAME}
if [[ ${SYSTEM_TYPE} == "$VARIANT_MESH" ]]; then
DEFAULTDOMAIN="${DEFAULT_DOMAIN_NAME}.local"
fi
# create a login password if needed
if [ ! $IRC_PASSWORD ]; then
if [ ! ${IRC_PASSWORD} ]; then
IRC_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
fi
@ -312,15 +317,15 @@ function install_irc_server {
sed -i 's|;CertFile = /etc/ssl/certs/server.crt|CertFile = /etc/ssl/certs/ngircd.crt|g' /etc/ngircd/ngircd.conf
sed -i 's|;DHFile = /etc/ngircd/dhparams.pem|DHFile = /etc/ssl/certs/ngircd.dhparam|g' /etc/ngircd/ngircd.conf
sed -i 's|;KeyFile = /etc/ssl/private/server.key|KeyFile = /etc/ssl/private/ngircd.key|g' /etc/ngircd/ngircd.conf
sed -i "s/;Ports =.*/Ports = $IRC_PORT/1" /etc/ngircd/ngircd.conf
sed -i "s/;Ports =.*/Ports = $IRC_PORT/2" /etc/ngircd/ngircd.conf
sed -i "s/;Ports =.*/Ports = ${IRC_PORT}/1" /etc/ngircd/ngircd.conf
sed -i "s/;Ports =.*/Ports = ${IRC_PORT}/2" /etc/ngircd/ngircd.conf
sed -i "s/;Name = #ngircd/Name = #${PROJECT_NAME}/g" /etc/ngircd/ngircd.conf
sed -i "s/;Topic = Our ngircd testing channel/Topic = ${PROJECT_NAME} chat channel/g" /etc/ngircd/ngircd.conf
sed -i 's/;MaxUsers = 23/MaxUsers = 23/g' /etc/ngircd/ngircd.conf
sed -i "s|;KeyFile = /etc/ngircd/#chan.key|KeyFile = /etc/ngircd/#${PROJECT_NAME}.key|g" /etc/ngircd/ngircd.conf
sed -i "s/;CloakHost = cloaked.host/CloakHost = ${PROJECT_NAME}/g" /etc/ngircd/ngircd.conf
IRC_SALT="$(create_password 30)"
if [ -f $IMAGE_PASSWORD_FILE ]; then
if [ -f ${IMAGE_PASSWORD_FILE} ]; then
IRC_OPERATOR_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
else
IRC_OPERATOR_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
@ -332,11 +337,11 @@ function install_irc_server {
sed -i "s/;Name = TheOper/Name = $MY_USERNAME/g" /etc/ngircd/ngircd.conf
sed -i "s/;Password = ThePwd/Password = $IRC_OPERATOR_PASSWORD/g" /etc/ngircd/ngircd.conf
sed -i 's|;Listen =.*|Listen = 0.0.0.0,0.0.0.0:9050,127.0.0.1,127.0.0.1:9050|g' /etc/ngircd/ngircd.conf
if [ $IRC_PASSWORD ]; then
if [ ${IRC_PASSWORD} ]; then
sed -i "0,/RE/s/Password =.*/Password =$IRC_PASSWORD/" /etc/ngircd/ngircd.conf
fi
# If we are on a mesh then DNS is not available
if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
if [[ ${SYSTEM_TYPE} == "$VARIANT_MESH" ]]; then
sed -i "s/;DNS =.*/DNS = no/g" /etc/ngircd/ngircd.conf
fi
# upgrade a cypher
@ -353,30 +358,30 @@ function install_irc_server {
add_watchdog_daemon ngircd
if ! grep -q $"IRC Server" /home/$MY_USERNAME/README; then
echo '' >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
echo $'IRC Server' >> /home/$MY_USERNAME/README
echo '==========' >> /home/$MY_USERNAME/README
echo $'To connect to your IRC server in irssi:' >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
if [[ $ONION_ONLY != 'yes' ]]; then
echo " irssi" >> /home/$MY_USERNAME/README
echo " /server add -auto -ssl $DEFAULTDOMAIN $IRC_PORT" >> /home/$MY_USERNAME/README
echo " /connect $DEFAULT_DOMAIN_NAME" >> /home/$MY_USERNAME/README
if ! grep -q $"IRC Server" /home/${MY_USERNAME}/README; then
echo '' >> /home/${MY_USERNAME}/README
echo '' >> /home/${MY_USERNAME}/README
echo $'IRC Server' >> /home/${MY_USERNAME}/README
echo '==========' >> /home/${MY_USERNAME}/README
echo $'To connect to your IRC server in irssi:' >> /home/${MY_USERNAME}/README
echo '' >> /home/${MY_USERNAME}/README
if [[ ${ONION_ONLY} != 'yes' ]]; then
echo " irssi" >> /home/${MY_USERNAME}/README
echo " /server add -auto -ssl $DEFAULTDOMAIN $IRC_PORT" >> /home/${MY_USERNAME}/README
echo " /connect $DEFAULT_DOMAIN_NAME" >> /home/${MY_USERNAME}/README
else
echo " usetorwith irssi" >> /home/$MY_USERNAME/README
echo " /server add -auto $IRC_ONION_HOSTNAME $IRC_PORT" >> /home/$MY_USERNAME/README
echo " /connect $IRC_ONION_HOSTNAME" >> /home/$MY_USERNAME/README
echo " usetorwith irssi" >> /home/${MY_USERNAME}/README
echo " /server add -auto $IRC_ONION_HOSTNAME $IRC_PORT" >> /home/${MY_USERNAME}/README
echo " /connect $IRC_ONION_HOSTNAME" >> /home/${MY_USERNAME}/README
fi
echo " /join #${PROJECT_NAME}" >> /home/$MY_USERNAME/README
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
chmod 600 /home/$MY_USERNAME/README
echo " /join #${PROJECT_NAME}" >> /home/${MY_USERNAME}/README
chown ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/README
chmod 600 /home/${MY_USERNAME}/README
fi
function_check configure_firewall_for_irc
configure_firewall_for_irc
echo 'install_irc_server' >> $COMPLETION_FILE
install_completed irc_server
}
function install_irc_client {
@ -385,76 +390,76 @@ function install_irc_client {
fi
apt-get -y install irssi
if [ ! -d /home/$MY_USERNAME/.irssi ]; then
mkdir /home/$MY_USERNAME/.irssi
if [ ! -d /home/${MY_USERNAME}/.irssi ]; then
mkdir /home/${MY_USERNAME}/.irssi
fi
echo 'servers = (' > /home/$MY_USERNAME/.irssi/config
echo ' {' >> /home/$MY_USERNAME/.irssi/config
echo ' address = "chat.freenode.net";' >> /home/$MY_USERNAME/.irssi/config
echo ' chatnet = "Freenode";' >> /home/$MY_USERNAME/.irssi/config
echo ' port = "6667";' >> /home/$MY_USERNAME/.irssi/config
echo ' autoconnect = "no";' >> /home/$MY_USERNAME/.irssi/config
echo ' },' >> /home/$MY_USERNAME/.irssi/config
echo ' {' >> /home/$MY_USERNAME/.irssi/config
echo ' address = "irc.oftc.net";' >> /home/$MY_USERNAME/.irssi/config
echo ' chatnet = "OFTC";' >> /home/$MY_USERNAME/.irssi/config
echo ' port = "6667";' >> /home/$MY_USERNAME/.irssi/config
echo ' autoconnect = "yes";' >> /home/$MY_USERNAME/.irssi/config
echo ' },' >> /home/$MY_USERNAME/.irssi/config
echo ' {' >> /home/$MY_USERNAME/.irssi/config
echo " address = \"127.0.0.1\";" >> /home/$MY_USERNAME/.irssi/config
if [[ $ONION_ONLY == 'no' ]]; then
echo " port = \"${IRC_PORT}\";" >> /home/$MY_USERNAME/.irssi/config
echo ' use_ssl = "yes";' >> /home/$MY_USERNAME/.irssi/config
echo 'servers = (' > /home/${MY_USERNAME}/.irssi/config
echo ' {' >> /home/${MY_USERNAME}/.irssi/config
echo ' address = "chat.freenode.net";' >> /home/${MY_USERNAME}/.irssi/config
echo ' chatnet = "Freenode";' >> /home/${MY_USERNAME}/.irssi/config
echo ' port = "6667";' >> /home/${MY_USERNAME}/.irssi/config
echo ' autoconnect = "no";' >> /home/${MY_USERNAME}/.irssi/config
echo ' },' >> /home/${MY_USERNAME}/.irssi/config
echo ' {' >> /home/${MY_USERNAME}/.irssi/config
echo ' address = "irc.oftc.net";' >> /home/${MY_USERNAME}/.irssi/config
echo ' chatnet = "OFTC";' >> /home/${MY_USERNAME}/.irssi/config
echo ' port = "6667";' >> /home/${MY_USERNAME}/.irssi/config
echo ' autoconnect = "yes";' >> /home/${MY_USERNAME}/.irssi/config
echo ' },' >> /home/${MY_USERNAME}/.irssi/config
echo ' {' >> /home/${MY_USERNAME}/.irssi/config
echo " address = \"127.0.0.1\";" >> /home/${MY_USERNAME}/.irssi/config
if [[ ${ONION_ONLY} == 'no' ]]; then
echo " port = \"${IRC_PORT}\";" >> /home/${MY_USERNAME}/.irssi/config
echo ' use_ssl = "yes";' >> /home/${MY_USERNAME}/.irssi/config
else
IRC_ONION_HOSTNAME=$(cat $COMPLETION_FILE | grep "irc onion domain" | awk -F ':' '{print $2}')
echo " port = \"${IRC_ONION_PORT}\";" >> /home/$MY_USERNAME/.irssi/config
echo ' use_ssl = "no";' >> /home/$MY_USERNAME/.irssi/config
IRC_ONION_HOSTNAME=$(cat ${COMPLETION_FILE} | grep "irc onion domain" | awk -F ':' '{print $2}')
echo " port = \"${IRC_ONION_PORT}\";" >> /home/${MY_USERNAME}/.irssi/config
echo ' use_ssl = "no";' >> /home/${MY_USERNAME}/.irssi/config
fi
echo ' chatnet = "Freedombone";' >> /home/$MY_USERNAME/.irssi/config
echo ' ssl_verify = "no";' >> /home/$MY_USERNAME/.irssi/config
echo ' autoconnect = "yes";' >> /home/$MY_USERNAME/.irssi/config
if [ $IRC_PASSWORD ]; then
echo " password = \"${IRC_PASSWORD}\";" >> /home/$MY_USERNAME/.irssi/config
echo ' chatnet = "Freedombone";' >> /home/${MY_USERNAME}/.irssi/config
echo ' ssl_verify = "no";' >> /home/${MY_USERNAME}/.irssi/config
echo ' autoconnect = "yes";' >> /home/${MY_USERNAME}/.irssi/config
if [ ${IRC_PASSWORD} ]; then
echo " password = \"${IRC_PASSWORD}\";" >> /home/${MY_USERNAME}/.irssi/config
fi
echo ' }' >> /home/$MY_USERNAME/.irssi/config
echo ');' >> /home/$MY_USERNAME/.irssi/config
echo '' >> /home/$MY_USERNAME/.irssi/config
echo 'chatnets = {' >> /home/$MY_USERNAME/.irssi/config
echo ' Freedombone = {' >> /home/$MY_USERNAME/.irssi/config
echo ' type = "IRC";' >> /home/$MY_USERNAME/.irssi/config
echo ' max_kicks = "1";' >> /home/$MY_USERNAME/.irssi/config
echo ' max_msgs = "4";' >> /home/$MY_USERNAME/.irssi/config
echo ' max_whois = "1";' >> /home/$MY_USERNAME/.irssi/config
echo ' };' >> /home/$MY_USERNAME/.irssi/config
echo ' Freenode = {' >> /home/$MY_USERNAME/.irssi/config
echo ' type = "IRC";' >> /home/$MY_USERNAME/.irssi/config
echo ' max_kicks = "1";' >> /home/$MY_USERNAME/.irssi/config
echo ' max_msgs = "4";' >> /home/$MY_USERNAME/.irssi/config
echo ' max_whois = "1";' >> /home/$MY_USERNAME/.irssi/config
echo ' };' >> /home/$MY_USERNAME/.irssi/config
echo ' OFTC = {' >> /home/$MY_USERNAME/.irssi/config
echo ' type = "IRC";' >> /home/$MY_USERNAME/.irssi/config
echo ' max_kicks = "1";' >> /home/$MY_USERNAME/.irssi/config
echo ' max_msgs = "1";' >> /home/$MY_USERNAME/.irssi/config
echo ' max_whois = "1";' >> /home/$MY_USERNAME/.irssi/config
echo ' };' >> /home/$MY_USERNAME/.irssi/config
echo '};' >> /home/$MY_USERNAME/.irssi/config
echo '' >> /home/$MY_USERNAME/.irssi/config
echo 'channels = (' >> /home/$MY_USERNAME/.irssi/config
echo ' { name = "#freedombone"; chatnet = "Freedombone"; autojoin = "Yes"; },' >> /home/$MY_USERNAME/.irssi/config
echo ');' >> /home/$MY_USERNAME/.irssi/config
echo '' >> /home/$MY_USERNAME/.irssi/config
echo 'settings = {' >> /home/$MY_USERNAME/.irssi/config
echo " core = { real_name = \"$MY_NAME\"; user_name = \"$MY_USERNAME\"; nick = \"$MY_USERNAME\"; };" >> /home/$MY_USERNAME/.irssi/config
echo ' "fe-text" = { actlist_sort = "refnum"; };' >> /home/$MY_USERNAME/.irssi/config
echo '};' >> /home/$MY_USERNAME/.irssi/config
echo 'ignores = ( { level = "CTCPS"; } );' >> /home/$MY_USERNAME/.irssi/config
echo ' }' >> /home/${MY_USERNAME}/.irssi/config
echo ');' >> /home/${MY_USERNAME}/.irssi/config
echo '' >> /home/${MY_USERNAME}/.irssi/config
echo 'chatnets = {' >> /home/${MY_USERNAME}/.irssi/config
echo ' Freedombone = {' >> /home/${MY_USERNAME}/.irssi/config
echo ' type = "IRC";' >> /home/${MY_USERNAME}/.irssi/config
echo ' max_kicks = "1";' >> /home/${MY_USERNAME}/.irssi/config
echo ' max_msgs = "4";' >> /home/${MY_USERNAME}/.irssi/config
echo ' max_whois = "1";' >> /home/${MY_USERNAME}/.irssi/config
echo ' };' >> /home/${MY_USERNAME}/.irssi/config
echo ' Freenode = {' >> /home/${MY_USERNAME}/.irssi/config
echo ' type = "IRC";' >> /home/${MY_USERNAME}/.irssi/config
echo ' max_kicks = "1";' >> /home/${MY_USERNAME}/.irssi/config
echo ' max_msgs = "4";' >> /home/${MY_USERNAME}/.irssi/config
echo ' max_whois = "1";' >> /home/${MY_USERNAME}/.irssi/config
echo ' };' >> /home/${MY_USERNAME}/.irssi/config
echo ' OFTC = {' >> /home/${MY_USERNAME}/.irssi/config
echo ' type = "IRC";' >> /home/${MY_USERNAME}/.irssi/config
echo ' max_kicks = "1";' >> /home/${MY_USERNAME}/.irssi/config
echo ' max_msgs = "1";' >> /home/${MY_USERNAME}/.irssi/config
echo ' max_whois = "1";' >> /home/${MY_USERNAME}/.irssi/config
echo ' };' >> /home/${MY_USERNAME}/.irssi/config
echo '};' >> /home/${MY_USERNAME}/.irssi/config
echo '' >> /home/${MY_USERNAME}/.irssi/config
echo 'channels = (' >> /home/${MY_USERNAME}/.irssi/config
echo ' { name = "#freedombone"; chatnet = "Freedombone"; autojoin = "Yes"; },' >> /home/${MY_USERNAME}/.irssi/config
echo ');' >> /home/${MY_USERNAME}/.irssi/config
echo '' >> /home/${MY_USERNAME}/.irssi/config
echo 'settings = {' >> /home/${MY_USERNAME}/.irssi/config
echo " core = { real_name = \"$MY_NAME\"; user_name = \"$MY_USERNAME\"; nick = \"$MY_USERNAME\"; };" >> /home/${MY_USERNAME}/.irssi/config
echo ' "fe-text" = { actlist_sort = "refnum"; };' >> /home/${MY_USERNAME}/.irssi/config
echo '};' >> /home/${MY_USERNAME}/.irssi/config
echo 'ignores = ( { level = "CTCPS"; } );' >> /home/${MY_USERNAME}/.irssi/config
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.irssi
chown -R ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/.irssi
echo 'install_irc_client' >> $COMPLETION_FILE
install_completed irc_client
}
function install_irc {

View File

@ -37,6 +37,12 @@ LIBREVAULT_REPO="https://github.com/Librevault/librevault"
LIBREVAULT_COMMIT='86a6aefcb5cc458f4d42195368fbcff2871f98e3'
LIBREVAULT_PORT=42345
librevault_variables=(PROTOBUF_REPO
PROTOBUF_COMMIT
LIBREVAULT_REPO
LIBREVAULT_COMMIT
LIBREVAULT_PORT)
function install_interactive_librevault {
echo -n ''
}

View File

@ -37,22 +37,14 @@ MEDIAGOBLIN_COMMIT='d1ac2d52fd8859c3f32fa38e4836ffe9615e5bba'
MEDIAGOBLIN_ADMIN_PASSWORD=
MEDIAGOBLIN_ONION_PORT=8096
mediagoblin_variables=(ONION_ONLY
MEDIAGOBLIN_DOMAIN_NAME
MEDIAGOBLIN_CODE
MEDIAGOBLIN_REPO
MEDIAGOBLIN_COMMIT
DDNS_PROVIDER)
function install_interactive_mediagoblin {
if [ ! $ONION_ONLY ]; then
ONION_ONLY='no'
fi
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "MEDIAGOBLIN_DOMAIN_NAME" $CONFIGURATION_FILE; then
MEDIAGOBLIN_DOMAIN_NAME=$(grep "MEDIAGOBLIN_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "MEDIAGOBLIN_CODE" $CONFIGURATION_FILE; then
MEDIAGOBLIN_CODE=$(grep "MEDIAGOBLIN_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if [[ $ONION_ONLY != "no" ]]; then
MEDIAGOBLIN_DOMAIN_NAME='media.local'
else
@ -128,22 +120,6 @@ function reconfigure_mediagoblin {
}
function upgrade_mediagoblin {
if [ ! $ONION_ONLY ]; then
ONION_ONLY='no'
fi
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "MEDIAGOBLIN_DOMAIN_NAME" $CONFIGURATION_FILE; then
MEDIAGOBLIN_DOMAIN_NAME=$(grep "MEDIAGOBLIN_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "MEDIAGOBLIN_CODE" $CONFIGURATION_FILE; then
MEDIAGOBLIN_CODE=$(grep "MEDIAGOBLIN_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if [ ! $MEDIAGOBLIN_DOMAIN_NAME ]; then
return
fi
@ -167,8 +143,6 @@ function restore_local_mediagoblin {
}
function backup_remote_mediagoblin {
if grep -q "Mediagoblin domain" $COMPLETION_FILE; then
MEDIAGOBLIN_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Mediagoblin domain" | awk -F ':' '{print $2}')
function_check suspend_site
suspend_site ${MEDIAGOBLIN_DOMAIN_NAME}
@ -180,12 +154,9 @@ function backup_remote_mediagoblin {
restart_site
echo $"Backup of Mediagoblin complete"
fi
}
function restore_remote_mediagoblin {
if grep -q "Mediagoblin domain" $COMPLETION_FILE; then
MEDIAGOBLIN_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Mediagoblin domain" | awk -F ':' '{print $2}')
if [ -d $SERVER_DIRECTORY/backup/mediagoblin ]; then
echo $"Restoring Mediagoblin installation"
temp_restore_dir=/root/tempmediagoblin
@ -199,7 +170,6 @@ function restore_remote_mediagoblin {
echo $"Restore of Mediagoblin complete"
fi
chown -hR mediagoblin:www-data /var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs
fi
}
function remove_mediagoblin {
@ -207,22 +177,6 @@ function remove_mediagoblin {
}
function install_mediagoblin {
if [ ! $ONION_ONLY ]; then
ONION_ONLY='no'
fi
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "MEDIAGOBLIN_DOMAIN_NAME" $CONFIGURATION_FILE; then
MEDIAGOBLIN_DOMAIN_NAME=$(grep "MEDIAGOBLIN_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "MEDIAGOBLIN_CODE" $CONFIGURATION_FILE; then
MEDIAGOBLIN_CODE=$(grep "MEDIAGOBLIN_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if [ ! $MEDIAGOBLIN_DOMAIN_NAME ]; then
return
fi

View File

@ -39,6 +39,12 @@ MUMBLE_PORT=64738
MUMBLE_DATABASE="mumble-server.sqlite"
MUMBLE_CONFIG_FILE="mumble-server.ini"
mumble_variables=(MY_USERNAME
MUMBLE_PORT
MUMBLE_SERVER_PASSWORD
ONION_ONLY
ADMIN_USERNAME)
function install_interactive_mumble {
echo -n ''
}

View File

@ -42,6 +42,15 @@ RSS_READER_PATH=/etc/share/tt-rss
RSS_READER_GNUSOCIAL_REPO="https://github.com/bashrc/ttrss-gnusocial"
RSS_READER_GNUSOCIAL_COMMIT='20b2535e3f2b0ddc0117b584bdcaa6bf7a2d9fa2'
rss_variables=(RSS_READER_REPO
RSS_MOBILE_READER_REPO
RSS_READER_COMMIT
RSS_MOBILE_READER_COMMIT
RSS_READER_ADMIN_PASSWORD
RSS_READER_DOMAIN_NAME
USB_MOUNT
MY_USERNAME)
function install_interactive_rss {
echo -n ''
}
@ -81,14 +90,14 @@ function reconfigure_rss {
}
function upgrade_rss {
if grep -Fxq "install_rss" $COMPLETION_FILE; then
if [[ $(app_is_installed rss) == "1" ]]; then
function_check set_repo_commit
set_repo_commit $RSS_READER_PATH "rss reader commit" "$RSS_READER_COMMIT" $RSS_READER_REPO
function_check rss_modifications
rss_modifications
fi
if grep -Fxq "install_rss_mobile_reader" $COMPLETION_FILE; then
if [[ $(app_is_installed rss_mobile_reader) == "1" ]]; then
if [ ! $RSS_READER_PATH ]; then
RSS_READER_PATH=/etc/share/tt-rss
fi
@ -116,12 +125,6 @@ function upgrade_rss {
}
function backup_local_rss {
RSS_READER_DOMAIN_NAME='ttrss'
if grep -q "rss reader domain" $COMPLETION_FILE; then
RSS_READER_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "rss reader domain" | awk -F ':' '{print $2}')
fi
if grep -q "rss reader domain" $COMPLETION_FILE; then
if [ -d /etc/share/tt-rss ]; then
RSS_READER_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "rss reader domain" | awk -F ':' '{print $2}')
@ -134,16 +137,9 @@ function backup_local_rss {
echo $"ttrss backup complete"
fi
fi
}
function restore_local_rss {
if ! grep -q "rss reader domain" $COMPLETION_FILE; then
return
fi
RSS_READER_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "rss reader domain" | awk -F ':' '{print $2}')
if [ $RSS_READER_DOMAIN_NAME ]; then
echo $"Restoring ttrss"
temp_restore_dir=/root/tempttrss
function_check rss_create_database
@ -184,13 +180,9 @@ function restore_local_rss {
rm -rf $temp_restore_dir
fi
fi
echo $"Restore of ttrss complete"
fi
}
function backup_remote_rss {
if grep -q "rss reader domain" $COMPLETION_FILE; then
RSS_READER_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "rss reader domain" | awk -F ':' '{print $2}')
if [ -d /etc/share/tt-rss ]; then
function_check suspend_site
suspend_site ${RSS_READER_DOMAIN_NAME}
@ -208,13 +200,11 @@ function backup_remote_rss {
else
echo $"RSS reader domain specified but not found in /etc/share/ttrss}"
fi
fi
}
function restore_remote_rss {
if grep -q "rss reader domain" $COMPLETION_FILE; then
echo $"Restoring ttrss"
RSS_READER_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "rss reader domain" | awk -F ':' '{print $2}')
function_check restore_database_from_friend
function_check rss_create_database
@ -256,9 +246,6 @@ function remove_rss {
if [[ $(app_is_installed rss) == "0" ]]; then
return
fi
if grep -q "RSS_READER_DOMAIN_NAME" $CONFIGURATION_FILE; then
RSS_READER_DOMAIN_NAME=$(grep "RSS_READER_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
nginx_dissite $RSS_READER_DOMAIN_NAME
function_check remove_onion_service
remove_onion_service ttrss ${RSS_READER_ONION_PORT} ${RSS_MOBILE_READER_ONION_PORT}
@ -292,10 +279,6 @@ function rss_modifications {
}
function install_rss_main {
if grep -Fxq "install_rss_main" $COMPLETION_FILE; then
return
fi
apt-get -y install php-gettext php5-curl php5-gd php5-mysql git
apt-get -y install curl php-xml-parser php5-mcrypt
@ -520,7 +503,7 @@ function install_rss_main {
chmod 600 /home/$MY_USERNAME/README
fi
echo 'install_rss_main' >> $COMPLETION_FILE
install_completed rss_main
}
function install_rss_gnusocial {
@ -560,8 +543,7 @@ function install_rss_gnusocial {
echo "rss reader gnusocial commit:$RSS_READER_GNUSOCIAL_COMMIT" >> $COMPLETION_FILE
fi
chown -R www-data:www-data $RSS_READER_GNUSOCIAL_PATH
echo 'install_rss_gnusocial' >> $COMPLETION_FILE
install_completed rss_gnusocial
}
function install_rss_mobile_reader {
@ -612,8 +594,7 @@ function install_rss_mobile_reader {
chown -R www-data:www-data $RSS_MOBILE_READER_PATH
chown -R www-data:www-data $RSS_READER_PATH
chmod a+x $RSS_MOBILE_READER_PATH
echo 'install_rss_mobile_reader' >> $COMPLETION_FILE
install_completed rss_mobile_reader
}
function install_rss {

View File

@ -38,6 +38,13 @@ SEARX_ONION_HOSTNAME=
SEARX_LOGIN_TEXT=$"Search engine login"
SEARX_PASSWORD=
searx_variables=(SEARX_REPO
SEARX_COMMIT
SEARX_PATH
SEARX_LOGIN_TEXT
MY_USERNAME
SYSTEM_TYPE)
function install_interactive_searx {
echo -n ''
}

View File

@ -33,10 +33,20 @@ VARIANTS='full chat'
SIP_SERVER_PASSWORD=
SIP_PORT=5060
SIP_TLS_PORT=5061
TURN_PORT=3478
TURN_TLS_PORT=5349
TURN_NONCE=
sip_variables=(ONION_ONLY
MY_USERNAME
SIP_PORT
SIP_TLS_PORT
SIP_SERVER_PASSWORD
TURN_PORT
TURN_TLS_PORT
TURN_NONCE)
function remove_user_sip {
remove_username="$1"
${PROJECT_NAME}-rmsipuser ${remove_username}
@ -147,9 +157,11 @@ function remove_sip {
if [[ $(app_is_installed sip) == "0" ]]; then
return
fi
iptables -D INPUT -p udp --dport $TURN_PORT -j ACCEPT
iptables -D INPUT -p tcp --dport $TURN_PORT -j ACCEPT
iptables -D INPUT -p tcp --dport $TURN_TLS_PORT -j ACCEPT
iptables -D INPUT -p udp --dport $SIP_PORT -j ACCEPT
iptables -D INPUT -p tcp --dport $SIP_PORT -j ACCEPT
iptables -D INPUT -p udp --dport $SIP_TLS_PORT -j ACCEPT
@ -225,6 +237,7 @@ function update_sipwitch_daemon {
if [ ! -f /etc/init.d/sipwitch ]; then
return
fi
service sipwitch stop
# remove the original sipwitch daemon if it exists

View File

@ -39,6 +39,15 @@ SYNCTHING_PORT=22000
SYNCTHING_SHARED_DATA=/var/lib/syncthing/SyncShared
SYNCTHING_USER_IDS_FILE='.syncthingids'
syncthing_variables=(SYNCTHING_ID
SYNCTHING_CONFIG_PATH
SYNCTHING_CONFIG_FILE
SYNCTHING_RELAY_SERVER
SYNCTHING_RELEASES
SYNCTHING_PORT
SYNCTHING_SHARED_DATA
USB_MOUNT)
function syncthing_create_ids_file {
if [ ! -f ~/.syncthing-server-id ]; then
return
@ -472,6 +481,7 @@ function configure_firewall_for_syncthing {
if grep -Fxq "configure_firewall_for_syncthing" $COMPLETION_FILE; then
return
fi
iptables -A INPUT -p udp --dport $SYNCTHING_PORT -j ACCEPT
iptables -A INPUT -p tcp --dport $SYNCTHING_PORT -j ACCEPT
function_check save_firewall_settings

View File

@ -39,6 +39,10 @@ TAHOELAFS_STORAGE_SPACE=1G
TAHOELAFS_SHARED_DIR='Shared'
TAHOE_COMMAND="cd /var/lib/tahoelafs && venv/bin/tahoe"
tahoelafs_variables=(TAHOELAFS_REPO
TAHOELAFS_COMMIT
TAHOELAFS_PORT)
function install_interactive_tahoelafs {
echo -n ''
}

View File

@ -49,6 +49,16 @@ TOXIC_FILE=/usr/local/bin/toxic
QTOX_REPO="https://github.com/bashrc/qTox"
QTOX_COMMIT='27a628a3789fca4f31516c3982e580052dd3c773'
tox_variables=(SYSTEM_TYPE
TOXCORE_REPO
TOXCORE_COMMIT
TOXIC_COMMIT
MY_USERNAME
ONION_ONLY
INSTALLED_WITHIN_DOCKER
TOX_PORT
TOX_NODES)
function remove_user_tox {
remove_username="$1"

View File

@ -30,6 +30,8 @@
VARIANTS=''
vpn_variables=()
function install_interactive_vpn {
echo -n ''
}

View File

@ -38,6 +38,12 @@ WEBMAIL_ADMIN_PASSWORD=
WEB_PATH=/var/www
WEBMAIL_PATH=$WEB_PATH/webmail
webmail_variables=(WEBMAIL_REPO
WEBMAIL_COMMIT
MY_USERNAME
ONION_ONLY
DEFAULT_DOMAIN_NAME)
function install_interactive_webmail {
echo -n ''
}

View File

@ -36,26 +36,14 @@ WIKI_TITLE="${PROJECT_NAME} Wiki"
WIKI_CODE=
WIKI_ONION_PORT=8089
function install_interactive_wiki {
if [ ! $ONION_ONLY ]; then
ONION_ONLY='no'
fi
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "WIKI_TITLE" $CONFIGURATION_FILE; then
WIKI_TITLE=$(grep "WIKI_TITLE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "WIKI_DOMAIN_NAME" $CONFIGURATION_FILE; then
WIKI_DOMAIN_NAME=$(grep "WIKI_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "WIKI_CODE" $CONFIGURATION_FILE; then
WIKI_CODE=$(grep "WIKI_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
wiki_variables=(ONION_ONLY
MY_USERNAME
WIKI_TITLE
WIKI_DOMAIN_NAME
WIKI_CODE
DDNS_PROVIDER)
function install_interactive_wiki {
if [[ $ONION_ONLY != "no" ]]; then
WIKI_TITLE=$'My Wiki'
WIKI_DOMAIN_NAME='wiki.local'
@ -270,25 +258,6 @@ function get_wiki_admin_password {
}
function install_wiki {
if [ ! $ONION_ONLY ]; then
ONION_ONLY='no'
fi
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "WIKI_TITLE" $CONFIGURATION_FILE; then
WIKI_TITLE=$(grep "WIKI_TITLE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "WIKI_DOMAIN_NAME" $CONFIGURATION_FILE; then
WIKI_DOMAIN_NAME=$(grep "WIKI_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "WIKI_CODE" $CONFIGURATION_FILE; then
WIKI_CODE=$(grep "WIKI_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if [ ! $WIKI_DOMAIN_NAME ]; then
return
fi

View File

@ -37,6 +37,14 @@ XMPP_PASSWORD=
XMPP_CIPHERS='"EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA256:EECDH:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!IDEA:!ECDSA:kEDH:CAMELLIA128-SHA:AES128-SHA"'
XMPP_ECC_CURVE='"secp384r1"'
xmpp_variables=(ONION_ONLY
INSTALLED_WITHIN_DOCKER
XMPP_CIPHERS
XMPP_ECC_CURVE
XMPP_ECC_CURVE
MY_USERNAME
DEFAULT_DOMAIN_NAME)
function remove_user_xmpp {
remove_username="$1"
${PROJECT_NAME}-rmxmpp -e "${remove_username}@$HOSTNAME"

View File

@ -49,6 +49,16 @@ ZERONET_DEFAULT_MAIL_TAGLINE="Mail for the Mesh"
ZERONET_ID_REPO="https://github.com/HelloZeroNet/ZeroID"
ZERONET_ID_COMMIT='ccf14fdc96fa9cdb2ddd8a7ab283a8e17a4f234b'
zeronet_variables=(ZERONET_BLOG_COMMIT
ZERONET_MAIL_COMMIT
ZERONET_FORUM_COMMIT
TRACKER_PORT
ZERONET_PORT
MY_USERNAME
ZERONET_DEFAULT_BLOG_TAGLINE
ZERONET_DEFAULT_FORUM_TAGLINE
ZERONET_DEFAULT_MAIL_TAGLINE)
function install_interactive_zeronet {
echo -n ''
}

View File

@ -115,6 +115,7 @@ for app_name in "${APPS_INSTALLED_NAMES[@]}"
do
if [[ $(function_exists remove_user_${app_name}) == "1" ]]; then
echo $"Removing user from ${app_name}"
app_load_variables ${app_name}
remove_user_${app_name} "$MY_USERNAME"
fi
done

View File

@ -374,6 +374,7 @@ function backup_apps {
for app_name in "${APPS_INSTALLED_NAMES[@]}"
do
echo $"Backup ${app_name}"
app_load_variables ${app_name}
function_check backup_${localremote}_${app_name}
backup_${localremote}_${app_name}
BACKUP_APPS_COMPLETED+=("${app_name}")
@ -392,6 +393,7 @@ function restore_apps {
for app_name in "${APPS_INSTALLED_NAMES[@]}"
do
echo $"Restoring ${app_name}"
app_load_variables ${app_name}
function_check restore_${localremote}_${app_name}
restore_${localremote}_${app_name}
RESTORE_APPS_COMPLETED+=("${app_name}")

View File

@ -105,9 +105,10 @@ read_config_param "GPG_ENCRYPT_STORED_EMAIL"
read_config_param "MAX_PHP_MEMORY"
read_config_param "TLS_TIME_SOURCE1"
read_config_param "TLS_TIME_SOURCE2"
read_config_param "WEBMAIL_REPO"
read_config_param "WEBMAIL_COMMIT"
read_config_param "ONION_ONLY"
read_config_param "DEFAULT_LANGUAGE"
read_config_param "MINIMAL_INSTALL"
read_config_param "LETSENCRYPT_SERVER"
read_config_param "WIFI_INTERFACE"
read_config_param "WIFI_SSID"
@ -116,68 +117,15 @@ read_config_param "GPG_ENCRYPT_STORED_EMAIL"
read_config_param "WIFI_HOTSPOT"
read_config_param "WIFI_NETWORKS_FILE"
read_config_param "SYNCTHING_ID"
read_config_param "SYNCTHING_CONFIG_PATH"
read_config_param "SYNCTHING_CONFIG_FILE"
read_config_param "SYNCTHING_RELAY_SERVER"
read_config_param "SYNCTHING_RELEASES"
read_config_param "SYNCTHING_PORT"
read_config_param "SYNCTHING_SHARED_DATA"
read_config_param "TURN_PORT"
read_config_param "TURN_TLS_PORT"
read_config_param "TURN_NONCE"
read_config_param "DEFAULT_SEARCH"
read_config_param "SEARCH_ENGINE_PASSWORD"
read_config_param "XMPP_PASSWORD"
read_config_param "RSS_READER_REPO"
read_config_param "RSS_MOBILE_READER_REPO"
read_config_param "RSS_READER_COMMIT"
read_config_param "RSS_MOBILE_READER_COMMIT"
read_config_param "RSS_READER_ADMIN_PASSWORD"
read_config_param "RSS_READER_DOMAIN_NAME"
read_config_param "PROJECT_WEBSITE"
read_config_param "PROJECT_REPO"
read_config_param "ONION_ONLY"
read_config_param "DEFAULT_LANGUAGE"
read_config_param "MINIMAL_INSTALL"
read_config_param "LETSENCRYPT_SERVER"
read_config_param "FULLBLOG_REPO"
read_config_param "FULLBLOG_COMMIT"
read_config_param "IRC_PORT"
read_config_param "IRC_PASSWORD"
read_config_param "GOGS_COMMIT"
read_config_param "GIT_ADMIN_PASSWORD"
read_config_param "GIT_DOMAIN_NAME"
read_config_param "GIT_CODE"
read_config_param "TOXCORE_COMMIT"
read_config_param "TOXIC_COMMIT"
read_config_param "GPGIT_REPO"
read_config_param "GPGIT_COMMIT"
read_config_param "HUBZILLA_REPO"
read_config_param "HUBZILLA_COMMIT"
read_config_param "HUBZILLA_DOMAIN_NAME"
read_config_param "HUBZILLA_CODE"
read_config_param "IPFS_COMMIT"
read_config_param "ZERONET_BLOG_COMMIT"
read_config_param "ZERONET_MAIL_COMMIT"
read_config_param "ZERONET_FORUM_COMMIT"
read_config_param "TRACKER_PORT"
read_config_param "ZERONET_PORT"
read_config_param "NGINX_ENSITE_REPO"
read_config_param "NGINX_ENSITE_REPO"
read_config_param "NGINX_ENSITE_COMMIT"
@ -185,59 +133,21 @@ read_config_param "GPG_ENCRYPT_STORED_EMAIL"
read_config_param "CLEANUP_MAILDIR_COMMIT"
read_config_param "CLEANUP_MAILDIR_REPO"
read_config_param "ZERONET_COMMIT"
read_config_param "INADYN_REPO"
read_config_param "INADYN_COMMIT"
read_config_param "IPFS_PORT"
read_config_param "DH_KEYLENGTH"
read_config_param "WIFI_CHANNEL"
read_config_param "BATMAN_CELLID"
read_config_param "TOX_PORT"
read_config_param "TOX_NODES"
read_config_param "TOXCORE_REPO"
read_config_param "IPV6_NETWORK"
read_config_param "HWRNG_TYPE"
read_config_param "MEDIAGOBLIN_DOMAIN_NAME"
read_config_param "MEDIAGOBLIN_CODE"
read_config_param "MEDIAGOBLIN_REPO"
read_config_param "MEDIAGOBLIN_COMMIT"
read_config_param "XMPP_CIPHERS"
read_config_param "XMPP_ECC_CURVE"
read_config_param "MUMBLE_PORT"
read_config_param "MUMBLE_SERVER_PASSWORD"
read_config_param "SIP_PORT"
read_config_param "SIP_TLS_PORT"
read_config_param "SIP_SERVER_PASSWORD"
read_config_param "ENABLE_BABEL"
read_config_param "ENABLE_BATMAN"
read_config_param "ENABLE_CJDNS"
read_config_param "CJDNS_COMMIT"
read_config_param "CJDNS_IPV6"
read_config_param "CJDNS_PUBLIC_KEY"
read_config_param "CJDNS_PRIVATE_KEY"
read_config_param "WIKI_TITLE"
read_config_param "WIKI_DOMAIN_NAME"
read_config_param "WIKI_CODE"
read_config_param "PUBLIC_MAILING_LIST"
read_config_param "FULLBLOG_DOMAIN_NAME"
read_config_param "FULLBLOG_CODE"
read_config_param "MY_BLOG_TITLE"
read_config_param "MY_BLOG_SUBTITLE"
if grep -q "DEBIAN_REPO" $CONFIGURATION_FILE; then
DEBIAN_REPO=$(grep "DEBIAN_REPO" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
CHECK_MESSAGE=$"Check your internet connection, /etc/network/interfaces and /etc/resolv.conf, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."

View File

@ -43,6 +43,36 @@ APPS_INSTALLED_NAMES=()
# file containing a list of removed apps
REMOVED_APPS_FILE=/root/removed
# Loads variables defined at the beginning of an app script
function app_load_variables {
app_name=$1
var_name=${app_name}_variables
if [ ! $var_name ]; then
return
fi
for v in "${$var_name[@]}"
do
read_config_param $v
done
}
# Saves variables for a given app script
function app_save_variables {
app_name=$1
var_name=${app_name}_variables
if [ ! $var_name ]; then
return
fi
for v in "${$var_name[@]}"
do
save_config_param $v "$$v"
done
}
# gets the variants list from an app script
function app_variants {
filename=$1
@ -270,6 +300,7 @@ function remove_apps {
if [[ ${APPS_INSTALLED[$app_index]} == "1" ]]; then
if [[ ${APPS_CHOSEN[$app_index]} == "0" ]]; then
echo $"Removing application: ${a}"
app_load_variables ${a}
remove_app ${a}
remove_${a}
echo $"${a} was removed"
@ -310,6 +341,8 @@ function install_apps {
# clears any removal indicator
reinstall_app ${a}
app_load_variables ${a}
if [[ $(app_is_installed ${a}) == "1" ]]; then
echo $"Upgrading application from interactive: ${a}"
upgrade_${a}
@ -317,12 +350,14 @@ function install_apps {
else
echo $"Installing application from interactive: ${a}"
install_${a}
app_save_variables ${a}
install_completed ${a}
echo $"${a} was installed from interactive"
fi
else
# check if the app was removed
if [[ $(app_is_removed ${a}) == "0" ]]; then
app_load_variables ${a}
if [[ $(app_is_installed ${a}) == "1" ]]; then
echo $"Upgrading application: ${a}"
upgrade_${a}