cornucopia: bump SRCREV
[openembedded.git] / recipes / coreutils / coreutils-target.inc
blob49b63f3e783a1978aff84d978a99001d5c823983
1 EXTRA_AUTORECONF += "-I ${S}/m4"
2 SRC_URI += "file://onceonly.m4"
4 # [ gets a special treatment and is not included in this
5 bindir_progs = "basename cksum comm csplit cut dir dircolors dirname du \
6                 env expand expr factor fmt fold groups head hostid id install \
7                 join link logname md5sum mkfifo 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 sha256sum sha512sum timeout \
11                 "
13 # hostname gets a special treatment and is not included in this
14 base_bindir_progs = "cat chgrp chmod chown cp date dd df echo false kill \
15                      ln ls mkdir mknod mv nice pwd rm rmdir sleep stty sync touch \
16                      true uname \
17                      "
19 sbindir_progs= "chroot"
21 do_configure_prepend() {
22         install -m 0644 ${WORKDIR}/onceonly.m4 ${S}/m4
25 do_install () {
26         autotools_do_install
28         # Renaming the utilities that should go in /usr/bin
29         for i in ${bindir_progs}; do 
30                 if [ -e ${D}${bindir}/$i ]; then
31                         mv ${D}${bindir}/$i ${D}${bindir}/$i.${PN};
32                 fi
33         done
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
38                 if [ -e ${D}${bindir}/$i ]; then
39                         mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${PN};
40                 fi
41         done
43         # Renaming and moving the utilities that should go in /usr/sbin (FHS)
44         install -d ${D}${sbindir}
45         for i in ${sbindir_progs}; do
46                 if [ -e ${D}${bindir}/$i ]; then
47                         mv ${D}${bindir}/$i ${D}${sbindir}/$i.${PN};
48                 fi
49         done
51         # [ requires special handling because [.coreutils will cause the sed stuff
52         # in update-alternatives to fail, therefore use lbracket - the name used
53         # for the actual source file.
54         mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${PN}
55         # hostname and uptime separated. busybox's versions are preferred
56         if [ -e ${D}${bindir}/hostname ]; then
57                 mv ${D}${bindir}/hostname ${D}${base_bindir}/hostname.${PN}
58         fi
59         if [ -e ${D}${bindir}/uptime ]; then
60                 mv ${D}${bindir}/uptime ${D}${bindir}/uptime.${PN}
61         fi
64 pkg_postinst_${PN} () {
65         # The utilities in /usr/bin
66         for i in ${bindir_progs}; do 
67 #               if [ -e ${bindir}/$i.${PN} ]; then
68                         update-alternatives --install ${bindir}/$i $i $i.${PN} 100;
69 #               fi
70         done
72         # The utilities in /bin
73         for i in ${base_bindir_progs}; do 
74 #               if [ -e ${base_bindir}/$i.${PN} ]; then
75                         update-alternatives --install ${base_bindir}/$i $i $i.${PN} 100;
76 #               fi
77         done
79         # The utilities in /usr/sbin
80         for i in ${sbindir_progs}; do
81 #               if [ -e ${sbindir}/$i.${PN} ]; then
82                         update-alternatives --install ${sbindir}/$i $i $i.${PN} 100;
83 #               fi
84         done
86         # Special cases. uptime and hostname is broken, prefer busybox's version. [ needs to be treated separately.
87         update-alternatives --install ${bindir}/uptime uptime uptime.${PN} 10
88         update-alternatives --install ${base_bindir}/hostname hostname hostname.${PN} 10
89         update-alternatives --install '${bindir}/[' '[' 'lbracket.${PN}' 100
92 pkg_prerm_${PN} () {
93         # The utilities in /usr/bin
94         for i in ${bindir_progs}; do update-alternatives --remove $i $i.${PN}; done
96         # The utilities in /bin
97         for i in ${base_bindir_progs}; do update-alternatives --remove $i $i.${PN}; done
99         # The utilities in /usr/sbin
100         for i in ${sbindir_progs}; do update-alternatives --remove $i $i.${PN}; done
102         # The special cases
103         update-alternatives --remove hostname hostname.${PN}
104         update-alternatives --remove uptime uptime.${PN}
105         update-alternatives --remove '[' 'lbracket.${PN}'