qwerty12
|
2009-06-03
, 00:28
|
|
Posts: 4,274 |
Thanked: 5,358 times |
Joined on Sep 2007
@ Looking at y'all and sighing
|
#31
|
|
2009-06-03
, 02:21
|
|
Posts: 903 |
Thanked: 632 times |
Joined on Apr 2008
|
#32
|
$HOME` == /root because dpkg will run the package's install scripts as root.
|
2009-06-03
, 06:55
|
|
Posts: 4,274 |
Thanked: 5,358 times |
Joined on Sep 2007
@ Looking at y'all and sighing
|
#33
|
What would be the correct way to get the user's home directory from a script run as root?
|
2009-06-03
, 07:43
|
Posts: 542 |
Thanked: 117 times |
Joined on Sep 2008
@ 52 N, 6 E
|
#34
|
pocketpenguin:~# apt-get install quickclip Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: quickclip 0 upgraded, 1 newly installed, 0 to remove and 38 not upgraded. Need to get 43.6kB of archives. After unpacking 315kB of additional disk space will be used. WARNING: The following packages cannot be authenticated! quickclip Install these packages without verification [y/N]? y Get:1 http://repository.maemo.org diablo/free quickclip 0.4.4-2 [43.6kB] Fetched 43.6kB in 0s (60.4kB/s) (Reading database ... 19023 files and directories currently installed.) Unpacking quickclip (from .../quickclip_0.4.4-2_all.deb) ... mkdir: cannot create directory '/root/MyDocs/Quick_Clip/': No such file or directory Setting up quickclip (0.4.4-2) ... chown: /root/MyDocs/Quick_Clip/: No such file or directory Cache file created successfully.
|
2009-06-03
, 15:27
|
|
Posts: 903 |
Thanked: 632 times |
Joined on Apr 2008
|
#35
|
Unfortunately, I'm not sure that there is one (I certainly do not know of a method of getting it cleanly anyway, perhaps someone else does?). The thing is, preinst scripts aren't really meant to install files to ~ - dpkg is, as you'll know, from Debian which can be used with multiple users (I know, doesn't sound like a feature but look at Windows 95/98/ME to understand...) and, in that world, installing files to one person's ~ isn't correct - what if a user, with a new account made after installing such a program wants use a program that relies on that method of installing files?
But, anyway, sorry for the mini-rant above (it's not intended as one! ). I hardcode "/home/user" because this is Maemo which is ever unlikely to see apps, desktop, etc running as a different account.
I can't remember which package demonstrates this but Nokia have a way of checking for scratchbox (think it's along the lines of "if [ -e /scratchbox/tools/config ]", something like that), if that scratchbox check proves true, you may wish to do something along the lines of: "for userz in `ls /home`; do cp whatever /home/$userz; done" etc. (with the caveat that this only works for already added users, not for users that'll be added later like above).
You may just want to do "if not os.path.exists" from your python application, upon its first run, and just copy the files if not existing from that. That'll be pretty much universal as you can get the correct $HOME etc.
The Following User Says Thank You to BrentDC For This Useful Post: | ||
|
2009-06-03
, 15:27
|
|
Posts: 903 |
Thanked: 632 times |
Joined on Apr 2008
|
#36
|
still not working yet after reboot ....Code:pocketpenguin:~# apt-get install quickclip Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: quickclip 0 upgraded, 1 newly installed, 0 to remove and 38 not upgraded. Need to get 43.6kB of archives. After unpacking 315kB of additional disk space will be used. WARNING: The following packages cannot be authenticated! quickclip Install these packages without verification [y/N]? y Get:1 http://repository.maemo.org diablo/free quickclip 0.4.4-2 [43.6kB] Fetched 43.6kB in 0s (60.4kB/s) (Reading database ... 19023 files and directories currently installed.) Unpacking quickclip (from .../quickclip_0.4.4-2_all.deb) ... mkdir: cannot create directory '/root/MyDocs/Quick_Clip/': No such file or directory Setting up quickclip (0.4.4-2) ... chown: /root/MyDocs/Quick_Clip/: No such file or directory Cache file created successfully.
|
2009-06-03
, 15:51
|
|
Posts: 4,274 |
Thanked: 5,358 times |
Joined on Sep 2007
@ Looking at y'all and sighing
|
#37
|
In addition, the poster there seemed to think using "sudo echo $HOME" would result in the correct directory being printed. This might explain why this worked fine on my device but not others (the different ways to get root? that was my initial hunch).
|
2009-06-03
, 16:07
|
|
Posts: 903 |
Thanked: 632 times |
Joined on Apr 2008
|
#38
|
|
2009-06-08
, 22:01
|
|
Posts: 903 |
Thanked: 632 times |
Joined on Apr 2008
|
#39
|
|
2009-06-08
, 22:38
|
|
Posts: 1,391 |
Thanked: 4,272 times |
Joined on Sep 2007
@ Vienna, Austria
|
#40
|
The thing is, preinst scripts aren't really meant to install files to ~ - dpkg is, as you'll know, from Debian which can be used with multiple users (I know, doesn't sound like a feature but look at Windows 95/98/ME to understand...) and, in that world, installing files to one person's ~ isn't correct - what if a user, with a new account made after installing such a program wants use a program that relies on that method of installing files?
Tags |
development, python, quick clip |
|