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