From e314dda90d36aa3b38352c4970dac0c70a43d9d6 Mon Sep 17 00:00:00 2001 From: m0rv4i Date: Wed, 26 Sep 2018 13:47:32 +0100 Subject: [PATCH] Update update.sh --- Update.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Update.sh b/Update.sh index ae85958..00dc8ca 100755 --- a/Update.sh +++ b/Update.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Update PoshC2 echo "" @@ -15,19 +15,26 @@ echo "" echo "[+] Updating PoshC2_Python" echo "" +ROOTDIR=`dirname "$0"` +if [ ! -d "$ROOTDIR" ]; then + ROOTDIR="/opt/PoshC2_Python/" +fi +pushd "$ROOTDIR" > /dev/null + # Backup config -echo "[+] Backup Config.py" -mv /opt/PoshC2_Python/Config.py /tmp/Config.py +echo "[+] Backup Config" +git stash > /dev/null # Install requirements for PoshC2_Python echo "" -echo "[+] Performing git pull on /opt/PoshC2_Python/" -cd /opt/PoshC2_Python/ -git pull +echo "[+] Performing git pull on $ROOTDIR" +git pull # Restore config -echo "[+] Restore Config.py" -mv /tmp/Config.py /opt/PoshC2_Python/Config.py +echo "[+] Restore Config" +git stash pop > /dev/null echo "" echo "[+] Update complete" echo "" + +popd > /dev/null