Merge lp:~didrocks/ubiquity/copy_wallpaper_cache into lp:ubiquity

Proposed by Didier Roche-Tolomelli
Status: Superseded
Proposed branch: lp:~didrocks/ubiquity/copy_wallpaper_cache
Merge into: lp:ubiquity
Diff against target: 79 lines (+50/-2)
2 files modified
debian/changelog (+6/-1)
scripts/install.py (+44/-1)
To merge this branch: bzr merge lp:~didrocks/ubiquity/copy_wallpaper_cache
Reviewer Review Type Date Requested Status
Colin Watson (community) Needs Fixing
Review via email: mp+20434@code.launchpad.net

This proposal has been superseded by a proposal from 2010-03-03.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

Just some minor comments; this mostly looks OK.

Typo: "ureadheaded" -> "ureadahead".

Please be consistent with the existing copy_network_config method in how you get the casper user's home directory. (If you wanted to move this to a common method in the process, that would be OK.)

You don't need those two unsightly backslash-continuations; line continuations are automatic within brackets of any kind.

There's no need to say 'return' at the end.

review: Needs Fixing
3858. By Didier Roche-Tolomelli

fix some typo and uneeded \, return…

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Ok, needed changes has been done.

As told on IRC, I tried to factor the copy_network_config method (in fact, I tried already yesterday, but didn't push it further when I saw it didn't work), but we get 'root' as casper user in install mode (no SUDO_USER environment variable) and I need 'ubuntu' to access its wallpaper gconf key.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2010-03-01 17:40:27 +0000
3+++ debian/changelog 2010-03-02 12:20:33 +0000
4@@ -23,7 +23,12 @@
5 * Fix choose_partition thawing to handle free space at the end of
6 update_partitions (LP: #527848).
7
8- -- Evan Dandrea <evand@ubuntu.com> Thu, 25 Feb 2010 12:50:49 +0000
9+ [ Didier Roche ]
10+ * scripts/install.py:
11+ - copy the cached wallpaper created either by g-s-d or nautilus or by the
12+ dedicated script in install mode. (LP: #530024)
13+
14+ -- Didier Roche <didrocks@ubuntu.com> Mon, 01 Mar 2010 18:40:15 +0100
15
16 ubiquity (2.1.28) lucid; urgency=low
17
18
19=== modified file 'scripts/install.py'
20--- scripts/install.py 2010-02-24 16:38:40 +0000
21+++ scripts/install.py 2010-03-02 12:20:33 +0000
22@@ -427,7 +427,13 @@
23 'Could not create an Apparmor cache:')
24 for line in traceback.format_exc().split('\n'):
25 syslog.syslog(syslog.LOG_WARNING, line)
26-
27+ try:
28+ self.copy_wallpaper_cache()
29+ except:
30+ syslog.syslog(syslog.LOG_WARNING,
31+ 'Could not copy wallpaper cache:')
32+ for line in traceback.format_exc().split('\n'):
33+ syslog.syslog(syslog.LOG_WARNING, line)
34 self.copy_dcd()
35
36 self.db.progress('SET', self.count)
37@@ -2358,6 +2364,43 @@
38 install_misc.chrex(self.target,'umount', '/sys/kernel/security')
39 install_misc.chrex(self.target,'umount', '/sys')
40
41+ def copy_wallpaper_cache(self):
42+ """Copy wallpaper cache for libgnome desktop so that it's taken into
43+ account by ureadahead. Only install on system having g-s-d."""
44+
45+ # we don't use copy_network_config casper user trick as it's not and not
46+ # ubuntu in install mode
47+ casper_user = 'ubuntu'
48+ casper_user_home = os.path.expanduser('~%s' % casper_user)
49+ casper_user_wallpaper_cache_dir = os.path.join(casper_user_home,
50+ '.cache', 'wallpaper')
51+ target_user = self.db.get('passwd/username')
52+ target_user_cache_dir = os.path.join(self.target, 'home',
53+ target_user, '.cache')
54+ target_user_wallpaper_cache_dir = os.path.join(target_user_cache_dir,
55+ 'wallpaper')
56+ if not os.path.isdir(target_user_wallpaper_cache_dir) and \
57+ os.path.isfile('/usr/lib/gnome-settings-daemon/'
58+ 'gnome-update-wallpaper-cache'):
59+ # installer mode (else, g-s-d created it)
60+ if not os.path.isdir(casper_user_wallpaper_cache_dir):
61+ subprocess.call(['sudo', '-u', casper_user, '-i', 'DISPLAY=:0',
62+ '/usr/lib/gnome-settings-daemon/'
63+ 'gnome-update-wallpaper-cache'])
64+ # copy to targeted user
65+ uid = subprocess.Popen(['chroot', self.target, 'sudo', '-u',
66+ target_user, '--', 'id', '-u'],
67+ stdout=subprocess.PIPE).communicate()[0].strip('\n')
68+ gid = subprocess.Popen(['chroot', self.target, 'sudo', '-u',
69+ target_user, '--', 'id', '-g'],
70+ stdout=subprocess.PIPE).communicate()[0].strip('\n')
71+ uid = int(uid)
72+ gid = int(gid)
73+ self.copy_tree(casper_user_wallpaper_cache_dir,
74+ target_user_wallpaper_cache_dir, uid, gid)
75+ os.chmod(target_user_cache_dir, 0700)
76+ os.chmod(target_user_wallpaper_cache_dir, 0700)
77+
78 def cleanup(self):
79 """Miscellaneous cleanup tasks."""
80

Subscribers

People subscribed via source and target branches

to status/vote changes: