mirror of
https://github.com/RightNow-AI/openfang.git
synced 2026-08-14 00:47:51 +00:00
cachyos build
This commit is contained in:
@@ -88,6 +88,21 @@ export PATH="$HOME/.cargo/bin:$PATH"
|
||||
# Add to ~/.bashrc or ~/.zshrc to persist
|
||||
```
|
||||
|
||||
### Black screen on login after install (Arch / CachyOS / fish users)
|
||||
|
||||
**Cause**: Older OpenFang installers (`<v0.6.4`) appended a PATH line directly to `~/.config/fish/config.fish`. On Arch derivatives like CachyOS, the desktop session can source fish on login — a malformed or invalid PATH line then prevents the session from finishing, leaving you on a black screen.
|
||||
|
||||
**Fix**: Boot to a TTY (`Ctrl+Alt+F2`) and remove any OpenFang PATH lines from `config.fish`:
|
||||
```bash
|
||||
sed -i '/openfang/d' ~/.config/fish/config.fish
|
||||
```
|
||||
Then re-run the installer — current versions write to `~/.config/fish/conf.d/openfang.fish` (a drop-in directory) instead, and guard the path with `test -d` so a missing install dir can never wedge fish startup.
|
||||
|
||||
To remove OpenFang's PATH entry cleanly:
|
||||
```bash
|
||||
rm ~/.config/fish/conf.d/openfang.fish
|
||||
```
|
||||
|
||||
### Docker container won't start
|
||||
|
||||
**Common causes**:
|
||||
|
||||
+58
-28
@@ -149,39 +149,69 @@ install() {
|
||||
USER_SHELL=$(grep "^$(id -un):" /etc/passwd 2>/dev/null | cut -d: -f7)
|
||||
fi
|
||||
|
||||
SHELL_RC=""
|
||||
# Fish shell: write to ~/.config/fish/conf.d/openfang.fish (drop-in dir).
|
||||
# This keeps the user's config.fish completely untouched, so a broken
|
||||
# PATH entry can never wedge the user's main shell config — critical
|
||||
# on Arch/CachyOS where the desktop session sources fish on login.
|
||||
USE_FISH_DROPIN=0
|
||||
case "$USER_SHELL" in
|
||||
*/zsh) SHELL_RC="$HOME/.zshrc" ;;
|
||||
*/bash) SHELL_RC="$HOME/.bashrc" ;;
|
||||
*/fish) SHELL_RC="$HOME/.config/fish/config.fish" ;;
|
||||
*/fish) USE_FISH_DROPIN=1 ;;
|
||||
esac
|
||||
# Also check for config files if shell detection failed.
|
||||
# Check bash/zsh first (more common defaults), fish last — avoids
|
||||
# writing to config.fish for users who merely have Fish installed.
|
||||
if [ -z "$SHELL_RC" ]; then
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
SHELL_RC="$HOME/.bashrc"
|
||||
elif [ -f "$HOME/.zshrc" ]; then
|
||||
SHELL_RC="$HOME/.zshrc"
|
||||
elif [ -f "$HOME/.config/fish/config.fish" ]; then
|
||||
SHELL_RC="$HOME/.config/fish/config.fish"
|
||||
fi
|
||||
# If $USER_SHELL didn't match fish but config.fish exists AND no other
|
||||
# rc files exist, the user is likely a fish user — use the drop-in too.
|
||||
if [ "$USE_FISH_DROPIN" -eq 0 ] \
|
||||
&& [ -f "$HOME/.config/fish/config.fish" ] \
|
||||
&& [ ! -f "$HOME/.bashrc" ] \
|
||||
&& [ ! -f "$HOME/.zshrc" ]; then
|
||||
USE_FISH_DROPIN=1
|
||||
fi
|
||||
|
||||
if [ -n "$SHELL_RC" ] && ! grep -q "openfang" "$SHELL_RC" 2>/dev/null; then
|
||||
# Determine syntax from the TARGET FILE, not $USER_SHELL — this
|
||||
# prevents Bash syntax from ever being written to config.fish even
|
||||
# when shell detection mis-identifies the user's shell.
|
||||
case "$SHELL_RC" in
|
||||
*/config.fish)
|
||||
mkdir -p "$(dirname "$SHELL_RC")"
|
||||
echo "fish_add_path \"$INSTALL_DIR\"" >> "$SHELL_RC"
|
||||
;;
|
||||
*)
|
||||
echo "export PATH=\"$INSTALL_DIR:\$PATH\"" >> "$SHELL_RC"
|
||||
;;
|
||||
if [ "$USE_FISH_DROPIN" -eq 1 ]; then
|
||||
FISH_CONF_DIR="$HOME/.config/fish/conf.d"
|
||||
FISH_DROPIN="$FISH_CONF_DIR/openfang.fish"
|
||||
mkdir -p "$FISH_CONF_DIR"
|
||||
if [ ! -f "$FISH_DROPIN" ]; then
|
||||
# Guarded with `test -d` so a missing/broken install dir never
|
||||
# breaks fish startup (which would black-screen Arch/CachyOS
|
||||
# desktop sessions that source fish at login).
|
||||
cat > "$FISH_DROPIN" <<EOF
|
||||
# OpenFang PATH — auto-generated by installer
|
||||
if test -d "$INSTALL_DIR"
|
||||
fish_add_path -g "$INSTALL_DIR"
|
||||
end
|
||||
EOF
|
||||
echo " Added $INSTALL_DIR to PATH via $FISH_DROPIN"
|
||||
fi
|
||||
# Best-effort: clean up legacy bash-syntax export from config.fish
|
||||
# written by older OpenFang installers (<v0.5.0). Harmless if absent.
|
||||
OLD_FISH_RC="$HOME/.config/fish/config.fish"
|
||||
if [ -f "$OLD_FISH_RC" ] && grep -q "openfang/bin" "$OLD_FISH_RC" 2>/dev/null; then
|
||||
# Remove any line containing .openfang/bin (covers both bash
|
||||
# `export PATH=` syntax and old fish `set -gx PATH` lines).
|
||||
TMPFILE=$(mktemp)
|
||||
grep -v "openfang/bin" "$OLD_FISH_RC" > "$TMPFILE" || true
|
||||
mv "$TMPFILE" "$OLD_FISH_RC"
|
||||
echo " Cleaned legacy openfang PATH entry from $OLD_FISH_RC"
|
||||
fi
|
||||
else
|
||||
SHELL_RC=""
|
||||
case "$USER_SHELL" in
|
||||
*/zsh) SHELL_RC="$HOME/.zshrc" ;;
|
||||
*/bash) SHELL_RC="$HOME/.bashrc" ;;
|
||||
esac
|
||||
echo " Added $INSTALL_DIR to PATH in $SHELL_RC"
|
||||
# Fall back to existing rc files when shell detection failed.
|
||||
if [ -z "$SHELL_RC" ]; then
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
SHELL_RC="$HOME/.bashrc"
|
||||
elif [ -f "$HOME/.zshrc" ]; then
|
||||
SHELL_RC="$HOME/.zshrc"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$SHELL_RC" ] && ! grep -q "openfang" "$SHELL_RC" 2>/dev/null; then
|
||||
echo "export PATH=\"$INSTALL_DIR:\$PATH\"" >> "$SHELL_RC"
|
||||
echo " Added $INSTALL_DIR to PATH in $SHELL_RC"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Verify installation
|
||||
|
||||
Reference in New Issue
Block a user