summaryrefslogtreecommitdiff
path: root/src/lib/lib-software.sh
blob: d2fc82fa597328877ad110c02cd3a152249a65b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh


# run_mkinitcpio() taken from setup. adapted a bit. TODO: GET ALL THE UI CODE OUT OF HERE !!
# runs mkinitcpio on the target system, displays output
#
run_mkinitcpio()  
{
	target_special_fs on
    # all mkinitcpio output goes to /tmp/mkinitcpio.log, which we tail
    # into a dialog
    ( \
        touch /tmp/setup-mkinitcpio-running
        echo "mkinitcpio progress ..." > /tmp/mkinitcpio.log; \
        echo >> /tmp/mkinitcpio.log; \
        chroot "$TARGET_DIR" /sbin/mkinitcpio -p kernel26 >>/tmp/mkinitcpio.log 2>&1
        echo $? > /tmp/.mkinitcpio-retcode
        echo >> /tmp/mkinitcpio.log   
        rm -f /tmp/setup-mkinitcpio-running
    ) &

    sleep 2

    DIALOG --title "Rebuilding initcpio images ..." \
        --no-kill --tailboxbg "/tmp/mkinitcpio.log" 18 70 2>$ANSWER
    while [ -f /tmp/setup-mkinitcpio-running ]; do
        sleep 1
    done
    kill $(cat $ANSWER)

    target_special_fs off

    # alert the user to fatal errors
    if [ $(cat /tmp/.mkinitcpio-retcode) -ne 0 ]; then
        DIALOG --title "MKINITCPIO FAILED - SYSTEM MAY NOT BOOT" --exit-label \
        "Continue" --textbox "/tmp/mkinitcpio.log" 18 70
        return 1
    fi
}