summaryrefslogtreecommitdiffstats
path: root/scripts/lib/ptxd_make_nfsd.sh
blob: cf0ee374b81a1dfa5d76acf2e5d954dc51a5d2f4 (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
#!/bin/bash
#
# Copyright (C) 2012 by Michael Olbrich <m.olbrich@pengutronix.de>
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

ptxd_make_nfsd_exec() {
    local port
    local root="/$(basename "${ptx_nfsroot}")"
    local base="$(dirname "${ptx_nfsroot}")"

    if ! port="$(ptxd_get_kconfig "${PTXDIST_BOARDSETUP}" "PTXCONF_BOARDSETUP_NFSPORT")"; then
	port=2049
    fi

    echo
    echo "Mount rootfs with nfsroot=${root},v3,tcp,port=${port},mountport=${port}"
    echo

    echo "/ (rw,no_root_squash)" > "${PTXDIST_TEMPDIR}/exports" &&
    UNFS_BASE="${base}" unfsd -e "${PTXDIST_TEMPDIR}/exports" -n ${port} -m ${port} -p -d
}
export -f ptxd_make_nfsd_exec

ptxd_make_nfsd() {
    ptxd_make_image_init &&
    ptxd_get_ipkg_files ${image_pkgs_selected_target} &&

    cd "${ptx_nfsroot}" &&
    {
	ptxd_dopermissions "${ptxd_reply_perm_files[@]}"
	echo ptxd_make_nfsd_exec
    } | fakeroot --
}
export -f ptxd_make_nfsd