d6f149a09d0920a484ab050e8638d14809349af3
[live-boot-grml.git] / scripts / live-bottom / 40install_driver_updates
1 #!/bin/sh
2
3 #set -e
4
5 # initramfs-tools header
6
7 PREREQ=""
8
9 prereqs()
10 {
11         echo "${PREREQ}"
12 }
13
14 case "${1}" in
15         prereqs)
16                 prereqs
17                 exit 0
18                 ;;
19 esac
20
21 # live-initramfs header
22
23 . /scripts/live-functions
24
25 log_begin_msg "Installing driver updates..."
26
27 # live-initramfs script
28
29 if [ ! -d /tmp/driver-updates ]; then
30         exit 0
31 fi
32
33 install_dir=/var/cache/driver-updates
34
35 mkdir "/root$install_dir"
36 cp -a /tmp/driver-updates/*.deb "/root$install_dir/"
37
38 # We cannot leave packages in a bad state. So if the install fails, remove
39 # it. This will get caught in live.log.
40 for deb in "/root$install_dir"/*; do
41         [ -f "$deb" ] || continue
42         debbase="${deb##*/}"
43         if ! chroot /root dpkg -i "$install_dir/$debbase"; then
44             chroot /root dpkg -P "${debbase%%_*}"
45         fi
46 done
47
48 log_end_msg