Skip to main content
Topic: Making a PKGBUILD to install binaries (Read 2417 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Making a PKGBUILD to install binaries

Hello everyone! I am trying to make a PKGBUILD to install binary files

here is my question:

what does this do? what is "install" for? What does "-D" do? And what is "-m755" ?
does this install -D -m755 thing just copy the binary files into the directory? What does 755 represent? Some sort of permissions or something? I want to copy .exe files for Mono to use, what number should I use, 755?

Code: [Select]
install -D -m755 "${pkgname}"       "${pkgdir}/usr/bin/${pkgname}"
install -D -m644 "man/${pkgname}.1" "${pkgdir}/usr/share/man/man1/${pkgname}.1"


And what would it look like to install an init script with a PKGBUILD? Does anyone have any examples I can look at? I want to make a PKGBUILD that will cover Runit, SysV & SystemD, so far I think I could make 3 different parts & just "uncomment your init system to install desired init script", but is there perhaps a way to make a PKGBUILD detect the installer's init & auto-select the right file for them?

Re: Making a PKGBUILD to install binaries

Reply #1
Quote
what does this do? what is "install" for? What does "-D" do?
"This install program copies files (often just compiled) into destination locations you choose."
Run this and study...
Code: [Select]
install --help
or
Code: [Select]
man install

Quote
And what is "-m755" ?
File permissions, read wiki
https://wiki.archlinux.org/index.php/File_permissions_and_attributes#Numeric_method

Quote
is there perhaps a way to make a PKGBUILD detect the installer's init & auto-select the right file for them?
You can write some detection script, but it is much easiear for you and other users to create multiple packages for each init system with just init scripts , for example just see how Artix packages are done

Re: Making a PKGBUILD to install binaries

Reply #2
So can I use like... m+x to make a file executable? Because I want the init scripts to be executable, right?

Code: [Select]
 install -D -m+x "run" "${pkgdir}/etc/runit/sv/service/run"

Re: Making a PKGBUILD to install binaries

Reply #3
without reading 755 and 644 are rights as in chmod 0755 ... etc.
Read the chmod man , but 7 makes something executable, 777 is rwxrwxrwx for all.

m755 is probably for mode (chmod) 755

I wonder if you install something and do not specify rights it would be 0000
666 is  read write by everyone :)


Re: Making a PKGBUILD to install binaries

Reply #4
So do you think I would want -m777 ? Just to clarify. I typed in man chmod but didn't see anything about the numbers... I know that chmod +x works but idk if m+x would work or not. This is the first time I've tried making a PKGBUILD like this.

Re: Making a PKGBUILD to install binaries

Reply #5
https://en.wikipedia.org/wiki/Chmod

I learned how to use the number system in the early 90s, haven't looked back
If you make a test file in /tmp/test and keep playing the numbers it will seem pretty easy in 10'

Re: Making a PKGBUILD to install binaries

Reply #6
So do you think I would want -m777 ?
Most of the time you do NOT want 777 (read + write + execute for everyone)
For executable files use 755 (read + write + execute) for owner and (read + execute) for anyone else
When you are creating package do NOT ever give anyone else from root permission to write