-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanage.sh
executable file
·48 lines (45 loc) · 1.52 KB
/
manage.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env nix
#!nix shell nixpkgs#git nixpkgs#gawk nixpkgs#gnused nixpkgs#kubectl nixpkgs#curl nixpkgs#docker nixpkgs#openssh nixpkgs#bash --command bash
DIR=$(dirname ${BASH_SOURCE[0]})
cd $DIR
source .env
echo $DIR
if [ -z $1 ]
then
SOFTS=( "plex" "sonarr" "radarr" "tautulli" "prowlarr" "bazarr" )
else
SOFTS=$1
fi
echo "##############################"
echo "Checking updates on : ${SOFTS[@]}"
echo "##############################"
NS="media"
for SOFT in ${SOFTS[@]}
do
echo "Checking update on ${SOFT}"
echo ""
echo "------------------------------"
echo ""
VERSION=$(${DIR}/${SOFT}/update.sh|awk '/VERSION/ {print $2;}')
if [[ `git -C ${DIR} status --porcelain` ]]
then
if [ -f "${SOFT}/docker.nix" ]
then
echo "Building docker for ${SOFT} on version: ${VERSION}"
nix build .\#docker-${SOFT}
docker load < $(readlink ${DIR}/result)
docker tag mcth/${SOFT}:nix mcth/${SOFT}:latest
docker tag mcth/${SOFT}:nix mcth/${SOFT}:${VERSION}
docker push mcth/${SOFT}
docker push mcth/${SOFT}:${VERSION}
kubectl set image "deploy/${SOFT}" -n "${NS}" "${SOFT}=mcth/${SOFT}:${VERSION:-latest}"
fi
git -C ${DIR} pull
git -C ${DIR} commit -am "Update ${SOFT} with new version : ${VERSION}"
curl -XPOST -H 'Content-Type: application/json' https://${USER}:${PASSWORD}@rshook.mcth.eu/send -d '{"title": "'"${SOFT}"'", "message": "'"${VERSION}"'" }'
git -C ${DIR} push
fi
done
#echo "##############################"
#echo "END"
#echo "##############################"