5 Commits
1.1 ... sphp

Author SHA1 Message Date
136fe35261 syno-cron-gitea-update.sh
-ajout de messages
2020-07-06 09:58:16 +02:00
63a0876da1 mbv-gitea-upd.sh
-détection de l’emplacement de gitea
2020-07-05 14:17:22 +02:00
d50274266b gitea update
-syno-cron-gitea-update.sh: màj de gitea sur le NAS Synology
-mbv-gitea-upd.sh: màj de gitea sur le vps maboiteverte.fr
2020-07-05 09:27:09 +02:00
cc064cde2f backup-conf.sh
-modif dossier destination
2020-07-05 09:23:54 +02:00
9e10864aea mkbuild.sh
-ajout du serveur maboiteverte.fr
2020-07-05 09:22:32 +02:00
4 changed files with 147 additions and 4 deletions

View File

@@ -53,16 +53,19 @@ copy() {
if [[ -f $1 ]]; then cp $1 $2; fi
}
# Backup folder
dest=$HOME/Documents/Configurations/SilverBook
# Web: PHP / Apache / MySQL
dest_mamp=$dest/config\ web\ \(homebrew\)/
cd "$dest_mamp"
CURRENT_APACHE=$(httpd -v | grep "version" | awk '{print $3}' | awk -F/ '{print $2}')
CURRENT_PHP=$(php -v | grep "cli" | awk '{print $2}')
CURRENT_MYSQL=$(mysql -V | awk '{print $5}' | sed 's/.$//')
dest=$HOME/Documents/Configurations/SilverBook
dest_mamp=$dest/config\ web\ \(homebrew\)/
cd "$dest_mamp"
if [ ! -d "apache $CURRENT_APACHE" ]; then mkdir "apache $CURRENT_APACHE"; fi
cp /usr/local/etc/httpd/httpd.conf "$dest_mamp/apache $CURRENT_APACHE/"
cp /usr/local/etc/httpd/server.crt "$dest_mamp/apache $CURRENT_APACHE/"

65
mbv-gitea-upd.sh Executable file
View File

