Skip to content

Commit fa4ed32

Browse files
committed
fix(bootstrap): fix termux auto-detection and unbound os variable error in bootstrap.sh
1 parent 0967842 commit fa4ed32

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

bootstrap.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ detect_target() {
7979
local device="desktop"
8080
local system_target=""
8181

82-
if [[ -n "${TERMUX_VERSION:-}" ]]; then
82+
if [ -d "/data/data/com.termux" ] || [ -f "/system/build.prop" ] || [ -n "${TERMUX_VERSION:-}" ]; then
8383
os="android"
8484
device="smartphone"
8585
elif grep -qEi "(Microsoft|WSL)" /proc/version &> /dev/null; then
@@ -88,7 +88,6 @@ detect_target() {
8888
fi
8989

9090
system_target="${USERNAME}@${arch}.${os}.${device}"
91-
9291
echo "$system_target"
9392
}
9493

@@ -108,7 +107,6 @@ main() {
108107
info "Sops key file not found. Starting Bitwarden workflow."
109108
warn "You will be prompted for your Bitwarden credentials."
110109

111-
# Using 'nix shell' to fetch bitwarden-cli temporarily
112110
nix-shell -p bitwarden-cli --run "
113111
set -euo pipefail
114112
if ! bw status | grep -q '\"status\":\"unlocked\"'; then
@@ -149,9 +147,9 @@ main() {
149147
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
150148
fi
151149

152-
if [[ "$os" == "android" ]]; then
150+
if [[ "$flake_target" =~ "android" ]]; then
153151
info "Running Android-specific environment fixes..."
154-
[ -d "/homeless-shelter" ] && sudo rm -rf /homeless-shelter && rm -rf /homeless-shelter/
152+
[ -d "/homeless-shelter" ] && rm -rf /homeless-shelter /homeless-shelter/ 2>/dev/null || true
155153
export HOME="/home/${USERNAME}"
156154
fi
157155

0 commit comments

Comments
 (0)