summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--flags.c38
-rw-r--r--utils.c21
-rw-r--r--utils.h1
4 files changed, 49 insertions, 12 deletions
diff --git a/README.md b/README.md
index 8e821c2..af94b1f 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,7 @@ This is a C wrapper that integrates with the prebuilt package managers in variou
* Debian based distros;
* Fedora based distros;
* Gentoo based distros;
+* OpenSUSE based distros;
* Void Linux *(or xbps)* derived/based distro.
## FAQ
diff --git a/flags.c b/flags.c
index 416898c..e7741f5 100644
--- a/flags.c
+++ b/flags.c
@@ -63,19 +63,23 @@ void cleanPackages(int os)
case xbps:
system("xbps-remove -ROo");
+ break;
+
+ case zypper:
+ system("zypper cc -a");
}
}
void help()
{
printf("PKG Options:\n"
- "c - removes orphans and cleans the package cache\n"
- "h - display this message\n"
- "i - installs selected packages\n"
- "q - display installed packages\n"
- "r - remove a selected package\n"
- "s - look up for a package in the available repositories\n"
- "u - updates repos and packages\n\n");
+ "c - removes orphans and cleans the package cache\n"
+ "h - display this message\n"
+ "i - installs selected packages\n"
+ "q - display installed packages\n"
+ "r - remove a selected package\n"
+ "s - look up for a package in the available repositories\n"
+ "u - updates repos and packages\n\n");
}
void installPackages(int os, char *packages)
@@ -102,6 +106,10 @@ void installPackages(int os, char *packages)
case xbps:
commandProcessor(packages, "xbps-install -S ");
+ break;
+
+ case zypper:
+ commandProcessor(packages, "zypper install ");
}
}
}
@@ -128,6 +136,10 @@ void queryPackages(int os)
case xbps:
system("xbps-query -l");
+ break;
+
+ case zypper:
+ system("zypper packages -i");
}
}
@@ -155,6 +167,10 @@ void removePackages(int os, char *packages)
case xbps:
commandProcessor(packages, "xbps-remove -ROo ");
+ break;
+
+ case zypper:
+ commandProcessor(packages, "zypper remove -u ");
}
}
}
@@ -183,6 +199,10 @@ void searchPackages(int os, char *packages)
case xbps:
commandProcessor(packages, "xbps-query -Rs ");
+ break;
+
+ case zypper:
+ commandProcessor(packages, "zypper search ");
}
}
}
@@ -209,5 +229,9 @@ void updatePackages(int os)
case xbps:
system("xbps-install -Su");
+ break;
+
+ case zypper:
+ system("zypper update && zypper dist-upgrade");
}
}
diff --git a/utils.c b/utils.c
index 5ca2174..1b0312d 100644
--- a/utils.c
+++ b/utils.c
@@ -1,4 +1,5 @@
#include "utils.h"
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -16,38 +17,48 @@ int detectOsType()
switch (i)
{
case apt:
- if ( checkIfFileExists("/usr/bin/apt") == 0 )
+ if ( checkIfFileExists("/usr/bin/apt" ) == 0 )
{
exists = i;
}
break;
case dnf:
- if ( checkIfFileExists("/usr/bin/dnf") == 0 )
+ if ( checkIfFileExists("/usr/bin/dnf" ) == 0 )
{
exists = i;
}
break;
case emerge:
- if ( checkIfFileExists("/usr/bin/emerge") == 0 )
+ if ( checkIfFileExists("/usr/bin/emerge" ) == 0 )
{
exists = i;
}
break;
case pacman:
- if ( checkIfFileExists("/usr/bin/pacman") == 0 )
+ if ( checkIfFileExists("/usr/bin/pacman" ) == 0 )
{
exists = i;
}
break;
case xbps:
- if ( checkIfFileExists("/usr/bin/xbps-install") == 0 )
+ if ( checkIfFileExists("/usr/bin/xbps-install" ) == 0 )
{
exists = i;
}
+ break;
+
+ case zypper:
+ if ( checkIfFileExists("/usr/bin/zypper" ) == 0 )
+ {
+ exists = i;
+ }
+
+ default:
+ puts("Unrecognized Package Manager" );
}
}
return exists;
diff --git a/utils.h b/utils.h
index f7cb640..9f2b10a 100644
--- a/utils.h
+++ b/utils.h
@@ -9,6 +9,7 @@ enum os
emerge,
pacman,
xbps,
+ zypper,
ENUMSIZE
};