mirror of
https://github.com/mindverse/Second-Me.git
synced 2026-07-13 11:18:23 +00:00
* feat:remove conda from setup * cool. more code about removing conda & env * optimize script * add python check * optimize setup * optimize setup * add warning info * optimize check * add node check & npm check * add cmake install suggestion * add poetry suggestion * add python command check * add python tools * add poetry * add graphrag poetry install command optimization * active poetry shell * fix duplicated log * avoid poetry multipul active * add sqlite3 check * optimize sqlite3 setup suggestion * optimize * add gitignore * reverse compose detect
44 lines
1.1 KiB
Bash
44 lines
1.1 KiB
Bash
#!/bin/bash
|
|
# OS detection utility functions
|
|
|
|
# Detect OS type: Returns "macos", "linux", "windows", or "unknown"
|
|
detect_os_type() {
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
echo "macos"
|
|
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
echo "linux"
|
|
elif [[ "$OSTYPE" == "msys"* ]] || [[ "$OSTYPE" == "cygwin"* ]] || [[ "$OSTYPE" == "win32" ]]; then
|
|
echo "windows"
|
|
else
|
|
echo "unknown"
|
|
fi
|
|
}
|
|
|
|
# Detect Linux distribution: Returns "debian", "fedora", "redhat", "arch", "alpine", or "other"
|
|
detect_linux_distro() {
|
|
if [ -f /etc/debian_version ]; then
|
|
echo "debian"
|
|
elif [ -f /etc/fedora-release ]; then
|
|
echo "fedora"
|
|
elif [ -f /etc/redhat-release ]; then
|
|
echo "redhat"
|
|
elif [ -f /etc/arch-release ]; then
|
|
echo "arch"
|
|
elif [ -f /etc/alpine-release ]; then
|
|
echo "alpine"
|
|
else
|
|
echo "other"
|
|
fi
|
|
}
|
|
|
|
# Get full system identification
|
|
get_system_id() {
|
|
local os_type=$(detect_os_type)
|
|
|
|
if [ "$os_type" = "linux" ]; then
|
|
local linux_distro=$(detect_linux_distro)
|
|
echo "${os_type}-${linux_distro}"
|
|
else
|
|
echo "$os_type"
|
|
fi
|
|
}
|