#package-manager #linux #apt #yum #linux-distro #program #programs

no-std palin

Utility Liblary for linux's package managers, such as apt, yum, pacman

8 releases (breaking)

new 0.8.0 Dec 13, 2024
0.7.0 Sep 27, 2024
0.6.0 Sep 26, 2024
0.5.0 Sep 15, 2024
0.1.0 Jan 22, 2024

#228 in Unix APIs

Download history 7/week @ 2024-09-02 88/week @ 2024-09-09 89/week @ 2024-09-16 302/week @ 2024-09-23 71/week @ 2024-09-30 11/week @ 2024-10-07 20/week @ 2024-10-14 10/week @ 2024-10-21 4/week @ 2024-10-28 9/week @ 2024-11-04 9/week @ 2024-11-18 6/week @ 2024-11-25 14/week @ 2024-12-02 195/week @ 2024-12-09

224 downloads per month
Used in 2 crates (via sys-info-extended)

MIT license

64KB
1K SLoC

Palin - An utility liblary for package managers.

Palin is a Utility Liblary for linux's package managers, such as apt, yum, pacman. It can detect which package managers installed in a linux distro, checks if a program installed in that. In next releases, new utilites will be added.

Consider to give a like on github repo if you like that crate.

Guide


use palin::*;

fn main() {
    let package_managers = find_package_managers(); // this returns: Vec<&'a str>

    // then check which package managers exist and do your stuff depending on that. It usually will return this kind of answer:

    // ["apt", "dpkg"]
    // ["yum", "dnf", "rpm"]
    // ["apk", "busybox"]
    // etc...
}

Then you can check is a program installed on a package managers list. That functions returns a boolean:


use palin::*;

fn main(){
    let is_wget_exist_in_apt = check_if_exist_in_apt("wget");
    let is_wget_exist_in_dpkg = check_if_exist_in_dpkg("wget");
    let is_wget_exist_in_yum = check_if_exist_in_yum("wget");
    let is_wget_exist_in_dnf = check_if_exist_in_dnf("wget");
    let is_wget_exist_in_rpm = check_if_exist_in_rpm("wget");
    let is_wget_exist_in_pacman = check_if_exist_in_pacman("wget");
    let is_wget_exist_in_busybox = check_if_exist_in_busybox("wget");
}

And also you can check existences of some specific programs:


use palin::*;

fn main(){
    let is_curl_exist = check_if_curl_exist();
    let is_wget_exist = check_if_wget_exist();
    let is_dig_exist = check_if_dig_exist();
    let is_ip_exist = check_if_ip_exist();
}

Then you can get an apt program if apt exist:


use palin::*;

fn main(){
    // check if apt exist before

    let get_wget_program = get_apt_program("wget").unwrap();

    // do your other stuff 
}

Planned Features For Future Releases

  • Adding support for listing the programs of package managers.
  • Adding support for showing more information support for programs of package managers.

No runtime deps