mirror of
https://git.bits.team/Bits/mod-manager.git
synced 2024-11-23 06:28:23 -05:00
Ensure script is ran with sudo
This commit is contained in:
parent
84e4635825
commit
3cb311136b
4
.gitignore
vendored
4
.gitignore
vendored
@ -132,4 +132,6 @@ dist
|
|||||||
|
|
||||||
server/
|
server/
|
||||||
|
|
||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
|
build/
|
14
install.sh
14
install.sh
@ -3,6 +3,7 @@
|
|||||||
MIN_NODE_VERSION=12
|
MIN_NODE_VERSION=12
|
||||||
DOWNLOAD_DIR="/tmp/mod-manager-install"
|
DOWNLOAD_DIR="/tmp/mod-manager-install"
|
||||||
INSTALL_DIR="/usr/local/lib/mod-manager"
|
INSTALL_DIR="/usr/local/lib/mod-manager"
|
||||||
|
BINARY_PATH="/usr/bin/mod-manager"
|
||||||
CYAN="\033[1;96m"
|
CYAN="\033[1;96m"
|
||||||
RED="\033[0;91m"
|
RED="\033[0;91m"
|
||||||
GREEN="\033[0;92m"
|
GREEN="\033[0;92m"
|
||||||
@ -24,6 +25,12 @@ success() {
|
|||||||
print "$GREEN" "$1"
|
print "$GREEN" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ "$EUID" -ne 0 ]
|
||||||
|
then
|
||||||
|
error "This script must be ran as root. Please use sudo."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
rm -rf "$DOWNLOAD_DIR"
|
rm -rf "$DOWNLOAD_DIR"
|
||||||
mkdir -p "$DOWNLOAD_DIR"
|
mkdir -p "$DOWNLOAD_DIR"
|
||||||
|
|
||||||
@ -40,14 +47,14 @@ fi
|
|||||||
|
|
||||||
# Download source files
|
# Download source files
|
||||||
info "Downloading mod-manager source..."
|
info "Downloading mod-manager source..."
|
||||||
git clone "git@hogwarts.bits.team:Bits/mod-manager.git" "$DOWNLOAD_DIR" || exit
|
git clone "https://hogwarts.bits.team/git/Bits/mod-manager.git" "$DOWNLOAD_DIR" || exit
|
||||||
|
|
||||||
# Compile
|
# Compile
|
||||||
info "Compiling..."
|
info "Compiling..."
|
||||||
cd "$DOWNLOAD_DIR" || exit
|
cd "$DOWNLOAD_DIR" || exit
|
||||||
npm install --save
|
npm install --save
|
||||||
npm install -g @vercel/ncc
|
npm install -g @vercel/ncc
|
||||||
npx tsc;
|
npx tsc
|
||||||
ncc build build/ts/mod-manager.js -o build/flat
|
ncc build build/ts/mod-manager.js -o build/flat
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
@ -59,7 +66,8 @@ cp -r build/flat/* "$INSTALL_DIR"
|
|||||||
|
|
||||||
# Creating executable
|
# Creating executable
|
||||||
info "Creating executable..."
|
info "Creating executable..."
|
||||||
echo "node $INSTALL_DIR/index.js \$\@" > /usr/bin/mod-manager
|
echo "node $INSTALL_DIR/index.js \$\@" > $BINARY_PATH
|
||||||
|
chmod +x $BINARY_PATH
|
||||||
|
|
||||||
# Cleaning up
|
# Cleaning up
|
||||||
info "Cleaning up..."
|
info "Cleaning up..."
|
||||||
|
Loading…
Reference in New Issue
Block a user