Merge lp:~mterry/ubuntu-touch-session/pulse-in-snap into lp:ubuntu-touch-session

Proposed by Michael Terry
Status: Merged
Approved by: Łukasz Zemczak
Approved revision: 295
Merged at revision: 296
Proposed branch: lp:~mterry/ubuntu-touch-session/pulse-in-snap
Merge into: lp:ubuntu-touch-session
Diff against target: 163 lines (+28/-19)
10 files modified
etc/profile.d/upstart-phablet.sh (+1/-1)
ubuntu-touch-lightdm-session (+1/-1)
ubuntu-touch-session (+9/-9)
upstart-session/bluez-mpris-proxy.conf (+1/-1)
upstart-session/cameraservice-trust-stored.conf (+1/-1)
upstart-session/obexd.conf (+1/-1)
upstart-session/ofono-setup.conf (+1/-1)
upstart-session/pulseaudio-trust-stored.conf (+1/-1)
upstart-session/pulseaudio.conf (+11/-2)
usc-wrapper (+1/-1)
To merge this branch: bzr merge lp:~mterry/ubuntu-touch-session/pulse-in-snap
Reviewer Review Type Date Requested Status
Łukasz Zemczak Approve
Albert Astals Cid (community) Abstain
Ubuntu Phablet Team Pending
Review via email: mp+306662@code.launchpad.net

Commit message

Support running inside a snap (without breaking non-snap runs).

Description of the change

Support running inside a snap (without breaking non-snap runs).

For testing this, you can install silo 2129 (which will pull in a lot of other stuff too though...)

To post a comment you must log in.
293. By Michael Terry

Rely on PATH where possible

Revision history for this message
Albert Astals Cid (aacid) wrote :

I needed to add
  initctl set-env LD_LIBRARY_PATH=$SNAP/usr/lib/pulse-8.0/modules:$LD_LIBRARY_PATH
after
  initctl set-env --global PULSE_SCRIPT=$SNAP_USER_DATA/etc/pulse/touch.pa

so that pulseaudio actually started.

Lukas had a different/similar solution.

review: Needs Fixing
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Well we have currently this in our snacraft.yaml:

export PULSE_DLPATH=$(ls -d $SNAP/usr/lib/pulse-*/modules)

But that wasn't enough; what I did was to add:

export GST_PLUGIN_SYSTEM_PATH=$SNAP/usr/lib/$ARCH/gstreamer-1.0

and
...
 apps:
   unity8-session:
     command: snappyenv ${SNAP}/sbin/upstart --user
- plugs: [home]
+ plugs: [home, gsettings, pulseaudio, opengl]

After that, the indicator-sound starts and logout actually takes no more than a few seconds.

Revision history for this message
Michael Terry (mterry) wrote :

Hmm, I'm having pulseaudio start for me fine without any changes in this MP. I'm curious what our differences would be.

Revision history for this message
Albert Astals Cid (aacid) wrote :

You are running the snap in a xenial install while i'm running it in a zesty one? (Not idea about ltinkl)

294. By Michael Terry

Use .local/share/pulse instead of etc/pulse inside SNAP_USER_DATA in case we're using that for HOME too, like we do in u8 snap

Revision history for this message
Michael Terry (mterry) wrote :

I've committed a change to our snap packaging that uses the snapcraft-desktop-helpers scripts. I bet with those + this MP things work for you.

I'm working on updating the silo PPA and snap to have all the latest changes.

Revision history for this message
Michael Terry (mterry) wrote :

(or you could just build your own snap and test that way)

Revision history for this message
Michael Terry (mterry) wrote :

Try again. I fixed an issue with our wrapper script that might have prevented this from working. (I hope)

Revision history for this message
Albert Astals Cid (aacid) wrote :

> Try again. I fixed an issue with our wrapper script that might have prevented
> this from working. (I hope)

Yes, that worked.

Revision history for this message
Albert Astals Cid (aacid) :
review: Abstain
295. By Michael Terry

