Initial commit. Updatedendrite ready for testing...
This commit is contained in:
commit
95f4122677
1 changed files with 71 additions and 0 deletions
71
updatedendrite.sh
Executable file
71
updatedendrite.sh
Executable file
|
@ -0,0 +1,71 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
## Update Dendrite with git running on alpinelinux
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
## Variables
|
||||||
|
#
|
||||||
|
|
||||||
|
# User running dendrite
|
||||||
|
dendriteuser=dendrite
|
||||||
|
|
||||||
|
# How to stop and start dendrite
|
||||||
|
stopdendrite="rc-service dendrite stop"
|
||||||
|
startdendrite="rc-service dendrite start"
|
||||||
|
|
||||||
|
# Installdir
|
||||||
|
installdir="/opt/dendrite"
|
||||||
|
|
||||||
|
# Workdir
|
||||||
|
workdir="/tmp"
|
||||||
|
|
||||||
|
# Backupdir
|
||||||
|
backupdir="/home/dendrite/backup"
|
||||||
|
|
||||||
|
# Delete old backups? "yes" or "no"
|
||||||
|
deletebackup="no"
|
||||||
|
|
||||||
|
#
|
||||||
|
## Main
|
||||||
|
#
|
||||||
|
|
||||||
|
# Set Starttime of script
|
||||||
|
starttime=`date +"%Y%m%d"`
|
||||||
|
echo "Starting update at $starttime"
|
||||||
|
|
||||||
|
# Stopping dendrite
|
||||||
|
$stopdendrite
|
||||||
|
|
||||||
|
# Delete old backups if not wanted
|
||||||
|
if [[ "$deletebackup" = "yes" ]]; then
|
||||||
|
rm -r $backupdir/dendrite-*
|
||||||
|
elif [[ "$deletebackup" = "no" ]]; then
|
||||||
|
echo "Will not delete old backups."
|
||||||
|
else
|
||||||
|
echo "Wrong argument $deletebackup. Please set *deletebackup* to *yes* or *no*"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Move old dendrite to backup
|
||||||
|
if [[ ! -d "$backupdir" ]]; then
|
||||||
|
echo "Since $backupdir doesn't exist - create it."
|
||||||
|
mkdir -p $backupdir
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir $backupdir/dendrite-$starttime/
|
||||||
|
mv $installdir/* $backupdir/dendrite-$starttime/
|
||||||
|
|
||||||
|
# Clone https://github.com/matrix-org/dendrite to $workdir
|
||||||
|
su $dendriteuser -s $SHELL -lc "git clone https://github.com/matrix-org/dendrite $workdir/dendrite"
|
||||||
|
|
||||||
|
# Compile dendrite
|
||||||
|
cd $workdir/dendrite
|
||||||
|
su $dendriteuser -s $SHELL -lc "go build -o /opt/dendrite/bin/ ./cmd/..."
|
||||||
|
|
||||||
|
# Starting dendrite
|
||||||
|
$startdendrite
|
||||||
|
|
||||||
|
# Finish
|
||||||
|
echo "New dendrite-version is running! Check if it is working: https://federationtester.matrix.org/"
|
Loading…
Reference in a new issue