diff --git a/Cargo.lock b/Cargo.lock
index 735cf99..3c500d0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -113,6 +113,7 @@ dependencies = [
"hcl-rs",
"indexmap",
"inquire",
+ "os-release",
"owo-colors",
"serde",
"spinners",
@@ -314,6 +315,15 @@ version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
+[[package]]
+name = "os-release"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "82f29ae2f71b53ec19cc23385f8e4f3d90975195aa3d09171ba3bef7159bec27"
+dependencies = [
+ "lazy_static",
+]
+
[[package]]
name = "os_str_bytes"
version = "6.5.0"
diff --git a/Cargo.toml b/Cargo.toml
index 2bbff8b..407e7ff 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,6 +18,7 @@ clap = "3.2.20"
hcl-rs = "0.14.2"
indexmap = {version = "1.9.3", features = ["serde"]}
inquire = "0.6.2"
+os-release = "0.1.0"
owo-colors = "3.5.0"
serde = "1.0.163"
spinners = "4.1.0"
diff --git a/README.md b/README.md
index 470dfaa..41bcdda 100644
--- a/README.md
+++ b/README.md
@@ -19,39 +19,30 @@
-Crosup is a CLI tool to help you quickly setup your development environment on a new Chromebook (ChromeOS), Mac or any Debian-based Linux. It is designed to be simple and easy to use.
-
-## 📦 Features
-- [x] Install vscode
-- [x] Install docker
-- [x] Install nix
-- [x] Install flox
-- [x] Install devbox
-- [x] Install homebrew
-- [x] Install fish
-- [x] Install ble.sh
-- [x] Install atuin
-- [x] Install tig
-- [x] Install fzf
-- [x] Install httpie
-- [x] Install kubectl
-- [x] Install minikube
-- [x] Install tilt
-- [x] Install zellij
-- [x] Install ripgrep
-- [x] Install fd
-- [x] Install exa
-- [x] Install bat
-- [x] Install glow
-- [x] Install devenv
-- [x] Install neovim
-- [x] Install zoxide
-- [x] Install direnv
+Crosup is a CLI tool to help you quickly setup your development environment on a new Chromebook (ChromeOS) or any Linux distribution. It is designed to be simple and easy to use.
+
+## ✨ Features
+- [x] Compatible with ChromeOS, Debian-based Linux, OpenSUSE, Fedora, RedHat, CentOS, Alpine and more!
+- [x] Detects your OS and installs the appropriate tools
+- [x] HCL/TOML configuration file
+- [x] Install developer tools like docker, nix, devbox, homebrew, flox, fish, vscode, ble.sh, atuin, tig, fzf, httpie, kubectl, minikube, tilt, zellij, ripgrep, fd, exa, bat, glow, devenv and more!
+
## 🚚 Installation
```sh
curl -sSL https://raw.githubusercontent.com/tsirysndr/crosup/master/install.sh | bash
```
+## 📦 Supported OS
+- [x] ChromeOS (Debian Container)
+- [x] Debian-based Linux
+- [x] OpenSUSE
+- [x] Fedora
+- [x] RedHat
+- [x] CentOS
+- [x] Alpine
+- [x] Arch
+- [x] Gentoo
+
## 🚀 Usage
```
______ __ __
@@ -61,7 +52,7 @@ curl -sSL https://raw.githubusercontent.com/tsirysndr/crosup/master/install.sh |
\____/_/ \____/____/\____/ .___/
/_/
-ChromeOS developer environment setup tool
+Quickly install your development tools on your new Chromebook or any Linux distribution
USAGE:
crosup [SUBCOMMAND]
@@ -78,190 +69,26 @@ SUBCOMMANDS:
zellij, ripgrep, fd, exa, bat, glow, devenv
```
-## 📝 Configuration
-Crosup uses a configuration file to determine which tools to install. The default configuration is embedded in the binary, but you can generate a default configuration file (Crosfile.hcl) using the `crosup init` subcommand, you can specify the default format using the `--toml` flag.
+## Minimal Configuration
+This is a minimal configuration file to install vim and git:
+
+```toml
+# Crosfile.toml
+[install.pkg.vim]
+packages = ["vim"]
+version_check = "vim --version"
-Example configuration file in HCL format:
-
-```hcl
-# Crosfile.hcl
-brew "install" {
- pkg "minikube" {
- preinstall = "sudo apt-get install -y qemu-system libvirt-clients libvirt-daemon-system"
- postinstall = "sudo sed -i 's/#user = \"root\"/user = \"root\"/g' /etc/libvirt/qemu.conf\nsudo sed -i 's/#group = \"root\"/group = \"root\"/g' /etc/libvirt/qemu.conf\nsudo sed -i 's/#dynamic_ownership = 1/dynamic_ownership = 0/g' /etc/libvirt/qemu.conf\nsudo sed -i 's/#remember_owner = 1/remember_owner = 0/g' /etc/libvirt/qemu.conf"
- version_check = "minikube version"
- }
-
- pkg "tilt" {
- version_check = "tilt version"
- }
-
- pkg "kubernetes-cli" {
- version_check = "kubectl version --client"
- }
-
- pkg "bat" {
- version_check = "bat --version"
- }
-
- pkg "direnv" {
- version_check = "direnv --version"
- }
-
- pkg "exa" {
- version_check = "exa --version"
- }
-
- pkg "fd" {
- version_check = "fd --version"
- }
-
- pkg "fzf" {
- version_check = "fzf --version"
- }
-
- pkg "fish" {
- version_check = "fish --version"
- }
-
- pkg "glow" {
- version_check = "glow --version"
- }
-
- pkg "httpie" {
- version_check = "http --version"
- }
-
- pkg "tig" {
- version_check = "tig --version"
- }
-
- pkg "zellij" {
- version_check = "zellij --version"
- }
-
- pkg "zoxide" {
- version_check = "zoxide --version"
- }
-
- pkg "ripgrep" {
- version_check = "rg --version"
- }
-
- pkg "neovim" {
- version_check = "nvim --version"
- }
-}
-
-git "install" {
- repo "blesh" {
- url = "https://github.com/akinomyoga/ble.sh.git"
- install = "make -C ble.sh install PREFIX=~/.local"
- preinstall = "sudo apt-get install -y gawk build-essential"
- postinstall = "echo 'source ~/.local/share/blesh/ble.sh' >> ~/.bashrc"
- install_check = "~/.local/share/blesh/ble.sh"
- recursive = true
- depth = 1
- shallow_submodules = true
- }
-}
-
-nix "install" {
- pkg "flox" {
- impure = true
- experimental_features = "nix-command flakes"
- accept_flake_config = true
- preinstall = "echo 'extra-trusted-substituters = https://cache.floxdev.com' | sudo tee -a /etc/nix/nix.conf && echo 'extra-trusted-public-keys = flox-store-public-0:8c/B+kjIaQ+BloCmNkRUKwaVPFWkriSAd0JJvuDu4F0=' | sudo tee -a /etc/nix/nix.conf"
- flake = "github:flox/floxpkgs#flox.fromCatalog"
- version_check = ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && flox --version"
- }
-
- pkg "cachix" {
- flake = "github:cachix/cachix"
- }
-
- pkg "devenv" {
- accept_flake_config = true
- preinstall = "echo \"trusted-users = root $USER\" | sudo tee -a /etc/nix/nix.conf\nsudo pkill nix-daemon\ncachix use devenv"
- flake = "github:cachix/devenv/latest"
- depends_on = [
- "cachix"
- ]
- version_check = ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && devenv version"
- }
-}
-
-curl "install" {
- script "devbox" {
- url = "https://get.jetpack.io/devbox"
- version_check = "devbox version"
-
- env {
- FORCE = "1"
- }
-
- shell = "bash"
- depends_on = [
- "nix"
- ]
- }
-
- script "atuin" {
- url = "https://raw.githubusercontent.com/ellie/atuin/main/install.sh"
- version_check = "atuin --version"
- shell = "bash"
- }
-
- script "nix" {
- url = "https://install.determinate.systems/nix"
- enable_sudo = true
- version_check = ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix --version"
- args = "install --no-confirm"
- }
-
- script "homebrew" {
- url = "https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"
- postinstall = "echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >> ~/.bashrc"
- version_check = "brew --version"
-
- env {
- NONINTERACTIVE = "true"
- }
-
- shell = "bash"
- }
-}
-
-apt "install" {
- pkg "docker" {
- gpg_key = "https://download.docker.com/linux/debian/gpg"
- gpg_path = "/etc/apt/keyrings/docker.gpg"
- setup_repository = "echo \"deb [arch=\"$(dpkg --print-architecture)\" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \"$(. /etc/os-release && echo \"$VERSION_CODENAME\")\" stable\" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null"
- apt_update = true
- packages = [
- "docker-ce",
- "docker-ce-cli",
- "containerd.io",
- "docker-buildx-plugin",
- "docker-compose-plugin"
- ]
- depends_on = [
- "ca-certificates",
- "curl",
- "gnupg"
- ]
- postinstall = "sudo usermod -aG docker $USER && newgrp docker"
- version_check = "docker --version"
- }
-
- pkg "vscode" {
- url = "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64"
- version_check = "code --version"
- }
-}
+[install.pkg.git]
+packages = ["git"]
+version_check = "git --version"
```
-Example of a Crosfile.toml for a Debian-based system:
+When you run `crosup install`, it will detect your OS and install the appropriate tools using the default package manager.
+
+## 📝 Configuration
+Crosup uses a configuration file to determine which tools to install. The default configuration is embedded in the binary, but you can generate a default configuration file (Crosfile.hcl) using the `crosup init` subcommand, you can specify the default format using the `--toml` flag.
+
+Example of a Crosfile.toml (`crosup init --toml`) for a Debian-based system:
```toml
# Crosfile.toml
diff --git a/src/cmd/install.rs b/src/cmd/install.rs
index c791478..36fd962 100644
--- a/src/cmd/install.rs
+++ b/src/cmd/install.rs
@@ -3,7 +3,7 @@ use anyhow::Error;
use crate::{config::verify_if_config_file_is_present, graph::build_installer_graph};
pub fn execute_install(tool: Option) -> Result<(), Error> {
- let config = verify_if_config_file_is_present()?;
+ let mut config = verify_if_config_file_is_present()?;
match tool {
Some(tool) => {
@@ -14,7 +14,7 @@ pub fn execute_install(tool: Option) -> Result<(), Error> {
false => vec![tool.as_str()],
};
for tool in tools {
- let (graph, installers) = build_installer_graph(&config);
+ let (graph, installers) = build_installer_graph(&mut config);
let tool = installers
.into_iter()
.find(|installer| installer.name() == tool)
@@ -24,7 +24,7 @@ pub fn execute_install(tool: Option) -> Result<(), Error> {
}
}
None => {
- let (graph, _) = build_installer_graph(&config);
+ let (graph, _) = build_installer_graph(&mut config);
graph.install_all()?;
}
}
diff --git a/src/graph.rs b/src/graph.rs
index 736e927..223b5f3 100644
--- a/src/graph.rs
+++ b/src/graph.rs
@@ -4,13 +4,17 @@ use crate::{
dnf::DnfInstaller, emerge::EmergeInstaller, git::GitInstaller, nix::NixInstaller,
pacman::PacmanInstaller, yum::YumInstaller, zypper::ZypperInstaller, Installer,
},
- macros::{add_vertex, add_vertex_with_condition, downcast_installer},
+ macros::{
+ add_vertex, add_vertex_with_condition, convert_generic_installer, downcast_installer,
+ },
types::{
configuration::Configuration,
curl::{default_brew_installer, default_nix_installer},
},
};
use anyhow::Error;
+use os_release::OsRelease;
+use owo_colors::OwoColorize;
#[derive(Debug, Clone)]
pub struct Vertex {
@@ -92,7 +96,62 @@ impl Into>> for InstallerGraph {
}
}
-pub fn build_installer_graph(config: &Configuration) -> (InstallerGraph, Vec>) {
+pub fn autodetect_installer(config: &mut Configuration) {
+ if let Some(generic_install) = &config.install {
+ // detect linux
+ if cfg!(target_os = "linux") {
+ // determine linux distribution using os-release
+ if let Ok(os_release) = OsRelease::new() {
+ let os = os_release.id.to_lowercase();
+ let os = os.as_str();
+
+ let package_manager = match os {
+ "ubuntu" | "debian" | "linuxmint" | "pop" | "elementary" | "zorin" => {
+ convert_generic_installer!(config, generic_install, apt);
+ "apt-get"
+ }
+ "fedora" | "centos" | "rhel" | "rocky" | "amazon" => {
+ convert_generic_installer!(config, generic_install, dnf);
+ "dnf"
+ }
+ "opensuse" | "sles" => {
+ convert_generic_installer!(config, generic_install, zypper);
+ "zypper"
+ }
+ "arch" | "manjaro" => {
+ convert_generic_installer!(config, generic_install, pacman);
+ "pacman"
+ }
+ "gentoo" => {
+ convert_generic_installer!(config, generic_install, emerge);
+ "emerge"
+ }
+ "alpine" => {
+ convert_generic_installer!(config, generic_install, apk);
+ "apk"
+ }
+ _ => panic!("Unsupported OS: {}", os),
+ };
+
+ let os_pretty = os_release.pretty_name;
+ println!("-> Detected OS:🐧 {}", os_pretty.magenta());
+ println!(
+ "-> Using package manager: 📦 {}",
+ package_manager.bright_green()
+ );
+ }
+ }
+ if cfg!(target_os = "macos") {
+ println!("-> Detected OS: 🍎 macOS");
+ println!("-> Using package manager: 📦 {}", "brew".bright_green());
+ convert_generic_installer!(config, generic_install, brew);
+ }
+ }
+}
+
+pub fn build_installer_graph(
+ config: &mut Configuration,
+) -> (InstallerGraph, Vec>) {
let mut graph = InstallerGraph::new();
if config.clone().nix.is_some() {
@@ -119,6 +178,8 @@ pub fn build_installer_graph(config: &Configuration) -> (InstallerGraph, Vec {
+ $config.$installer = Some(
+ [("install".into(), $generic_install.clone().into())]
+ .into_iter()
+ .chain($config.clone().$installer.unwrap_or_default().into_iter())
+ .collect(),
+ );
+ };
+}
+
pub(crate) use add_vertex;
pub(crate) use add_vertex_with_condition;
pub(crate) use apk_add;
@@ -391,6 +402,7 @@ pub(crate) use append_to_nix_conf;
pub(crate) use apt_install;
pub(crate) use brew_install;
pub(crate) use check_version;
+pub(crate) use convert_generic_installer;
pub(crate) use dnf_install;
pub(crate) use downcast_installer;
pub(crate) use emerge_install;
diff --git a/src/main.rs b/src/main.rs
index 7255358..bd33895 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -18,7 +18,7 @@ fn cli() -> Command<'static> {
\____/_/ \____/____/\____/ .___/
/_/
-ChromeOS developer environment setup tool"#,
+Quickly install your development tools on your new Chromebook or any Linux distribution"#,
)
.author("Tsiry Sandratraina ")
.subcommand(
diff --git a/src/types/configuration.rs b/src/types/configuration.rs
index a0d78d7..d286c7e 100644
--- a/src/types/configuration.rs
+++ b/src/types/configuration.rs
@@ -9,6 +9,7 @@ use super::{
dnf::DnfConfiguration,
emerge::EmergeConfiguration,
git::{default_git_install, GitConfiguration},
+ install::InstallConfiguration,
nix::{default_nix_install, NixConfiguration},
pacman::PacmanConfiguration,
yum::YumConfiguration,
@@ -22,6 +23,11 @@ pub enum ConfigFormat {
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Configuration {
+ #[serde(
+ skip_serializing_if = "Option::is_none",
+ serialize_with = "hcl::ser::block"
+ )]
+ pub install: Option,
#[serde(
skip_serializing_if = "Option::is_none",
serialize_with = "hcl::ser::labeled_block"
@@ -92,6 +98,7 @@ pub struct Configuration {
impl Default for Configuration {
fn default() -> Self {
Configuration {
+ install: None,
brew: Some(default_brew_install()),
git: Some(default_git_install()),
nix: Some(default_nix_install()),
diff --git a/src/types/curl.rs b/src/types/curl.rs
index dab2352..131f4f3 100644
--- a/src/types/curl.rs
+++ b/src/types/curl.rs
@@ -52,12 +52,18 @@ pub fn default_nix_installer() -> Script {
}
pub fn default_brew_installer() -> Script {
+ let postinstall = match std::env::consts::OS {
+ "macos" => Some("echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> ~/.zprofile".into()),
+ "linux" => {
+ Some("echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >> ~/.bashrc".into())
+ }
+ _ => None,
+ };
+
Script {
name: "homebrew".into(),
url: "https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh".into(),
- postinstall: Some(
- "echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >> ~/.bashrc".into(),
- ),
+ postinstall,
version_check: Some("brew --version".into()),
env: Some(
[("NONINTERACTIVE".into(), "true".into())]
diff --git a/src/types/install.rs b/src/types/install.rs
new file mode 100644
index 0000000..35b3f8e
--- /dev/null
+++ b/src/types/install.rs
@@ -0,0 +1,329 @@
+use indexmap::IndexMap;
+use serde::{Deserialize, Serialize};
+
+use super::{apk, apt, brew, dnf, emerge, pacman, yum, zypper};
+
+#[derive(Serialize, Deserialize, Debug, Clone, Default)]
+pub struct InstallConfiguration {
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub packages: Option>,
+
+ #[serde(serialize_with = "hcl::ser::labeled_block")]
+ pub pkg: IndexMap,
+}
+
+#[derive(Serialize, Deserialize, Debug, Clone, Default)]
+pub struct Package {
+ #[serde(skip_serializing, skip_deserializing)]
+ pub name: String,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub url: Option,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub gpg_key: Option,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub gpg_path: Option,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub setup_repository: Option,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub apt_update: Option,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub packages: Option>,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub depends_on: Option>,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub preinstall: Option,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub postinstall: Option,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub version_check: Option,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub non_interactive: Option,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub interactive: Option,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub ask: Option,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub verbose: Option,
+
+ #[serde(
+ skip_serializing_if = "Option::is_none",
+ serialize_with = "hcl::ser::block"
+ )]
+ pub apk: Option,
+
+ #[serde(
+ skip_serializing_if = "Option::is_none",
+ serialize_with = "hcl::ser::block"
+ )]
+ pub apt: Option,
+
+ #[serde(
+ skip_serializing_if = "Option::is_none",
+ serialize_with = "hcl::ser::block"
+ )]
+ pub brew: Option,
+
+ #[serde(
+ skip_serializing_if = "Option::is_none",
+ serialize_with = "hcl::ser::block"
+ )]
+ pub dnf: Option,
+
+ #[serde(
+ skip_serializing_if = "Option::is_none",
+ serialize_with = "hcl::ser::block"
+ )]
+ pub emerge: Option,
+
+ #[serde(
+ skip_serializing_if = "Option::is_none",
+ serialize_with = "hcl::ser::block"
+ )]
+ pub pacman: Option,
+
+ #[serde(
+ skip_serializing_if = "Option::is_none",
+ serialize_with = "hcl::ser::block"
+ )]
+ pub yum: Option,
+
+ #[serde(
+ skip_serializing_if = "Option::is_none",
+ serialize_with = "hcl::ser::block"
+ )]
+ pub zypper: Option,
+}
+
+impl Into for InstallConfiguration {
+ fn into(self) -> brew::BrewConfiguration {
+ let pkg = Some(
+ self.pkg
+ .into_iter()
+ .map(|(name, pkg)| match pkg.brew {
+ Some(brew) => (name.clone(), brew),
+ None => (name.clone(), brew::Package { name, ..pkg.into() }),
+ })
+ .collect(),
+ );
+ brew::BrewConfiguration {
+ pkgs: self.packages,
+ pkg,
+ }
+ }
+}
+
+impl Into for InstallConfiguration {
+ fn into(self) -> apk::ApkConfiguration {
+ let pkg = self
+ .pkg
+ .into_iter()
+ .map(|(name, pkg)| match pkg.apk {
+ Some(apk) => (name.clone(), apk),
+ None => (name.clone(), apk::Package { name, ..pkg.into() }),
+ })
+ .collect();
+ apk::ApkConfiguration { pkg }
+ }
+}
+
+impl Into for InstallConfiguration {
+ fn into(self) -> apt::AptConfiguration {
+ let pkg = self
+ .pkg
+ .into_iter()
+ .map(|(name, pkg)| match pkg.apt {
+ Some(apt) => (name.clone(), apt),
+ None => (name.clone(), apt::Package { name, ..pkg.into() }),
+ })
+ .collect();
+ apt::AptConfiguration { pkg }
+ }
+}
+
+impl Into for InstallConfiguration {
+ fn into(self) -> dnf::DnfConfiguration {
+ let pkg = self
+ .pkg
+ .into_iter()
+ .map(|(name, pkg)| match pkg.dnf {
+ Some(dnf) => (name.clone(), dnf),
+ None => (name.clone(), dnf::Package { name, ..pkg.into() }),
+ })
+ .collect();
+ dnf::DnfConfiguration { pkg }
+ }
+}
+
+impl Into for InstallConfiguration {
+ fn into(self) -> emerge::EmergeConfiguration {
+ let pkg = self
+ .pkg
+ .into_iter()
+ .map(|(name, pkg)| match pkg.emerge {
+ Some(emerge) => (name.clone(), emerge),
+ None => (name.clone(), emerge::Package { name, ..pkg.into() }),
+ })
+ .collect();
+ emerge::EmergeConfiguration { pkg }
+ }
+}
+
+impl Into for InstallConfiguration {
+ fn into(self) -> pacman::PacmanConfiguration {
+ let pkg = self
+ .pkg
+ .into_iter()
+ .map(|(name, pkg)| match pkg.pacman {
+ Some(pacman) => (name.clone(), pacman),
+ None => (name.clone(), pacman::Package { name, ..pkg.into() }),
+ })
+ .collect();
+ pacman::PacmanConfiguration { pkg }
+ }
+}
+
+impl Into for InstallConfiguration {
+ fn into(self) -> yum::YumConfiguration {
+ let pkg = self
+ .pkg
+ .into_iter()
+ .map(|(name, pkg)| match pkg.yum {
+ Some(yum) => (name.clone(), yum),
+ None => (name.clone(), yum::Package { name, ..pkg.into() }),
+ })
+ .collect();
+ yum::YumConfiguration { pkg }
+ }
+}
+
+impl Into for InstallConfiguration {
+ fn into(self) -> zypper::ZypperConfiguration {
+ let pkg = self
+ .pkg
+ .into_iter()
+ .map(|(name, pkg)| match pkg.zypper {
+ Some(zypper) => (name.clone(), zypper),
+ None => (name.clone(), zypper::Package { name, ..pkg.into() }),
+ })
+ .collect();
+ zypper::ZypperConfiguration { pkg }
+ }
+}
+
+impl Into for Package {
+ fn into(self) -> apk::Package {
+ apk::Package {
+ name: self.name,
+ packages: self.packages,
+ depends_on: self.depends_on,
+ postinstall: self.postinstall,
+ version_check: self.version_check,
+ interactive: self.interactive,
+ }
+ }
+}
+
+impl Into for Package {
+ fn into(self) -> apt::Package {
+ apt::Package {
+ name: self.name,
+ url: self.url,
+ gpg_key: self.gpg_key,
+ gpg_path: self.gpg_path,
+ setup_repository: self.setup_repository,
+ apt_update: self.apt_update,
+ packages: self.packages,
+ depends_on: self.depends_on,
+ postinstall: self.postinstall,
+ version_check: self.version_check,
+ }
+ }
+}
+
+impl Into for Package {
+ fn into(self) -> dnf::Package {
+ dnf::Package {
+ name: self.name,
+ packages: self.packages,
+ depends_on: self.depends_on,
+ postinstall: self.postinstall,
+ version_check: self.version_check,
+ }
+ }
+}
+
+impl Into for Package {
+ fn into(self) -> emerge::Package {
+ emerge::Package {
+ name: self.name,
+ packages: self.packages,
+ depends_on: self.depends_on,
+ postinstall: self.postinstall,
+ version_check: self.version_check,
+ ask: self.ask,
+ verbose: self.verbose,
+ }
+ }
+}
+
+impl Into for Package {
+ fn into(self) -> pacman::Package {
+ pacman::Package {
+ name: self.name,
+ packages: self.packages,
+ depends_on: self.depends_on,
+ postinstall: self.postinstall,
+ version_check: self.version_check,
+ }
+ }
+}
+
+impl Into for Package {
+ fn into(self) -> yum::Package {
+ yum::Package {
+ name: self.name,
+ packages: self.packages,
+ depends_on: self.depends_on,
+ postinstall: self.postinstall,
+ version_check: self.version_check,
+ }
+ }
+}
+
+impl Into for Package {
+ fn into(self) -> zypper::Package {
+ zypper::Package {
+ name: self.name,
+ packages: self.packages,
+ depends_on: self.depends_on,
+ postinstall: self.postinstall,
+ version_check: self.version_check,
+ non_interactive: self.non_interactive,
+ }
+ }
+}
+
+impl Into for Package {
+ fn into(self) -> brew::Package {
+ brew::Package {
+ name: self.name,
+ preinstall: self.preinstall,
+ postinstall: self.postinstall,
+ version_check: self.version_check,
+ }
+ }
+}
diff --git a/src/types/mod.rs b/src/types/mod.rs
index 6c3dfa9..8f7ad8b 100644
--- a/src/types/mod.rs
+++ b/src/types/mod.rs
@@ -6,6 +6,7 @@ pub mod curl;
pub mod dnf;
pub mod emerge;
pub mod git;
+pub mod install;
pub mod nix;
pub mod pacman;
pub mod yum;