|
104 | 104 | if command -v pip &> /dev/null; then
|
105 | 105 | echo "Updating PIP and all installed Python packages..."
|
106 | 106 |
|
107 |
| - # Upgrade pip first |
| 107 | + # Upgrade PIP itself first |
108 | 108 | python3 -m pip install --upgrade pip
|
109 | 109 |
|
110 |
| - # Upgrade all packages while resolving dependencies properly |
111 |
| - pip list --outdated --format=freeze | awk -F '==' '{print $1}' | xargs -r python3 -m pip install --upgrade |
| 110 | + # Install system dependencies to prevent errors |
| 111 | + if command -v apt &> /dev/null; then |
| 112 | + sudo apt install -y cmake pkg-config libvirt-dev libpq-dev gobject-introspection |
| 113 | + elif command -v dnf &> /dev/null; then |
| 114 | + sudo dnf install -y cmake pkgconf-pkg-config libvirt-devel postgresql-devel gobject-introspection |
| 115 | + elif command -v pacman &> /dev/null; then |
| 116 | + sudo pacman -S --needed --noconfirm cmake pkg-config libvirt postgresql-libs gobject-introspection |
| 117 | + fi |
| 118 | + |
| 119 | + # Get a list of outdated packages and upgrade them |
| 120 | + outdated_packages=$(pip list --outdated --format=columns | awk 'NR>2 {print $1}') |
| 121 | + |
| 122 | + if [ -n "$outdated_packages" ]; then |
| 123 | + echo "Upgrading: $outdated_packages" |
| 124 | + echo "$outdated_packages" | xargs -n1 python3 -m pip install --upgrade |
| 125 | + else |
| 126 | + echo "All PIP packages are up to date." |
| 127 | + fi |
112 | 128 | fi
|
113 | 129 |
|
114 | 130 |
|
115 | 131 |
|
| 132 | + |
116 | 133 | if command -v poetry &> /dev/null; then
|
117 | 134 | echo "Updating Poetry packages..."
|
118 | 135 | poetry self update
|
|
160 | 177 | # Container and Virtualization
|
161 | 178 | if command -v docker &> /dev/null; then
|
162 | 179 | echo "Updating Docker images..."
|
163 |
| - docker images --format "{{.Repository}}" | xargs -L1 docker pull |
| 180 | + if groups | grep -q '\bdocker\b'; then |
| 181 | + docker images --format "{{.Repository}}" | xargs -L1 docker pull |
| 182 | + else |
| 183 | + echo "Skipping Docker updates: User lacks permissions. Run 'sudo usermod -aG docker $USER' and restart." |
| 184 | + fi |
164 | 185 | fi
|
165 | 186 |
|
| 187 | + |
166 | 188 | if command -v podman &> /dev/null; then
|
167 | 189 | echo "Updating Podman images..."
|
168 |
| - podman images --format "{{.Repository}}" | xargs -L1 podman pull |
| 190 | + podman_images=$(podman images --format "{{.Repository}}") |
| 191 | + |
| 192 | + if [ -n "$podman_images" ]; then |
| 193 | + echo "$podman_images" | xargs -L1 podman pull |
| 194 | + else |
| 195 | + echo "No Podman images found to update." |
| 196 | + fi |
169 | 197 | fi
|
170 | 198 |
|
| 199 | + |
171 | 200 | if command -v minikube &> /dev/null; then
|
172 | 201 | echo "Updating Minikube..."
|
173 | 202 | minikube update-check
|
|
0 commit comments