You are not logged in.
Hello, and thanks for reading this.
Is it possible to give a command root permissions in a pkgbuild without sudo? I'm trying to `cp` a file into `/usr/bin` and `touch` a file in /usr/share/applications, but I get a permission error. How can I avoid this problem?
Last edited by T4rtP1ck73 (2021-08-11 18:45:57)
Offline
Your doing it wrong. PKGBUILDS should never touch anything that isn't under $pkgdir.
Please post what you've come up with so far.
Offline
How do I use code tags?
Offline
Offline
pkgname=aio-backup
pkgver=0.1.2
pkgrel=3
makedepends=('rust' 'cargo')
arch=('any')
prepare() {
if [ -d /usr/bin/aio-backup ]; then
rm -rf /usr/bin/aio-backup
fi
if [ -d /usr/share/applications/AIO\ Backup ]; then
rm -rf /usr/share/applications/AIO\ Backup/
fi
}
package() {
cargo build --target-dir $pkgdir
chmod +x $pkgdir/debug/aio_backup
cp $pkgdir/debug/aio_backup $pkgdir/usr/bin/aio-backup
mv AIO\ Backup.desktop $pkgdir/usr/share/applications/AIO\ Backup.desktop
rm -rf $pkgdir/debug
}Btw, I just realized I forgot the source, no need to tell me ![]()
Last edited by T4rtP1ck73 (2021-08-11 19:02:07)
Offline
For your actual question you are misunderstanding how pacman works - you do not have to (and absolutely can not) remove existing files. Pacman will remove the existing files when the new package is installed. Even if this wasn't the case, you would not want to remove the existing files when the package is built, but only when it was installed.
So get rid of that prepare function all together.
Then read the wiki:
https://wiki.archlinux.org/title/Rust_p … guidelines
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Ok, done
Offline