-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·56 lines (45 loc) · 1.41 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·56 lines (45 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
# XXX: PLEASE DO NOT MODIFY
RED="\033[1;31m"
GREEN="\033[1;32m"
YELLOW="\033[1;33m"
BLUE="\033[1;34m"
EXECUTABLE="$PREFIX/bin/FBL"
createExecutable() {
echo "${BLUE}[+]${YELLOW} Installing Node.js..."
pkg install nodejs -y
echo "${BLUE}[+]${YELLOW} Creating FBLikers executable..."
touch "$EXECUTABLE"
CURRENT_PATH=$(pwd)
echo "${BLUE}[+]${YELLOW} Writing to executable file..."
cat << EOF > "$EXECUTABLE"
#!/bin/sh
if [ -e "$CURRENT_PATH" ] && [ -e "$CURRENT_PATH/index.js" ]; then
cd "$CURRENT_PATH"
node index.js
else
echo "${GREEN}${CURRENT_PATH} or ${CURRENT_PATH}/index.js ${YELLOW}does not exist."
fi
EOF
echo "${BLUE}[+]${YELLOW} Setting executable permissions..."
chmod +x "$EXECUTABLE"
echo "${BLUE}[+]${YELLOW} Installation complete. Running FBLikers..."
if [ -e "$CURRENT_PATH/index.js" ]; then
FBL
else
echo "${GREEN}index.js ${YELLOW}does not exist."
fi
}
if [ -e "$EXECUTABLE" ]; then
EXECUTABLEOUTP=$(cat "$EXECUTABLE")
TARGETDIR=$(echo "$EXECUTABLEOUTP" | grep -oP '(?<=cd ")[^"]*')
if [ -e "$TARGETDIR" ]; then
echo "${BLUE}[+]${GREEN} FBL${YELLOW} is already installed and executable. There is no need to recreate it."
echo "${BLUE}[+]${YELLOW} Simply run: ${GREEN}FBL"
else
echo "${BLUE}[+]${YELLOW} The target directory does not exist. Proceeding to create the executable for FBLikers..."
createExecutable
fi
else
createExecutable
fi