Implement new selfupdate using module script.

This commit is contained in:
Marco Vermeulen
2012-10-28 14:10:23 +00:00
parent e1a0c4df72
commit 25aec976cb
4 changed files with 27 additions and 14 deletions

View File

@@ -258,20 +258,6 @@ function gvm-version {
echo "Groovy enVironment Manager $GVM_VERSION"
}
function gvm-selfupdate {
mkdir -p "$GVM_DIR/bin"
curl -s "$GVM_SERVICE/res/init?platform=$PLATFORM" > "$GVM_DIR/bin/gvm-init.sh"
curl -s "$GVM_SERVICE/res/gvm" > "$GVM_DIR/bin/gvm"
chmod +x "$GVM_DIR/bin/gvm-init.sh"
chmod +x "$GVM_DIR/bin/gvm"
echo ""
echo "Successfully upgraded GVM."
echo ""
}
function gvm-broadcast {
if [ "$BROADCAST_HIST" ]; then
echo "$BROADCAST_HIST"

8
srv/scripts/gvm-selfupdate Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
curl -s "$GVM_SERVICE/selfupdate" | bash
echo ""
echo "Successfully upgraded GVM."
echo ""

13
srv/scripts/selfupdate.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
echo ""
echo "Updating gvm scripts..."
TMP_ZIP="/tmp/res.zip"
BIN_FOLDER="$HOME/.gvm/bin"
mkdir -p "$BIN_FOLDER"
curl -s "$GVM_SERVICE/res?platform=$PLATFORM" > "$TMP_ZIP"
unzip -qo "$TMP_ZIP" -d "$BIN_FOLDER"
rm "$TMP_ZIP"
chmod +x "$BIN_FOLDER"/*

View File

@@ -21,6 +21,11 @@ rm.get("/") { req ->
req.response.sendFile('srv/scripts/install.sh')
}
rm.get("/selfupdate") { req ->
addPlainTextHeader req
req.response.sendFile('srv/scripts/selfupdate.sh')
}
rm.get("/alive") { req ->
addPlainTextHeader req
req.response.end "OK"
@@ -43,6 +48,7 @@ rm.get("/res") { req ->
def files = []
files << new File('srv/scripts/gvm')
files << new File('srv/scripts/gvm-init.sh')
files << new File('srv/scripts/gvm-selfupdate')
def zipFile = buildZip(files)
req.response.putHeader("Content-Type", "application/zip")