Skip to content

Commit 2a73cc7

Browse files
committed
add uninstall for distros. ubuntu22 specific install script
1 parent ee22856 commit 2a73cc7

File tree

6 files changed

+31
-1
lines changed

6 files changed

+31
-1
lines changed

.github/workflows/podman-install-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
"fedora:39",
2020
"manjarolinux/base",
2121
"archlinux:latest",
22-
"opensuse/leap:latest"
22+
"opensuse/tumbleweed:latest"
2323
]
2424

2525
container:

src/main/podman/install/installOnLinux.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { script as dnfInstallScript } from './dnfInstallScript';
1212
import { script as pacmanInstallScript } from './pacmanInstallScript';
1313
import { script as yumInstallScript } from './yumInstallScript';
1414
import { script as zypperInstallScript } from './zypperInstallScript';
15+
// to be deprecated in the future
16+
import { script as ubuntu22InstallScript } from './ubuntu22InstallScript';
1517

1618
// const UBUNTU_INSTALL_SCRIPT = 'installOnUbuntuScript';
1719
/**
@@ -33,6 +35,10 @@ const installOnLinux = async (): Promise<any> => {
3335
const pkgManager: PackageManager = await findPackageManager();
3436
if (pkgManager === 'dpkg') {
3537
installScript = aptInstallScript;
38+
// to be deprecated in the future
39+
if(distro.includes('buntu') && release.includes('22.')) {
40+
installScript = ubuntu22InstallScript;
41+
}
3642
} else if (pkgManager === 'dnf') {
3743
installScript = dnfInstallScript;
3844
} else if (pkgManager === 'yum') {
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Same script as on https://podman.io/docs/installation, except the 'sudo' is removed as
2+
// sudo-prompt will not execute a command with sudo
3+
export const script = `apt-get -y update -qq
4+
apt-get -y -qq install curl
5+
mkdir -p /etc/apt/keyrings
6+
curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_22.04/Release.key \
7+
| gpg --dearmor \
8+
| tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null
9+
echo \
10+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\
11+
https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_22.04/ /" \
12+
| tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null
13+
apt-get update -qq
14+
apt-get -qq -y install podman`;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const script = 'pacman -Rs podman';

src/main/podman/uninstall/uninstallOnLinux.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import {
88
} from '../../nn-auto-updater/findPackageManager.js';
99
import { script as aptUninstallScript } from './aptUninstallScript';
1010
import { script as dnfUninstallScript } from './dnfUninstallScript';
11+
import { script as pacmanUninstallScript } from './pacmanUninstallScript';
1112
import { script as yumUninstallScript } from './yumUninstallScript';
13+
import { script as zypperUninstallScript } from './zypperUninstallScript';
1214

1315
/**
1416
* Uninstall podman by removing binaries and various configuration files
@@ -28,9 +30,14 @@ const uninstallOnLinux = async (): Promise<boolean | { error: string }> => {
2830
uninstallScript = aptUninstallScript;
2931
} else if (pkgManager === 'dnf') {
3032
uninstallScript = dnfUninstallScript;
33+
} else if (pkgManager === 'pacman') {
34+
uninstallScript = pacmanUninstallScript;
3135
} else if (pkgManager === 'yum') {
3236
uninstallScript = yumUninstallScript;
37+
} else if (pkgManager === 'zypper') {
38+
uninstallScript = zypperUninstallScript;
3339
}
40+
3441
const { stdout, stderr } = await execAwait(uninstallScript, {
3542
log: true,
3643
sudo: true,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// biome-ignore lint/style/noUnusedTemplateLiteral: less diff for future changes
2+
export const script = `zypper remove -y podman`;

0 commit comments

Comments
 (0)