File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3+ # Function to safely enable unprivileged user namespaces
4+ enable_unprivileged_namespaces () {
5+ # Check if the sysctl parameter exists (some kernels don't have it)
6+ if ! sysctl kernel.unprivileged_userns_clone > /dev/null 2>&1 ; then
7+ echo " Info: kernel.unprivileged_userns_clone not available on this system"
8+ return 0
9+ fi
10+
11+ # Check current value
12+ local current_value=$( sysctl -n kernel.unprivileged_userns_clone 2> /dev/null)
13+
14+ if [ " $current_value " != " 1" ]; then
15+ echo " Enabling unprivileged user namespaces..."
16+ if sudo sysctl kernel.unprivileged_userns_clone=1; then
17+ echo " Successfully enabled unprivileged user namespaces"
18+ return 0
19+ else
20+ echo " Warning: Failed to enable unprivileged user namespaces"
21+ return 1
22+ fi
23+ else
24+ echo " Unprivileged user namespaces already enabled"
25+ return 0
26+ fi
27+ }
28+
329# Variables
430user=" steam"
531BRANCH=" master"
184210 echo " $FILE successfully patched for Metamod."
185211fi
186212
213+ # Try to enable unprivileged namespaces
214+ enable_unprivileged_namespaces
215+
187216echo " Starting server on $PUBLIC_IP :$PORT "
188217# https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers#Command-Line_Parameters
189218sudo -u $user /home/${user} /steamrt/run ./game/bin/linuxsteamrt64/cs2 --graphics-provider " " -- \
You can’t perform that action at this time.
0 commit comments