web-root/update.sh

20 lines
501 B
Bash
Raw Permalink Normal View History

2023-05-27 13:17:49 +00:00
#!/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