Show detailed per-application configuration status

- Replace simple yes/no check with detailed per-app status display
- Show configuration status for each detected browser individually
- Display Firefox, Brave, Chrome, Chromium status separately
- Show NPM and Pip configuration status
- Always show status even when apps are configured
- Allow reconfiguration even if some apps are already set up
- Count configured vs total browsers for smart prompting

Output example:
📱 Application Configuration Status:
    Firefox: Configured
   ⚠️  Brave: Not configured
    Chromium: Configured
   ⚠️  NPM: Not configured

Benefits:
- Users can see exactly which apps are configured
- Easy to identify missing configurations
- Can reconfigure specific apps without full reset
- More transparent and informative
This commit is contained in:
mindesbunister
2025-10-06 09:37:14 +02:00
parent 642c8c64ff
commit 8e5b6e8036

View File

@@ -551,22 +551,84 @@ analyze_and_prompt() {
echo " swapon --show # Check zram status" echo " swapon --show # Check zram status"
echo "" echo ""
# Check if applications are already configured for tmpfs # Check if applications are configured for tmpfs
local current_user=$(logname 2>/dev/null || echo $SUDO_USER) local current_user=$(logname 2>/dev/null || echo $SUDO_USER)
local user_home=$(eval echo ~$current_user) local user_home=$(eval echo ~$current_user)
local apps_configured=false
# Quick check if browsers are configured echo "📱 Application Configuration Status:"
if [[ -f "$user_home/.mozilla/firefox"/*default*/prefs.js ]] && \ local configured_browsers=0
grep -q "tmpfs-cache" "$user_home/.mozilla/firefox"/*default*/prefs.js 2>/dev/null; then local total_browsers=0
apps_configured=true
# Check each browser
if [[ -d "$user_home/.mozilla/firefox" ]]; then
((total_browsers++))
if grep -q "tmpfs-cache" "$user_home/.mozilla/firefox"/*default*/prefs.js 2>/dev/null; then
echo " ✅ Firefox: Configured"
((configured_browsers++))
else
echo " ⚠️ Firefox: Not configured"
fi
fi fi
if [[ ! $apps_configured ]]; then if [[ -d "$user_home/.config/BraveSoftware" ]]; then
echo "📱 Application Configuration:" ((total_browsers++))
echo " ⚠️ Your applications are not yet configured to use tmpfs caches" if [[ -f "$user_home/.local/share/applications/brave-browser.desktop" ]] && \
echo "" grep -q "tmpfs-cache" "$user_home/.local/share/applications/brave-browser.desktop" 2>/dev/null; then
read -p " Would you like to automatically configure your browsers and dev tools? (y/N): " -n 1 -r echo " ✅ Brave: Configured"
((configured_browsers++))
else
echo " ⚠️ Brave: Not configured"
fi
fi
if [[ -d "$user_home/.config/google-chrome" ]]; then
((total_browsers++))
if [[ -f "$user_home/.local/share/applications/google-chrome.desktop" ]] && \
grep -q "tmpfs-cache" "$user_home/.local/share/applications/google-chrome.desktop" 2>/dev/null; then
echo " ✅ Chrome: Configured"
((configured_browsers++))
else
echo " ⚠️ Chrome: Not configured"
fi
fi
if [[ -d "$user_home/.config/chromium" ]]; then
((total_browsers++))
if [[ -f "$user_home/.local/share/applications/chromium-browser.desktop" ]] && \
grep -q "tmpfs-cache" "$user_home/.local/share/applications/chromium-browser.desktop" 2>/dev/null; then
echo " ✅ Chromium: Configured"
((configured_browsers++))
else
echo " ⚠️ Chromium: Not configured"
fi
fi
# Check dev tools
local npm_configured=false
if command -v npm &>/dev/null; then
local npm_cache=$(sudo -u $current_user npm config get cache 2>/dev/null)
if [[ "$npm_cache" == *"tmpfs-cache"* ]]; then
echo " ✅ NPM: Configured"
npm_configured=true
else
echo " ⚠️ NPM: Not configured"
fi
fi
local pip_configured=false
if command -v pip3 &>/dev/null || command -v pip &>/dev/null; then
if [[ -f "$user_home/.config/pip/pip.conf" ]] && \
grep -q "tmpfs-cache" "$user_home/.config/pip/pip.conf" 2>/dev/null; then
echo " ✅ Pip: Configured"
pip_configured=true
else
echo " ⚠️ Pip: Not configured"
fi
fi
echo ""
if [[ $configured_browsers -lt $total_browsers ]] || [[ $npm_configured == false ]] || [[ $pip_configured == false ]]; then
read -p " Would you like to configure/reconfigure your applications? (y/N): " -n 1 -r
echo echo
if [[ $REPLY =~ ^[Yy]$ ]]; then if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "" echo ""