Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
No build reason found for SLE-Module-Legacy:s390x
home:dspinella
rinstall
rinstall-0.2.0~git35.c30f365.obscpio
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File rinstall-0.2.0~git35.c30f365.obscpio of Package rinstall
07070100000000000041ED00000000000000000000000266252D7200000000000000000000000000000000000000000000002500000000rinstall-0.2.0~git35.c30f365/.github07070100000001000041ED00000000000000000000000266252D7200000000000000000000000000000000000000000000002F00000000rinstall-0.2.0~git35.c30f365/.github/workflows07070100000002000081A400000000000000000000000166252D72000007B0000000000000000000000000000000000000003900000000rinstall-0.2.0~git35.c30f365/.github/workflows/cargo.ymlon: [push, pull_request] name: Continuous integration jobs: check: name: Check runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true - uses: actions-rs/cargo@v1 with: command: check test: name: Test Suite runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true - uses: actions-rs/cargo@v1 with: command: test fmt: name: Rustfmt runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true - run: rustup component add rustfmt - uses: actions-rs/cargo@v1 with: command: fmt args: --all -- --check clippy: name: Clippy runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true - run: rustup component add clippy - uses: actions-rs/cargo@v1 with: command: clippy args: -- -D warnings audit: name: Audit runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true - name: Install cargo-audit binary crate uses: actions-rs/install@v0.1 with: crate: cargo-audit version: latest use-tool-cache: true - name: Security audit uses: actions-rs/audit-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} 07070100000003000081A400000000000000000000000166252D7200000482000000000000000000000000000000000000003B00000000rinstall-0.2.0~git35.c30f365/.github/workflows/release.ymlon: push: tags: - '*.*.*' name: Release jobs: release: name: Release Packaging runs-on: ubuntu-latest strategy: matrix: target: [x86_64-unknown-linux-musl] steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true target: ${{ matrix.target }} - name: Release Build uses: actions-rs/cargo@v1 with: command: build args: --release --target ${{ matrix.target }} - name: Strip binary run: strip target/${{ matrix.target }}/release/rinstall - name: Create tarball run: | touch .tarball cp target/${{ matrix.target }}/release/rinstall rinstall tar -cvf rinstall-${{ matrix.target }}.tar.zst \ rinstall \ README.md \ LICENSE.md \ install.yml \ .tarball - name: Upload release tarball uses: softprops/action-gh-release@v1 with: files: rinstall-${{ matrix.target }}.tar.zst 07070100000004000081A400000000000000000000000166252D7200000008000000000000000000000000000000000000002800000000rinstall-0.2.0~git35.c30f365/.gitignore/target 07070100000005000081A400000000000000000000000166252D7200000750000000000000000000000000000000000000002A00000000rinstall-0.2.0~git35.c30f365/CHANGELOG.md# 0.3.0 * **Breaking changes**: + For `rust` packages, all the files will be searched inside of the output directory (usually `target`) and, if they don't exist, inside the project directory. This allows rinstall to correctly get files generated by `build.rs` without adding too much clutter in the `install.yml`. To force rinstall to get a file in the project directory, use the `$PROJECTDIR` placeholder. + Don't require --system when --packaging is in use. Due to this change, --system and --packaging are now conflicting. * Bugfixes: * Always add an ending '/' to directory paths, both in the default ones and in the one read from the command line. Fixes #6. # 0.2.0 * install.yml: + Add new `systemd-user-units` key * **Breaking changes**: + Use `XDG_DATA_HOME` as `localstatedir` in non system-wide installations + Use `/usr/local/lib/systemd` as systemd_unitsdir instead of `/usr/local/lib/systemd/system` + `user-config` will be installed as docs in system-wide installations + Move default command to an install subcommand * Add colored output * Add new `--rust-debug-target` flag * Small improvements to dry mode and warnings * Improved README.md documentation * Add autogenerated man pages and completions * Add $PROJECTDIR placeholder for rust projects * Take multiple packages in `uninstall` command * Add support for pkginfo files as argument in `uninstall` * Rework rinstall arguments * Enable system mode dependending on the flag; previously it was always enabled when rinstall was executed as root * Add --update flag to install command * Improved messages * Add elvish completions # 0.1.1 * In non system-wide installations, use XDG_DATA_HOME as localstatedir * Improve error messages when handling man pages * Fix rinstall binary location in the release tarball # 0.1.0 First release of rinstall. 07070100000006000081A400000000000000000000000166252D72000052BE000000000000000000000000000000000000002800000000rinstall-0.2.0~git35.c30f365/Cargo.lock# This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "addr2line" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] [[package]] name = "adler" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "anstream" version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", "utf8parse", ] [[package]] name = "anstyle" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" dependencies = [ "anstyle", "windows-sys 0.52.0", ] [[package]] name = "arrayref" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" [[package]] name = "arrayvec" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "backtrace" version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", ] [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "blake3" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" dependencies = [ "arrayref", "arrayvec", "cc", "cfg-if", "constant_time_eq", ] [[package]] name = "camino" version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" dependencies = [ "serde", ] [[package]] name = "cc" version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", "clap_derive", ] [[package]] name = "clap_builder" version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ "anstream", "anstyle", "clap_lex", "strsim", "terminal_size", ] [[package]] name = "clap_complete" version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd79504325bf38b10165b02e89b4347300f855f273c4cb30c4a3209e6583275e" dependencies = [ "clap", ] [[package]] name = "clap_derive" version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ "heck", "proc-macro2", "quote", "syn", ] [[package]] name = "clap_lex" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "clap_mangen" version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1dd95b5ebb5c1c54581dd6346f3ed6a79a3eef95dd372fc2ac13d535535300e" dependencies = [ "clap", "roff", ] [[package]] name = "color-eyre" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55146f5e46f237f7423d74111267d4597b59b0dad0ffaf7303bce9945d843ad5" dependencies = [ "backtrace", "eyre", "indenter", "once_cell", "owo-colors", ] [[package]] name = "colorchoice" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "colored" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" dependencies = [ "lazy_static", "windows-sys 0.48.0", ] [[package]] name = "constant_time_eq" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" [[package]] name = "crc32fast" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] [[package]] name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", "windows-sys 0.52.0", ] [[package]] name = "eyre" version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" dependencies = [ "indenter", "once_cell", ] [[package]] name = "filetime" version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", "redox_syscall", "windows-sys 0.52.0", ] [[package]] name = "flate2" version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", ] [[package]] name = "gimli" version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "indenter" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown", ] [[package]] name = "itoa" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "json" version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd" [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "linux-raw-sys" version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "log" version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "memchr" version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "miniz_oxide" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "object" version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] [[package]] name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "owo-colors" version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" [[package]] name = "proc-macro2" version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] [[package]] name = "redox_syscall" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] [[package]] name = "rinstall" version = "0.3.0" dependencies = [ "blake3", "camino", "clap", "clap_complete", "clap_mangen", "color-eyre", "colored", "flate2", "json", "lazy_static", "libc", "log", "semver", "serde", "serde_yaml", "tar", "void", "walkdir", "xdg", ] [[package]] name = "roff" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b833d8d034ea094b1ea68aa6d5c740e0d04bad9d16568d08ba6f76823a114316" [[package]] name = "rustc-demangle" version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", "windows-sys 0.52.0", ] [[package]] name = "ryu" version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "same-file" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ "winapi-util", ] [[package]] name = "semver" version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" dependencies = [ "serde", ] [[package]] name = "serde" version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "serde_yaml" version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ "indexmap", "itoa", "ryu", "serde", "unsafe-libyaml", ] [[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" version = "2.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "tar" version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" dependencies = [ "filetime", "libc", "xattr", ] [[package]] name = "terminal_size" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" dependencies = [ "rustix", "windows-sys 0.48.0", ] [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unsafe-libyaml" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" [[package]] name = "utf8parse" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "walkdir" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", ] [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ "windows-targets 0.48.5", ] [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ "windows-targets 0.52.4", ] [[package]] name = "windows-targets" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm 0.48.5", "windows_aarch64_msvc 0.48.5", "windows_i686_gnu 0.48.5", "windows_i686_msvc 0.48.5", "windows_x86_64_gnu 0.48.5", "windows_x86_64_gnullvm 0.48.5", "windows_x86_64_msvc 0.48.5", ] [[package]] name = "windows-targets" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ "windows_aarch64_gnullvm 0.52.4", "windows_aarch64_msvc 0.52.4", "windows_i686_gnu 0.52.4", "windows_i686_msvc 0.52.4", "windows_x86_64_gnu 0.52.4", "windows_x86_64_gnullvm 0.52.4", "windows_x86_64_msvc 0.52.4", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" [[package]] name = "xattr" version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" dependencies = [ "libc", "linux-raw-sys", "rustix", ] [[package]] name = "xdg" version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" 07070100000007000081A400000000000000000000000166252D72000004BE000000000000000000000000000000000000002800000000rinstall-0.2.0~git35.c30f365/Cargo.toml[package] name = "rinstall" version = "0.3.0" edition = "2021" license = "GPL-3.0+" authors = ["Danilo Spinella <danilo.spinella@suse.com>"] keywords = ["packaging"] repository = "https://github.com/danyspin97/rinstall" homepage = "https://github.com/danyspin97/rinstall" description = "Declarative install for programs" categories = ["command-line-utilities"] [dependencies] blake3 = "1.5.1" camino = { version = "1.1.6", features = [ "serde1" ] } clap = { version = "4.5.4", features = ["derive", "env", "wrap_help", "help", "usage", "error-context"] } color-eyre = { version = "0.6.3", default-features = false } colored = "2.1.0" json = "0.12.4" lazy_static = "1.4.0" libc = "0.2.153" log = { version = "0.4.21", features = [ "std" ] } semver = { version = "1.0.22", features = ["serde"] } serde = { version = "1.0.197", features = ["derive"] } serde_yaml = "0.9.34" xdg = "2.5.2" walkdir = "2.5.0" void = "1.0.2" tar = "0.4.40" flate2 = "1.0.28" [build-dependencies] clap = { version = "4.5.4", features = ["derive", "cargo", "env"] } clap_complete = "4.5.2" clap_mangen = "0.2.20" # used for the imports in src/config.rs serde = { version = "1.0.197", features = ["derive"] } [profile.release] lto = true 07070100000008000081A400000000000000000000000166252D7200008864000000000000000000000000000000000000002800000000rinstall-0.2.0~git35.c30f365/LICENSE.md### GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. ### Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. ### TERMS AND CONDITIONS #### 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. #### 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. #### 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. #### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. #### 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. #### 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: - a) The work must carry prominent notices stating that you modified it, and giving a relevant date. - b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". - c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. - d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. #### 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: - a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. - b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. - c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. - d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. - e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. #### 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: - a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or - b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or - c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or - d) Limiting the use for publicity purposes of names of licensors or authors of the material; or - e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or - f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. #### 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. #### 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. #### 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. #### 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. #### 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. #### 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. #### 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. #### 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. #### 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. #### 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS ### How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: <program> Copyright (C) <year> <name of author> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands \`show w' and \`show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/licenses/why-not-lgpl.html>. 07070100000009000081A400000000000000000000000166252D7200004F98000000000000000000000000000000000000002700000000rinstall-0.2.0~git35.c30f365/README.md# rinstall ![GitHub branch checks state](https://img.shields.io/github/checks-status/danyspin97/rinstall/main?logo=github) ![GitHub](https://img.shields.io/github/license/danyspin97/rinstall) **rinstall** is an helper tool that installs software and additional data into the system. Many programs often include man pages, documentation, config files and there is no standard way to install them except for using Makefiles or complete build system. However, Makefiles are notoriously complicated to setup; it is especially hard to follow the [Directory Variables] from the _GNU Coding Standard_.). Build systems instead cover the installation part but depending on an entire build system to install a shell script or a rust binary is not optimal. You can read more of _rinstall_ rationale [here][Makefiles Best Practices]. [Directory Variables]: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html [Makefiles Best Practices]: https://danyspin97.org/blog/makefiles-best-practices/ rinstall read a declarative YAML file (`install.yml`) containing the list of the files to install. It then installs the program either system-wide or for the current user (following the [XDG BaseDirectories]). It reads the default configuration for the system from `/etc/rinstall.yml` or `.config/rinstall.yml`, using a default one otherwise. [XDG BaseDirectories]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html [![Packaging status](https://repology.org/badge/vertical-allrepos/rinstall.svg)](https://repology.org/project/rinstall/versions) ## Features - List the files to install and their location in a declarative way - Ensure backward compatibility (no need to update `install.yml` every new rinstall version) - Support for both user and system-wide installation - Works inside the codebase or from the release tarball - Native support for _Rust_ programs and *cargo* - Easy uninstallation of packages - Allow templating of documentation and man pages - Support for GNU Directory standard, FHS and XDG BaseDirectories, with optional configuration - Support most common types of files - Reproducible installation - Packagers friendly ## Build To build from source run the following command: ``` $ cargo build --release ``` To install rinstall for the current user: ``` $ ./target/release/rinstall install -y ``` ## Usage If the project has an `install.yml` file present, either in the root directory or in the `.package` directory, it supports installation via **rinstall**. Run rinstall as your user to see the changes that will be done to the filesystem: ``` $ rinstall install ``` After having reviewed the changes, add `-y` or `--yes` to perform an user installation: ``` $ rinstall install --yes ``` The same apply for performing a system-wide installation, enabled by adding the flag `--system`. To list the changes made to the filesystem, run **rinstall** in dry mode (i.e. without the flag`--yes`): ``` $ rinstall install --system ``` To accept the changes, run again the command and append the flag `-y` or `--yes`. You need to run the command as root to apply the changes to the filestem. ``` # rinstall install --system -y ``` ### Uninstall When a package gets installed, a file with the suffix `.pkg` will be created inside `$localstatedir/rinstall` (by default `/usr/local/var/ rinstall` for system installations and `$HOME/.local/share/rinstall` for user installations). This file will contain the list of installed files, allowing the the `uninstall` subcommand to revert the installation of a package: ```bash $ rinstall uninstall wpaperd Would remove /home/danyspin97/.local/bin/wpaperd Would remove /home/danyspin97/.local/bin/wpaperctl Would remove /home/danyspin97/.local/share/bash-completion/wpaperd.bash Would remove /home/danyspin97/.local/share/licenses/wpaperd/LICENSE.md Would remove /home/danyspin97/.local/share/rinstall/wpaperd.pkg ``` ### Packagers rinstall support the packagers use-case out of the box. When calling rinstall inside a package specification (i.e. spec file, `PKGBUILD`, `ebuild`), add the `--packaging` flag and it will enable all relevant flags and ask you the needed information: ```bash $ rinstall install --packaging --destdir mydestdir >>> Package rinstall Would install target/release/rinstall -> mydestdir/usr/local/bin/rinstall Would install target/release/man/rinstall.1 -> mydestdir/usr/local/share/man/man1/rinstall.1 Would install README.md -> mydestdir/usr/local/share/doc/rinstall/README.md ... ``` ### Release tarballs **rinstall** supports installing from release tarballs (i.e. the tarballs published on Github for each release containing a compiled version of the program). To allow a program to be installed from a release tarball create a `.tarball` empty file during the generation and include `install.yml`. **rinstall** will then assume that all the files are in the top directory and proceed to install them as usual; this means that for _Rust_ programs, the executables will be searched in the top directory instead of `target/release`. Please assure that all the files listed in `install.yml` are included in the tarball. ## Configuration The installation directories chosen by rinstall can be configured by adding and tweaking the file `rinstall.yml` under the `sysconfdir`. By default, `/etc/rinstall.yml` and `$HOME/.config/rinstall.yml` will be used respectively for the root user and the non-root user. The root configuration should already be installed by the rinstall package of your distribution and it can also be found in the `config/root/` directory of this repository; the non-root user configuration can be found in the `config/user/` directory. All the placeholders will be replaced at runtime by **rinstall**. Additionally, a different configuration file can be passed by using the `--config` (or `-c`) command line argument. All the values can also be overridden when invoking rinstall by using the respective command line arguments. The configuration is a YAML file that can contain the following keys. If any of them is missing, a default value will be used instead. - `bindir` - `libdir` - `datarootdir` - `datadir` - `sysconfdir` - `localstatedir` - `runstatedir` - `systemd_unitsdir` In addition, the system-wide configuration can contain the following keys: - `prefix` - `exec_prefix` - `sbindir` - `libexecdir` - `includedir` - `docdir` - `mandir` - `pam_modulesdir` Please refer to the [Directory Variables] for their usage. If any key is missing, ### Placeholders in configuration #### Root user configuration In the configuration you may want to set a value based on another directory set prior. For example you may want `bindir` to be a directory `bin` relative to the `exec_prefix` directory. **rinstall** supports placeholders in the configuration to allow this: ``` exec_prefix: /usr/local bindir: @exec_prefix@/bin ``` The root user configuration allows for the following placeholders: - `@prefix@`, supported by all values - `@exec_prefix@`, supported in `bindir` and `libdir` - `@localstatedir@`, supported in `runstatedir` - `@datarootdir@`, supported in `docdir` and `mandir` - `@libdir`, supported in `pam_modulesdir` and `systemd_unitsdir` #### Non-root user configuration Non-root user configuration relies on XDG Directories, so it allows placeholders that refer to these values. The placeholders will be replaced by the environment variable and, if it is not set, it will fallback on a default value: ``` datadir: @XDG_DATA_HOME@ sysconfdir: @XDG_CONFIG_HOME@ ``` The non-root user configuratione supports for the following placeholders: - `@XDG_DATA_HOME@`, supported in `datarootdir` and `datadir` - `@XDG_CONFIG_HOME@`, supported in `sysconfdir` and `systemd_unitsdir` - `@XDG_STATE_HOME@`, supported in `localstatedir` - `@XDG_RUNTIME_DIR@`, supported in `runstatedir` - `@sysconfdir@`, supported in `systemd_unitsdir` ### `<pkg-name>` An additional placeholder used when configuring the directories is `<pkg- name>`; this will automatically be replaced by the package name used inside `install.yml`. Some directories (e.g. `docdir` use this placeholder by default). Manually set the directories to remove it. ## Writing `install.yml` To support **rinstall**, place an `install.yml` file into the root of your project. It shall contain the rinstall version to use and the packages to install. Each package shall contain the entries of the files to install, divided by their purpose/destination. Example file for a program named `foo` written in Rust that only install an executable with the same name: ```yaml rinstall: 0.1.0 pkgs: foo: type: rust exe: - foo ``` ### `install.yml` examples - [kanidm](https://github.com/kanidm/kanidm/blob/master/install.yml) - [wpaperd](https://github.com/danyspin97/wpaperd/blob/main/install.yml) - [dog in openSUSE](https://build.opensuse.org/package/view_file/network:utilities/dog/install.yml?expand=1) - [myxer in openSUSE](https://build.opensuse.org/package/view_file/multimedia:apps/myxer/install.yml?expand=1) ### rinstall version each **rinstall** release will have a respective version of the spec file; each version might support new entry types but it might remove support for some as well. rinstall will support older releases, along with all its entry types which were allowed. ### Packages **rinstall** support the installation of multiple packages from the same repository. Put all the packages under a unique name inside the key `pkgs` in the `install.yml` file (even if there is only one package): ```yaml rinstall: 0.1.0 pkgs: foo: type: rust exe: - foo bar: type: rust exe: - bar bar-c: include: - bar.h ``` ### Entries Each entry list a file to install and it shall either be a string or a struct containing the following data: - `src`: the source, containing the location to the file that will be installed. Unless noted, it shall always be relative to the project directory. - `dst`: the destination (_optional_), containing the directory or file where that this entry should be installed to. It shall always be relative, the corresponding system directory will be appended based on the type of entry; e.g. for `exe` entries, the destination part will be appended to `bindir`. To mark the destination as a directory, add a leading path separator `/`. - `tmpl`: enable templating for the current entry; refer to **templating** for more information. When the entry is only a string, it shall contains the source and follows the same rules as `src`. Example entry defined by a struct: ```yaml src: myprog.sh dst: myprog ``` Example entry where destination is a directory: ```yaml src: myprog dst: internaldir/ ``` ### Valid entries **rinstall** allows for the following keys: _Note_: ***each entry will be available for both system and non-system wide installations except were expliticly noted***. #### Type (_since 0.1.0_) The type part can either be `rust` or `default`. If no value is specified, then `default` will be used. - `rust` for projects built using `cargo`. The target directory is fetched using `cargo metadata` and used as root directory for executables and libraries. I.e. you don't need to use `target/release/myexe` when listing executables, but just `myexe`. If you need to install an executable script in a Rust project, use `$PROJECTDIR/` prefix. - `default` for all the other projects. All the directories will be relative to the root directory of the project. #### `exe` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *no* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$bindir` | `/usr/local/bin` | | *user-wide* | `$bindir` | `$HOME/.local/bin` | For the executables. #### `admin_exe` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *yes* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$sbindir` | `/usr/local/sbin` | For admin executables; they will be installed in `sbindir` (which defaults to `/usr/local/sbin`). #### `libs` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *no* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$libdir` | `/usr/local/lib` | | *user-wide* | `$libdir` | `$HOME/.local/lib` | For the libraries. #### `libexec` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *yes* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$libexecdir` | `/usr/local/libexec` | #### `include` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *yes* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$includedir` | `/usr/local/include` | For headers. #### `man` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *yes* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$mandir` | `/usr/local/share/man` | For the man pages. #### `data` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *no* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$datarootdir` | `/usr/local/lib` | | *user-wide* | `$XDG_DATA_HOME` | `$HOME/.local/share` | For architecture independent files. #### `docs` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *yes* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$datarootdir/<pkg-name>` | `/usr/local/share/doc/<pkg-name>` | For documentation and examples. #### `config` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *no* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$sysconfdir/<pkg-name>` | `/usr/local/etc/<pkg-name>` | | *user-wide* | `$XDG_CONFIG_HOME/<pkg-name>` | `$HOME/.config/<pkg-name>` | For configuration files. #### `user-config` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *no* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$datarootdir/<pkg-name>/user-config` | `/usr/local/share/docs/<pkg-name>/user-config` | | *user-wide* | `$XDG_CONFIG_HOME` | `$HOME/.config` | For configuration files that can only be used by non-root users. For system-wide installations, these files will be treated as documentation. #### `desktop-files` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *no* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$datarootdir/applications` | `/usr/local/share/applications` | | *user-wide* | `$XDG_DATA_HOME/applications` | `$HOME/.local/share/applications` | For `.desktop` files; they will be installed in folder `applications` under `datarootdir` (which defaults to `/usr/local/share/applications`). #### `appstream-metadata` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *yes* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$datarootdir/metainfo` | `/usr/local/share/metainfo` | For [AppStream metadata] files. [AppStream metadata]: https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html #### `completions` | | Version | System-wide only | | --- | --- | --- | | *bash* | _since 0.1.0_ | *no* | | *elvish* | _since 0.2.0_ | *no* | | *fish* | _since 0.1.0_ | *yes* | | *zsh* | _since 0.1.0_ | *yes* | For completions files; they will be installed in the respective shell completions directory, under `datarootdir`: - `$datarootdir/bash-completion/completions` for *bash* - `$datarootdir/elvish/lib` for *elvish* - `$datarootdir/fish/vendor_completions.d` for *fish* - `$datarootdir/zsh/site-functions` for *zsh* Example: ```yaml completions: bash: - cat.bash - cp.bash fish: - cat.fish - cp.fish zsh: - _cat - _cp ``` #### `pam-modules` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *yes* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$libdir/security` | `/usr/local/lib/security` | For PAM modules. If only `src` is provided, and the name of the file starts with `lib`, e.g. `libpam_mymodule.so`, it will be automatically converted to `pam_mymodule.so`. #### `systemd-units` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *yes* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$systemd_unitsdir/system` | `/usr/local/lib/systemd/system` | For systemd system units. #### `systemd-user-units` | Version | System-wide only | | --- | --- | | _since 0.2.0_ | *no* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$systemd_unitsdir/user` | `/usr/local/lib/systemd/user` | | *user-wide* | `$XDG_DATA_HOME/systemd/user` | `$HOME/.local/share/systemd/user` | For systemd user units; they will be installed in `@systemd_unitsdir@/user` (`/usr/local/lib/systemd/user` by default). #### `icons` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *no* | For icons. There two different locations for icons: - `@datarootdir@/pixmaps` (system-wide only) - `@datarootdir@/icons` To install an icon into one or the other, use `pixmaps`: ```yaml icons: - src: myicon.svg pixmaps: true ``` The icons in the latter are divided into different folders by: - `theme`, which defaults to `hicolor` - `dimensions`, which is the size of the icon in the form of `YxY` (`48x48`) or `scalable` for svg icons (**mandatory**) - `type`, which defaults to `apps` Example: ```yaml icons: - src: myicon.svg dimensions: scalable ``` `theme` and `type` are optional. For more information the entries in `@datarootdir@/icons`, have a look at the [Directory Layout] of the freedesktop icon theme specification. [Directory Layout]: https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout #### `terminfo` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *yes* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$datarootdir/terminfo` | `/usr/local/share/terminfo` | For terminfo sources. The source files won't be compiled by **rinstall**. Please compile them manually after installation by using `tic`. The files there are divided into different folders based on the first letter of the file name. For example the file `alacritty.info` should be installed in `/usr/local/share/terminfo/a/alacritty.info`. Just use the name of the file in `src` or `dst` and **rinstall** will handle the directory. #### `licenses` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *no* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$datarootdir/licenses/<pkg-name>` | `/usr/local/share/licenses/<pkg-name>` | | *user-wide* | `$XDG_DATA_HOME/licenses/<pkg-name>` | `$HOME/.local/share/applications/<pkg-name>` | For licenses. #### `pkg-config` | Version | System-wide only | | --- | --- | | _since 0.1.0_ | *yes* | | | Installed in | Defaults to | | --- | --- | --- | | *system-wide* | `$libdir/pkgconfig` | `/usr/local/lib/pkgconfig` | For `pkg-config` files. ### Templating Sometimes it might be required to refer to some installed file or some location. However, these locations are only known when installing, so they can't be hard-coded into the file itself. **rinstall** allows to replace some placeholders with the actual directories. To enable templating for a file, add `tmpl: true` to an entry: ``` docs: - src: my-doc.md tmpl: true ``` `my-doc.md` file will contains one of the placeholders specified below and they will be replaced automatically by rinstall. For example if it contains the following contents: ``` This project has used @prefix@ as its prefix and @bindir@ as its bindir. ``` Then we invoke rinstall like this: ``` # rinstall install -y --prefix /usr --bindir "@prefix@/bin" ``` The documentation file `my-doc.md` installed will look like the following: ``` This project has used /usr as its prefix and /usr/bin as its bindir. ``` #### Allowed placeholders The following placeholders will be replaced with their respective value when templating is enabled for an entry: - `@prefix@` - `@exec_prefix@` - `@bindir@` - `@datarootdir@` - `@datadir@` - `@sysconfdir@` - `@localstatedir@` - `@runstatedir@` - `@includedir@` - `@docdir@` - `@mandir@` - `@pam_modulesdir@` - `@systemd_unitsdir@` ## License **rinstall** is licensed under the GPL-3+ license. 0707010000000A000081A400000000000000000000000166252D7200000592000000000000000000000000000000000000002600000000rinstall-0.2.0~git35.c30f365/build.rsuse clap_complete::{generate_to, Shell}; use clap_mangen::Man; use std::io::Error; use std::path::Path; use std::{fs::File, path::PathBuf}; use clap::{Args, CommandFactory, Parser, Subcommand, ValueEnum}; use serde::Deserialize; include!("src/dirs_config.rs"); include!("src/install_cmd.rs"); include!("src/uninstall.rs"); include!("src/tarball_cmd.rs"); include!("src/opts.rs"); fn build_shell_completion(outdir: &Path) -> Result<(), Error> { let mut opts = Opts::command(); let shells = Shell::value_variants(); for shell in shells { generate_to(*shell, &mut opts, "rinstall", outdir)?; } Ok(()) } fn build_manpages(outdir: &Path) -> Result<(), Error> { let opts = Opts::command(); let file = Path::new(&outdir).join("rinstall.1"); let mut file = File::create(file)?; Man::new(opts).render(&mut file)?; Ok(()) } fn main() -> Result<(), Box<dyn std::error::Error>> { println!("cargo:rerun-if-changed=src/cli.rs"); println!("cargo:rerun-if-changed=man"); let outdir = PathBuf::from(std::env::var("OUT_DIR").unwrap()) .ancestors() .nth(3) .unwrap() .to_path_buf(); let comp_path = outdir.join("completions"); let man_path = outdir.join("man"); std::fs::create_dir_all(&comp_path)?; std::fs::create_dir_all(&man_path)?; build_shell_completion(&comp_path)?; build_manpages(&man_path)?; Ok(()) } 0707010000000B000041ED00000000000000000000000266252D7200000000000000000000000000000000000000000000002400000000rinstall-0.2.0~git35.c30f365/config0707010000000C000041ED00000000000000000000000266252D7200000000000000000000000000000000000000000000002900000000rinstall-0.2.0~git35.c30f365/config/root0707010000000D000081A400000000000000000000000166252D72000001C2000000000000000000000000000000000000003600000000rinstall-0.2.0~git35.c30f365/config/root/rinstall.ymlprefix: /usr/local exec_prefix: @prefix@ bindir: @exec_prefix@/bin sbindir: @exec_prefix@/sbin libdir: @exec_prefix@/lib libexecdir: @exec_prefix@/libexec datarootdir: @prefix@/share datadir: @prefix@/share sysconfdir: @prefix@/etc localstatedir: @prefix@/var runstatedir: @localstatedir@/run includedir: @prefix@/include docdir: @datarootdir@/doc mandir: @datarootdir@/man pam_modulesdir: @libdir@/security systemd_unitsdir: @libdir@/systemd/system 0707010000000E000041ED00000000000000000000000266252D7200000000000000000000000000000000000000000000002900000000rinstall-0.2.0~git35.c30f365/config/user0707010000000F000081A400000000000000000000000166252D72000000F0000000000000000000000000000000000000003600000000rinstall-0.2.0~git35.c30f365/config/user/rinstall.ymlbindir: .local/bin libdir: .local/lib datarootdir: @XDG_DATA_HOME@ datadir: @XDG_DATA_HOME@/share sysconfdir: @XDG_CONFIG_HOME@ localstatedir: @XDG_STATE_HOME@ runstatedir: @XDG_RUNTIME_DIR@ systemd_unitsdir: @XDG_CONFIG_HOME@/systemd/user 07070100000010000041ED00000000000000000000000266252D7200000000000000000000000000000000000000000000002500000000rinstall-0.2.0~git35.c30f365/contrib07070100000011000081A400000000000000000000000166252D7200000139000000000000000000000000000000000000003000000000rinstall-0.2.0~git35.c30f365/contrib/rpm.macros%rinstall() \ %{shrink:\ %{_bindir}/rinstall \ install \ --packaging \ --destdir=%{buildroot} \ --prefix=%{_prefix} \ --libdir=%{_libdir} \ --libexecdir=%{_libexecdir} \ --includedir=%{_includedir} \ --mandir=%{_mandir} \ --systemd-unitsdir=%{_systemd_unitdir} \ --yes } 07070100000012000081A400000000000000000000000166252D72000001E0000000000000000000000000000000000000002900000000rinstall-0.2.0~git35.c30f365/install.ymlrinstall: 0.2.0 pkgs: rinstall: type: rust exe: - rinstall docs: - README.md licenses: - LICENSE.md man: - man/rinstall.1 completions: bash: - completions/rinstall.bash elvish: - completions/rinstall.elv fish: - completions/rinstall.fish zsh: - completions/_rinstall rinstall_rpm_macros: libs: - src: contrib/rpm.macros dst: rpm/macros.d/macros.rinstall 07070100000013000081A400000000000000000000000166252D7200000044000000000000000000000000000000000000002A00000000rinstall-0.2.0~git35.c30f365/rustfmt.tomlfn_args_layout = "Vertical" tab_spaces = 4 use_try_shorthand = true 07070100000014000041ED00000000000000000000000266252D7200000000000000000000000000000000000000000000002100000000rinstall-0.2.0~git35.c30f365/src07070100000015000081A400000000000000000000000166252D72000011AD000000000000000000000000000000000000002900000000rinstall-0.2.0~git35.c30f365/src/dirs.rsuse std::env; use camino::{Utf8Path, Utf8PathBuf}; use color_eyre::{eyre::ensure, Result}; use crate::DirsConfig; pub struct Dirs { pub prefix: Option<Utf8PathBuf>, pub exec_prefix: Option<Utf8PathBuf>, pub bindir: Utf8PathBuf, pub sbindir: Option<Utf8PathBuf>, pub libdir: Utf8PathBuf, pub libexecdir: Utf8PathBuf, pub datarootdir: Utf8PathBuf, pub datadir: Utf8PathBuf, pub sysconfdir: Utf8PathBuf, pub localstatedir: Utf8PathBuf, pub runstatedir: Utf8PathBuf, pub includedir: Option<Utf8PathBuf>, pub docdir: Option<Utf8PathBuf>, pub mandir: Option<Utf8PathBuf>, pub pam_modulesdir: Option<Utf8PathBuf>, pub systemd_unitsdir: Utf8PathBuf, } impl Dirs { pub fn new( dirs_config: DirsConfig, system: bool, ) -> Result<Self> { let mut dirs = Self { prefix: dirs_config.prefix.map(Utf8PathBuf::from), exec_prefix: dirs_config.exec_prefix.map(Utf8PathBuf::from), bindir: Utf8PathBuf::from(dirs_config.bindir.unwrap()), sbindir: dirs_config.sbindir.map(Utf8PathBuf::from), libdir: Utf8PathBuf::from(dirs_config.libdir.unwrap()), libexecdir: Utf8PathBuf::from(dirs_config.libexecdir.unwrap()), datarootdir: Utf8PathBuf::from(dirs_config.datarootdir.unwrap()), datadir: Utf8PathBuf::from(dirs_config.datadir.unwrap()), sysconfdir: Utf8PathBuf::from(dirs_config.sysconfdir.unwrap()), localstatedir: Utf8PathBuf::from(dirs_config.localstatedir.unwrap()), runstatedir: Utf8PathBuf::from(dirs_config.runstatedir.unwrap()), includedir: dirs_config.includedir.map(Utf8PathBuf::from), docdir: dirs_config.docdir.map(Utf8PathBuf::from), mandir: dirs_config.mandir.map(Utf8PathBuf::from), pam_modulesdir: dirs_config.pam_modulesdir.map(Utf8PathBuf::from), systemd_unitsdir: Utf8PathBuf::from(dirs_config.systemd_unitsdir.unwrap()), }; if system { dirs.check_absolute_paths()?; } else { dirs.append_home(); } Ok(dirs) } fn append_home(&mut self) { let home = &env::var("HOME").unwrap(); macro_rules! append_home_to { ( $($var:ident),* ) => { $( if self.$var.is_relative() { self.$var = Utf8Path::new(home).join(&self.$var); } )* }; } append_home_to!( bindir, libdir, libexecdir, datarootdir, datadir, sysconfdir, localstatedir, runstatedir, systemd_unitsdir ); } /// Check that all paths are absolute fn check_absolute_paths(&self) -> Result<()> { macro_rules! check_abs_path_impl { ($var:expr, $name:tt) => { ensure!( $var.is_absolute(), "{}, with path '{}', is not an absolute path", $name, $var ); }; } macro_rules! check_abs_path { ( $($var:ident, $name:tt),* ) => { $( check_abs_path_impl!(self.$var, $name); )* }; } macro_rules! check_abs_path_opt { ( $($var:ident, $name:tt),* ) => { $( if let Some(ref path) = self.$var { check_abs_path_impl!(path, $name); } )* }; } check_abs_path!( bindir, "bindir", libdir, "libdir", libexecdir, "libexecdir", datarootdir, "datarootdir", datadir, "datadir", sysconfdir, "sysconfdir", localstatedir, "localstatedir", runstatedir, "runstatedir", systemd_unitsdir, "systemd-unitsdir" ); check_abs_path_opt!( prefix, "prefix", exec_prefix, "exec_prefix", includedir, "includedir", docdir, "docdir", mandir, "mandir", pam_modulesdir, "pam_modulesdir" ); Ok(()) } } 07070100000016000081A400000000000000000000000166252D7200001454000000000000000000000000000000000000003000000000rinstall-0.2.0~git35.c30f365/src/dirs_config.rs#[derive(Args, Deserialize, Clone)] pub struct DirsConfig { #[clap( long, requires = "system", env, help = concat!("A prefix used in constructing the default values of the directories", " listed below. (system only)", " [default: /usr/local]") )] pub prefix: Option<String>, #[clap( long, requires = "system", env, help = concat!("A prefix used in constructing the default values of some of the", " variables listed below. (system only)", " [default: @prefix@])]") )] pub exec_prefix: Option<String>, #[clap( long, env, help = concat!("The directory for installing executable programs that users can run.", " [system default: @exec_prefix@/bin] [user default: $HOME/.local/bin]") )] pub bindir: Option<String>, #[clap( long, requires = "system", env, help = concat!("The directory for installing executable programs that can be run from the", " shell, but are only generally useful to system administrators.", " (system only)", " [default: @exec_prefix@/sbin]") )] pub sbindir: Option<String>, #[clap( long, env, help = concat!("The directory for object files and libraries of object code.", " [system default: @exec_prefix@/lib] [user default: $HOME/.local/lib]") )] pub libdir: Option<String>, #[clap( long, requires = "system", env, help = concat!("The directory for installing executable programs to be run by other", " programs rather than by users. (system only)", " [default: @exec_prefix@/libexec]") )] pub libexecdir: Option<String>, #[clap( long, env, help = concat!("The root of the directory tree for read-only architecture-independent", " data files.", " [system default: @prefix@/share] [user default: @XDG_DATA_HOME@]") )] pub datarootdir: Option<String>, #[clap( long, env, help = concat!("The directory for installing idiosyncratic read-only architecture-independent", " data files for this program.", " [default: @datarootdir@]") )] pub datadir: Option<String>, #[clap( long, env, help = concat!("The directory for installing read-only data files that pertain to a single", " machine–that is to say, files for configuring a host.", " [system default: @prefix@/etc] [user default: @XDG_CONFIG_HOME@]") )] pub sysconfdir: Option<String>, #[clap( long, env, help = concat!("The directory for installing data files which the programs modify while they run,", " and that pertain to one specific machine.", " [system default: @prefix@/var] [user default: @XDG_DATA_HOME@]") )] pub localstatedir: Option<String>, #[clap( long, env, help = concat!("The directory for installing data files which the programs modify while", " they run and which need not persist longer than the execution of the", " program.", " [system default: @localstatedir@/run] [user default: @XDG_RUNTIME_DIR@]") )] pub runstatedir: Option<String>, #[clap( long, requires = "system", env, help = concat!("The directory for installing header files to be included by user programs", " with the C ‘#include’ preprocessor directive. (system only)", " [default: @prefix@/include]") )] pub includedir: Option<String>, #[clap( long, requires = "system", env, help = concat!("The directory for installing documentation files (other than Info)", " The package name will be appendend automatically. (system only)", " [default: @datarootdir@/doc]") )] pub docdir: Option<String>, #[clap( long, requires = "system", env, help = concat!("The top-level directory for installing the man pages (if any)", " (system only)", " [default: @datarootdir@/man]") )] pub mandir: Option<String>, #[clap( long, requires = "system", env, help = concat!("The directory for installing the pam modules for this package. (system only)", "[default: @libdir@/security]") )] pub pam_modulesdir: Option<String>, #[clap( long, env, help = concat!("The directory for installing the systemd unit files for this package.", " (system only)", "[default: @libdir@/systemd]") )] pub systemd_unitsdir: Option<String>, } 07070100000017000081A400000000000000000000000166252D720000206A000000000000000000000000000000000000003500000000rinstall-0.2.0~git35.c30f365/src/dirs_config_impl.rsuse std::fs; use camino::Utf8PathBuf; use clap::Args; use color_eyre::{ eyre::{ensure, ContextCompat, WrapErr}, Result, }; use serde::Deserialize; use xdg::BaseDirectories; lazy_static! { static ref XDG: BaseDirectories = BaseDirectories::new() .context("unable to initialize XDG Base Directories") .unwrap(); } include!("dirs_config.rs"); macro_rules! update_fields { ($update:expr, $other:expr, $($field:tt),*) => { $( if let Some($field) = $other.$field { $update.$field = Some($field); } )* }; } impl DirsConfig { pub fn load( config: Option<&str>, system: bool, opts: &mut Self, ) -> Result<Self> { let mut dirs_config = if system { Self::system_config() } else { Self::user_config() }; let config_file = if let Some(config_file) = config { let config_file = Utf8PathBuf::from(config_file); ensure!(config_file.exists(), "config file does not exist"); config_file } else if system { Utf8PathBuf::from("/etc/rinstall.yml") } else { Utf8PathBuf::from_path_buf(XDG.place_config_file("rinstall.yml")?).unwrap() }; if config_file.exists() { let config_from_file = serde_yaml::from_str( &fs::read_to_string(&config_file) .with_context(|| format!("unable to read file {:?}", config_file))?, )?; dirs_config.merge(system, config_from_file); } opts.sanitize(); dirs_config.merge(system, opts.clone()); dirs_config.replace_placeholders(system)?; Ok(dirs_config) } #[must_use] pub fn system_config() -> Self { Self { prefix: Some("/usr/local/".to_string()), exec_prefix: Some("@prefix@".to_string()), bindir: Some("@exec_prefix@bin/".to_string()), sbindir: Some("@exec_prefix@sbin/".to_string()), libdir: Some("@exec_prefix@lib/".to_string()), libexecdir: Some("@exec_prefix@libexec/".to_string()), datarootdir: Some("@prefix@share/".to_string()), datadir: Some("@prefix@share/".to_string()), sysconfdir: Some("@prefix@etc/".to_string()), localstatedir: Some("@prefix@var/".to_string()), runstatedir: Some("@localstatedir@run/".to_string()), includedir: Some("@prefix@include/".to_string()), docdir: Some("@datarootdir@doc/".to_string()), mandir: Some("@datarootdir@man/".to_string()), pam_modulesdir: Some("@libdir@security/".to_string()), systemd_unitsdir: Some("@libdir@systemd/".to_string()), } } #[must_use] pub fn user_config() -> Self { Self { prefix: None, exec_prefix: None, bindir: Some(".local/bin/".to_string()), sbindir: None, libdir: Some(".local/lib/".to_string()), libexecdir: Some(".local/libexec/".to_string()), datarootdir: Some("@XDG_DATA_HOME@/".to_string()), datadir: Some("@XDG_DATA_HOME@/".to_string()), sysconfdir: Some("@XDG_CONFIG_HOME@/".to_string()), localstatedir: Some("@XDG_DATA_HOME@/".to_string()), runstatedir: Some("@XDG_RUNTIME_DIR@/".to_string()), includedir: None, docdir: None, mandir: None, pam_modulesdir: None, systemd_unitsdir: Some("@sysconfdir@/systemd/".to_string()), } } pub fn merge( &mut self, system: bool, other: Self, ) { if system { self.merge_root_conf(other); } else { self.merge_user_conf(other); } } fn merge_root_conf( &mut self, config: Self, ) { update_fields!( self, config, prefix, exec_prefix, bindir, sbindir, libdir, libexecdir, datarootdir, datadir, sysconfdir, localstatedir, runstatedir, includedir, docdir, mandir, pam_modulesdir, systemd_unitsdir ); } fn merge_user_conf( &mut self, config: Self, ) { update_fields!( self, config, bindir, libdir, libexecdir, datarootdir, datadir, sysconfdir, localstatedir, runstatedir, systemd_unitsdir ); } pub fn replace_placeholders( &mut self, system: bool, ) -> Result<()> { if system { self.replace_root_placeholders(); } else { self.replace_user_placeholders(&XDG) .context("unable to sanitize user directories")?; } Ok(()) } fn replace_root_placeholders(&mut self) { macro_rules! replace { ( $replacement:ident, $needle:literal, $($var:ident),* ) => { $( self.$var = Some(self.$var .as_ref() .unwrap() .replace($needle, self.$replacement.as_ref().unwrap())); )* }; } replace!( prefix, "@prefix@", exec_prefix, bindir, sbindir, libdir, libexecdir, datadir, datarootdir, sysconfdir, localstatedir, runstatedir, includedir, docdir, mandir, pam_modulesdir, systemd_unitsdir ); replace!( exec_prefix, "@exec_prefix@", bindir, sbindir, libdir, libexecdir ); replace!(localstatedir, "@localstatedir@", runstatedir); replace!(datarootdir, "@datarootdir@", docdir, mandir); replace!(libdir, "@libdir@", pam_modulesdir, systemd_unitsdir); } fn replace_user_placeholders( &mut self, xdg: &BaseDirectories, ) -> Result<()> { macro_rules! replace { ( $var:ident, $needle:literal, $replacement:expr ) => { self.$var = Some(self.$var.as_ref().unwrap().replace( $needle, $replacement.as_os_str().to_str().with_context(|| { format!("unable to convert {:?} to String", $replacement) })?, )); }; } replace!(datarootdir, "@XDG_DATA_HOME@", xdg.get_data_home()); replace!(datadir, "@XDG_DATA_HOME@", xdg.get_data_home()); replace!(sysconfdir, "@XDG_CONFIG_HOME@", xdg.get_config_home()); replace!(localstatedir, "@XDG_DATA_HOME@", xdg.get_data_home()); let runtime_directory = xdg .get_runtime_directory() .context("insecure XDG_RUNTIME_DIR found")?; replace!(runstatedir, "@XDG_RUNTIME_DIR@", runtime_directory); replace!(systemd_unitsdir, "@XDG_CONFIG_HOME@", xdg.get_config_home()); replace!(systemd_unitsdir, "@sysconfdir@", xdg.get_config_home()); Ok(()) } fn sanitize(&mut self) { macro_rules! add_ending_slash { ( $($var:ident),* ) => { $( if let Some(path) = self.$var.as_mut() { if !path.ends_with("/") { path.push_str("/"); } } )* }; } add_ending_slash!( prefix, exec_prefix, bindir, sbindir, libdir, libexecdir, datarootdir, datadir, sysconfdir, localstatedir, runstatedir, includedir, docdir, mandir, pam_modulesdir, systemd_unitsdir ); } } 07070100000018000081A400000000000000000000000166252D72000007E9000000000000000000000000000000000000002900000000rinstall-0.2.0~git35.c30f365/src/icon.rsuse std::str::FromStr; use camino::Utf8PathBuf; use color_eyre::{eyre::ensure, Result}; use serde::Deserialize; use void::Void; #[derive(Deserialize)] #[serde(deny_unknown_fields)] pub struct Icon { #[serde(rename(deserialize = "src"))] pub source: Utf8PathBuf, #[serde(rename(deserialize = "dst"))] pub destination: Option<Utf8PathBuf>, #[serde(rename(deserialize = "type"))] pub icon_type: Option<String>, pub theme: Option<String>, pub dimensions: Option<String>, #[serde(default)] pub pixmaps: bool, } impl Icon { const fn new_with_source(source: Utf8PathBuf) -> Self { Self { source, destination: None, icon_type: None, theme: None, dimensions: None, pixmaps: true, } } pub fn get_destination(&self) -> Result<Utf8PathBuf> { let dest = if self.pixmaps { Utf8PathBuf::from("pixmaps").join("") } else { ensure!( self.dimensions.is_some(), "dimensions must be set for all non pixmaps icons" ); let default_theme: &'static str = "hicolor"; let default_icon_type: &'static str = "apps"; let theme = self.theme.as_deref().unwrap_or(default_theme); let icon_type = self.icon_type.as_deref().unwrap_or(default_icon_type); Utf8PathBuf::from("icons") .join(theme) .join(self.dimensions.as_ref().unwrap()) .join(icon_type) .join("") }; if let Some(destination) = &self.destination { Ok(dest.join(destination)) } else { Ok(dest) } } } impl FromStr for Icon { // This implementation of `from_str` can never fail, so use the impossible // `Void` type as the error type. type Err = Void; fn from_str(s: &str) -> Result<Self, Self::Err> { Ok(Self::new_with_source(Utf8PathBuf::from(s))) } } 07070100000019000081A400000000000000000000000166252D7200000B9E000000000000000000000000000000000000003000000000rinstall-0.2.0~git35.c30f365/src/install_cmd.rs#[derive(Args, Clone)] pub struct InstallCmd { #[clap(help = "Path to the rinstall.yml configuration", from_global)] pub config: Option<String>, #[clap( long = "system", help = "Perform a system-wide installation", global = true )] pub system: bool, #[clap( short = 'y', long = "yes", help = "Accept the changes and perform the installation" )] pub accept_changes: bool, #[clap( short = 'f', long = "force", help = "Force the installation by overwriting (non-config) files", conflicts_with = "destdir" )] pub force: bool, #[clap( long = "update-config", help = "Overwrite the existing configurations of the package", conflicts_with = "destdir" )] pub update_config: bool, #[clap( long, help = concat!("Use the generated binaries and libraries from the", " debug profile (only effective for rust projects)") )] pub rust_debug_target: bool, #[clap( long, help = concat!("Use the generated binaries and libraries from this", " target triple (only effective for rust projects)") )] pub rust_target_triple: Option<String>, #[clap( short = 'D', long, help = "Install all the files relative to this directory", env )] pub destdir: Option<String>, #[clap( long = "skip-pkginfo", help = "Skip the installation of rinstall pkginfo, used for uninstallation", conflicts_with = "destdir" )] pub skip_pkg_info: bool, #[clap( short = 'P', long, help = "Path to the directory containing the project to install", default_value_os_t = std::env::current_dir() .expect("unable to get current directory"), )] pub package_dir: std::path::PathBuf, #[clap( short = 'p', long = "pkgs", help = "List of packages to install, separated by a comma" )] pub packages: Vec<String>, #[clap( short = 'U', long = "update", help = "Update the current installed package" )] pub update: bool, #[clap( long, help = concat!("Enable packaging mode (use system directories", " enable --skip-pkginfo and requires --destdir)"), conflicts_with_all(["skip_pkg_info", "system"]), requires = "destdir" )] pub packaging: bool, #[clap( long, help = "List of the completion types to install. Possible values are: bash, elvish, fish, zsh" )] pub completions: Option<String>, #[clap( long, help = "Path to a tarball to install the package from", conflicts_with = "package_dir", hide = true )] pub tarball: Option<std::path::PathBuf>, #[clap(flatten, next_help_heading = "DIRECTORIES")] pub dirs: DirsConfig, } 0707010000001A000081A400000000000000000000000166252D7200004CC0000000000000000000000000000000000000003500000000rinstall-0.2.0~git35.c30f365/src/install_cmd_impl.rsuse std::{ fs::{self, File}, io::{BufReader, Cursor, Read}, }; use camino::{Utf8Path, Utf8PathBuf}; use clap::Args; use color_eyre::{ eyre::{bail, ensure, Context, ContextCompat}, Result, }; use colored::Colorize; use flate2::bufread::GzDecoder; use log::{info, warn}; use walkdir::WalkDir; use crate::{ dirs::Dirs, dirs_config_impl::DirsConfig, install_spec::InstallSpec, install_target::InstallEntry, package::{CompletionsToInstall, Package, Type}, package_info::PackageInfo, project::{RustDirectories, RUST_DIRECTORIES, RUST_DIRECTORIES_ONCE}, templating::apply_templating, utils::{append_destdir, write_to_file}, Uninstall, }; include!("install_cmd.rs"); impl InstallCmd { // Returns true if we need to use the system directories pub fn system_dirs(&self) -> bool { // If it is being run as root, or --system / --packaging have been set (unsafe { libc::getuid() } == 0) || self.system || self.packaging } pub fn skip_pkg_info(&self) -> bool { self.skip_pkg_info || self.packaging } pub fn run(mut self) -> Result<()> { let dirs_config = DirsConfig::load(self.config.as_deref(), self.system_dirs(), &mut self.dirs)?; let dirs = Dirs::new(dirs_config, self.system_dirs()).context("unable to create dirs")?; let completions = if let Some(completions) = self.completions.as_ref() { CompletionsToInstall::parse(completions)? } else { CompletionsToInstall::all() }; // Disable the experimental tarball feature if let Some(tarball) = self.tarball.as_ref() { let tarball = Utf8Path::from_path(tarball) .with_context(|| format!("{tarball:?} contains invalid UTF-8 characters"))?; ensure!(tarball.exists(), "{tarball} does not exists"); // Decoompress the content of the archive let mut decoder = GzDecoder::new(BufReader::new( File::open(tarball).with_context(|| format!("unable to open tarball {tarball}"))?, )); let mut buf = Vec::new(); decoder .read_to_end(&mut buf) .with_context(|| format!("unable to decompress tarball {tarball}"))?; let cursor = Cursor::new(buf); let mut archive = tar::Archive::new(cursor); let mut tarball_entries = archive .entries() .context("unable to create iterator over tarball archive")?; let mut entry = tarball_entries .next() .context("empty tarball archive")? .context("invalid tarball archive")?; ensure!( entry .path() .context("invalid path in tarball archive")? .file_name() .context("invalid path in tarball archive")? .to_string_lossy() == "install.yml", "the first file is not rinstall spec file" ); let mut spec_file = String::new(); // Pass the error up with the ? operator entry .read_to_string(&mut spec_file) .context("unable to read spec file from tarball")?; let install_spec = InstallSpec::new_from_string(spec_file)?; let version = install_spec.version.clone(); let packages = install_spec.packages(&self.packages); // TODO // Initialize project directories (only rust for now) if packages.iter().any(|p| p.pkg_type == Type::Rust) { RUST_DIRECTORIES_ONCE.call_once(|| { // We use call_once on std::once::Once, this is safe unsafe { RUST_DIRECTORIES = Some( RustDirectories::new( None, self.rust_debug_target, self.rust_target_triple.as_deref(), ) // TODO .unwrap(), ); } }); } for package in packages { let mut pkg_installer = PackageInstaller::new(&package, &self, &dirs) .with_context(|| { format!( "failed to create package installer for package {:?}", package.name ) })?; let install_entries = package.targets(&dirs, &version, self.system_dirs(), &completions)?; while let Some(Ok(mut tarball_entry)) = tarball_entries.next() { let entry_path = tarball_entry .path() .context("unable to read path for tarball entry")?; let path = Utf8Path::from_path(&entry_path) .with_context(|| { format!("invalid UTF8 path for tarball entry {:?}", entry_path) })? .to_path_buf(); // Is equal to ["rinstall-0.3.0/rinstall", "rinstall-0.3.0", ""] let ancestors = path.ancestors().collect::<Vec<_>>(); // Get the second last let prefix = ancestors[ancestors.len() - 2]; // and then strip it from the path, as it's just the directory let path = path.strip_prefix(prefix).unwrap(); // Skip entries in the tarball that are not inside the rinstall spec file // This is okay because the tarball entries list does not match the target list // i.e. a directory in the spec file will have all the corresponding files in the entries for install_entry in &install_entries { let destination = if install_entry.source == path { Some(install_entry.destination_for_file()) } else if let Ok(strip_prefix) = path.strip_prefix(&install_entry.source) { Some(install_entry.destination.join(strip_prefix)) } else { None }; if let Some(destination) = destination { let installer = |destination| -> Result<()> { // unpack_in returns true if the entry was unpacked // false if the entry contains '..' and thus was not packed match tarball_entry.unpack_in(destination)? { true => Err(color_eyre::eyre::anyhow!("path contains '..'")), false => Ok(()), } }; pkg_installer.install_target( install_entry, destination, self.accept_changes, installer, )?; continue; } } } } } else { let packagedir = Utf8Path::from_path(&self.package_dir).with_context(|| { format!("{:?} contains invalid UTF-8 characters", self.package_dir) })?; let install_spec = InstallSpec::new_from_path(packagedir)?; let version = install_spec.version.clone(); let packages = install_spec.packages(&self.packages); if packages.iter().any(|p| p.pkg_type == Type::Rust) { RUST_DIRECTORIES_ONCE.call_once(|| { // We use call_once on std::once::Once, this is safe unsafe { RUST_DIRECTORIES = Some( RustDirectories::new( Some(packagedir.to_owned()), self.rust_debug_target, self.rust_target_triple.as_deref(), ) // TODO .unwrap(), ); } }); } for package in packages { let mut pkg_installer = PackageInstaller::new(&package, &self, &dirs)?; let entries = package.targets(&dirs, &version, self.system_dirs(), &completions)?; for install_entry in entries { ensure!( install_entry.full_source.exists(), "File {:?} does not exist", install_entry.source ); if install_entry.full_source.is_file() { let destination = install_entry.destination_for_file(); let installer = |destination| -> Result<()> { std::fs::copy(&install_entry.full_source, &destination) .with_context(|| { format!( "unable to copy file {} to {destination}", install_entry.full_source ) }) .map(|_| ()) }; pkg_installer .install_target( &install_entry, destination, self.accept_changes, installer, ) .with_context(|| { format!("failed to install file {:?}", install_entry.full_source) })?; } else if install_entry.full_source.is_dir() { WalkDir::new(&install_entry.full_source) .into_iter() .try_for_each(|entry| -> Result<()> { let entry = entry?; if !entry.file_type().is_file() { // skip directories return Ok(()); } let full_file_path = Utf8Path::from_path(entry.path()).unwrap(); let destination = install_entry.destination_for_file_in_directory(full_file_path); let installer = |destination| -> Result<()> { std::fs::copy(&install_entry.full_source, &destination) .with_context(|| { format!( "unable to copy file {} to {destination}", install_entry.full_source ) }) .map(|_| ()) }; pkg_installer .install_target( &install_entry, destination, self.accept_changes, installer, ) .with_context(|| { format!( "failed to install file {:?}", install_entry.full_source ) })?; Ok(()) })?; } else { bail!( "{:?} is neither a file nor a directory", install_entry.source ); } } pkg_installer.install_pkg_info()?; } } Ok(()) } } struct PackageInstaller<'a> { check_for_overwrite: bool, dirs: &'a Dirs, install_opts: &'a InstallCmd, pkg_info: PackageInfo, } impl<'a> PackageInstaller<'a> { pub fn new( package: &Package, install_opts: &'a InstallCmd, dirs: &'a Dirs, ) -> Result<Self> { let pkg_info = PackageInfo::new(package.name.as_ref().unwrap(), dirs); let pkg_info_path = append_destdir(&pkg_info.path, install_opts.destdir.as_deref()); let pkg_already_installed = pkg_info_path.exists(); info!( "{} {} {}", ">>>".magenta(), "Package".bright_black(), pkg_info.pkg_name.italic().blue() ); // if this package is already installed and the user did not specify --update if pkg_already_installed && !install_opts.update { // check that we are running in dry-run mode ensure!( !install_opts.accept_changes, "cannot install {} because it has already been installed", pkg_info.pkg_name ); warn!( "package {} is already installed", pkg_info.pkg_name.blue().italic(), ) } // if this package is already installed, we need to uninstall it first if pkg_already_installed && install_opts.update { let uninstall = Uninstall { config: None, accept_changes: install_opts.accept_changes, force: install_opts.force, system: install_opts.system_dirs(), prefix: None, localstatedir: Some(dirs.localstatedir.as_str().to_owned()), packages: vec![pkg_info.pkg_name.clone()], }; uninstall.run()?; } Ok(Self { check_for_overwrite: pkg_already_installed, dirs, install_opts, pkg_info, }) } fn install_target<F>( &mut self, target: &InstallEntry, destination: Utf8PathBuf, accept_changes: bool, mut installer: F, ) -> Result<()> where F: FnMut(Utf8PathBuf) -> Result<()>, { // if we are not installing to a custom destdir and the file already exists if self.install_opts.destdir.is_none() && self.handle_existing_file(target, &destination)? { return Ok(()); } let destination_destdir = append_destdir(&destination, self.install_opts.destdir.as_deref()); if accept_changes { info!( "Installing {} -> {}", target.source.as_str().purple().bold(), destination_destdir.as_str().cyan().bold() ); fs::create_dir_all(destination_destdir.parent().unwrap()).with_context(|| { format!( "unable to create directory {:?}", destination_destdir.parent() ) })?; installer(destination_destdir.clone())?; self.apply_templating(target)?; self.pkg_info .add_file(&destination, &destination_destdir, target.replace)?; } else { info!( "Would install {} -> {}", target.source.as_str().purple().bold(), destination.as_str().cyan().bold() ); } Ok(()) } fn apply_templating( &self, entry: &InstallEntry, ) -> Result<()> { if entry.templating { let mut file = File::open(&entry.destination) .with_context(|| format!("unable to open file {:?}", entry.destination))?; let mut file_contents = Vec::new(); file.read_to_end(&mut file_contents) .with_context(|| format!("unable to read file {:?}", entry.destination))?; let contents = apply_templating(&file_contents, self.dirs) .with_context(|| format!("unable to apply templating to {:?}", entry.source))?; write_to_file(&entry.destination, contents.as_bytes())?; } Ok(()) } /// Returns true if the file already exists and we should skip installation fn handle_existing_file( &self, target: &InstallEntry, destination: &Utf8Path, ) -> Result<bool> { let accept_changes = self.install_opts.accept_changes; if destination.exists() && target.replace { if !self.install_opts.force { if accept_changes { bail!( "file {:?} already exists, add --force to overwrite it", destination ); } else if !self.check_for_overwrite { warn!( "file {} already exists, add {} to overwrite it", destination.as_str().yellow().bold(), "--force".bright_black().italic(), ); } } else if !accept_changes { warn!( "file {} already exists, it would be overwritten", destination.as_str().yellow().bold() ); } else { warn!("file {} already exists, overwriting it", destination); } } if destination.exists() && !target.replace { if self.install_opts.update_config { if accept_changes { warn!("config {} is being overwritten", destination); } else if !self.check_for_overwrite { warn!("config {} will be overwritten", target.destination); } } else { info!( "{} config {} -> {}", if accept_changes { "Skipping" } else { "Would skip" }, // TODO target.source.as_str().purple().bold(), destination.as_str().cyan().bold() ); // Skip installation return Ok(true); } } Ok(false) } fn install_pkg_info(&self) -> Result<()> { if !self.install_opts.skip_pkg_info() { if self.install_opts.accept_changes { info!( "Installing {} -> {}", "pkginfo".purple().bold(), self.pkg_info.path.as_str().cyan().bold() ); self.pkg_info.install()?; } else { info!( "Would install {} -> {}", "pkginfo".purple().bold(), self.pkg_info.path.as_str().cyan().bold() ); } } Ok(()) } } 0707010000001B000081A400000000000000000000000166252D72000008D8000000000000000000000000000000000000003100000000rinstall-0.2.0~git35.c30f365/src/install_spec.rsuse std::{collections::HashMap, fs}; use camino::Utf8Path; use color_eyre::{ eyre::{bail, Context}, Result, }; use semver::Version; use serde::Deserialize; use crate::Package; #[derive(Deserialize, Clone)] pub enum RinstallVersion { #[serde(rename = "0.1.0")] V0_1_0, #[serde(rename = "0.2.0")] V0_2_0, } impl From<&RinstallVersion> for Version { fn from(val: &RinstallVersion) -> Self { match val { RinstallVersion::V0_1_0 => Version::new(0, 1, 0), RinstallVersion::V0_2_0 => Version::new(0, 2, 0), } } } #[derive(Deserialize)] #[serde(deny_unknown_fields)] pub struct InstallSpec { #[serde(rename(deserialize = "rinstall"))] pub version: RinstallVersion, #[serde(rename(deserialize = "pkgs"))] pub packages: HashMap<String, Package>, } impl InstallSpec { pub fn new_from_path(package_dir: &Utf8Path) -> Result<Self> { // Try root/install.yml and root/.package/install.yml files let install_spec = { let install_spec = package_dir.join("install.yml"); if install_spec.exists() { install_spec } else { let install_spec = package_dir.join(".package").join("install.yml"); if install_spec.exists() { install_spec } else { bail!("unable to find 'install.yml' file"); } } }; Ok(serde_yaml::from_str( &fs::read_to_string(&install_spec) .with_context(|| format!("unable to read file {:?}", install_spec))?, )?) } pub fn new_from_string(spec_file: String) -> Result<Self> { Ok(serde_yaml::from_str(&spec_file)?) } pub fn packages( self, selected: &[String], ) -> Vec<Package> { // Only return packages that are selected by the user self.packages .into_iter() .filter(|(name, _)| selected.is_empty() || selected.iter().any(|pkg| pkg == name)) .map(|(name, package)| { let mut package = package; package.name = Some(name); package }) .collect::<Vec<Package>>() } } 0707010000001C000081A400000000000000000000000166252D7200000437000000000000000000000000000000000000003300000000rinstall-0.2.0~git35.c30f365/src/install_target.rsuse camino::{Utf8Path, Utf8PathBuf}; // SpecFile entries pub struct InstallEntry { // The source as written in the spec file pub source: Utf8PathBuf, // The full path to the source (either file or directory) pub full_source: Utf8PathBuf, pub destination: Utf8PathBuf, // Do we apply templating here? pub templating: bool, // Do this file replace the contents by default? // i.e. in config it's not replaceable pub replace: bool, } #[derive(Clone, Copy)] pub enum FilesPolicy { Replace, NoReplace, } impl InstallEntry { pub fn destination_for_file(&self) -> Utf8PathBuf { if self.destination.as_str().ends_with('/') { self.destination.join(self.source.file_name().unwrap()) } else { self.destination.to_owned() } } pub fn destination_for_file_in_directory( &self, full_path: &Utf8Path, ) -> Utf8PathBuf { let relative_file_path = full_path.strip_prefix(&self.full_source).unwrap(); self.destination.join(relative_file_path) } } 0707010000001D000081A400000000000000000000000166252D7200000447000000000000000000000000000000000000002900000000rinstall-0.2.0~git35.c30f365/src/main.rsmod dirs; mod dirs_config_impl; mod icon; mod install_cmd_impl; mod install_spec; mod install_target; mod opts_impl; mod package; mod package_info; mod project; mod simple_logger; mod string_or_struct; mod tarball_cmd_impl; mod templating; mod uninstall_impl; mod utils; #[macro_use] extern crate lazy_static; use clap::Parser; use color_eyre::Result; use log::LevelFilter; use dirs::Dirs; pub use dirs_config_impl::DirsConfig; pub use install_cmd_impl::InstallCmd; pub use opts_impl::{Opts, SubCommand}; use package::Package; use simple_logger::SimpleLogger; pub use tarball_cmd_impl::TarballCmd; pub use uninstall_impl::Uninstall; fn main() -> Result<()> { color_eyre::install()?; let opts = Opts::parse(); log::set_boxed_logger(Box::new(SimpleLogger { quiet: opts.quiet })) .map(|()| log::set_max_level(LevelFilter::Info))?; match opts.subcmd { SubCommand::Uninstall(uninstall) => { uninstall.run()?; } SubCommand::Install(install) => install.run()?, SubCommand::Tarball(tarball) => tarball.run()?, } Ok(()) } 0707010000001E000081A400000000000000000000000166252D720000038F000000000000000000000000000000000000002900000000rinstall-0.2.0~git35.c30f365/src/opts.rs#[derive(Parser)] #[clap( version, author, about, long_about = "A helper tool that installs software and additional data into the system" )] pub struct Opts { #[clap( short, long, help = "Path to the rinstall.yml configuration", global = true )] pub config: Option<String>, #[clap( short, long, help = concat!("Do not print anything on the stdout. Warnings and", " errors will still be print on the stderr") )] pub quiet: bool, #[clap(subcommand)] pub subcmd: SubCommand, } #[derive(Subcommand)] pub enum SubCommand { #[clap(about = "Install the packages into the system")] Install(Box<InstallCmd>), #[clap(about = "Uninstall the packages from the system")] Uninstall(Uninstall), #[clap(about = "Create a tarball of the package")] Tarball(Box<TarballCmd>), } 0707010000001F000081A400000000000000000000000166252D720000007B000000000000000000000000000000000000002E00000000rinstall-0.2.0~git35.c30f365/src/opts_impl.rsuse clap::{Parser, Subcommand}; use crate::InstallCmd; use crate::TarballCmd; use crate::Uninstall; include!("opts.rs"); 07070100000020000081A400000000000000000000000166252D72000062AB000000000000000000000000000000000000002C00000000rinstall-0.2.0~git35.c30f365/src/package.rsuse std::str::FromStr; use camino::{Utf8Path, Utf8PathBuf}; use color_eyre::{ eyre::{bail, ensure, Context, ContextCompat}, Result, }; use colored::Colorize; use log::warn; use semver::{Version, VersionReq}; use serde::Deserialize; use void::Void; use crate::{ icon::Icon, install_spec::RinstallVersion, install_target::FilesPolicy, project::{DefaultProjectDirectories, ProjectDirectories, RUST_DIRECTORIES}, string_or_struct::string_or_struct, }; use crate::{install_target::InstallEntry, Dirs}; pub struct CompletionsToInstall { bash: bool, elvish: bool, fish: bool, zsh: bool, } impl CompletionsToInstall { pub fn parse(s: &str) -> Result<Self> { let mut res = Self { bash: false, elvish: false, fish: false, zsh: false, }; macro_rules! completion_match { ( $($completion_literal:literal, $completion:tt),* ) => { for completion in s.split(",") { match completion { $( $completion_literal => { ensure!( !res.$completion, "{} completions has already been set in --completions", $completion_literal ); res.$completion = true; } )* catchall => bail!("{catchall} is not a valid completion type"), } } }; } completion_match!("bash", bash, "elvish", elvish, "fish", fish, "zsh", zsh); Ok(res) } pub fn all() -> Self { Self { bash: true, elvish: true, fish: true, zsh: true, } } } #[derive(Deserialize)] #[serde(deny_unknown_fields)] pub struct InnerEntry { #[serde(rename(deserialize = "src"))] pub source: Utf8PathBuf, #[serde(rename(deserialize = "dst"))] pub destination: Option<Utf8PathBuf>, #[serde(default, rename(deserialize = "tmpl"))] pub templating: bool, } impl InnerEntry { pub const fn new_with_source(source: Utf8PathBuf) -> Self { Self { source, destination: None, templating: false, } } fn new_entry( self, policy: FilesPolicy, install_dir: &Utf8Path, pkg_type: &Type, ) -> Result<InstallEntry> { let replace = matches!(policy, FilesPolicy::Replace); ensure!( self.source.is_relative(), "the source file {:?} is not relative", self.source ); let destination = if self.source.is_file() || self.destination.is_some() { install_dir.join(if let Some(destination) = self.destination { ensure!( destination.is_relative(), "the destination part of a file must be relative" ); destination } else { Utf8PathBuf::from(self.source.file_name().with_context(|| { format!("unable to get file name from {:?}", self.source) })?) }) } else { install_dir.to_path_buf() }; let full_source = pkg_type.sourcepath(&self.source); Ok(InstallEntry { source: self.source, full_source, destination, templating: self.templating, replace, }) } } impl FromStr for InnerEntry { // This implementation of `from_str` can never fail, so use the impossible // `Void` type as the error type. type Err = Void; fn from_str(s: &str) -> Result<Self, Self::Err> { Ok(Self::new_with_source(Utf8PathBuf::from(s))) } } #[derive(Deserialize, Clone, PartialEq, Debug, Copy)] pub enum Type { #[serde(rename(deserialize = "default"))] Default, #[serde(rename(deserialize = "rust"))] Rust, #[serde(rename(deserialize = "custom"))] Custom, } impl Default for Type { fn default() -> Self { Self::Default } } impl Type { pub fn sourcepath( self, source: &Utf8Path, ) -> Utf8PathBuf { match self { Type::Default | Type::Custom => DefaultProjectDirectories.sourcepath(source), Type::Rust => unsafe { RUST_DIRECTORIES.as_ref().unwrap() }.sourcepath(source), } } } #[derive(Deserialize)] #[serde(transparent)] struct Entry { #[serde(deserialize_with = "string_or_struct")] pub entry: InnerEntry, } // DataEntry is not really a good name, it is just an Entry with use_pkg_name option #[derive(Deserialize)] #[serde(transparent)] struct DataEntry { #[serde(deserialize_with = "string_or_struct")] pub entry: InnerDataEntry, } #[derive(Deserialize)] struct InnerDataEntry { #[serde(rename(deserialize = "use-pkg-name"), default = "bool_true")] use_pkg_name: bool, #[serde(flatten)] entry: InnerEntry, } impl InnerDataEntry { pub fn new_with_source(s: Utf8PathBuf) -> InnerDataEntry { InnerDataEntry { use_pkg_name: true, entry: InnerEntry::new_with_source(s), } } } impl FromStr for InnerDataEntry { // This implementation of `from_str` can never fail, so use the impossible // `Void` type as the error type. type Err = Void; fn from_str(s: &str) -> Result<Self, Self::Err> { Ok(InnerDataEntry::new_with_source(Utf8PathBuf::from(s))) } } const fn bool_true() -> bool { true } #[derive(Deserialize)] struct IconEntry { #[serde(flatten, deserialize_with = "string_or_struct")] icon: Icon, } #[derive(Deserialize, Default)] #[serde(deny_unknown_fields)] struct Completions { #[serde(default)] bash: Vec<Entry>, #[serde(default)] elvish: Vec<Entry>, #[serde(default)] fish: Vec<Entry>, #[serde(default)] zsh: Vec<Entry>, } #[derive(Deserialize)] #[serde(deny_unknown_fields)] pub struct Package { pub name: Option<String>, #[serde(rename(deserialize = "type"), default)] pub pkg_type: Type, #[serde(default)] exe: Vec<Entry>, #[serde(default, rename(deserialize = "admin-exe"))] admin_exe: Vec<Entry>, #[serde(default)] libs: Vec<Entry>, #[serde(default)] libexec: Vec<Entry>, #[serde(default)] includes: Vec<Entry>, #[serde(default)] man: Vec<Entry>, #[serde(default)] data: Vec<DataEntry>, #[serde(default)] docs: Vec<DataEntry>, #[serde(default)] config: Vec<DataEntry>, #[serde(default, rename(deserialize = "user-config"))] user_config: Vec<Entry>, #[serde(default, rename(deserialize = "desktop-files"))] desktop_files: Vec<Entry>, #[serde(default, rename(deserialize = "appstream-metadata"))] appstream_metadata: Vec<Entry>, #[serde(default)] completions: Completions, #[serde(default, rename(deserialize = "pam-modules"))] pam_modules: Vec<Entry>, #[serde(default, rename(deserialize = "systemd-units"))] systemd_units: Vec<Entry>, #[serde(default, rename(deserialize = "systemd-user-units"))] systemd_user_units: Vec<Entry>, #[serde(default)] icons: Vec<IconEntry>, #[serde(default)] terminfo: Vec<Entry>, #[serde(default)] licenses: Vec<DataEntry>, #[serde(default, rename(deserialize = "pkg-config"))] pkg_config: Vec<Entry>, } impl Package { /// Generate a vector of InstallTarget from a package defined in install.yml pub fn targets( self, dirs: &Dirs, rinstall_version: &RinstallVersion, system_install: bool, completions_to_install: &CompletionsToInstall, ) -> Result<Vec<InstallEntry>> { self.check_entries(rinstall_version)?; let package_name = self.name.unwrap(); let empty_path = Utf8PathBuf::new(); let mut results = [ (self.exe, Some(&dirs.bindir), "exe"), (self.libs, Some(&dirs.libdir), "libs"), (self.libexec, Some(&dirs.libexecdir), "libexec"), (self.admin_exe, dirs.sbindir.as_ref(), "admin_exe"), (self.includes, dirs.includedir.as_ref(), "includes"), ( self.desktop_files, Some(&dirs.datarootdir.join("applications/")), "desktop-files", ), ( self.systemd_user_units, Some(&dirs.systemd_unitsdir.join("user/")), "systemd-user-units", ), ] .into_iter() .flat_map(|(mut files, mut dir, name)| { // Skip directories that don't exists, i.e. mandir, includedir if dir.is_none() { files.clear(); // Give an empty path to dir so that the unwrap succeeds dir = Some(&empty_path); } let dir = dir.unwrap(); let pkg_type = self.pkg_type; files.into_iter().map(move |entry| { entry .entry .new_entry(FilesPolicy::Replace, dir, &pkg_type) .with_context(|| format!("While iterating {name} entries")) }) }) .chain( [ ( self.data, Some(&dirs.datadir), "data".to_owned(), FilesPolicy::Replace, ), ( self.config, Some(&dirs.sysconfdir), "config".to_owned(), FilesPolicy::NoReplace, ), ( self.docs, dirs.docdir.as_ref(), "docs".to_owned(), FilesPolicy::Replace, ), ( self.licenses, Some(&dirs.datarootdir.join("licenses/")), "licenses".to_owned(), FilesPolicy::Replace, ), ] .into_iter() .flat_map(|(mut files, mut dir, name, policy)| { // Skip directories that don't exists, i.e. mandir, includedir if dir.is_none() { files.clear(); // Give an empty path to dir so that the unwrap succeeds dir = Some(&empty_path); } let dir = dir.unwrap(); let with_pkgname = dir.join(&package_name); let pkg_type = &self.pkg_type; files.into_iter().map(move |data_entry| { let entry = data_entry.entry; // Check the use_pkg_name option for this entry // When it is enabled (which it is by default) this entry will be installed // with $install_dir/<pkg-name>/ as root director for dst let dir = if entry.use_pkg_name { &with_pkgname } else { dir }; entry .entry .new_entry(policy, dir, pkg_type) .with_context(|| format!("While iterating {name} entries")) }) }), ) .collect::<Result<Vec<InstallEntry>>>()?; if let Some(mandir) = &dirs.mandir { results.extend( self.man .into_iter() .map(|entry| -> Result<InstallEntry> { let entry = entry.entry; ensure!( !entry.source.as_str().ends_with('/'), "the man entry cannot be a directory" ); let use_source_name = entry .destination .as_ref() .map_or(true, |destination| destination.as_str().ends_with('/')); let name = if use_source_name { &entry.source } else { entry.destination.as_ref().unwrap() }; let man_cat = name .extension() .with_context(|| format!("unable to get extension of file {:?}", name))? .to_string(); ensure!( man_cat.chars().next().unwrap().is_ascii_digit(), "the last character should be a digit from 1 to 8" ); let install_dir = mandir.join(format!("man{}/", &man_cat)); entry.new_entry(FilesPolicy::Replace, &install_dir, &self.pkg_type) }) .collect::<Result<Vec<InstallEntry>>>() .context("error while iterating man pages")?, ); } if system_install { results.extend( self.user_config .into_iter() .map(|entry| { entry.entry.new_entry( FilesPolicy::Replace, &dirs.docdir.as_ref().unwrap().join("user-config"), &self.pkg_type, ) }) .collect::<Result<Vec<InstallEntry>>>() .context("error while iterating user-config entries")?, ); } else { results.extend( self.user_config .into_iter() .map(|entry| { entry.entry.new_entry( FilesPolicy::NoReplace, &dirs.sysconfdir, &self.pkg_type, ) }) .collect::<Result<Vec<InstallEntry>>>() .context("error while iterating user-config entries")?, ); } if system_install { results.extend( self.appstream_metadata .into_iter() .map(|entry| { entry.entry.new_entry( FilesPolicy::Replace, &dirs.datarootdir.join("metainfo/"), &self.pkg_type, ) }) .collect::<Result<Vec<InstallEntry>>>() .context("error while iterating appstream-metadata entries")?, ); } let mut completions = Vec::new(); if completions_to_install.bash { completions.extend( self.completions .bash .into_iter() .map(|completion| { ( completion, if system_install { "bash-completion/completions/" } else { "bash-completion/" }, ) }) .collect::<Vec<(Entry, &'static str)>>(), ) } if completions_to_install.elvish { completions.extend( self.completions .elvish .into_iter() .map(|completion| (completion, "elvish/lib/")), ); } if system_install { if completions_to_install.fish { completions.extend( self.completions .fish .into_iter() .map(|completion| (completion, "fish/vendor_completions.d/")), ); } if completions_to_install.zsh { completions.extend( self.completions .zsh .into_iter() .map(|completion| (completion, "zsh/site-functions/")), ); } } results.extend( completions .into_iter() .map(|(entry, completionsdir)| -> Result<InstallEntry> { let entry = entry.entry; entry.new_entry( FilesPolicy::Replace, &dirs.datarootdir.join(completionsdir), &self.pkg_type, ) }) .collect::<Result<Vec<InstallEntry>>>() .context("error while iterating completion files")?, ); if let Some(pam_modulesdir) = &dirs.pam_modulesdir { results.extend( self.pam_modules .into_iter() .map(|entry| { let Entry { entry: InnerEntry { source, destination, templating, }, } = entry; let destination = if destination.is_some() { destination } else { let file_name = source.file_name().unwrap(); if file_name.starts_with("libpam_") { Some(Utf8PathBuf::from(file_name.strip_prefix("lib").unwrap())) } else { None } }; InnerEntry { source, destination, templating, } .new_entry( FilesPolicy::Replace, pam_modulesdir, &self.pkg_type, ) }) .collect::<Result<Vec<InstallEntry>>>() .context("error while iterating pam-modules")?, ); } if system_install { results.extend( self.systemd_units .into_iter() .map(|entry| { entry.entry.new_entry( FilesPolicy::Replace, &dirs.systemd_unitsdir.join("system/"), &self.pkg_type, ) }) .collect::<Result<Vec<InstallEntry>>>() .context("error while iterating systemd-units entries")?, ); } results.extend( self.icons .into_iter() .map(|icon| -> Icon { icon.icon }) .filter(|icon| system_install || !icon.pixmaps) .map(|icon| -> Result<InstallEntry> { InnerEntry { source: icon.source.clone(), destination: Some(icon.get_destination().with_context(|| { format!( "unable to generate destination for icon {:?}", icon.source.clone() ) })?), templating: false, } .new_entry( FilesPolicy::Replace, &dirs.datarootdir, &self.pkg_type, ) }) .collect::<Result<Vec<InstallEntry>>>() .context("error while iterating icons")?, ); if system_install { results.extend( self.terminfo .into_iter() .map(|entry| -> Result<InstallEntry> { let entry = entry.entry; ensure!( !entry.source.as_str().ends_with('/'), "the terminfo entry cannot be a directory" ); let use_source_name = entry .destination .as_ref() .map_or(true, |destination| destination.as_str().ends_with('/')); let name = if use_source_name { &entry.source } else { entry.destination.as_ref().unwrap() }; let initial = name .file_name() .with_context(|| format!("unable to get filename of file {:?}", name))? .chars() .next() .with_context(|| { format!("terminfo entry {:?} contains an empty filename", name) })? .to_lowercase() .to_string(); let install_dir = dirs.datarootdir.join("terminfo").join(initial); entry.new_entry(FilesPolicy::Replace, &install_dir, &self.pkg_type) }) .collect::<Result<Vec<InstallEntry>>>() .context("error while iterating terminfo files")?, ); } if system_install { results.extend( self.pkg_config .into_iter() .map(|entry| { entry.entry.new_entry( FilesPolicy::Replace, &dirs.libdir.join("pkgconfig/"), &self.pkg_type, ) }) .collect::<Result<Vec<InstallEntry>>>() .context("error while iterating pkg-config entries")?, ); } Ok(results) } fn check_entries( &self, version: &RinstallVersion, ) -> Result<()> { let version: Version = version.into(); macro_rules! check_version_expr { ( $name:literal, $type:expr, $req:literal ) => { let requires = VersionReq::parse($req).unwrap(); ensure!( $type.is_empty() || requires.matches(&version), "{} requires version {}", $name, requires ); }; } macro_rules! check_version { ( $name:literal, $type:ident, $req:literal ) => { check_version_expr!($name, self.$type, $req); }; } if self.pkg_type == Type::Custom && VersionReq::parse(">=0.2.0").unwrap().matches(&version) { warn!( "type '{}' has been deprecated, use '{}' or leave it empty", "custom".bright_black(), "default".bright_black(), ); } check_version!("exe", exe, ">=0.1.0"); check_version!("admin_exe", admin_exe, ">=0.1.0"); check_version!("libs", libs, ">=0.1.0"); check_version!("libexec", libexec, ">=0.1.0"); check_version!("includes", includes, ">=0.1.0"); check_version!("man", man, ">=0.1.0"); check_version!("data", data, ">=0.1.0"); check_version!("docs", docs, ">=0.1.0"); check_version!("config", config, ">=0.1.0"); check_version!("user-config", user_config, ">=0.1.0"); check_version!("desktop-files", desktop_files, ">=0.1.0"); check_version!("appstream-metadata", appstream_metadata, ">=0.1.0"); check_version_expr!("completions:bash", self.completions.bash, ">=0.1.0"); check_version_expr!("completions:elvish", self.completions.elvish, ">=0.2.0"); check_version_expr!("completions:fish", self.completions.fish, ">=0.1.0"); check_version_expr!("completions:zsh", self.completions.zsh, ">=0.1.0"); check_version!("pam-modules", pam_modules, ">=0.1.0"); check_version!("systemd-units", systemd_units, ">=0.1.0"); check_version!("systemd-user-units", systemd_user_units, ">=0.2.0"); check_version!("icons", icons, ">=0.1.0"); check_version!("terminfo", terminfo, ">=0.1.0"); check_version!("licenses", licenses, ">=0.1.0"); check_version!("pkg-config", pkg_config, ">=0.1.0"); Ok(()) } } 07070100000021000081A400000000000000000000000166252D720000091A000000000000000000000000000000000000003100000000rinstall-0.2.0~git35.c30f365/src/package_info.rsuse std::{ fs::{self, File}, io::Write, }; use camino::{Utf8Path, Utf8PathBuf}; use color_eyre::{eyre::Context, Result}; use serde::{Deserialize, Serialize}; use crate::dirs::Dirs; #[derive(Serialize, Deserialize)] pub struct InstalledFile { pub path: Utf8PathBuf, pub checksum: String, pub replace: bool, } impl InstalledFile { pub fn has_been_modified(&self) -> Result<bool> { Ok(self.checksum != blake3::hash( &fs::read(&self.path) .with_context(|| format!("unable to read file {:?}", self.path))?, ) .to_hex() .to_string()) } } #[derive(Serialize, Deserialize)] pub struct PackageInfo { #[serde(skip)] pub pkg_name: String, pub path: Utf8PathBuf, pub files: Vec<InstalledFile>, } impl PackageInfo { pub fn new( pkg_name: &str, dirs: &Dirs, ) -> Self { Self { pkg_name: pkg_name.to_string(), path: dirs .localstatedir .join("rinstall") .join(format!("{}.pkg", &pkg_name)), files: Vec::new(), } } pub fn add_file( &mut self, target_path: &Utf8Path, path: &Utf8Path, replace: bool, ) -> Result<()> { let mut hasher = blake3::Hasher::new(); hasher.update_reader(File::open(path)?)?; let file = InstalledFile { path: Utf8Path::new("/").join(target_path), checksum: hasher.finalize().to_string(), replace, }; self.files.push(file); Ok(()) } pub fn install(&self) -> Result<()> { fs::create_dir_all(self.path.parent().unwrap()) .with_context(|| format!("unable to create parent directory for {:?}", self.path))?; File::create(&self.path) .with_context(|| format!("unable to open file {:?}", self.path))? .write( serde_yaml::to_string(self) .with_context(|| { format!("unable to serialize installation into {:?}", self.path) })? .as_bytes(), ) .with_context(|| format!("unable to write installation info in {:?}", self.path))?; Ok(()) } } 07070100000022000081A400000000000000000000000166252D7200001342000000000000000000000000000000000000002C00000000rinstall-0.2.0~git35.c30f365/src/project.rsuse std::{env, os::unix::process::CommandExt, process::Command, sync::Once}; use camino::{Utf8Path, Utf8PathBuf}; use color_eyre::{eyre::Context, Result}; pub static RUST_DIRECTORIES_ONCE: Once = Once::new(); pub static mut RUST_DIRECTORIES: Option<RustDirectories> = None; // Contains data about the project that will be installed // It doesn't refer to the system and the actual installation directories // It is only relevant for the source part in InstallEntry pub struct RustDirectories { pub packagedir: Option<Utf8PathBuf>, pub outputdir: Option<Utf8PathBuf>, } pub struct DefaultProjectDirectories; pub trait ProjectDirectories { fn sourcepath( &'static self, source: &Utf8Path, ) -> Utf8PathBuf; } impl RustDirectories { pub fn new( package_dir: Option<Utf8PathBuf>, rust_debug_target: bool, rust_target_triple: Option<&str>, ) -> Result<Self> { Ok(Self { packagedir: package_dir.as_ref().map(|p| p.to_owned()), // package_dir is empty when we are extracting from a tarball outputdir: if let Some(package_dir) = package_dir { Some(Self::target_dir( &package_dir, rust_debug_target, rust_target_triple, )?) } else { None }, }) } fn target_dir( package_dir: &Utf8Path, rust_debug_target: bool, rust_target_triple: Option<&str>, ) -> Result<Utf8PathBuf> { let env_target_dir = std::env::var("CARGO_TARGET_DIR"); // if CARGO_TARGET_DIR and target directory do not exist, // try reading the "target_directory" from cargo metadata let res = if env_target_dir.is_err() || !package_dir.join("target").exists() // cargo is installed? && Command::new("cargo") .current_dir(package_dir) .output() .map_or(false, |output| output.status.success()) { Utf8PathBuf::from( json::parse(&String::from_utf8_lossy( &Command::new("cargo") .arg("metadata") .current_dir(package_dir) .uid( // cargo metadata only works when running as the current user that has built // the project. Otherwise it will use metadata for the root user and // it is almost never what we want env::var("SUDO_UID").map_or(unsafe { libc::getuid() }, |uid| { uid.parse::<u32>().unwrap() }), ) .gid( env::var("SUDO_GID").map_or(unsafe { libc::getgid() }, |gid| { gid.parse::<u32>().unwrap() }), ) .output() .context("unable to run `cargo metadata`")? .stdout, )) .context("unable to parse JSON from `cargo metadata` output")?["target_directory"] .to_string(), ) } else if let Ok(env_target_dir) = env_target_dir { Utf8PathBuf::from(env_target_dir) } else { package_dir.join("target") }; // Append the target triple and debug/release let res = res .join(rust_target_triple.unwrap_or_default()) .join(if rust_debug_target { "debug" } else { "release" }); Ok(res) } } impl ProjectDirectories for RustDirectories { fn sourcepath( &'static self, source: &Utf8Path, ) -> Utf8PathBuf { // Packagedir is set when we are installing from a directory // It is not set when installing from a tarball match (&self.packagedir, &self.outputdir) { (Some(packagedir), Some(outputdir)) => { // In this case we are checking if the source exists inside output_dir // If it does we use it let outputdir_source = outputdir.join(source); if outputdir_source.exists() { outputdir_source } else { // Otherwise we use packagedir packagedir.join(source) } } (None, None) => source.to_owned(), // Both are always set or not set _ => unreachable!(), } } } impl ProjectDirectories for DefaultProjectDirectories { fn sourcepath( &'static self, source: &Utf8Path, ) -> Utf8PathBuf { source.to_path_buf() } } 07070100000023000081A400000000000000000000000166252D7200000312000000000000000000000000000000000000003200000000rinstall-0.2.0~git35.c30f365/src/simple_logger.rsuse colored::Colorize; use log::{Level, Metadata, Record}; pub struct SimpleLogger { pub quiet: bool, } impl log::Log for SimpleLogger { fn enabled( &self, metadata: &Metadata, ) -> bool { metadata.level() <= Level::Warn || !self.quiet } fn log( &self, record: &Record, ) { if self.enabled(record.metadata()) { match record.level() { Level::Error => eprintln!("{}: {}", "ERROR".red().bold(), record.args()), Level::Warn => eprintln!("{}: {}", "WARNING".yellow().bold(), record.args()), Level::Info => println!("{}", record.args()), Level::Debug | Level::Trace => unreachable!(), } } } fn flush(&self) {} } 07070100000024000081A400000000000000000000000166252D7200000737000000000000000000000000000000000000003500000000rinstall-0.2.0~git35.c30f365/src/string_or_struct.rsuse std::{fmt, marker::PhantomData, str::FromStr}; use serde::{ de::{self, MapAccess, Visitor}, Deserialize, Deserializer, }; use void::Void; // https://serde.rs/string-or-struct.html pub fn string_or_struct<'de, T, D>(deserializer: D) -> Result<T, D::Error> where T: Deserialize<'de> + FromStr<Err = Void>, D: Deserializer<'de>, { // This is a Visitor that forwards string types to T's `FromStr` impl and // forwards map types to T's `Deserialize` impl. The `PhantomData` is to // keep the compiler from complaining about T being an unused generic type // parameter. We need T in order to know the Value type for the Visitor // impl. struct StringOrStruct<T>(PhantomData<fn() -> T>); impl<'de, T> Visitor<'de> for StringOrStruct<T> where T: Deserialize<'de> + FromStr<Err = Void>, { type Value = T; fn expecting( &self, formatter: &mut fmt::Formatter, ) -> fmt::Result { formatter.write_str("string or map") } fn visit_str<E>( self, value: &str, ) -> Result<T, E> where E: de::Error, { Ok(FromStr::from_str(value).unwrap()) } fn visit_map<M>( self, map: M, ) -> Result<T, M::Error> where M: MapAccess<'de>, { // `MapAccessDeserializer` is a wrapper that turns a `MapAccess` // into a `Deserializer`, allowing it to be used as the input to T's // `Deserialize` implementation. T then deserializes itself using // the entries from the map visitor. Deserialize::deserialize(de::value::MapAccessDeserializer::new(map)) } } deserializer.deserialize_any(StringOrStruct(PhantomData)) } 07070100000025000081A400000000000000000000000166252D72000004EA000000000000000000000000000000000000003000000000rinstall-0.2.0~git35.c30f365/src/tarball_cmd.rs#[derive(Args, Clone)] pub struct TarballCmd { #[clap( long, help = concat!("Use the generated binaries and libraries from the", " debug profile (only effective for rust projects)") )] pub rust_debug_target: bool, #[clap( long, help = concat!("Use the generated binaries and libraries from this", " target triple (only effective for rust projects)") )] pub rust_target_triple: Option<String>, #[clap( short = 'P', long, help = "Path to the directory containing the project to install", default_value_os_t = std::env::current_dir() .expect("unable to get current directory"), )] pub package_dir: std::path::PathBuf, #[clap( short = 'p', long = "pkgs", help = "List of packages to install, separated by a comma" )] pub packages: Vec<String>, #[clap( long, help = "Name of the inner directory inside the tarball (default to the tarball-name)" )] pub directory_name: Option<String>, #[clap( long, help = "Name of the tarball to create (the suffix .tar.gz is added if not present)" )] pub tarball_name: String, } 07070100000026000081A400000000000000000000000166252D72000015CC000000000000000000000000000000000000003500000000rinstall-0.2.0~git35.c30f365/src/tarball_cmd_impl.rsuse std::{ fs::{self, File}, io::Write, }; use camino::Utf8Path; use clap::Args; use color_eyre::{ eyre::{Context, ContextCompat}, owo_colors::OwoColorize, Result, }; use colored::Colorize; use flate2::{write::GzEncoder, Compression}; use log::info; use walkdir::WalkDir; use crate::{ dirs::Dirs, install_spec::InstallSpec, package::{CompletionsToInstall, Type}, project::{RustDirectories, RUST_DIRECTORIES, RUST_DIRECTORIES_ONCE}, DirsConfig, }; include!("tarball_cmd.rs"); impl TarballCmd { pub fn run(self) -> Result<()> { let dirs_config = DirsConfig::load(None, true, &mut DirsConfig::system_config())?; let dirs = Dirs::new(dirs_config, true).context("unable to create dirs")?; let install_spec = InstallSpec::new_from_path(Utf8Path::from_path(&self.package_dir).unwrap())?; let package_dir = Utf8Path::from_path(&self.package_dir) .context("Package directory contains invalid UTF-8 character")?; // For the filename of the tarball append the suffix .tar.gz let filename = format!("{}.tar.gz", self.tarball_name); info!("Creating tarball {}", filename.italic().yellow()); let archive_buf: Vec<u8> = Vec::new(); let mut archive = tar::Builder::new(archive_buf); archive.follow_symlinks(false); let directory_name = self.directory_name.as_deref().unwrap_or(&self.tarball_name); // Add install.yml info!("Adding install.yml"); archive .append_path_with_name( package_dir.join("install.yml"), format!("{directory_name}/install.yml",), ) .context("Unable to append file install.yml to tarball")?; let rinstall_version = install_spec.version.clone(); let packages = install_spec.packages(&self.packages); if packages.iter().any(|p| p.pkg_type == Type::Rust) { RUST_DIRECTORIES_ONCE.call_once(|| { // We use call_once on std::once::Once, this is safe unsafe { RUST_DIRECTORIES = Some( RustDirectories::new( Some(package_dir.to_path_buf()) , self.rust_debug_target, self.rust_target_triple.as_deref(), ) // TODO .unwrap(), ); } }); } for package in packages { info!( "{} {} {}", ">>>".magenta(), "Package".bright_black(), package.name.as_ref().unwrap().italic().blue() ); let targets = package.targets(&dirs, &rinstall_version, true, &CompletionsToInstall::all())?; for install_entry in &targets { // Print each file/directory added info!("Adding {}", install_entry.source.as_str().bold().magenta()); archive .append_path_with_name( &install_entry.full_source, format!("{directory_name}/{}", install_entry.source), ) .with_context(|| { format!("Unable to append path {} to tarball", install_entry.source) })?; if install_entry.full_source.is_dir() { WalkDir::new(&install_entry.full_source) .into_iter() .try_for_each(|entry| -> Result<()> { let entry = entry?; if !entry.file_type().is_file() { // skip directories return Ok(()); } let full_file_path = Utf8Path::from_path(entry.path()).unwrap(); // unwrap here is unsafe let relative_file_path = full_file_path .strip_prefix(&install_entry.full_source) .unwrap(); let source = install_entry.source.join(relative_file_path); info!("Adding {}", source.as_str().bold().magenta()); archive .append_path_with_name( full_file_path, format!("{directory_name}/{source}",), ) .with_context(|| { format!("Unable to append path {source} to tarball") })?; Ok(()) })?; } } } if Utf8Path::new(&filename).exists() { fs::remove_file(&filename) .with_context(|| format!("unable to remove file {filename}"))?; } let file = File::create(&filename).with_context(|| format!("Unable to create file {filename}"))?; let mut encoder = GzEncoder::new(file, Compression::default()); //.context("unable to compress tarball")?; encoder .write_all(&archive.into_inner().context("unable to create tarball")?) .context("Unable to write compressed tarball into filesystem")?; Ok(()) } } 07070100000027000081A400000000000000000000000166252D72000007E7000000000000000000000000000000000000002F00000000rinstall-0.2.0~git35.c30f365/src/templating.rsuse color_eyre::{ eyre::{ensure, ContextCompat}, Result, }; use crate::Dirs; pub fn apply_templating( contents: &[u8], dirs: &Dirs, ) -> Result<String> { macro_rules! replace_impl { ( $contents:tt, $dir:expr, $needle:literal ) => { $contents = $contents.replace( $needle, $dir.as_os_str() .to_str() .with_context(|| format!("unable to convert {:?} to String", $dir))?, ); }; } macro_rules! replace { ( $contents:tt, $dir:ident, $needle:literal ) => { replace_impl!($contents, &dirs.$dir, $needle); }; } macro_rules! replace_when_some { ( $contents:tt, $dir:ident, $needle:literal ) => { if let Some($dir) = &dirs.$dir { replace_impl!($contents, $dir, $needle); } else { // TODO: Is this needed? ensure!( !$contents.contains($needle), "tried replacing {} when its value is none", $needle ); } }; } let mut contents = String::from_utf8_lossy(contents).to_string(); replace_when_some!(contents, prefix, "@prefix@"); replace_when_some!(contents, exec_prefix, "@exec_prefix@"); replace!(contents, bindir, "@bindir@"); replace!(contents, libdir, "@libdir@"); replace!(contents, datarootdir, "@datarootdir@"); replace!(contents, datadir, "@datadir@"); replace!(contents, sysconfdir, "@sysconfdir@"); replace!(contents, localstatedir, "@localstatedir@"); replace!(contents, runstatedir, "@runstatedir@"); replace_when_some!(contents, includedir, "@includedir@"); replace_when_some!(contents, docdir, "@docdir@"); replace_when_some!(contents, mandir, "@mandir@"); replace_when_some!(contents, pam_modulesdir, "@pam_moduledirs@"); replace!(contents, systemd_unitsdir, "@systemd_unitsdir@"); Ok(contents) } 07070100000028000081A400000000000000000000000166252D720000056D000000000000000000000000000000000000002E00000000rinstall-0.2.0~git35.c30f365/src/uninstall.rs#[derive(Parser, Clone)] pub struct Uninstall { #[clap( short, long, help = "Path to the rinstall.yml configuration", global = true )] pub config: Option<String>, #[clap( short = 'y', long = "yes", help = "Accept the changes and perform the uninstallation" )] pub accept_changes: bool, #[clap(short = 'f', long = "force", help = "Force the uninstallation")] pub force: bool, #[clap( long = "system", help = "Perform a system-wide uninstallation", global = true )] pub system: bool, #[clap( long, env, requires = "system", global = true, help = concat!("A prefix used in constructing the default values of the directories", " listed below. (system only)", " [default: /usr/local]") )] pub prefix: Option<String>, #[clap( long, env, global = true, help = concat!("A prefix used in constructing the default values of the directories", " listed below. (system only)", " [default: /usr/local]") )] pub localstatedir: Option<String>, #[clap( help = "The names or pkginfo files of the packages to remove", required = true, )] pub packages: Vec<String>, } 07070100000029000081A400000000000000000000000166252D7200000DA4000000000000000000000000000000000000003300000000rinstall-0.2.0~git35.c30f365/src/uninstall_impl.rsuse std::fs; use camino::{Utf8Path, Utf8PathBuf}; use clap::Parser; use color_eyre::{ eyre::{ensure, Context}, Result, }; use colored::Colorize; use log::{info, warn}; use crate::{dirs::Dirs, dirs_config_impl::DirsConfig, package_info::PackageInfo}; include!("uninstall.rs"); impl Uninstall { pub fn run(self) -> Result<()> { let mut opt_dirs = if unsafe { libc::getuid() } == 0 || self.system { DirsConfig::system_config() } else { DirsConfig::user_config() }; opt_dirs.prefix = self.prefix; opt_dirs.localstatedir = self.localstatedir; let dirs_config = DirsConfig::load(self.config.as_deref(), self.system, &mut opt_dirs)?; let dirs = Dirs::new(dirs_config, self.system).context("unable to create dirs")?; let dry_run = !self.accept_changes; for pkg in &self.packages { let pkg_info = if Utf8Path::new(&pkg).is_absolute() { Utf8PathBuf::from(pkg) } else { dirs.localstatedir .join("rinstall") .join(format!("{}.pkg", &pkg)) }; ensure!(pkg_info.exists(), "package {} is not installed", &pkg); let pkg_info: PackageInfo = serde_yaml::from_str( &fs::read_to_string(&pkg_info) .with_context(|| format!("unable to read file {:?}", &pkg_info))?, )?; for file in &pkg_info.files { let modified = file.has_been_modified()?; if dry_run { if file.replace && modified { warn!( "file {} has been modified but it will be uninstalled anyway", file.path.as_str().cyan().bold() ); } else if !file.replace && modified { warn!( "file {} has been modified but it won't be removed, add {} to remove it", file.path.as_str().yellow().bold(), "--force".bright_black().italic(), ); } else { info!("Would remove {}", file.path.as_str().cyan().bold()); } } else if !file.replace && modified && !self.force { info!("Keeping file {}", file.path.as_str().cyan().bold()); } else if modified && (file.replace || self.force) { warn!( "modified file {} has been uninstalled", file.path.as_str().cyan().bold(), ); fs::remove_file(&file.path) .with_context(|| format!("unable to remove file {:?}", file.path))?; } else { info!("Removing {}", file.path.as_str().cyan().bold()); fs::remove_file(&file.path) .with_context(|| format!("unable to remove file {:?}", file.path))?; } } if dry_run { info!("Would remove {}", pkg_info.path.as_str().cyan().bold()); } else { info!("Removing {}", pkg_info.path.as_str().cyan().bold()); fs::remove_file(&pkg_info.path) .with_context(|| format!("unable to remove file {:?}", &pkg_info.path))?; } } Ok(()) } } 0707010000002A000081A400000000000000000000000166252D7200000378000000000000000000000000000000000000002A00000000rinstall-0.2.0~git35.c30f365/src/utils.rsuse std::{fs::OpenOptions, io::Write}; use camino::{Utf8Path, Utf8PathBuf}; use color_eyre::{eyre::Context, Result}; pub fn append_destdir( destination: &Utf8Path, destdir: Option<&str>, ) -> Utf8PathBuf { destdir.map_or(destination.to_owned(), |destdir| { // join does not work when the argument (not the self) is an absolute path Utf8PathBuf::from({ let mut s = destdir.to_string(); s.push_str(destination.as_str()); s }) }) } pub fn write_to_file( destination: &Utf8Path, contents: &[u8], ) -> Result<()> { OpenOptions::new() .write(true) .truncate(true) .open(destination) .with_context(|| format!("unable to open file {:?}", destination))? .write(contents) .with_context(|| format!("unable to write to file {:?}", destination))?; Ok(()) } 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!373 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor