2
I developed an application for Debian and created .deb installation package using equivs-build. The control file which I used to create package has a line running a postinst script, setup.sh. In this file, I tried to get the login name of the user using several methods including:
USER=$(logname)
USER=$(who am i | awk '{print $1}')
These ways work properly when I try them as root in a terminal window. Unfortunately, they all failed during installation and login user name is retrieved as "root". This leads all the paths in the script to be wrong and script exits with an error, causing Software Center to show an error message and stopping installation.
However, using dpkg to install the package as below, my application was installed successfully.
dpkg -i package-name
So, why this is happening? How to get login name properly?
1The reason why I am trying to achieve this is my application is a parental controls application which should be installed for just one user. – Mustafa Orkun Acar – 2014-10-12T19:33:32.790