@@ -0,0 +1,65 @@
#!/bin/bash
echo "****************"
echo "* Update gitea *"
echo "****************"
GITEA_BIN=`which gitea`
if [ "$GITEA_BIN" == "*gitea*" ]; then
echo "Gitea is not installed..."
exit 0
fi
#GITEA_INSTALLED=`/usr/local/bin/gitea --version | cut -d \ -f 3`
GITEA_INSTALLED=`$GITEA_BIN --version | cut -d \ -f 3`
LATEST_URL=`curl -Ls -o /dev/null -w %{url_effective} https://github.com/go-gitea/gitea/releases/latest`
#https://github.com/go-gitea/gitea/releases/tag/v1.11.3
#echo LATEST_URL = ${LATEST_URL}
GITEA_VERSION=${LATEST_URL##*/v}
echo "Installed: "${GITEA_INSTALLED}
echo "Latest: "${GITEA_VERSION}
now=$(date +"%d-%m-%Y_%T")
server=$(hostname -s)
file=$server"@"$now
filename="Gitea_$file.sql"
#echo $filename
if [ "${GITEA_INSTALLED}" == "${GITEA_VERSION}" ]; then
echo "No update available..."
exit 0
else
a=$(echo -e "Do you wanna update gitea ? (y/n)")
read -p "$a" choice
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
echo "Download latest gitea..."
DOWNLOAD_URL=https://github.com/go-gitea/gitea/releases/download/v${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-amd64
echo ${DOWNLOAD_URL}
wget -O /tmp/gitea ${DOWNLOAD_URL}
#xz --decompress gitea-*.xz
echo "Stop gitea service..."
sudo systemctl stop gitea
echo "Backup gitea mysql database..."
sudo mysqldump -u root admin_gitea > /tmp/$filename
echo "Installing gitea..."
# -rwxr-xr-x 1 bruno psacln 83144088 Apr 1 19:28 gitea
#sudo mv /tmp/gitea /usr/local/bin
#sudo chmod +x /usr/local/bin/gitea
sudo mv /tmp/gitea `dirname "$GITEA_BIN"`
sudo chmod +x ${GITEA_BIN}
echo "Restart gitea service..."
sudo systemctl restart gitea
fi
fi

View File

@@ -27,6 +27,12 @@ server2[user]="funnymac"
server2[server]="ftp.cluster011.ovh.net"
server2[dest]="www/$folder/"
# server3: maboiteverte.fr
declare -A server3
server3[user]="bruno"
server3[server]="ftp.maboiteverte.fr"
server3[dest]="httpdocs/$folder/"
notification() {
path_img=`dirname "$0"`
@@ -52,13 +58,35 @@ notification() {
cd $project_dir || exit
mkdocs build --clean
echo ""
echo "*********************************************"
echo "* sending Docs to ${server1[server]}... *"
echo "*********************************************"
echo ""
rsync -e '/usr/bin/ssh -p 42666' --exclude-from="$HOME/.exclude-rsync.txt" --rsync-path=/bin/rsync -zarvh --stats --progress "$folder/" ${server1[user]}@${server1[server]}:${server1[dest]}
result=$?
notification "MkDocs: sending Docs to ${server1[server]}..." "${server1[server]}" $result
echo ""
echo "***********************************************"
echo "* sending Docs to ${server2[server]}... *"
echo "***********************************************"
echo ""
rsync --exclude-from="$HOME/.exclude-rsync.txt" -zarvh --stats --progress "$folder/" ${server2[user]}@${server2[server]}:${server2[dest]}
result=$?
notification "MkDocs: sending Docs to ${server2[server]}..." "${server2[server]}" $result
echo ""
echo "********************************************"
echo "* sending Docs to ${server3[server]}... *"
echo "********************************************"
echo ""
rsync --exclude-from="$HOME/.exclude-rsync.txt" -zarvh --stats --progress "$folder/" ${server3[user]}@${server3[server]}:${server3[dest]}
result=$?
notification "MkDocs: sending Docs to ${server3[server]}..." "${server3[server]}" $result

47
syno-cron-gitea-update.sh Normal file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
GITEA_INSTALLED=`/volume1/@appstore/Gitea/gitea/gitea --version | cut -d \ -f 3`
LATEST_URL=`curl -Ls -o /dev/null -w %{url_effective} https://github.com/go-gitea/gitea/releases/latest`
#https://github.com/go-gitea/gitea/releases/tag/v1.11.3
echo LATEST_URL = ${LATEST_URL}
GITEA_VERSION=${LATEST_URL##*/v}
if [ "${GITEA_INSTALLED}" == "${GITEA_VERSION}" ]; then
echo "No update available..."
exit 0
fi
#Install
echo "Installed: "${GITEA_INSTALLED}
echo "Latest: "${GITEA_VERSION}
rm -rf /tmp/gitea
mkdir /tmp/gitea
cd /tmp/gitea
echo "Clone gitea-spk..."
git clone https://github.com/flipswitchingmonkey/gitea-spk.git
cd gitea-spk
echo "Download latest gitea..."
DOWNLOAD_URL=https://github.com/go-gitea/gitea/releases/download/v${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-amd64.xz
#echo ${DOWNLOAD_URL}
# sudo opkg install wget (sinon pas de https)
wget ${DOWNLOAD_URL}
# sudo opkg install xz
xz --decompress gitea-*.xz
# sudo opkg install tar (sinon tar: unrecognized option '--exclude=INFO.in')
echo "Create spk package..."
./create_spk.sh
echo "Install spk package..."
sudo synoservice --stop pkgctl-Gitea
#echo "Backup gitea mysql database..."
#sudo mysqldump -u root admin_gitea > /tmp/$filename
sudo synoservice --status pkgctl-Gitea
sudo synopkg install /tmp/gitea/gitea-spk/gitea-${GITEA_VERSION}-linux-amd64.spk
sudo synoservice --start pkgctl-Gitea
exit 1