Debian Codegraph @

debian/postinst

raw
1 #!/bin/sh
2 set -e
3
4 # Tag to allow some debhelper commands to inject relevant code
5 #DEBHELPER#
6
7 if [ "${1}" = "configure" ] && [ ! -z "${2}" ]; then
8 if dpkg --compare-versions ${2} le "9.0.0~exp1"; then
9 # Try remove folder if empty, left after 9.0.0~exp1 conf suppression
10 # by debhelper conffile handling
11 OLD_KDM_DIR=/etc/default/kdm.d
12 if [ -d ${OLD_KDM_DIR} ] ; then
13 echo "Removing old KDM configuration directory \"${OLD_KDM_DIR}\""
14 rmdir ${OLD_KDM_DIR} || true
15 fi
16 fi
17 fi
18
19 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-remove" ]; then
20 # Vendor logo alternative
21 update-alternatives --install \
22 /usr/share/images/vendor-logos \
23 vendor-logos \
24 /usr/share/desktop-base/debian-logos 50 \
25 --slave /usr/share/icons/vendor/64x64/emblems/emblem-vendor.png \
26 emblem-vendor-64 \
27 /usr/share/icons/desktop-base/64x64/emblems/emblem-debian.png \
28 --slave /usr/share/icons/vendor/128x128/emblems/emblem-vendor.png \
29 emblem-vendor-128 \
30 /usr/share/icons/desktop-base/128x128/emblems/emblem-debian.png \
31 --slave /usr/share/icons/vendor/256x256/emblems/emblem-vendor.png \
32 emblem-vendor-256 \
33 /usr/share/icons/desktop-base/256x256/emblems/emblem-debian.png \
34 --slave /usr/share/icons/vendor/scalable/emblems/emblem-vendor.svg \
35 emblem-vendor-scalable \
36 /usr/share/icons/desktop-base/scalable/emblems/emblem-debian.svg \
37 --slave /usr/share/icons/vendor/64x64/emblems/emblem-vendor-symbolic.png \
38 emblem-vendor-symbolic-64 \
39 /usr/share/icons/desktop-base/64x64/emblems/emblem-debian-symbolic.png \
40 --slave /usr/share/icons/vendor/128x128/emblems/emblem-vendor-symbolic.png \
41 emblem-vendor-symbolic-128 \
42 /usr/share/icons/desktop-base/128x128/emblems/emblem-debian-symbolic.png \
43 --slave /usr/share/icons/vendor/256x256/emblems/emblem-vendor-symbolic.png \
44 emblem-vendor-symbolic-256 \
45 /usr/share/icons/desktop-base/256x256/emblems/emblem-debian-symbolic.png \
46 --slave /usr/share/icons/vendor/scalable/emblems/emblem-vendor-symbolic.svg \
47 emblem-vendor-symbolic-scalable \
48 /usr/share/icons/desktop-base/scalable/emblems/emblem-debian-symbolic.svg \
49 --slave /usr/share/icons/vendor/64x64/emblems/emblem-vendor-white.png \
50 emblem-vendor-white-64 \
51 /usr/share/icons/desktop-base/64x64/emblems/emblem-debian-white.png \
52 --slave /usr/share/icons/vendor/128x128/emblems/emblem-vendor-white.png \
53 emblem-vendor-white-128 \
54 /usr/share/icons/desktop-base/128x128/emblems/emblem-debian-white.png \
55 --slave /usr/share/icons/vendor/256x256/emblems/emblem-vendor-white.png \
56 emblem-vendor-white-256 \
57 /usr/share/icons/desktop-base/256x256/emblems/emblem-debian-white.png \
58 --slave /usr/share/icons/vendor/scalable/emblems/emblem-vendor-white.svg \
59 emblem-vendor-white-scalable \
60 /usr/share/icons/desktop-base/scalable/emblems/emblem-debian-white.svg
61
62 # Theme package alternatives
63 while read theme priority; do
64 update-alternatives --install \
65 /usr/share/desktop-base/active-theme \
66 desktop-theme \
67 /usr/share/desktop-base/$theme-theme $priority
68 done << EOF
69 ceratopsian 50
70 emerald 40
71 homeworld 40
72 futureprototype 40
73 moonlight 40
74 softwaves 40
75 lines 40
76 joy 40
77 joy-inksplat 40
78 spacefun 40
79 EOF
80
81 # Use active theme as highest priority for background
82 active_background=/usr/share/desktop-base/active-theme/wallpaper/contents/images/1920x1080.svg
83 if [ -e ${active_background} ]; then
84 update-alternatives --install \
85 /usr/share/images/desktop-base/desktop-background \
86 desktop-background ${active_background} 70
87 fi
88 # Alternatives for the background in theme packages
89 while read theme filename priority; do
90 update-alternatives --install \
91 /usr/share/images/desktop-base/desktop-background \
92 desktop-background \
93 /usr/share/desktop-base/$theme-theme/wallpaper/contents/images/$filename $priority
94 done << EOF
95 ceratopsian 1920x1080.svg 65
96 emerald 1920x1080.svg 50
97 homeworld 1920x1080.svg 50
98 futureprototype 1920x1080.svg 50
99 moonlight 1920x1080.svg 50
100 softwaves 1024x768.svg 50
101 softwaves 1280x720.svg 50
102 softwaves 1280x800.svg 50
103 softwaves 1280x1024.svg 50
104 softwaves 1600x1200.svg 50
105 softwaves 1920x1080.svg 50
106 softwaves 1920x1200.svg 50
107 softwaves 2560x1440.svg 50
108 softwaves 2560x1600.svg 50
109 lines 1280x1024.svg 50
110 lines 1600x1200.svg 50
111 lines 1920x1080.svg 50
112 lines 1920x1200.svg 50
113 lines 2560x1080.svg 50
114 joy 1280x720.svg 50
115 joy 1280x1024.svg 50
116 joy 1600x1200.svg 50
117 joy 1920x1080.svg 50
118 joy 1920x1200.svg 50
119 joy-inksplat 1280x720.svg 50
120 joy-inksplat 1280x1024.svg 50
121 joy-inksplat 1600x1200.svg 50
122 joy-inksplat 1920x1080.svg 50
123 joy-inksplat 1920x1200.svg 50
124 spacefun 1280x720.svg 50
125 spacefun 1280x1024.svg 50
126 spacefun 1920x1080.svg 50
127 spacefun 1920x1200.svg 50
128 EOF
129
130 # Set up an alternative for the XML version of the background
131 # (for GNOME)
132 # Highest priority for active theme
133 active_background_xml=/usr/share/desktop-base/active-theme/wallpaper/gnome-background.xml
134 if [ -e ${active_background_xml} ]; then
135 update-alternatives --install \
136 /usr/share/images/desktop-base/desktop-background.xml \
137 desktop-background.xml ${active_background_xml} 50
138 fi
139 # Alternatives for theme packages
140 while read theme priority; do
141 update-alternatives --install \
142 /usr/share/images/desktop-base/desktop-background.xml \
143 desktop-background.xml \
144 /usr/share/desktop-base/$theme-theme/wallpaper/gnome-background.xml $priority
145 done << EOF
146 ceratopsian 40
147 emerald 40
148 homeworld 30
149 futureprototype 30
150 moonlight 30
151 softwaves 30
152 lines 30
153 joy 30
154 joy-inksplat 30
155 spacefun 30
156 EOF
157
158 # Set up an alternative for the XML version of the lock screen
159 # (for GNOME)
160 # Highest priority for active theme
161 active_lockscreen=/usr/share/desktop-base/active-theme/lockscreen/gnome-background.xml
162 if [ -e ${active_lockscreen} ]; then
163 update-alternatives --install \
164 /usr/share/images/desktop-base/desktop-lockscreen.xml \
165 desktop-lockscreen.xml ${active_lockscreen} 50
166 fi
167 # Alternatives for theme packages
168 while read theme priority; do
169 update-alternatives --install \
170 /usr/share/images/desktop-base/desktop-lockscreen.xml \
171 desktop-lockscreen.xml \
172 /usr/share/desktop-base/$theme-theme/lockscreen/gnome-background.xml $priority
173 done << EOF
174 ceratopsian 40
175 emerald 30
176 homeworld 30
177 futureprototype 30
178 moonlight 30
179 softwaves 30
180 lines 30
181 joy 30
182 spacefun 30
183 EOF
184
185 # Set up an alternative for the wallpaper for Plasma 5/KDE
186 # Highest priority for active theme
187 active_plasma_wallpaper=/usr/share/desktop-base/active-theme/wallpaper
188 if [ -e ${active_plasma_wallpaper} ]; then
189 update-alternatives --install \
190 /usr/share/wallpapers/DebianTheme \
191 desktop-plasma5-wallpaper ${active_plasma_wallpaper} 50
192 fi
193 # Alternatives for theme packages
194 while read theme priority; do
195 update-alternatives --install \
196 /usr/share/wallpapers/DebianTheme \
197 desktop-plasma5-wallpaper \
198 /usr/share/desktop-base/$theme-theme/wallpaper $priority
199 done << EOF
200 ceratopsian 40
201 emerald 30
202 homeworld 30
203 futureprototype 30
204 moonlight 30
205 softwaves 30
206 lines 30
207 joy 30
208 joy-inksplat 30
209 spacefun 30
210 EOF
211
212 # Login theme
213 # Highest priority for active theme
214 active_login_background=/usr/share/desktop-base/active-theme/login/background.svg
215 if [ -e ${active_login_background} ]; then
216 update-alternatives --install /usr/share/images/desktop-base/login-background.svg \
217 desktop-login-background ${active_login_background} 50
218 fi
219 # Alternatives for theme packages
220 while read theme background priority; do
221 update-alternatives --install /usr/share/images/desktop-base/login-background.svg \
222 desktop-login-background \
223 /usr/share/desktop-base/$theme-theme/login/$background $priority
224 done << EOF
225 ceratopsian background.svg 40
226 emerald background.svg 30
227 homeworld background.svg 30
228 futureprototype background.svg 30
229 moonlight background.svg 30
230 softwaves background.svg 30
231 lines background.svg 30
232 lines background-nologo.svg 30
233 joy background.svg 30
234 spacefun background.svg 30
235 EOF
236
237 # Set up an alternative for the GRUB background/colors config
238 # Highest priority for active theme
239 # Favor widescreen / hi-res background for efi installations detected
240 # by the presence of grub-efi* packages (not the grub-efi*-bin which don’t
241 # necessary account for grub being the active bootloader).
242 if dpkg-query --list grub-efi* | grep -v "^... grub-efi[^[:space:]]*-bin" | grep -q "^[ih][HUFWti] " ; then
243 echo "grub-efi* packages found, using 16/9 as default grub background ratio"
244 grub_first_ratio="16x9"
245 grub_second_ratio="4x3"
246 else
247 echo "No grub-efi* package found, using 4/3 as default grub background ratio"
248 grub_first_ratio="4x3"
249 grub_second_ratio="16x9"
250 fi
251 active_grub_background=/usr/share/desktop-base/active-theme/grub/grub_background.sh
252 active_grub_first_ratio=/usr/share/desktop-base/active-theme/grub/grub-${grub_first_ratio}.png
253 if [ -e ${active_grub_first_ratio} ] && [ -e ${active_grub_background} ]; then
254 update-alternatives --install \
255 /usr/share/images/desktop-base/desktop-grub.png \
256 desktop-grub ${active_grub_first_ratio} 50 \
257 --slave /usr/share/desktop-base/grub_background.sh \
258 desktop-grub.sh ${active_grub_background}
259 fi
260 active_grub_second_ratio=/usr/share/desktop-base/active-theme/grub/grub-${grub_second_ratio}.png
261 if [ -e ${active_grub_second_ratio} ] && [ -e ${active_grub_background} ]; then
262 update-alternatives --install \
263 /usr/share/images/desktop-base/desktop-grub.png \
264 desktop-grub ${active_grub_second_ratio} 45 \
265 --slave /usr/share/desktop-base/grub_background.sh \
266 desktop-grub.sh ${active_grub_background}
267 fi
268 # Alternatives for theme packages
269 while read theme ratio priority; do
270 update-alternatives --install /usr/share/images/desktop-base/desktop-grub.png \
271 desktop-grub \
272 /usr/share/desktop-base/$theme-theme/grub/grub-$ratio.png $priority \
273 --slave /usr/share/desktop-base/grub_background.sh \
274 desktop-grub.sh \
275 /usr/share/desktop-base/$theme-theme/grub/grub_background.sh
276 done << EOF
277 ceratopsian 4x3 40
278 ceratopsian 16x9 40
279 emerald 4x3 30
280 emerald 16x9 30
281 homeworld 4x3 30
282 homeworld 16x9 30
283 futureprototype 4x3 30
284 futureprototype 16x9 30
285 moonlight 4x3 30
286 moonlight 16x9 30
287 softwaves 4x3 30
288 softwaves 16x9 30
289 lines 4x3 30
290 lines 16x9 30
291 joy 4x3 30
292 joy 16x9 30
293 spacefun 4x3 30
294 spacefun 16x9 30
295 EOF
296
297 # Apply GRUB background update into /boot
298 # Try detecting active grub packages (so not -doc, -common, -bin) as a hint
299 # that GRUB is being used as bootloader before calling update-grub.
300 # Some people use the *-bin packages without using GRUB as bootloader
301 # (see #851893 for more context).
302 if dpkg-query --list "grub-*" | grep -v "^... grub\(-common\|-emu\|[^[:space:]]*\(-bin\|-doc\)\)" | grep -q "^[ih][HUFWti] " \
303 && which update-grub > /dev/null ; then
304 # Ensure the background image file has actually been written to disc
305 # before updating.
306 sync
307 # Report success whatever grub return status. This is needed at least
308 # in live systems fon installation to succeed (see #850601).
309 # Until we find a better solution like detecting we’re in a live image
310 # and not calling update-grub at all.
311 update-grub || echo "Updating grub failed, report success anyway!"
312 fi
313
314 if which update-initramfs > /dev/null; then
315 update-initramfs -u
316 fi
317
318 fi