Score:0

Problem with postinst Script

cd flag

I've written a short postinst Script to create some Directories after my Application has been installed, with the Intention that the Application may create new Subdirectories of these Directories regardless of the User that will use the Application later, like Log-Files in several Subdirectories.

My Script looks like this:

#!/bin/bash
set -e

if [ ! -d "/opt/myApp/logs" ]; then
sudo mkdir /opt/myApp/logs
sudo chmod a+rwX /opt/myApp/logs
sudo setfacl -d -m u::rwX /opt/myApp/logs
sudo setfacl -d -m g::rwX /opt/myApp/logs
sudo setfacl -d -m o::rwX /opt/myApp/logs
sudo mkdir /opt/myApp/logs/srv
sudo mkdir /opt/myApp/logs/inst
fi

When I build my *.deb Package and use the Software Installer to install my App, the /opt/myApp/logs Directory gets created, but not the Subdirectories /srv and /inst.

To check out what's wrong, I normally do the following Steps:

  • run my postinst Script manually from within the Terminal, and all Subdirectories will be created

  • Uninstall my Application via the Software Installer

  • remove all Directories created by the postinstall Script manually

  • Reinstall the Application via Software Installer

  • This Time all Directories are created by the Script as intended. Application works.

  • Try it out on a "fresh" Ubuntu Installation

  • start all over again: Directories won't be created the first Time the postinst Script is executed by the Software Installer on a "fresh" Linux.

Any Suggestions why the Subdirectories won't be created by the Software Installer Application when run for the first Time, but only when I execute my postinst Script manually? And afterwards also by the Software Installer with the exact same postinst Script?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.