increase dvbapp PR.
[vuplus_openembedded] / recipes / coreutils / coreutils-target.inc
1 EXTRA_AUTORECONF += "-I ${S}/m4"
2 SRC_URI += "file://onceonly.m4"
3
4 # [ gets a special treatment and is not included in this
5 bindir_progs = "basename cksum comm csplit cut df dir dircolors dirname du \
6                 env expand expr factor fmt fold groups head hostid id install \
7                 join link logname md5sum mkfifo nice nl nohup od paste pathchk \
8                 pinky pr printenv printf ptx readlink seq sha1sum shred sort \
9                 split stat sum tac tail tee test tr tsort tty unexpand uniq \
10                 unlink users vdir wc who whoami yes \
11                 "
12
13 # hostname gets a special treatment and is not included in this
14 base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill \
15                      ln ls mkdir mknod mv pwd rm rmdir sleep stty sync touch \
16                      true uname \
17                      "
18
19 sbindir_progs= "chroot"
20
21 do_configure_prepend() {
22         install -m 0644 ${WORKDIR}/onceonly.m4 ${S}/m4
23 }
24
25 do_install () {
26         autotools_do_install
27
28         # Renaming the utilities that should go in /usr/bin
29         for i in ${bindir_progs}; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${PN}; done
30
31         # Renaming and moving the utilities that should go in /bin (FHS)
32         install -d ${D}${base_bindir}
33         for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${PN}; done
34
35         # Renaming and moving the utilities that should go in /usr/sbin (FHS)
36         install -d ${D}${sbindir}
37         for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${PN}; done
38
39         # [ requires special handling because [.coreutils will cause the sed stuff
40         # in update-alternatives to fail, therefore use lbracket - the name used
41         # for the actual source file.
42         mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${PN}
43         # hostname and uptime separated. busybox's versions are preferred
44         if [ -e ${D}${bindir}/hostname ]; then
45                 mv ${D}${bindir}/hostname ${D}${base_bindir}/hostname.${PN}
46         fi
47         if [ -e ${D}${bindir}/uptime ]; then
48                 mv ${D}${bindir}/uptime ${D}${bindir}/uptime.${PN}
49         fi
50 }
51
52 pkg_postinst_${PN} () {
53         # The utilities in /usr/bin
54         for i in ${bindir_progs}; do update-alternatives --install ${bindir}/$i $i $i.${PN} 100; done
55
56         # The utilities in /bin
57         for i in ${base_bindir_progs}; do update-alternatives --install ${base_bindir}/$i $i $i.${PN} 100; done
58
59         # The utilities in /usr/sbin
60         for i in ${sbindir_progs}; do update-alternatives --install ${sbindir}/$i $i $i.${PN} 100; done
61
62         # Special cases. uptime and hostname is broken, prefer busybox's version. [ needs to be treated separately.
63         update-alternatives --install ${bindir}/uptime uptime uptime.${PN} 10
64         update-alternatives --install ${base_bindir}/hostname hostname hostname.${PN} 10
65         update-alternatives --install '${bindir}/[' '[' 'lbracket.${PN}' 100
66 }
67
68 pkg_prerm_${PN} () {
69         # The utilities in /usr/bin
70         for i in ${bindir_progs}; do update-alternatives --remove $i $i.${PN}; done
71
72         # The utilities in /bin
73         for i in ${base_bindir_progs}; do update-alternatives --remove $i $i.${PN}; done
74
75         # The utilities in /usr/sbin
76         for i in ${sbindir_progs}; do update-alternatives --remove $i $i.${PN}; done
77
78         # The special cases
79         update-alternatives --remove hostname hostname.${PN}
80         update-alternatives --remove uptime uptime.${PN}
81         update-alternatives --remove '[' 'lbracket.${PN}'
82 }