r/linuxfromscratch • u/Worried_Response2204 • Feb 02 '23
How to package manager?
How can I write my own package manager from scratch using lfs?
4
Upvotes
r/linuxfromscratch • u/Worried_Response2204 • Feb 02 '23
How can I write my own package manager from scratch using lfs?
4
u/d1ng0b0ng0 Feb 02 '23
http://www.linuxfromscratch.org/hints/list.html
Package mgmt is discussed in S6.3
2
u/[deleted] Feb 02 '23
As a distribution développer who wrote and maintains a package manager I must warn you , it’s a difficult road :
First you need a way to compile packages , and keep track of their install locations on the system. This can easily be done with make && make install DESTDIR=/some/dir, get all the files path in /some/dir and then move everything to the root.
The second step is to write the package locations somewhere and remove them when updating or uninstalling.
If you are interested by an attempt at a package management library in C look at https://git.sovietlinux.ml/sovietlinux/libspm
Edit : DM me for more info , I would be happy to share my thoughts and experiences
2
u/syazwanemmett Feb 02 '23
Well, check ‘scratchpkg’, a package manager written posix shell script, was written for LFS system, then become main package manager for an independent source based distribution.