patchman/client/api/getPackageList_linux.go

23 lines
522 B
Go
Raw Normal View History

2023-10-22 16:11:13 +02:00
package api
import (
"git.jmbit.de/jmb/patchman/client/apt"
"git.jmbit.de/jmb/patchman/client/common"
"git.jmbit.de/jmb/patchman/client/utils"
"git.jmbit.de/jmb/patchman/client/zypper"
2023-10-22 16:11:13 +02:00
"github.com/gin-gonic/gin"
)
func getPackageList(c *gin.Context) {
var packageList []common.ListPackage
// Get system package manager packages
switch utils.GetOSInfo().PackageManager {
case "apt":
packageList = apt.GetInstalledList()
case "zypper":
packageList = zypper.GetInstalledList()
2023-10-22 16:11:13 +02:00
}
c.JSON(200, packageList)
}