Improved install experience

This commit is contained in:
2025-04-01 15:26:50 +00:00
parent c00256f723
commit 78c71ab8b4
4 changed files with 47 additions and 55 deletions

29
scripts/add_to_environment.sh Normal file → Executable file
View File

@@ -1,18 +1,15 @@
#!/bin/bash
add_to_environment() {
local path="$1"
# Check if the path is already in the environment file
if ! grep -q "$path" /etc/environment; then
# Get current PATH from environment file
current_path=$(grep "^PATH=" /etc/environment | cut -d'"' -f2)
if [ -z "$current_path" ]; then
# If PATH doesn't exist in the file, create it
echo "PATH=\"\$PATH:$path\"" >> /etc/environment
else
# Replace existing PATH line with updated one
sed -i "s|^PATH=.*|PATH=\"$path:$current_path\"|" /etc/environment
fi
local path="$1"
# Check if the path is already in the environment file
if ! grep -q "$path" /etc/environment; then
# Get current PATH from environment file
current_path=$(grep "^PATH=" /etc/environment | cut -d'"' -f2)
if [ -z "$current_path" ]; then
# If PATH doesn't exist in the file, create it
echo "PATH=\"\$PATH:$path\"" >> /etc/environment
else
# Replace existing PATH line with updated one
sed -i "s|^PATH=.*|PATH=\"$path:$current_path\"|" /etc/environment
fi
}
fi