Add apk package manager

This commit is contained in:
Akemi Izuko 2023-11-19 21:52:04 -07:00
parent 44d8d56462
commit f39f1296a6
Signed by: akemi
GPG key ID: 8DE0764E1809E9FC

View file

@ -9,6 +9,11 @@ import shutil
import subprocess import subprocess
PACKAGE_MANAGERS = { PACKAGE_MANAGERS = {
"apk": {
"name": "apk",
"install_cmd": ["apk", "add"],
"check_installed": ["apk", "info", "--installed"],
},
"apt": { "apt": {
"name": "apt", "name": "apt",
"install_cmd": ["apt", "install"], "install_cmd": ["apt", "install"],
@ -30,6 +35,7 @@ PACKAGES = [
{ {
"global_name": "alacritty", "global_name": "alacritty",
"executable_name": "alacritty", "executable_name": "alacritty",
"apk": "alacritty",
"apt": "alacritty", "apt": "alacritty",
"dnf": "alacritty", "dnf": "alacritty",
"pacman": "alacritty", "pacman": "alacritty",
@ -37,6 +43,7 @@ PACKAGES = [
{ {
"global_name": "bat", "global_name": "bat",
"executable_name": "bat", "executable_name": "bat",
"apk": "bat",
"apt": "bat", "apt": "bat",
"dnf": "bat", "dnf": "bat",
"pacman": "bat", "pacman": "bat",
@ -44,6 +51,7 @@ PACKAGES = [
{ {
"global_name": "bash", "global_name": "bash",
"executable_name": "bash", "executable_name": "bash",
"apk": "bash",
"apt": "bash", "apt": "bash",
"dnf": "bash", "dnf": "bash",
"pacman": "bash", "pacman": "bash",
@ -64,6 +72,7 @@ PACKAGES = [
{ {
"global_name": "curl", "global_name": "curl",
"executable_name": "curl", "executable_name": "curl",
"apk": "curl",
"apt": "curl", "apt": "curl",
"dnf": "curl", "dnf": "curl",
"pacman": "curl", "pacman": "curl",
@ -71,11 +80,13 @@ PACKAGES = [
{ {
"global_name": "dust", "global_name": "dust",
"executable_name": "dust", "executable_name": "dust",
"apk": "dust",
"pacman": "dust", "pacman": "dust",
}, },
{ {
"global_name": "exa -> eza", "global_name": "exa -> eza",
"executable_name": "exa", "executable_name": "exa",
"apk": "exa",
"apt": "exa", "apt": "exa",
"dnf": "eza", "dnf": "eza",
"pacman": "eza", "pacman": "eza",
@ -83,6 +94,7 @@ PACKAGES = [
{ {
"global_name": "fd-find", "global_name": "fd-find",
"executable_name": "fd", "executable_name": "fd",
"apk": "fd",
"apt": "fd-find", "apt": "fd-find",
"dnf": "fd-find", "dnf": "fd-find",
"pacman": "fd", "pacman": "fd",
@ -90,6 +102,7 @@ PACKAGES = [
{ {
"global_name": "foliate", "global_name": "foliate",
"executable_name": "foliate", "executable_name": "foliate",
"apk": "foliate",
"apt": "foliate", "apt": "foliate",
"dnf": "foliate", "dnf": "foliate",
"pacman": "foliate", "pacman": "foliate",
@ -97,6 +110,7 @@ PACKAGES = [
{ {
"global_name": "fuzzel", "global_name": "fuzzel",
"executable_name": "fuzzel", "executable_name": "fuzzel",
"apk": "fuzzel",
"apt": "fuzzel", "apt": "fuzzel",
"dnf": "fuzzel", "dnf": "fuzzel",
"pacman": "fuzzel", "pacman": "fuzzel",
@ -104,6 +118,7 @@ PACKAGES = [
{ {
"global_name": "fzf", "global_name": "fzf",
"executable_name": "fzf", "executable_name": "fzf",
"apk": "fzf",
"apt": "fzf", "apt": "fzf",
"dnf": "fzf", "dnf": "fzf",
"pacman": "fzf", "pacman": "fzf",
@ -111,6 +126,7 @@ PACKAGES = [
{ {
"global_name": "gawk", "global_name": "gawk",
"executable_name": "gawk", "executable_name": "gawk",
"apk": "gawk",
"apt": "gawk", "apt": "gawk",
"dnf": "gawk", "dnf": "gawk",
"pacman": "gawk", "pacman": "gawk",
@ -118,6 +134,7 @@ PACKAGES = [
{ {
"global_name": "git", "global_name": "git",
"executable_name": "git", "executable_name": "git",
"apk": "git",
"apt": "git", "apt": "git",
"dnf": "git", "dnf": "git",
"pacman": "git", "pacman": "git",
@ -125,6 +142,7 @@ PACKAGES = [
{ {
"global_name": "git-lfs", "global_name": "git-lfs",
"executable_name": "git-lfs", "executable_name": "git-lfs",
"apk": "git-lfs",
"apt": "git-lfs", "apt": "git-lfs",
"dnf": "git-lfs", "dnf": "git-lfs",
"pacman": "git-lfs", "pacman": "git-lfs",
@ -132,6 +150,7 @@ PACKAGES = [
{ {
"global_name": "grim", "global_name": "grim",
"executable_name": "grim", "executable_name": "grim",
"apk": "grim",
"apt": "grim", "apt": "grim",
"dnf": "grim", "dnf": "grim",
"pacman": "grim", "pacman": "grim",
@ -139,6 +158,7 @@ PACKAGES = [
{ {
"global_name": "pass", "global_name": "pass",
"executable_name": "pass", "executable_name": "pass",
"apk": "pass",
"apt": "pass", "apt": "pass",
"dnf": "pass", "dnf": "pass",
"pacman": "pass", "pacman": "pass",
@ -146,6 +166,7 @@ PACKAGES = [
{ {
"global_name": "slurp", "global_name": "slurp",
"executable_name": "slurp", "executable_name": "slurp",
"apk": "slurp",
"apt": "slurp", "apt": "slurp",
"dnf": "slurp", "dnf": "slurp",
"pacman": "slurp", "pacman": "slurp",
@ -159,6 +180,7 @@ PACKAGES = [
{ {
"global_name": "imv", "global_name": "imv",
"executable_name": "imv", "executable_name": "imv",
"apk": "imv",
"apt": "imv", "apt": "imv",
"dnf": "imv", "dnf": "imv",
"pacman": "imv", "pacman": "imv",
@ -166,12 +188,14 @@ PACKAGES = [
{ {
"global_name": "jq", "global_name": "jq",
"executable_name": "jq", "executable_name": "jq",
"apk": "jq",
"apt": "jq", "apt": "jq",
"dnf": "jq", "dnf": "jq",
"pacman": "jq", "pacman": "jq",
}, },
{ {
"global_name": "Meslo Nerd font", "global_name": "Meslo Nerd font",
"apk": "font-meslo-nerd",
"pacman": "ttf-meslo-nerd", "pacman": "ttf-meslo-nerd",
}, },
{ {
@ -183,6 +207,7 @@ PACKAGES = [
{ {
"global_name": "mpv", "global_name": "mpv",
"executable_name": "mpv", "executable_name": "mpv",
"apk": "mpv",
"apt": "mpv", "apt": "mpv",
"dnf": "mpv", "dnf": "mpv",
"pacman": "mpv", "pacman": "mpv",
@ -190,6 +215,7 @@ PACKAGES = [
{ {
"global_name": "neofetch", "global_name": "neofetch",
"executable_name": "neofetch", "executable_name": "neofetch",
"apk": "neofetch",
"apt": "neofetch", "apt": "neofetch",
"dnf": "neofetch", "dnf": "neofetch",
"pacman": "neofetch", "pacman": "neofetch",
@ -197,12 +223,14 @@ PACKAGES = [
{ {
"global_name": "neovim", "global_name": "neovim",
"executable_name": "nvim", "executable_name": "nvim",
"apk": "neovim",
"apt": "neovim", "apt": "neovim",
"dnf": "neovim", "dnf": "neovim",
"pacman": "neovim", "pacman": "neovim",
}, },
{ {
"global_name": "pynvim", "global_name": "pynvim",
"apk": "py3-pynvim",
"apt": "python3-pynvim", "apt": "python3-pynvim",
"dnf": "python3-neovim", "dnf": "python3-neovim",
"pacman": "python-pynvim", "pacman": "python-pynvim",
@ -210,6 +238,7 @@ PACKAGES = [
{ {
"global_name": "ripgrep", "global_name": "ripgrep",
"executable_name": "rg", "executable_name": "rg",
"apk": "ripgrep",
"apt": "ripgrep", "apt": "ripgrep",
"dnf": "ripgrep", "dnf": "ripgrep",
"pacman": "ripgrep", "pacman": "ripgrep",
@ -217,6 +246,7 @@ PACKAGES = [
{ {
"global_name": "socat", "global_name": "socat",
"executable_name": "socat", "executable_name": "socat",
"apk": "socat",
"apt": "socat", "apt": "socat",
"dnf": "socat", "dnf": "socat",
"pacman": "socat", "pacman": "socat",
@ -224,6 +254,7 @@ PACKAGES = [
{ {
"global_name": "sway", "global_name": "sway",
"executable_name": "sway", "executable_name": "sway",
"apk": "sway",
"apt": "sway", "apt": "sway",
"dnf": "sway", "dnf": "sway",
"pacman": "sway", "pacman": "sway",
@ -231,6 +262,7 @@ PACKAGES = [
{ {
"global_name": "swaybg", "global_name": "swaybg",
"executable_name": "swaybg", "executable_name": "swaybg",
"apk": "swaybg",
"apt": "swaybg", "apt": "swaybg",
"dnf": "swaybg", "dnf": "swaybg",
"pacman": "swaybg", "pacman": "swaybg",
@ -238,6 +270,7 @@ PACKAGES = [
{ {
"global_name": "swaylock", "global_name": "swaylock",
"executable_name": "swaylock", "executable_name": "swaylock",
"apk": "swaylock",
"apt": "swaylock", "apt": "swaylock",
"dnf": "swaylock", "dnf": "swaylock",
"pacman": "swaylock", "pacman": "swaylock",
@ -252,6 +285,7 @@ PACKAGES = [
{ {
"global_name": "tmux", "global_name": "tmux",
"executable_name": "tmux", "executable_name": "tmux",
"apk": "tmux",
"apt": "tmux", "apt": "tmux",
"dnf": "tmux", "dnf": "tmux",
"pacman": "tmux", "pacman": "tmux",
@ -259,6 +293,7 @@ PACKAGES = [
{ {
"global_name": "udisks2", "global_name": "udisks2",
"executable_name": "udisksctl", "executable_name": "udisksctl",
"apk": "udisks2",
"apt": "udisks2", "apt": "udisks2",
"dnf": "udisks2", "dnf": "udisks2",
"pacman": "udisks2", "pacman": "udisks2",
@ -266,6 +301,7 @@ PACKAGES = [
{ {
"global_name": "vifm", "global_name": "vifm",
"executable_name": "vifm", "executable_name": "vifm",
"apk": "vifm",
"apt": "vifm", "apt": "vifm",
"dnf": "vifm", "dnf": "vifm",
"pacman": "vifm", "pacman": "vifm",
@ -273,11 +309,13 @@ PACKAGES = [
{ {
"global_name": "viu", "global_name": "viu",
"executable_name": "viu", "executable_name": "viu",
"apk": "viu",
"pacman": "viu", "pacman": "viu",
}, },
{ {
"global_name": "wl-clipboard", "global_name": "wl-clipboard",
"executable_name": "wl-copy", "executable_name": "wl-copy",
"apk": "wl-clipboard",
"apt": "wl-clipboard", "apt": "wl-clipboard",
"dnf": "wl-clipboard", "dnf": "wl-clipboard",
"pacman": "wl-clipboard", "pacman": "wl-clipboard",
@ -285,6 +323,7 @@ PACKAGES = [
{ {
"global_name": "wlsunset", "global_name": "wlsunset",
"executable_name": "wlsunset", "executable_name": "wlsunset",
"apk": "wlsunset",
"apt": "wlsunset", "apt": "wlsunset",
"dnf": "wlsunset", "dnf": "wlsunset",
"pacman": "wlsunset", "pacman": "wlsunset",
@ -292,6 +331,7 @@ PACKAGES = [
{ {
"global_name": "wtype", "global_name": "wtype",
"executable_name": "wtype", "executable_name": "wtype",
"apk": "wtype",
"apt": "wtype", "apt": "wtype",
"dnf": "wtype", "dnf": "wtype",
"pacman": "wtype", "pacman": "wtype",
@ -305,12 +345,14 @@ PACKAGES = [
}, },
{ {
"global_name": "zathura-pdf-mupdf", "global_name": "zathura-pdf-mupdf",
"apk": "zathura-pdf-mupdf",
"dnf": "zathura-pdf-mupdf", "dnf": "zathura-pdf-mupdf",
"pacman": "zathura-pdf-mupdf", "pacman": "zathura-pdf-mupdf",
}, },
{ {
"global_name": "zathura", "global_name": "zathura",
"executable_name": "zathura", "executable_name": "zathura",
"apk": "zathura",
"apt": "zathura", "apt": "zathura",
"dnf": "zathura", "dnf": "zathura",
"pacman": "zathura", "pacman": "zathura",
@ -376,7 +418,9 @@ def extra_installs():
def find_package_manager(): def find_package_manager():
global PACKAGE_MANAGERS global PACKAGE_MANAGERS
if shutil.which("apt"): if shutil.which("apk"):
return PACKAGE_MANAGERS["apk"]
elif shutil.which("apt"):
return PACKAGE_MANAGERS["apt"] return PACKAGE_MANAGERS["apt"]
elif shutil.which("dnf"): elif shutil.which("dnf"):
return PACKAGE_MANAGERS["dnf"] return PACKAGE_MANAGERS["dnf"]