Skip to content

feat(export): also export /usr/sbin binaries#19

Open
CheapFuck wants to merge 1 commit into
codam-coding-college:mainfrom
CheapFuck:feat/export-usr-sbin
Open

feat(export): also export /usr/sbin binaries#19
CheapFuck wants to merge 1 commit into
codam-coding-college:mainfrom
CheapFuck:feat/export-usr-sbin

Conversation

@CheapFuck

Copy link
Copy Markdown

What

towel export only exported executables under /usr/bin. Packages that install into /usr/sbin (the issue mentions nix) were silently skipped.

Two patterns hardcoded /usr/bin:

 function towel_repoquery_exportables() {
 	local pkg="$1"
-	local bins_regex='/usr/bin/\S+'
+	local bins_regex='/usr/s?bin/\S+'
 	local desktops_regex='/usr/share/applications/\S+\.desktop'
 	local bin_files
-	bin_files=$(grep -E '^/usr/bin/\S+$' <<<"$files") || true
+	bin_files=$(grep -E '^/usr/s?bin/\S+$' <<<"$files") || true

Both now match /usr/bin and /usr/sbin.

Why it's safe

  • towel_export_bin_wrapper execs the binary by its full path (exec $bin_path), so an /usr/sbin target works with no other changes.
  • The existing [ -e "$bin_file" ] guard still applies, so only files that actually exist are wrapped.
  • /usr/bin matching is unchanged (the s? only adds /usr/sbin).

Verification (inside a towel container)

  • New regex still matches real /usr/bin entries (dnf repoquery -l bash/usr/bin/bash, …). No regression.
  • New regex matches both /usr/bin/foo and /usr/sbin/bar; the old regex dropped /usr/sbin/bar.
  • shellcheck -x and shfmt -d pass on install, towel, and all towel-* scripts.

Note: on a fully usr-merged image (e.g. Fedora rawhide, where /usr/sbin -> bin) repoquery already reports /usr/bin paths, so this is a no-op there; the change matters on systems/packages that still populate /usr/sbin.

Closes #14

`towel_repoquery_exportables` and `towel_auto_export` only matched
`/usr/bin/...`, so executables a package installs into `/usr/sbin` were never
exported. Broaden both patterns to `/usr/s?bin/` so binaries in either location
are picked up.

The generated wrapper already execs the binary by its full path, so
`/usr/sbin` targets work unchanged. `/usr/bin` matching is unaffected.

Closes codam-coding-college#14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export currently only exports binaries found in /usr/bin

1 participant