feat: Enhance package detection and installation process with improved parsing and validation

This commit is contained in:
Peter Wood
2025-05-29 07:31:59 -04:00
parent d75c7c5a94
commit ed50395490
9 changed files with 460 additions and 105 deletions

View File

@@ -25,7 +25,7 @@ echo -e "${BLUE}Checking for packages.list:${NC}"
if [ -f "$HOME/shell/setup/packages.list" ]; then
echo -e "- packages.list: ${GREEN}Found${NC}"
# Count packages in list (excluding comments and empty lines)
pkg_count=$(grep -v '^//' "$HOME/shell/setup/packages.list" | grep -v -e '^$' | wc -l)
pkg_count=$(grep -v '^//' "$HOME/shell/setup/packages.list" | grep -v -e '^$' | sed 's|//.*||' | awk '{print $1}' | grep -v '^$' | wc -l)
echo -e "- Package count: ${GREEN}$pkg_count packages${NC}"
else
echo -e "- packages.list: ${RED}Not found${NC}"
@@ -36,19 +36,19 @@ fi
echo -e "${BLUE}Setting up logs directory:${NC}"
if [ -d "/logs" ]; then
echo -e "- Logs directory: ${GREEN}Found${NC}"
# Check ownership and permissions
logs_owner=$(stat -c '%U:%G' /logs)
echo -e "- Current ownership: $logs_owner"
echo "- Setting permissions on /logs directory..."
sudo chown -R $(whoami):$(whoami) /logs 2>/dev/null || echo -e "${YELLOW}Failed to set ownership${NC}"
sudo chmod -R 777 /logs 2>/dev/null || echo -e "${YELLOW}Failed to set permissions${NC}"
# Verify permissions are correct
if [ -w "/logs" ]; then
echo -e "- Write permission: ${GREEN}OK${NC}"
# Create a test file to really verify we can write
if touch "/logs/test_file" 2>/dev/null; then
echo -e "- Test write: ${GREEN}Succeeded${NC}"