Benign linux Download

v2.2.1.sh

References a systemd ExecStart directiveReferences curl flags and HTTP URL
SHA-256064c24d72165b447283df58de22aea7de5eaed8f6c35bede6a957275c960a745

Evidence

References curl flags and HTTP URL lines 1–9
1#!/usr/bin/env bash
2# Install Levix on a Linux server and run it as a service.
3#
4# curl -fsSL https://levix.leviro.net/install.sh | bash
5#
6# This file is the source of every public installer. The copy served from
7# levix.leviro.net/install/vX.Y.Z.sh is this same script with VERSION rewritten
8# to that release, which is why a pinned URL keeps installing that version
9# forever. The copy in git lea …
System-wide /etc/systemd directory lines 25–32
25:45… utside npm's own prefix: the system
26# user, /var/lib/levix, and /etc/systemd/system/levix.service. It never touches
27# an existing installation's data, and it can be re-run to upgrade.
28
⋯4 lines
Shell suppresses failure with || true lines 32–79
32:38… installer.mjs when a release is published.
33# Keep this line exactly as it is: one assignment, one double-quoted value.
34VERSION="2.2.1"
35SERVICE="levix"
36DATA_DIR="/var/lib/levix"
37UNIT="/etc/systemd/system/${SERVICE}.service"
38MIN_NODE_MAJOR=24
39PORT=3001
40
41say() { printf '\n %s\n' "$*"; }
42die() { printf '\n error: %s\n\n' "$*" >&2; exit 1; }
43
44sudo_if_needed() {
45 if [ "$(id -u)" -eq 0 ]; then
46 "$@"
47 else
48 command -v sudo >/dev/null 2>&1 || die "This needs root, and sudo is not installed."
49 sudo "$@"
50 fi
51}
52
53# --- 1. Node ---------------------------------------------------------------
54
55node_major() {
56 if ! command -v node >/dev/null 2>&1; then
57 printf '0\n'
58 return
59 fi
60
61 local major
62 major="$(node -p 'process.versions.node.split(".")[0]' 2>/dev/null || true)"
63 case "$major" in
64 ''|*[!0-9]*) printf '0\n' ;;
65 *) printf '%s\n' "$major" ;;
66 esac
67}
68
69# Read distro metadata in a subshell. /etc/os-release commonly defines VERSION,
70# which must never overwrite Levix's own release VERSION in the parent shell.
71read_os_id() (
72 local os_release="$1"
73 [ -r "$os_release" ] || return 1
74 # shellcheck disable=SC1090
75 . "$os_release"
76 printf '%s\n' "${ID:-}"
77)
78
79install_node24() {
File command syntax mentions /etc path lines 94–122
94:32… DE_MAJOR} from NodeSource…"
95
96 sudo_if_needed apt-get update
97 sudo_if_needed apt-get install -y ca-certificates curl
98 sudo_if_needed install -d -m 0755 /etc/apt/keyrings
99
100 local key_tmp repo_tmp
101 key_tmp="$(mktemp)"
102 repo_tmp="$(mktemp)"
103
104 # Download the signing key as data; do not execute a second remote setup
105 # script inside the Levix installer.
106 if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key -o "$key_tmp"; then
107 rm -f "$key_tmp" "$repo_tmp"
108 die "Could not download the NodeSource signing key."
109 fi
110
111 printf '%s\n' \
112 "deb [signed-by=/etc/apt/keyrings/nodesource.asc] https://deb.nodesource.com/node_${MIN_NODE_MAJOR}.x nodistro main" \
113 > "$repo_tmp"
114
115 sudo_if_needed install -m 0644 "$key_tmp" /etc/apt/keyrings/nodesource.asc
116 sudo_if_needed install -m 0644 "$repo_tmp" /etc/apt/sources.list.d/nodesource.list
117 rm -f "$key_tmp" "$repo_tmp"
118
119 sudo_if_needed apt-get update
120 sudo_if_needed apt-get install -y nodejs
121
122 # A pre-existing nvm/asdf installat …
Direct PATH assignment (PATH= or PATH+=) lines 124–142
124:37… f this installer when it is suitable.
125 if [ -x /usr/bin/node ]; then
126 local system_major
127 system_major="$(/usr/bin/node -p 'process.versions.node.split(".")[0]' 2>/dev/null || printf '0')"
128 case "$system_major" in
129 ''|*[!0-9]*) system_major=0 ;;
130 esac
131 if [ "$system_major" -ge "$MIN_NODE_MAJOR" ]; then
132 PATH="/usr/bin:$PATH"
133 export PATH
134 hash -r
135 fi
136 fi
137}
138
139NODE_MAJOR="$(node_major)"
140if [ "$NODE_MAJOR" -lt "$MIN_NODE_MAJOR" ] || ! command -v npm >/dev/null 2>&1; then
141 if [ "$NODE_MAJOR" -eq 0 ]; then
142 sa …

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.