Active Topics

 


Reply
Thread Tools
Posts: 7 | Thanked: 0 times | Joined on May 2011
#1
Hi, All

I want to create a directory automatically as user inside /home/user using the debian package , is it possible?


for example ,I want to create a directory
/home/user/mydata

I use the postinst , but it seems it doesn't work well, I got the following error:
mkdir: can't create directory '/home/user/mydata': Permission denied

==================================================
# dpkg -i mydeb.deb
file /var/lib/dpkg/tmp.ci/digsigsums cannot be opened
No digsigsums file
Selecting previously deselected package mydeb.
(Reading database ... 42864 files and directories currently installed.)
Unpacking mydeb (from mydeb.deb) ...
No digsigsums file
Setting up mydeb (0.1-1) ...
mkdir: can't create directory '/home/user/mydata': Permission denied
==================================================




here is the postinit:
#! /bin/bash
mkdir -p /home/user/mydata


any ideas about it?

Thanks advance for your help

Last edited by dtln; 2011-05-23 at 02:55.
 
Posts: 2,102 | Thanked: 1,937 times | Joined on Sep 2008 @ Berlin, Germany
#2
May be unrelated, but: Do you really have bash installed, as N900 comes with some sort of ash, and you have to install bash and have it configured as shell for root and user to use it separately. But i don't know if that is the error
 

The Following User Says Thank You to michaaa62 For This Useful Post:
Venemo's Avatar
Posts: 1,296 | Thanked: 1,773 times | Joined on Aug 2009 @ Budapest, Hungary
#3
Originally Posted by dtln View Post
I want to create a directory automatically as user inside /home/user using the debian package , is it possible?
It is generally a bad practice to place stuff in a user's folders from a package. Place them to a better place, for example /opt (which is on the N900 the preferred place for applications)
One exception is when you want to have such a large file that only fits onto the eMMC's VFAT partition, then of course you could write to /home/user/MyDocs
 

The Following User Says Thank You to Venemo For This Useful Post:
Posts: 435 | Thanked: 769 times | Joined on Apr 2010
#4
How do you create the package? If you're doing it manually with dpkg -b just create the directory (which is considered like a file in Unix) in the files tree. Or you may create the directory at app runtime.
As Venemo wrote, you should leave /home/user dir, since it's mainly used for apps settings.
 

The Following User Says Thank You to gionni88 For This Useful Post:
Posts: 7 | Thanked: 0 times | Joined on May 2011
#5
Hi michaaa62,

The Bash is already installed,thanks anyway

Hi Venemo,

Thanks for your hint, I have changed the install path to /opt/mydata
but I still got "Permission denied" when copy the file to /home/user/MyDocs using postinst.

here is the postinit:
#! /bin/bash
cp /opt/mydata/abc.txt /home/user/MyDocs


Thanks
 
Posts: 7 | Thanked: 0 times | Joined on May 2011
#6
I have copy the file to debian/home/user/abc.txt
and change its owner to user
so after install the debian ,the file is installed coreectly



Originally Posted by gionni88 View Post
How do you create the package? If you're doing it manually with dpkg -b just create the directory (which is considered like a file in Unix) in the files tree. Or you may create the directory at app runtime.
As Venemo wrote, you should leave /home/user dir, since it's mainly used for apps settings.
 
Posts: 435 | Thanked: 769 times | Joined on Apr 2010
#7
Have you tried with #!/bin/sh instead of using bash?

Anyway, copying a file to MyDocs at install time is not safe, user may have MyDocs unmounted (usb mode etc). A proper way would be a file check in your app and an eventual copy/move.


Have you tried putting the file directly in MyDocs instead of shipping it to /opt and than moving it?

How do you create the package? Madde? Scratchbox? Manual dpkg?
 
Posts: 7 | Thanked: 0 times | Joined on May 2011
#8
I put the file into debian directory, debian/home/user/MyDocs
and change its owner to user , it works
Thanks

Originally Posted by gionni88 View Post
Have you tried with #!/bin/sh instead of using bash?

Anyway, copying a file to MyDocs at install time is not safe, user may have MyDocs unmounted (usb mode etc). A proper way would be a file check in your app and an eventual copy/move.


Have you tried putting the file directly in MyDocs instead of shipping it to /opt and than moving it?

How do you create the package? Madde? Scratchbox? Manual dpkg?
 
Reply


 
Forum Jump


All times are GMT. The time now is 22:37.