RangHo / dotfiles

My personal configuration and bootstrap files
GNU General Public License v3.0
23 stars 0 forks source link

Smarter installation script #2

Closed RangHo closed 3 years ago

RangHo commented 4 years ago

It might be good to have smarter installation script that can:

It would take a lot of efforts, though.

RangHo commented 3 years ago

Currently dependency of a package is described in requirements file using shell script and source'd by require.sh. I find this rather inefficient. There are two candidates to resolve this issue:

  1. mimic the format of Arch Linux's PKGBUILD, allowing to put arbitrary commands in pre-install and post-install hooks,
  2. use JSON format and parse the dependencies using jq.

The first option gives more extensibility, but the second option is far easier to manage (I think).

RangHo commented 3 years ago

Is creating a cross-distro dependency manager feasible in the first place? There are several scenarios to address:

  1. in some cases, packages are named differently depending on distributions (e.g. bat binary is packaged as bat in Arch, but batcat in Ubuntu, because of a name collision);
  2. there exists multiple "custom" repositories to download specific binaries, like AUR for Arch and PPA for Debian-likes;
  3. some packages don't exist for certain platform at all.

Trying to specify packages for all platforms might be the safest bet, but I am lazy as fuck intend to keep package description file as simple as possible.

RangHo commented 3 years ago

It seems shell script gives the optimal flexibility here. My current design provides common functionality such as installing binary package or other dotfile package, and leaves other configurations to each packages. If one package creates files elsewhere, it's that package's responsibility to clean up upon uninstallation of package. For that, package description file may provide these functions:

RangHo commented 3 years ago

Maybe requiring fzf as a part of core dependency might be a good idea. Since pretty much all package managers provide a way to search their repositories, fuzzy finding required package names and prompting users to select from multiple options should give good UX with flexibility.