web-root/update.sh

20 lines
No EOL
501 B
Bash
Executable file

#!/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