[Slackbuilds-users] Slackbuilds: doinst.sh and douninst.sh
    Alessandro Baggi 
    alessandro.baggi at gmail.com
       
    Fri Jul 19 08:24:04 UTC 2024
    
    
  
Il 19/07/24 02:38, Willy Sudiarto Raharjo ha scritto:
> 
> if you notice on postgresql.SlackBuild, we have this commands:
> 
> mkdir -p $PKG/var/lib/pgsql/$PG_VERSION/data
> chown -R postgres:postgres $PKG/var/lib/pgsql
> 
> without having postgres user and group, this would fail and the 
> files/directories will not have correct permission for the application
Hi Willy,
in this way, yes if user will not be created the chown command will 
fail, but at this point why not put the chown,user/group creation 
commands in doinst.sh and remove the statement that requires postgres 
user/group?
I think it is more genuine. For example I build my packages inside a VM, 
then I install on my workstation. Here, on my workstation (and on other 
machines where I will install postgresql package) without the user/group 
creation postgresql "cannot be used" as configured so I'm forced to 
create them manually, plus configuring rc.local/rc.local_shutdown, while 
this should be done during package installation.
For example, I have an automated build script to compile all needed 
slackbuilds. If I add a new package that requires a specific user/group 
definition the automated script will be stopped by that requirement but 
if provided inside doinst.sh the automation will work. From my point of 
view if an operation needs to be done many times, the right solution is 
automate it (this is one big advantages of IT).
Another thing that could be inserted in the doinst.sh (for services that 
require to start on boot) is populating rc.local with the correct 
statement (if ..... /etc/rc.d/rc.service start...fi) with the caution to 
not rewrite the same "starts statements" if already defined (maybe used 
in upgrading the package)
In the current state the package installation is not complete because it 
misses some points:
1. User/group privileges configuration that are required by the software 
to run (as shipped in the slackbuild)
2. Configuring and prepare the system to start/stop the service (if 
enabled) during boot/reboot/shutdown process
3. A clean process during package uninstall that clean created 
user/group, start/stop system configuration in rc.local/rc.local_shutdown
My 2 cents,
Alessandro.
    
    
More information about the SlackBuilds-users
mailing list