Spaces:
Running
Running
bobwatcherx
commited on
Commit
•
f2708ac
1
Parent(s):
300b08c
#21
Browse files- nodesource_setup.sh +113 -0
- src/app.html +3 -16
nodesource_setup.sh
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# Logger Function
|
4 |
+
log() {
|
5 |
+
local message="$1"
|
6 |
+
local type="$2"
|
7 |
+
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
|
8 |
+
local color
|
9 |
+
local endcolor="\033[0m"
|
10 |
+
|
11 |
+
case "$type" in
|
12 |
+
"info") color="\033[38;5;79m" ;;
|
13 |
+
"success") color="\033[1;32m" ;;
|
14 |
+
"error") color="\033[1;31m" ;;
|
15 |
+
*) color="\033[1;34m" ;;
|
16 |
+
esac
|
17 |
+
|
18 |
+
echo -e "${color}${timestamp} - ${message}${endcolor}"
|
19 |
+
}
|
20 |
+
|
21 |
+
# Error handler function
|
22 |
+
handle_error() {
|
23 |
+
local exit_code=$1
|
24 |
+
local error_message="$2"
|
25 |
+
log "Error: $error_message (Exit Code: $exit_code)" "error"
|
26 |
+
exit $exit_code
|
27 |
+
}
|
28 |
+
|
29 |
+
# Function to check for command availability
|
30 |
+
command_exists() {
|
31 |
+
command -v "$1" &> /dev/null
|
32 |
+
}
|
33 |
+
|
34 |
+
check_os() {
|
35 |
+
if ! [ -f "/etc/debian_version" ]; then
|
36 |
+
echo "Error: This script is only supported on Debian-based systems."
|
37 |
+
exit 1
|
38 |
+
fi
|
39 |
+
}
|
40 |
+
|
41 |
+
# Function to Install the script pre-requisites
|
42 |
+
install_pre_reqs() {
|
43 |
+
log "Installing pre-requisites" "info"
|
44 |
+
|
45 |
+
# Run 'apt-get update'
|
46 |
+
if ! apt-get update -y; then
|
47 |
+
handle_error "$?" "Failed to run 'apt-get update'"
|
48 |
+
fi
|
49 |
+
|
50 |
+
# Run 'apt-get install'
|
51 |
+
if ! apt-get install -y apt-transport-https ca-certificates curl gnupg; then
|
52 |
+
handle_error "$?" "Failed to install packages"
|
53 |
+
fi
|
54 |
+
|
55 |
+
if ! mkdir -p /usr/share/keyrings; then
|
56 |
+
handle_error "$?" "Makes sure the path /usr/share/keyrings exist or run ' mkdir -p /usr/share/keyrings' with sudo"
|
57 |
+
fi
|
58 |
+
|
59 |
+
rm -f /usr/share/keyrings/nodesource.gpg || true
|
60 |
+
rm -f /etc/apt/sources.list.d/nodesource.list || true
|
61 |
+
|
62 |
+
# Run 'curl' and 'gpg' to download and import the NodeSource signing key
|
63 |
+
if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then
|
64 |
+
handle_error "$?" "Failed to download and import the NodeSource signing key"
|
65 |
+
fi
|
66 |
+
|
67 |
+
# Explicitly set the permissions to ensure the file is readable by all
|
68 |
+
if ! chmod 644 /usr/share/keyrings/nodesource.gpg; then
|
69 |
+
handle_error "$?" "Failed to set correct permissions on /usr/share/keyrings/nodesource.gpg"
|
70 |
+
fi
|
71 |
+
}
|
72 |
+
|
73 |
+
# Function to configure the Repo
|
74 |
+
configure_repo() {
|
75 |
+
local node_version=$1
|
76 |
+
|
77 |
+
arch=$(dpkg --print-architecture)
|
78 |
+
if [ "$arch" != "amd64" ] && [ "$arch" != "arm64" ] && [ "$arch" != "armhf" ]; then
|
79 |
+
handle_error "1" "Unsupported architecture: $arch. Only amd64, arm64, and armhf are supported."
|
80 |
+
fi
|
81 |
+
|
82 |
+
echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null
|
83 |
+
|
84 |
+
# N|solid Config
|
85 |
+
echo "Package: nsolid" | tee /etc/apt/preferences.d/nsolid > /dev/null
|
86 |
+
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nsolid > /dev/null
|
87 |
+
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nsolid > /dev/null
|
88 |
+
|
89 |
+
# Nodejs Config
|
90 |
+
echo "Package: nodejs" | tee /etc/apt/preferences.d/nodejs > /dev/null
|
91 |
+
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
|
92 |
+
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
|
93 |
+
|
94 |
+
# Run 'apt-get update'
|
95 |
+
if ! apt-get update -y; then
|
96 |
+
handle_error "$?" "Failed to run 'apt-get update'"
|
97 |
+
else
|
98 |
+
log "Repository configured successfully."
|
99 |
+
log "To install Node.js, run: apt-get install nodejs -y" "info"
|
100 |
+
log "You can use N|solid Runtime as a node.js alternative" "info"
|
101 |
+
log "To install N|solid Runtime, run: apt-get install nsolid -y \n" "success"
|
102 |
+
fi
|
103 |
+
}
|
104 |
+
|
105 |
+
# Define Node.js version
|
106 |
+
NODE_VERSION="22.x"
|
107 |
+
|
108 |
+
# Check OS
|
109 |
+
check_os
|
110 |
+
|
111 |
+
# Main execution
|
112 |
+
install_pre_reqs || handle_error $? "Failed installing pre-requisites"
|
113 |
+
configure_repo "$NODE_VERSION" || handle_error $? "Failed configuring repository"
|
src/app.html
CHANGED
@@ -11,27 +11,14 @@
|
|
11 |
<!-- popcash meta -->
|
12 |
<meta name="ppck-ver" content="d644d8c10c7b6abe9b4f8eb7bd69e686" />
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
|
18 |
</head>
|
19 |
<body data-sveltekit-preload-data="hover">
|
20 |
<div style="display: contents">%sveltekit.body%</div>
|
21 |
|
22 |
-
|
23 |
-
<script>
|
24 |
-
(function(hffd){
|
25 |
-
var d = document,
|
26 |
-
s = d.createElement('script'),
|
27 |
-
l = d.scripts[d.scripts.length - 1];
|
28 |
-
s.settings = hffd || {};
|
29 |
-
s.src = "\/\/heartyquit.com\/cEDn9J6Sb.2\/5\/l\/SUWmQK9oNeT\/Ql2iMQz\/AnzgOQCS0n1-NaD_YczPMgDZMR5U";
|
30 |
-
s.async = true;
|
31 |
-
s.referrerPolicy = 'no-referrer-when-downgrade';
|
32 |
-
l.parentNode.insertBefore(s, l);
|
33 |
-
})({})
|
34 |
-
</script>
|
35 |
|
36 |
|
37 |
<!-- popcash popunder -->
|
|
|
11 |
<!-- popcash meta -->
|
12 |
<meta name="ppck-ver" content="d644d8c10c7b6abe9b4f8eb7bd69e686" />
|
13 |
|
14 |
+
<!-- juicyads meta -->
|
15 |
+
<meta name="juicyads-site-verification" content="21e9f5d8b4221309c30b069ca2afd4f4">
|
|
|
16 |
|
17 |
</head>
|
18 |
<body data-sveltekit-preload-data="hover">
|
19 |
<div style="display: contents">%sveltekit.body%</div>
|
20 |
|
21 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
|
24 |
<!-- popcash popunder -->
|