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

Proposed by Didier Roche-Tolomelli
Status: Merged
Merged at revision: not available
Proposed branch: lp:~didrocks/ubiquity/copy_wallpaper_cache
Merge into: lp:ubiquity
Diff against target: 82 lines (+53/-1) (has conflicts)
2 files modified
debian/changelog (+9/-0)
scripts/install.py (+44/-1)
Text conflict in debian/changelog
To merge this branch: bzr merge lp:~didrocks/ubiquity/copy_wallpaper_cache
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+20527@code.launchpad.net

This proposal supersedes a proposal from 2010-03-02.

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

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
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote : Posted in a previous version of this proposal

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.

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

Sorry, forgot to push resubmit proposal, see my previous comment :)

Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2010-03-03 00:39:16 +0000
+++ debian/changelog 2010-03-03 10:29:18 +0000
@@ -36,7 +36,16 @@
36 * Fix choose_partition thawing to handle free space at the end of36 * Fix choose_partition thawing to handle free space at the end of
37 update_partitions (LP: #527848).37 update_partitions (LP: #527848).
3838
39<<<<<<< TREE
39 -- Evan Dandrea <evand@ubuntu.com> Tue, 02 Mar 2010 21:11:41 +000040 -- Evan Dandrea <evand@ubuntu.com> Tue, 02 Mar 2010 21:11:41 +0000
41=======
42 [ Didier Roche ]
43 * scripts/install.py:
44 - copy the cached wallpaper created either by g-s-d or nautilus or by the
45 dedicated script in install mode. (LP: #530024)
46
47 -- Didier Roche <didrocks@ubuntu.com> Mon, 01 Mar 2010 18:40:15 +0100
48>>>>>>> MERGE-SOURCE
4049
41ubiquity (2.1.28) lucid; urgency=low50ubiquity (2.1.28) lucid; urgency=low
4251
4352
=== modified file 'scripts/install.py'
--- scripts/install.py 2010-02-24 16:38:40 +0000
+++ scripts/install.py 2010-03-03 10:29:18 +0000
@@ -427,7 +427,13 @@
427 'Could not create an Apparmor cache:')427 'Could not create an Apparmor cache:')
428 for line in traceback.format_exc().split('\n'):428 for line in traceback.format_exc().split('\n'):
429 syslog.syslog(syslog.LOG_WARNING, line)429 syslog.syslog(syslog.LOG_WARNING, line)
430430 try:
431 self.copy_wallpaper_cache()
432 except:
433 syslog.syslog(syslog.LOG_WARNING,
434 'Could not copy wallpaper cache:')
435 for line in traceback.format_exc().split('\n'):
436 syslog.syslog(syslog.LOG_WARNING, line)
431 self.copy_dcd()437 self.copy_dcd()
432438
433 self.db.progress('SET', self.count)439 self.db.progress('SET', self.count)
@@ -2358,6 +2364,43 @@
2358 install_misc.chrex(self.target,'umount', '/sys/kernel/security')2364 install_misc.chrex(self.target,'umount', '/sys/kernel/security')
2359 install_misc.chrex(self.target,'umount', '/sys')2365 install_misc.chrex(self.target,'umount', '/sys')
23602366
2367 def copy_wallpaper_cache(self):
2368 """Copy wallpaper cache for libgnome desktop so that it's taken into
2369 account by ureadahead. Only install on system having g-s-d."""
2370
2371 # we don't use copy_network_config casper user trick as it's not and not
2372 # ubuntu in install mode
2373 casper_user = 'ubuntu'
2374 casper_user_home = os.path.expanduser('~%s' % casper_user)
2375 casper_user_wallpaper_cache_dir = os.path.join(casper_user_home,
2376 '.cache', 'wallpaper')
2377 target_user = self.db.get('passwd/username')
2378 target_user_cache_dir = os.path.join(self.target, 'home',
2379 target_user, '.cache')
2380 target_user_wallpaper_cache_dir = os.path.join(target_user_cache_dir,
2381 'wallpaper')
2382 if not os.path.isdir(target_user_wallpaper_cache_dir) and \
2383 os.path.isfile('/usr/lib/gnome-settings-daemon/'
2384 'gnome-update-wallpaper-cache'):
2385 # installer mode (else, g-s-d created it)
2386 if not os.path.isdir(casper_user_wallpaper_cache_dir):
2387 subprocess.call(['sudo', '-u', casper_user, '-i', 'DISPLAY=:0',
2388 '/usr/lib/gnome-settings-daemon/'
2389 'gnome-update-wallpaper-cache'])
2390 # copy to targeted user
2391 uid = subprocess.Popen(['chroot', self.target, 'sudo', '-u',
2392 target_user, '--', 'id', '-u'],
2393 stdout=subprocess.PIPE).communicate()[0].strip('\n')
2394 gid = subprocess.Popen(['chroot', self.target, 'sudo', '-u',
2395 target_user, '--', 'id', '-g'],
2396 stdout=subprocess.PIPE).communicate()[0].strip('\n')
2397 uid = int(uid)
2398 gid = int(gid)
2399 self.copy_tree(casper_user_wallpaper_cache_dir,
2400 target_user_wallpaper_cache_dir, uid, gid)
2401 os.chmod(target_user_cache_dir, 0700)
2402 os.chmod(target_user_wallpaper_cache_dir, 0700)
2403
2361 def cleanup(self):2404 def cleanup(self):
2362 """Miscellaneous cleanup tasks."""2405 """Miscellaneous cleanup tasks."""
23632406

Subscribers

People subscribed via source and target branches

to status/vote changes: