Merge branch 'stretch' of https://github.com/bashrc/freedombone
This commit is contained in:
commit
79ddfdf178
|
@ -37,7 +37,7 @@ GNUSOCIAL_DOMAIN_NAME=
|
|||
GNUSOCIAL_CODE=
|
||||
GNUSOCIAL_ONION_PORT=8087
|
||||
GNUSOCIAL_REPO="https://git.gnu.io/gnu/gnu-social.git"
|
||||
GNUSOCIAL_COMMIT='d61375cb7fd9e3ac2dbba2b22d0d6461fb753892'
|
||||
GNUSOCIAL_COMMIT='d9fbc17f7745edb3e3eeddf6485f70b187df762f'
|
||||
GNUSOCIAL_ADMIN_PASSWORD=
|
||||
|
||||
GNUSOCIAL_BACKGROUND_IMAGE_URL=
|
||||
|
|
|
@ -34,7 +34,7 @@ IN_DEFAULT_INSTALL=0
|
|||
SHOW_ON_ABOUT=1
|
||||
|
||||
GOGS_USERNAME='gogs'
|
||||
GOGS_VERSION='0.11.4'
|
||||
GOGS_VERSION='0.11.29'
|
||||
|
||||
GIT_DOMAIN_NAME=
|
||||
GIT_CODE=
|
||||
|
@ -158,9 +158,17 @@ function upgrade_gogs {
|
|||
return
|
||||
fi
|
||||
|
||||
GOGS_CONFIG_FILE=/home/${GOGS_USERNAME}/custom/conf/app.ini
|
||||
GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
|
||||
GOGS_CONFIG_FILE=$GOGS_CONFIG_PATH/app.ini
|
||||
cp $GOGS_CONFIG_FILE $INSTALL_DIR/gogs_config.ini
|
||||
|
||||
if [ -d $INSTALL_DIR/gogs-repositories ]; then
|
||||
rm -rf $INSTALL_DIR/gogs-repositories
|
||||
fi
|
||||
if [ -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
|
||||
mv /home/${GOGS_USERNAME}/gogs-repositories $INSTALL_DIR
|
||||
fi
|
||||
|
||||
gogs_parameters
|
||||
echo "gogs binary upgrade: ${GOGS_BIN}"
|
||||
|
||||
|
@ -199,8 +207,23 @@ function upgrade_gogs {
|
|||
rm ${GOGS_FILE}
|
||||
fi
|
||||
|
||||
if [ ! -d ${GOGS_CONFIG_PATH} ]; then
|
||||
mkdir -p ${GOGS_CONFIG_PATH}
|
||||
fi
|
||||
|
||||
cp $INSTALL_DIR/gogs_config.ini $GOGS_CONFIG_FILE
|
||||
if [ ! -f $GOGS_CONFIG_FILE ]; then
|
||||
echo $'Gogs ini file not upgraded'
|
||||
exit 873535
|
||||
fi
|
||||
rm $INSTALL_DIR/gogs_config.ini
|
||||
if [ -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
|
||||
rm -rf /home/${GOGS_USERNAME}/gogs-repositories
|
||||
fi
|
||||
if [ -d $INSTALL_DIR/gogs-repositories ]; then
|
||||
mv $INSTALL_DIR/gogs-repositories /home/${GOGS_USERNAME}/gogs-repositories
|
||||
fi
|
||||
chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
|
||||
|
||||
sed -i "s|gogs version.*|gogs version:$GOGS_VERSION|g" ${COMPLETION_FILE}
|
||||
systemctl restart mariadb
|
||||
|
@ -233,26 +256,26 @@ function restore_local_gogs {
|
|||
if ! grep -q "gogs domain" ${COMPLETION_FILE}; then
|
||||
return
|
||||
fi
|
||||
if [ ! -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ${#GIT_DOMAIN_NAME} -gt 2 ]; then
|
||||
function_check gogs_create_database
|
||||
gogs_create_database
|
||||
|
||||
GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
|
||||
GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
|
||||
|
||||
function_check restore_database
|
||||
restore_database gogs ${GIT_DOMAIN_NAME}
|
||||
temp_restore_dir=/root/tempgogs
|
||||
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 $GOGS_CONFIG_PATH ]; then
|
||||
mkdir -p $GOGS_CONFIG_PATH
|
||||
fi
|
||||
if [ ! -d ${temp_restore_dir}/home/${GOGS_USERNAME}/custom ]; then
|
||||
cp -r ${temp_restore_dir}/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom
|
||||
if [ -d /root/tempgogs/home/${GOGS_USERNAME}/custom ]; then
|
||||
cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
|
||||
else
|
||||
cp -r ${temp_restore_dir}/* /home/${GOGS_USERNAME}/custom/
|
||||
cp -r /root/tempgogs/* /home/${GOGS_USERNAME}/custom/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check set_user_permissions
|
||||
|
@ -264,10 +287,13 @@ function restore_local_gogs {
|
|||
echo $"Restoring Gogs repos"
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb ${temp_restore_dir}repos gogsrepos
|
||||
if [ ! -d ${temp_restore_dir}repos/home/${GOGS_USERNAME}/gogs-repositories ]; then
|
||||
if [ ! -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
|
||||
mkdir /home/${GOGS_USERNAME}/gogs-repositories
|
||||
fi
|
||||
if [ -d ${temp_restore_dir}repos/home/${GOGS_USERNAME}/gogs-repositories ]; then
|
||||
cp -r ${temp_restore_dir}repos/home/${GOGS_USERNAME}/gogs-repositories/* /home/${GOGS_USERNAME}/gogs-repositories/
|
||||
else
|
||||
cp -r ${temp_restore_dir}/* /home/${GOGS_USERNAME}/gogs-repositories/
|
||||
cp -r ${temp_restore_dir}repos/* /home/${GOGS_USERNAME}/gogs-repositories/
|
||||
fi
|
||||
if [ ! "$?" = "0" ]; then
|
||||
function_check set_user_permissions
|
||||
|
@ -300,11 +326,10 @@ function restore_local_gogs {
|
|||
chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
|
||||
fi
|
||||
|
||||
GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
|
||||
GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
|
||||
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
|
||||
sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
|
||||
MARIADB_PASSWORD=
|
||||
systemctl restart gogs
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -344,11 +369,14 @@ function restore_remote_gogs {
|
|||
function_check gogs_create_database
|
||||
gogs_create_database
|
||||
|
||||
GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
|
||||
GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
|
||||
|
||||
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
|
||||
if [ ! -d $GOGS_CONFIG_PATH ]; then
|
||||
mkdir -p $GOGS_CONFIG_PATH
|
||||
fi
|
||||
if [ -d /root/tempgogs/home/${GOGS_USERNAME}/custom ]; then
|
||||
cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
|
||||
|
@ -360,6 +388,9 @@ function restore_remote_gogs {
|
|||
fi
|
||||
echo $"Restoring Gogs repos"
|
||||
restore_directory_from_friend /root/tempgogsrepos gogsrepos
|
||||
if [ ! -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
|
||||
mkdir /home/${GOGS_USERNAME}/gogs-repositories
|
||||
fi
|
||||
if [ -d /root/tempgogsrepos/home/${GOGS_USERNAME}/gogs-repositories ]; then
|
||||
cp -r /root/tempgogsrepos/home/${GOGS_USERNAME}/gogs-repositories/* /home/${GOGS_USERNAME}/gogs-repositories/
|
||||
else
|
||||
|
@ -388,11 +419,10 @@ function restore_remote_gogs {
|
|||
echo $"Restore of Gogs complete"
|
||||
fi
|
||||
|
||||
GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
|
||||
GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
|
||||
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
|
||||
sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
|
||||
MARIADB_PASSWORD=
|
||||
systemctl restart gogs
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -251,10 +251,10 @@ function upgrade_syncthing {
|
|||
}
|
||||
|
||||
function backup_local_syncthing {
|
||||
if [ -d /var/lib/syncthing/SyncShared ]; then
|
||||
if [ -d $SYNCTHING_SHARED_DATA ]; then
|
||||
function_check backup_directory_to_usb
|
||||
backup_directory_to_usb /var/lib/syncthing/SyncShared syncthingshared
|
||||
backup_directory_to_usb /root/.config/syncthing syncthingconfig
|
||||
backup_directory_to_usb $SYNCTHING_SHARED_DATA syncthingshared
|
||||
backup_directory_to_usb $SYNCTHING_CONFIG_PATH syncthingconfig
|
||||
fi
|
||||
|
||||
for d in /home/*/ ; do
|
||||
|
@ -294,10 +294,10 @@ function restore_local_syncthing {
|
|||
restore_directory_from_usb ${temp_restore_dir}config syncthingconfig
|
||||
#cp -r ${temp_restore_dir}config/* /
|
||||
|
||||
if [ ! -d /root/.config/syncthing ]; then
|
||||
mkdir -p /root/.config/syncthing
|
||||
if [ ! -d $SYNCTHING_CONFIG_PATH ]; then
|
||||
mkdir -p $SYNCTHING_CONFIG_PATH
|
||||
fi
|
||||
cp -r ${temp_restore_dir}config/* /root/.config/syncthing/
|
||||
cp -r ${temp_restore_dir}config/* $SYNCTHING_CONFIG_PATH/
|
||||
|
||||
if [ ! "$?" = "0" ]; then
|
||||
set_user_permissions
|
||||
|
@ -314,10 +314,10 @@ function restore_local_syncthing {
|
|||
restore_directory_from_usb ${temp_restore_dir}shared syncthingshared
|
||||
#cp -r ${temp_restore_dir}shared/* /
|
||||
|
||||
if [ ! -d /var/lib/syncthing/SyncShared ]; then
|
||||
mkdir -p /var/lib/syncthing/SyncShared
|
||||
if [ ! -d $SYNCTHING_SHARED_DATA ]; then
|
||||
mkdir -p $SYNCTHING_SHARED_DATA
|
||||
fi
|
||||
cp -r ${temp_restore_dir}shared/* /var/lib/syncthing/SyncShared/
|
||||
cp -r ${temp_restore_dir}shared/* $SYNCTHING_SHARED_DATA/
|
||||
|
||||
if [ ! "$?" = "0" ]; then
|
||||
set_user_permissions
|
||||
|
@ -373,16 +373,16 @@ function restore_local_syncthing {
|
|||
}
|
||||
|
||||
function backup_remote_syncthing {
|
||||
if [ -d /root/.config/syncthing ]; then
|
||||
if [ -d $SYNCTHING_CONFIG_PATH ]; then
|
||||
echo $"Backing up syncthing configuration"
|
||||
function_check backup_directory_to_friend
|
||||
backup_directory_to_friend /root/.config/syncthing syncthingconfig
|
||||
backup_directory_to_friend $SYNCTHING_CONFIG_PATH syncthingconfig
|
||||
echo $"Backup of syncthing configuration complete"
|
||||
fi
|
||||
if [ -d /var/lib/syncthing/SyncShared ]; then
|
||||
if [ -d $SYNCTHING_SHARED_DATA ]; then
|
||||
echo $"Backing up syncthing shared files"
|
||||
function_check backup_directory_to_friend
|
||||
backup_directory_to_friend /var/lib/syncthing/SyncShared syncthingshared
|
||||
backup_directory_to_friend $SYNCTHING_SHARED_DATA syncthingshared
|
||||
echo $"Backup of syncthing shared files complete"
|
||||
fi
|
||||
|
||||
|
@ -422,10 +422,10 @@ function restore_remote_syncthing {
|
|||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir syncthingconfig
|
||||
#cp -r $temp_restore_dir/* /
|
||||
if [ ! -d /root/.config/syncthing ]; then
|
||||
mkdir -p /root/.config/syncthing
|
||||
if [ ! -d $SYNCTHING_CONFIG_PATH ]; then
|
||||
mkdir -p $SYNCTHING_CONFIG_PATH
|
||||
fi
|
||||
cp -r ${temp_restore_dir}config/* /root/.config/syncthing/
|
||||
cp -r ${temp_restore_dir}config/* $SYNCTHING_CONFIG_PATH/
|
||||
if [ ! "$?" = "0" ]; then
|
||||
systemctl start syncthing
|
||||
systemctl start cron
|
||||
|
@ -440,10 +440,10 @@ function restore_remote_syncthing {
|
|||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir syncthingshared
|
||||
#cp -r $temp_restore_dir/* /
|
||||
if [ ! -d /var/lib/syncthing/SyncShared ]; then
|
||||
mkdir -p /var/lib/syncthing/SyncShared
|
||||
if [ ! -d $SYNCTHING_SHARED_DATA ]; then
|
||||
mkdir -p $SYNCTHING_SHARED_DATA
|
||||
fi
|
||||
cp -r ${temp_restore_dir}shared/* /var/lib/syncthing/SyncShared/
|
||||
cp -r ${temp_restore_dir}shared/* $SYNCTHING_SHARED_DATA/
|
||||
if [ ! "$?" = "0" ]; then
|
||||
systemctl start syncthing
|
||||
systemctl start cron
|
||||
|
|
|
@ -146,21 +146,6 @@ function install_tripwire {
|
|||
|
||||
' | twadmin --create-polfile -S /etc/tripwire/${HOSTNAME}-site.key /etc/tripwire/twpol.txt
|
||||
|
||||
# create the database
|
||||
echo '
|
||||
|
||||
' | tripwire --init --cfgfile /etc/tripwire/tw.cfg --polfile /etc/tripwire/tw.pol --dbfile /var/lib/tripwire/${HOSTNAME}.twd
|
||||
if [ ! -f /var/lib/tripwire/${HOSTNAME}.twd ]; then
|
||||
echo $'tripwire database was not created'
|
||||
exit 72925
|
||||
fi
|
||||
# recreate the configuration
|
||||
echo '
|
||||
|
||||
|
||||
|
||||
' | reset-tripwire
|
||||
|
||||
mark_completed $FUNCNAME
|
||||
}
|
||||
|
||||
|
|
|
@ -563,6 +563,9 @@ function gnusocial_block_user_script {
|
|||
echo "nickname=\$(echo \"\$remove_user\" | awk -F '@' '{print \$1}')" >> /usr/bin/gnusocial-delete-user
|
||||
echo "remove_domain=\$(echo \"\$remove_user\" | awk -F '@' '{print \$2}')" >> /usr/bin/gnusocial-delete-user
|
||||
echo '' >> /usr/bin/gnusocial-delete-user
|
||||
echo "database_query=\"delete from notice where content REGEXP '\@\${remove_user}';\"" >> /usr/bin/gnusocial-delete-user
|
||||
echo 'mysql -u root --password="$MARIADB_PASSWORD" -e "$database_query" $database_name' >> /usr/bin/gnusocial-delete-user
|
||||
echo '' >> /usr/bin/gnusocial-delete-user
|
||||
echo 'database_query="select profile.id from profile where nickname = '"'"'${nickname}'"'"' and profileurl like '"'"'%${remove_domain}%'"'"';"' >> /usr/bin/gnusocial-delete-user
|
||||
echo 'declare -a ids=$(mysql -u root --password="$MARIADB_PASSWORD" << EOF' >> /usr/bin/gnusocial-delete-user
|
||||
echo 'use $database_name;' >> /usr/bin/gnusocial-delete-user
|
||||
|
|
Loading…
Reference in New Issue