summaryrefslogtreecommitdiffstats
path: root/install/base
blob: db9752ed11a1c966f2b2cb3862fc133506df65d9 (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
40
41
42
43
44
#!/bin/bash

build() {
    for dir in new_root proc sys dev run tmp usr/{bin,sbin}; do
        add_dir "/$dir"
    done

    add_binary /lib/initcpio/busybox /bin/busybox
    add_binary /sbin/modprobe
    add_binary /sbin/blkid
    add_binary /bin/mount
    add_binary /sbin/switch_root

    add_symlink "/etc/mtab" "/proc/self/mounts"

    add_file "/lib/initcpio/init_functions" "/init_functions"
    add_file "/lib/initcpio/init" "/init"
    add_file "/lib/modprobe.d/usb-load-ehci-first.conf"

    # write a new config file. re-source the config as we can't guarantee the
    # environment hasn't been modified, but subshell it so it doesn't disturb
    # anyone else.
    (
        . "$CONFIG"

        # sanitize of any extra whitespace
        read -r -a modules <<< "$MODULES"
        read -r -a hooks <<< "$HOOKS"

        {
            (( ${#modules[*]} )) && printf 'MODULES="%s"\n' "${modules[*]%\?}"
            (( ${#hooks[*]} )) && printf 'HOOKS="%s"\n' "${hooks[*]}"
        } >"$BUILDROOT/config"
    )
}

help() {
    cat <<HELPEOF
This hook sets up all initial directories and installs base utilities. DO NOT
remove this one unless you know what you're doing.
HELPEOF
}

# vim: set ft=sh ts=4 sw=4 et: