You are not logged in.
i have build a PKGBUILD that uses a script bash file to copy the folder of the software to the user folder so as the software can modify the files inside that folder, the software is opened with wine.
now i want to add a script that delete that folder copied to user folder in case of uninstalling the AUR package
i could not find a guild for that.
i hope that you can help.
Offline
What is 'the user folder'? If you're talking about the user's home dir, you can't. You have no way of knowing what users have run the software.
Offline
Also don't install anything into /home/* with pacman. Ever.
This is most likely an https://en.wikipedia.org/wiki/XY_problem - what are you trying to do here?
Offline
ardv, is this related to the aur shamela package ?
If so, the shamela package does NOT touch user folders.
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
It seems what is packaged is really more or less itself just an installer. And when the packaged script is run (after the package is fully installed) it copies content into the user's home directory. While the amount of content that is copied should be minimized, this is no different from a program copying it's default configuration into the user's home directory for easy modification.
In all such cases, it is up to the user to clean up any leftover user configs and user data created by the program.
At most, you could have a post_remove script that informed the user of potential left over content that they could be free to then remove.
However, this all appears to be just so it can modify /usr/share/shamela/database when run as a user. Perhaps it'd be better to have a shamala user/group that the program runs as so it can modify those files without having to move them after installation. They may then also be listed in the PKGBUILD's backup files appropriately.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
ardv, is this related to the aur shamela package ?
If so, the shamela package does NOT touch user folders.
yes it is related to it.
after uninstalling the pakcage with: "pacman -R shamela" the "$HOME"/.shamela/database is still there
in another case there is a software that needs to save its settings in a file so i copied the whole program to HOME directory, and i need to remove that folder after uninstalling.
Offline
You can't.
Offline
a software that needs to save its settings in a file so i copied the whole program to HOME directory
That was the wrong solution to that problem.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
You can't.
Nor should.
Imagine the user has relevant data in that location and you remove the package for merely transactional reasons (you need to temporarily remove it to clear a dependency issue) - you just deleted all the users private data. Assume office packages would do that: you replace LO fresh w/ LO still and when uninstalling LO fresh all your documents get wiped.
Whatever problem you're actually trying to solve here, it's something else.
package management must not touch any $HOME ever.
Offline
For clarity :
Shamela is a wine program and OP did their best to follow the Wine pacakge guidelines - usr/bin script .
If someone wants more background, check older topics by OP.
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
https://wiki.archlinux.org/title/Wine_p … bin_script
Assuming that's the case here the problem isn't the package but the (upstream provided) script that invokes the wine executable and that apparently copies over files because the program wants to write into its directoy.
The pattern in the wiki looks like
#!/bin/bash
unset WINEPREFIX
if [ ! -d "$HOME"/.programname ] ; then
mkdir -p "$HOME"/.programname
#prepare the environment here
fi
WINEDEBUG=-all wine "$HOME"/.programname/programname "$@"
and what one could do intead is
#!/bin/bash
unset WINEPREFIX
mkdir -p "$HOME"/.programname # will silently "fail" if the diretory exists
lndir /opt/programname "$HOME"/.programname # will yell an error if a link with a different target exists, otherwise be fine
WINEDEBUG=-all wine "$HOME"/.programname/programname "$@"
# cleanup
find "$HOME"/.programname -type l -delete # remove all links
find "$HOME"/.programname -type d -delete # remove all (empty) directories
This way the invoking shell script will clean after itself and you get to preserve your custom data (if any) but not the wine program itself AND WILL ACTUALLY RUN UPDATED VERSIONS OF THE WINDOWS BINARY - copying stuff into your $HOME implies things get dated.
Edit: the emule https://wiki.archlinux.org/title/Wine_p … ne_example actually does something similar (except symlinking stuff manually and not cleaning up)
Last edited by seth (2024-09-30 13:15:12)
Offline