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

Proposed by Didier Roche on 2010-03-03
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 2010-03-03 Approve on 2010-03-05
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.
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
Didier Roche (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.

Didier Roche (didrocks) wrote :

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

Colin Watson (cjwatson) :
review: Approve

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

Subscribers

People subscribed via source and target branches

to status/vote changes: