docs: Update README and documentation for lxs multi-tool across Linux and Windows platforms.
This commit is contained in:
+22
-17
@@ -17,8 +17,8 @@ if [ -n "${BASH_SOURCE[0]:-}" ]; then
|
||||
LXS_SCRIPT_DIR=$(dirname "$_lxs_resolved")
|
||||
unset _lxs_resolved
|
||||
fi
|
||||
if [ -n "$LXS_SCRIPT_DIR" ] && [ -r "${LXS_SCRIPT_DIR}/VERSION" ]; then
|
||||
LXS_VERSION=$(head -n1 "${LXS_SCRIPT_DIR}/VERSION" 2>/dev/null | tr -d '[:space:]')
|
||||
if [ -n "$LXS_SCRIPT_DIR" ] && [ -r "${LXS_SCRIPT_DIR}/../VERSION" ]; then
|
||||
LXS_VERSION=$(head -n1 "${LXS_SCRIPT_DIR}/../VERSION" 2>/dev/null | tr -d '[:space:]')
|
||||
fi
|
||||
LXS_VERSION="${LXS_VERSION:-dev}"
|
||||
|
||||
@@ -27,6 +27,12 @@ LXS_BRANCH="${LXS_BRANCH:-main}"
|
||||
export LXS_RAW_BASE="${LXS_RAW_BASE:-${LXS_REPO_URL}/raw/branch/${LXS_BRANCH}}"
|
||||
LXS_TARBALL_URL="${LXS_TARBALL_URL:-${LXS_REPO_URL}/archive/${LXS_BRANCH}.tar.gz}"
|
||||
|
||||
# Platform sub-tree inside the repo. Every apps/ and tools/ path is resolved
|
||||
# under it, both on disk (${LXS_INSTALL_DIR}/linux/...) and remotely
|
||||
# (${LXS_RAW_BASE}/linux/...). A future macos/ tree only needs this to change.
|
||||
LXS_PLATFORM_DIR="linux"
|
||||
export LXS_RAW_PLATFORM_BASE="${LXS_RAW_BASE}/${LXS_PLATFORM_DIR}"
|
||||
|
||||
LXS_INSTALL_DIR="${LXS_INSTALL_DIR:-/usr/local/share/lxs}"
|
||||
LXS_BIN_PATH="${LXS_BIN_PATH:-/usr/local/bin/lxs}"
|
||||
LXS_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/lxs"
|
||||
@@ -43,7 +49,7 @@ if [ -n "$LXS_SCRIPT_DIR" ] && [ -r "${LXS_SCRIPT_DIR}/lib/common.sh" ]; then
|
||||
# shellcheck disable=SC1091
|
||||
. "${LXS_SCRIPT_DIR}/lib/common.sh"
|
||||
else
|
||||
_lib=$(curl -fsSL "${LXS_RAW_BASE}/lib/common.sh") || {
|
||||
_lib=$(curl -fsSL "${LXS_RAW_PLATFORM_BASE}/lib/common.sh") || {
|
||||
echo "Failed to fetch lib/common.sh" >&2
|
||||
exit 1
|
||||
}
|
||||
@@ -67,12 +73,6 @@ lxs_self_path() {
|
||||
echo "$src"
|
||||
}
|
||||
|
||||
lxs_is_installed() {
|
||||
local self
|
||||
self=$(lxs_self_path) || return 1
|
||||
[ "$(dirname "$self")" = "$LXS_INSTALL_DIR" ]
|
||||
}
|
||||
|
||||
lxs_need_root_for() {
|
||||
local path=$1
|
||||
local parent
|
||||
@@ -167,9 +167,14 @@ download_and_run() {
|
||||
shift
|
||||
local script_name local_path
|
||||
script_name=$(basename "$script_path")
|
||||
local_path="${LXS_INSTALL_DIR}/${script_path}"
|
||||
|
||||
if lxs_is_installed && [ -f "$local_path" ]; then
|
||||
# Prefer the copy sitting next to this script, whatever the prefix: that
|
||||
# covers the installed layout, a git checkout, and a custom
|
||||
# LXS_INSTALL_DIR alike. Only a `curl | bash` run has no siblings on disk.
|
||||
local_path=""
|
||||
[ -n "$LXS_SCRIPT_DIR" ] && local_path="${LXS_SCRIPT_DIR}/${script_path}"
|
||||
|
||||
if [ -n "$local_path" ] && [ -f "$local_path" ]; then
|
||||
chmod +x "$local_path" 2>/dev/null || true
|
||||
echo ""
|
||||
show_separator
|
||||
@@ -194,7 +199,7 @@ download_and_run() {
|
||||
|
||||
if curl -fsSL -H "Cache-Control: no-cache" \
|
||||
-o "${temp_file}" \
|
||||
"${LXS_RAW_BASE}/${script_path}"; then
|
||||
"${LXS_RAW_PLATFORM_BASE}/${script_path}"; then
|
||||
echo -e "${GREEN}[OK] Payload acquired${NC}"
|
||||
chmod +x "${temp_file}"
|
||||
|
||||
@@ -217,7 +222,7 @@ download_and_run() {
|
||||
return $exit_code
|
||||
else
|
||||
echo -e "${RED}[KO] Failed to download ${script_path}${NC}"
|
||||
echo -e "${RED} URL: ${LXS_RAW_BASE}/${script_path}${NC}"
|
||||
echo -e "${RED} URL: ${LXS_RAW_PLATFORM_BASE}/${script_path}${NC}"
|
||||
rm -f "${temp_file}"
|
||||
return 1
|
||||
fi
|
||||
@@ -309,8 +314,8 @@ lxs_sync_install() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -f "${work}/extracted/lxs.sh" ] || [ ! -f "${work}/extracted/VERSION" ]; then
|
||||
echo -e "${RED}[KO] Tarball is missing lxs.sh or VERSION${NC}"
|
||||
if [ ! -f "${work}/extracted/${LXS_PLATFORM_DIR}/lxs.sh" ] || [ ! -f "${work}/extracted/VERSION" ]; then
|
||||
echo -e "${RED}[KO] Tarball is missing ${LXS_PLATFORM_DIR}/lxs.sh or VERSION${NC}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -334,8 +339,8 @@ lxs_sync_install() {
|
||||
rm -rf "${LXS_INSTALL_DIR}.old"
|
||||
fi
|
||||
|
||||
chmod +x "${LXS_INSTALL_DIR}/lxs.sh" 2>/dev/null || true
|
||||
find "${LXS_INSTALL_DIR}/apps" "${LXS_INSTALL_DIR}/tools" -name '*.sh' -exec chmod +x {} + 2>/dev/null || true
|
||||
chmod +x "${LXS_INSTALL_DIR}/lxs.sh" "${LXS_INSTALL_DIR}/${LXS_PLATFORM_DIR}/lxs.sh" 2>/dev/null || true
|
||||
find "${LXS_INSTALL_DIR}/${LXS_PLATFORM_DIR}" -name '*.sh' -exec chmod +x {} + 2>/dev/null || true
|
||||
|
||||
if [ -e "$LXS_BIN_PATH" ] || [ -L "$LXS_BIN_PATH" ]; then
|
||||
rm -f "$LXS_BIN_PATH"
|
||||
|
||||
Reference in New Issue
Block a user