From a7725358f8e9f013cfdc9f892a8e5e35e27dce3c Mon Sep 17 00:00:00 2001 From: Sugaryy_ <65258128+Sugaryyyy@users.noreply.github.com> Date: Sat, 27 May 2023 15:17:49 +0200 Subject: [PATCH] Repo: Added a update script. --- update.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 update.sh diff --git a/update.sh b/update.sh new file mode 100644 index 0000000..f373ad9 --- /dev/null +++ b/update.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# A script for updating the root website +# Made by sugary :3 +WEBSITES_PATH="/var/www/" +WEBSITE_NAME="root" + +as_root() +{ + if [ $EUID = 0 ]; then $* + elif [ -x /usr/bin/sudo ]; then sudo $* + else su -c \\"$*\\" + fi +} + +export -f as_root + +as_root cp -rf $WEBSITES_PATH/$WEBSITE_NAME $WEBSITES_PATH/$WEBSITE_NAME.bak +as_root rm -rf $WEBSITES_PATH/$WEBSITE_NAME +as_root mkdir $WEBSITES_PATH/$WEBSITE_NAME +as_root cp -rf src/* $WEBSITES_PATH/$WEBSITE_NAME \ No newline at end of file