<div dir="ltr"><div dir="ltr">Sorry for the delay in responding! I started typing this up, got pulled away, and forgot about it until now.</div><div dir="ltr"><br></div><div dir="ltr">On Fri, Dec 27, 2024 at 12:49 AM Shahab Vahedi <<a href="mailto:list%2Bsbo@vahedi.org">list+sbo@vahedi.org</a>> wrote:<br></div><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">December 27, "Jeremy Hansen" wrote:<br>
<br>
> Do you have an example package where this occurred?<br>
<br>
Here, I am using "&&" to break out of the "( cd <path> ; rm -f <file> )"<br>
pattern in "doinst.sh":<br>
<br>
<a href="https://git.slackbuilds.org/slackbuilds/tree/system/brother-brscan4/doinst.sh?h=e3fa7302a#n20" rel="noreferrer" target="_blank">https://git.slackbuilds.org/slackbuilds/tree/system/brother-brscan4/doinst.sh?h=e3fa7302a#n20</a><br>
<br>
The counter removal part is in "douninst.sh" because now those "symlinks"<br>
are not handled automatically anymore:<br>
<br>
<a href="https://git.slackbuilds.org/slackbuilds/tree/system/brother-brscan4/douninst.sh?h=e3fa7302a#n2" rel="noreferrer" target="_blank">https://git.slackbuilds.org/slackbuilds/tree/system/brother-brscan4/douninst.sh?h=e3fa7302a#n2</a><br>
<br>
On the conterary, having the "( cd <path> ; rm -f <file> )" for these<br>
particular symlinks results in _automatic_ removal, so no "douninst.sh"<br>
section is necessary:<br>
<br>
<a href="https://git.slackbuilds.org/slackbuilds/tree/system/brother-brscan4/doinst.sh?h=e3fa7302a#n34" rel="noreferrer" target="_blank">https://git.slackbuilds.org/slackbuilds/tree/system/brother-brscan4/doinst.sh?h=e3fa7302a#n34</a><br>
<br>
This is desired as I want the empty "/etc/opt/brother/" dir be removed<br>
after uninstalling the package. </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> I can't think of a reason why the doinst.sh should have $LIBDIRSUFFIX in it<br>
> (but maybe there's edge cases I can't think of). Symlinks generally<br>
> (always?) should be created within the package directory structure by<br>
> commands in the SlackBuild, which will replace $LIBDIRSUFFIX with the<br>
> correct location in that directory structure.<br>
> <br>
> Then, when makepkg is ran, it will remove symlinks and add them<br>
> automatically to the doinst.sh.<br>
<br>
My whole point of adding things to "doinst.sh" was to avoid the warning<br>
(probably "warning" is too strong of a word) from "makepkg". I wanted to<br>
make things explicit.<br></blockquote><div><br></div><div>This seems like <i>a lot</i> of unnecessary work for something makepkg is literally designed to account for and automate (which minimizes chances of mistakes).</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> If there is really a reason to manually add symlinks to the doinst.sh, a<br>
> sed command should be used to ensure the correct directory is listed in the<br>
> final doinst.sh before the makepkg is ran.<br>
<br>
Could you provide the name of a package who does this?<br>
<br>
It's all good if we figure out that I did not package "brother-brscan4"<br>
as it should have been. I'm open to fixing that. HOWEVER, the point of my<br>
original e-mail was if anybody knows about this _undocumented_ behaviour?<br>
And by that, I mean that there is a "contract" on constructs like below: </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
( cd <path> ; rm -rf <file> )<br>
( cd <path> ; ln -sf <src> <file> )<br></blockquote><div><br></div><div><font face="arial, sans-serif" color="#000000">You'd throw something like @LIBDIR@ into the doinst.sh and then use sed at the end of the SlackBuild to make the necessary adjustments:</font></div><div><font face="arial, sans-serif" color="#000000"><br></font></div><div><font face="arial, sans-serif" color="#000000">sed -i "s|@LIBDIR@|lib$LIBDIRSUFFIX|g" doinst.sh</font></div><div><font face="arial, sans-serif" color="#000000"><br></font></div><div><font face="arial, sans-serif" color="#000000">I honestly didn't know if something like this existed in the repo, but doing a grep looking for sed commands adjusting doinst.sh files with a case-insensitive grep of lib showed there are 14 packages out of 9500ish scripts. You can find them using this command at the base of a cloned SBo repo:</font></div><div><font face="arial, sans-serif" color="#000000"><br></font></div><div><font color="#000000"><font face="monospace">grep sed.*doinst\.sh */*/*.SlackBuild | grep -i lib</font><br></font></div><div><font face="arial, sans-serif" color="#000000"><br></font></div><div><font color="#000000" face="arial, sans-serif">To compare, if you grep SlackBuilds for "ln -s" and remove results containing "man" (since the templates include a search to link manpages to their newly compressed versions), that nets over 1000 results. It seems it is much more common to create any required symlinks within the PKG directory using the SlackBuild and let makepkg handle the automation of removing them and adding them to the doinst.sh.</font></div><div><font color="#000000" face="arial, sans-serif"><br></font></div><div><font color="#000000" face="arial, sans-serif">Digging into this more, there is a use case for specifying the LIBDIRSUFFIX in the doinst.sh template, but this is for rebuilding the gio cache if modules have been added there. There isn't a way to handle this inside the SlackBuild, and the doinst.sh needs to know whether the files are stored in /usr/lib/ or /usr/lib64/. You're still able to manually specify your symlinks in the doinst.sh, but I really think it's better to just let makepkg handle them. Choice is up to you!</font></div><div><font color="#000000" face="arial, sans-serif"><br></font></div><div><font color="#000000" face="arial, sans-serif">Jeremy</font></div></div></div>