File: which-pkg-manager

package info (click to toggle)
qdirstat 2.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 12,024 kB
  • sloc: cpp: 26,846; perl: 543; sh: 434; xml: 80; makefile: 3
file content (35 lines) | stat: -rwxr-xr-x 628 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
#
# Show which primary package manager is used in the system.
# Currently supported: dpkg, rpm, pacman
#
# Author:  Stefan Hundhammer <Stefan.Hundhammer@gmx.de>
# License: GPL V2
#

RPM=/bin/rpm
DPKG=/usr/bin/dpkg
PACMAN=/usr/bin/pacman


check_primary_rpm()
{
    test -x $RPM && $RPM -qf $RPM | sed -e 's/-.*//'
}


check_primary_dpkg()
{
    test -x $DPKG && $DPKG -S $DPKG | grep '^dpkg:' | sed -e 's/:.*//'
}


check_primary_pacman()
{
    test -x $PACMAN && $PACMAN -Qo $PACMAN | grep "is owned by pacman" | sed -e 's/^.*is owned by //' -e 's/ .*//'
}


check_primary_rpm
check_primary_dpkg
check_primary_pacman