Only override PULSE_* if those vars aren't set (by a snap wrapper script, say)

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'etc/profile.d/upstart-phablet.sh'
2--- etc/profile.d/upstart-phablet.sh 2014-04-01 12:24:32 +0000
3+++ etc/profile.d/upstart-phablet.sh 2016-11-29 23:53:13 +0000
4@@ -4,5 +4,5 @@
5 uid=$(getent passwd "$USER"|cut -d: -f3)
6 export XDG_RUNTIME_DIR="/run/user/$uid"
7
8- export UPSTART_SESSION=$(/sbin/initctl list-sessions | awk '{ print $NF; quit }')
9+ export UPSTART_SESSION=$(initctl list-sessions | awk '{ print $NF; quit }')
10 fi
11
12=== modified file 'ubuntu-touch-lightdm-session'
13--- ubuntu-touch-lightdm-session 2014-06-03 14:31:27 +0000
14+++ ubuntu-touch-lightdm-session 2016-11-29 23:53:13 +0000
15@@ -7,5 +7,5 @@
16 if [ -n "$MIR_SOCKET" ]; then
17 exec $@
18 else
19- exec /usr/sbin/lightdm-session $@
20+ exec lightdm-session $@
21 fi
22
23=== modified file 'ubuntu-touch-session'
24--- ubuntu-touch-session 2016-10-11 10:07:50 +0000
25+++ ubuntu-touch-session 2016-11-29 23:53:13 +0000
26@@ -14,11 +14,11 @@
27
28 # override defaults by sourcing /etc/ubuntu-touch-session.d/$device.conf
29 device=$(getprop ro.product.device)
30-if [ -e /etc/ubuntu-touch-session.d/$device.conf ]; then
31- . /etc/ubuntu-touch-session.d/$device.conf
32+if [ -e $SNAP/etc/ubuntu-touch-session.d/$device.conf ]; then
33+ . $SNAP/etc/ubuntu-touch-session.d/$device.conf
34 else
35 # android.conf is used by the bind mount
36- . /etc/ubuntu-touch-session.d/android.conf
37+ . $SNAP/etc/ubuntu-touch-session.d/android.conf
38 fi
39
40 # Workaround for bug 1308210 / 1318070 (x86 emulator and scopes)
41@@ -30,11 +30,11 @@
42 fi
43
44 # Set up xdg dirs
45-[ -z "$XDG_CONFIG_DIRS" ] && export XDG_CONFIG_DIRS=/etc/xdg
46-[ -z "$XDG_DATA_DIRS" ] && export XDG_DATA_DIRS=/usr/local/share:/usr/share
47+[ -z "$XDG_CONFIG_DIRS" ] && export XDG_CONFIG_DIRS=$SNAP/etc/xdg
48+[ -z "$XDG_DATA_DIRS" ] && export XDG_DATA_DIRS=$SNAP/usr/local/share:$SNAP/usr/share
49 if [ -n "$DESKTOP_SESSION" ]; then
50- export XDG_CONFIG_DIRS=/etc/xdg/xdg-$DESKTOP_SESSION:$XDG_CONFIG_DIRS
51- export XDG_DATA_DIRS=/usr/share/$DESKTOP_SESSION:$XDG_DATA_DIRS
52+ export XDG_CONFIG_DIRS=$SNAP/etc/xdg/xdg-$DESKTOP_SESSION:$XDG_CONFIG_DIRS
53+ export XDG_DATA_DIRS=$SNAP/usr/share/$DESKTOP_SESSION:$XDG_DATA_DIRS
54 fi
55
56 # if /custom/xdg/config exists, add it to xdg_config_dirs. this is so upstart can get job definitions from /custom
57@@ -51,8 +51,8 @@
58 grep -q GRID_UNIT_PX $dot_profile || echo "export GRID_UNIT_PX=${GRID_UNIT_PX}" >> $dot_profile
59
60 # Make sure we're also exporting the profile.d variables
61-if [ -d /etc/profile.d ]; then
62- for i in /etc/profile.d/*.sh; do
63+if [ -d $SNAP/etc/profile.d ]; then
64+ for i in $SNAP/etc/profile.d/*.sh; do
65 if [ -r $i ]; then
66 . $i
67 fi
68
69=== modified file 'upstart-session/bluez-mpris-proxy.conf'
70--- upstart-session/bluez-mpris-proxy.conf 2015-10-19 20:21:22 +0000
71+++ upstart-session/bluez-mpris-proxy.conf 2016-11-29 23:53:13 +0000
72@@ -6,4 +6,4 @@
73
74 respawn
75
76-exec /usr/lib/bluetooth/mpris-proxy -s core.ubuntu.media.Service
77+exec $SNAP/usr/lib/bluetooth/mpris-proxy -s core.ubuntu.media.Service
78
79=== modified file 'upstart-session/cameraservice-trust-stored.conf'
80--- upstart-session/cameraservice-trust-stored.conf 2016-07-08 13:50:16 +0000
81+++ upstart-session/cameraservice-trust-stored.conf 2016-11-29 23:53:13 +0000
82@@ -22,7 +22,7 @@
83 # TODO check if needed by inspection of trust store library / camera service
84 sleep 1
85
86- exec /usr/bin/trust-stored-skeleton \
87+ exec trust-stored-skeleton \
88 --remote-agent UnixDomainSocketRemoteAgent --endpoint=$service_socket \
89 --local-agent MirAgent \
90 --trusted-mir-socket=/var/run/user/$(id -u)/mir_socket_trusted \
91
92=== modified file 'upstart-session/obexd.conf'
93--- upstart-session/obexd.conf 2016-04-15 07:55:53 +0000
94+++ upstart-session/obexd.conf 2016-11-29 23:53:13 +0000
95@@ -7,4 +7,4 @@
96 respawn
97 expect fork
98
99-exec /usr/lib/bluetooth/obexd -P ftp,irmc,mas,pcsuite -r $HOME
100+exec $SNAP/usr/lib/bluetooth/obexd -P ftp,irmc,mas,pcsuite -r $HOME
101
102=== modified file 'upstart-session/ofono-setup.conf'
103--- upstart-session/ofono-setup.conf 2015-07-28 19:02:49 +0000
104+++ upstart-session/ofono-setup.conf 2016-11-29 23:53:13 +0000
105@@ -4,4 +4,4 @@
106 start on started dbus and started pulseaudio
107 stop on desktop-end
108
109-exec /usr/bin/ofono-setup
110+exec ofono-setup
111
112=== modified file 'upstart-session/pulseaudio-trust-stored.conf'
113--- upstart-session/pulseaudio-trust-stored.conf 2016-07-08 13:50:16 +0000
114+++ upstart-session/pulseaudio-trust-stored.conf 2016-11-29 23:53:13 +0000
115@@ -10,7 +10,7 @@
116 # for the service
117 sleep 2
118
119- exec /usr/bin/trust-stored-skeleton \
120+ exec trust-stored-skeleton \
121 --remote-agent DBusRemoteAgent --bus=session \
122 --local-agent MirAgent \
123 --trusted-mir-socket=/var/run/user/$(id -u)/mir_socket_trusted \
124
125=== modified file 'upstart-session/pulseaudio.conf'
126--- upstart-session/pulseaudio.conf 2015-04-07 04:25:00 +0000
127+++ upstart-session/pulseaudio.conf 2016-11-29 23:53:13 +0000
128@@ -9,14 +9,23 @@
129
130 pre-start script
131 # Use the Touch specific Pulseaudio script file
132- initctl set-env --global PULSE_SCRIPT=/etc/pulse/touch.pa
133- initctl set-env --global PULSE_CLIENTCONFIG=/etc/pulse/touch-client.conf
134+ if [ -z "$PULSE_SCRIPT" ]; then
135+ initctl set-env --global PULSE_SCRIPT=/etc/pulse/touch.pa
136+ fi
137+ if [ -z "$PULSE_CLIENTCONFIG" ]; then
138+ initctl set-env --global PULSE_CLIENTCONFIG=/etc/pulse/touch-client.conf
139+ fi
140
141 # Force a default audio role (apps can overwrite this)
142 initctl set-env --global PULSE_PROP='media.role=multimedia'
143
144 # Force server-side corking when stalled (playback)
145 initctl set-env --global PULSE_PLAYBACK_CORK_STALLED=1
146+
147+ # Pulseaudio enforces this variable internally, but tries to re-exec itself
148+ # when enabling it and has difficulty finding its own binary, if in a snap.
149+ # So let's set it for the daemon, so it won't have to.
150+ initctl set-env LD_BIND_NOW=1
151 end script
152
153 exec pulseaudio --start --log-target=syslog
154
155=== modified file 'usc-wrapper'
156--- usc-wrapper 2014-09-08 21:02:31 +0000
157+++ usc-wrapper 2016-11-29 23:53:13 +0000
158@@ -5,4 +5,4 @@
159 . /etc/environment
160 export ANDROID_ROOT
161
162-exec unity-system-compositor --disable-overlays=false --spinner=/usr/bin/unity-system-compositor-spinner $@
163+exec unity-system-compositor --disable-overlays=false --spinner=$SNAP/usr/bin/unity-system-compositor-spinner $@

Subscribers

People subscribed via source and target branches