mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-24 14:11:55 +00:00
nixos start.sh fix
This commit is contained in:
parent
c995b8deaf
commit
6d1baccca1
26
nixos_start.sh
Executable file
26
nixos_start.sh
Executable file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
RC='\033[0m'
|
||||||
|
RED='\033[0;31m'
|
||||||
|
|
||||||
|
temp_file=$1
|
||||||
|
|
||||||
|
# Function to check command exit status and print error message if failed
|
||||||
|
check() {
|
||||||
|
local exit_code=$1
|
||||||
|
local message=$2
|
||||||
|
|
||||||
|
if [ $exit_code -ne 0 ]; then
|
||||||
|
echo -e "${RED}ERROR: $message${RC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Use patchelf to execute linutil on NixOS
|
||||||
|
nix-shell -p patchelf -p glibc --run "
|
||||||
|
patchelf --set-interpreter $(nix-build --no-out-link '<nixpkgs>' -A glibc)/lib/ld-linux-x86-64.so.2 --set-rpath /run/current-system/sw/lib $temp_file
|
||||||
|
"
|
||||||
|
check $? "Patching linutil"
|
||||||
|
|
||||||
|
$temp_file
|
||||||
|
check $? "Executing linutil"
|
10
start.sh
10
start.sh
|
@ -27,8 +27,14 @@ check $? "Downloading linutil"
|
||||||
chmod +x "$temp_file"
|
chmod +x "$temp_file"
|
||||||
check $? "Making linutil executable"
|
check $? "Making linutil executable"
|
||||||
|
|
||||||
"$temp_file"
|
#if the script is being run on NixOS
|
||||||
check $? "Executing linutil"
|
if [ -f /etc/NIXOS ]; then
|
||||||
|
./nixos_start.sh "$temp_file"
|
||||||
|
check $? "Executing linutil on NixOS"
|
||||||
|
else
|
||||||
|
"$temp_file"
|
||||||
|
check $? "Executing linutil"
|
||||||
|
fi
|
||||||
|
|
||||||
rm -f "$temp_file"
|
rm -f "$temp_file"
|
||||||
check $? "Deleting the temporary file"
|
check $? "Deleting the temporary file"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user