1 # Contributor: Jens Staal <staal1978@gmail.com>
3 pkgname=gnu2sysv-coreutils
7 pkgdesc="A replacement of GNU Coreutils with binaries derived from original UNIX utilities, provided by the Heirloom project"
8 url="https://wiki.archlinux.org/index.php/Base2heirloom"
9 license=('custom:"opensolaris"' 'custom:"lucent"')
11 makedepends=('heirloom-devtools-cvs' 'heirloom-cvs' 'heirloom-sh-cvs')
12 optdepends=('perl-digest-sha')
13 provides=('coreutils' 'gnu2heirloom-coreutils')
14 conflicts=('coreutils' 'gnu2busybox-coreutils')
16 source=('scripts.tar.gz')
18 md5sums=('c05f9dcff7bb7f9276b71ec1c5cc8916')
20 #Heirloom-variant dependent files below this line. Busybox covers unimplemented functions.
21 _5bin=($srcdir/scripts/5bin.ls)
22 _ucb=($srcdir/scripts/ucb.ls)
23 _posix=($srcdir/scripts/posix.ls)
25 #package-specific file list variables below this line
26 _busybox=($srcdir/scripts/busybox.ls)
27 _gnuonly=($srcdir/scripts/coreutils.gnuonly.ls)
28 _core_bin=($srcdir/scripts/coreutils.bin.ls)
29 _core_usrbin=($srcdir/scripts/coreutils.usr.bin.ls)
30 _core_usrsbin=($srcdir/scripts/coreutils.usr.sbin.ls)
37 mkdir $srcdir/tmp/usr/heirloom
38 mkdir $srcdir/tmp/usr/heirloom/share
40 msg "Fill up missing binaries for Coreutils using symlinks to Busybox"
41 for i in $(cat $_busybox)
43 ln -s /bin/busybox $srcdir/tmp/bin/$i
46 msg "move binaries corresponding to a specific Heirloom variant [sysV, posix, posix2001, s42 or ucb]"
47 msg "to a single intermediate directory: $srcdir/tmp/bin"
49 # the build function will be common for all gnu2heirloom packages of a given type
50 for i in $(cat $_posix)
52 cp /usr/heirloom/bin/posix/$i $srcdir/tmp/bin/$i
57 cp /usr/heirloom/bin/ucb/$i $srcdir/tmp/bin/$i
60 for i in $(cat $_5bin)
62 cp /usr/heirloom/bin/$i $srcdir/tmp/bin/$i
64 cp /usr/heirloom/bin/sh $srcdir/tmp/bin/jsh
66 msg "copy scripts and symlinks for missing utilities corresponding those in coreutils"
67 cp $srcdir/scripts/bin/* $srcdir/tmp/bin/
71 # The package function is the only thing changing for different packages [coreutils, findutils ...].
76 mkdir $pkgdir/usr/sbin
78 msg "moving binaries into a Coreutils tree structure"
80 for i in $(cat $_core_bin)
82 mv $srcdir/tmp/bin/$i $pkgdir/bin/$i
85 for i in $(cat $_core_usrbin)
87 mv $srcdir/tmp/bin/$i $pkgdir/usr/bin/$i
90 for i in $(cat $_core_usrsbin)
92 mv $srcdir/tmp/bin/$i $pkgdir/usr/sbin/$i
95 msg "adding corresponding man pages"
96 mkdir $pkgdir/usr/share
97 mkdir $pkgdir/usr/share/man
98 mkdir $pkgdir/usr/share/man/man1
100 # Moving manpages into a common directory
102 cp -ar /usr/heirloom/share/man $srcdir/tmp/usr/heirloom/share/man
103 mv $srcdir/tmp/usr/heirloom/share/man/man8/catman.8 $srcdir/tmp/usr/heirloom/share/man/man1/catman.1
104 mv $srcdir/tmp/usr/heirloom/share/man/man5/fspec.5 $srcdir/tmp/usr/heirloom/share/man/man1/fspec.1
105 mv $srcdir/tmp/usr/heirloom/share/man/man1m/mknod.1m $srcdir/tmp/usr/heirloom/share/man/man1/mknod.1
106 mv $srcdir/tmp/usr/heirloom/share/man/man1m/sync.1m $srcdir/tmp/usr/heirloom/share/man/man1/sync.1
108 for i in $(cat $_ucb)
110 mv $srcdir/tmp/usr/heirloom/share/man/man1b/$i.1b $srcdir/tmp/man/$i.1
113 for i in $(cat $_5bin)
115 mv $srcdir/tmp/usr/heirloom/share/man/man1/$i.1 $srcdir/tmp/man/$i.1
117 mv $srcdir/tmp/usr/heirloom/share/man/man1/true.1 $srcdir/tmp/man/true.1
118 mv $srcdir/tmp/usr/heirloom/share/man/man1/false.1 $srcdir/tmp/man/false.1
119 cp /usr/heirloom/share/man/man1/sh.1 $srcdir/tmp/man/jsh.1
122 for i in $(cat $_busybox)
124 printf "Busybox symlink. Type busybox $i --help for more info." > $i.1
127 _shavariants=($srcdir/scripts/shavariants)
128 for i in $(cat $_shavariants)
130 ln -s /usr/share/man/man1/shasum.1p.gz sha${i}sum.1
139 # Moving the relevant manpages to the package directory
141 for i in $(cat $_core_bin)
143 mv $srcdir/tmp/man/$i.1 $pkgdir/usr/share/man/man1/$i.1
146 for i in $(cat $_core_usrbin)
148 mv $srcdir/tmp/man/$i.1 $pkgdir/usr/share/man/man1/$i.1
151 for i in $(cat $_core_usrsbin)
153 mv $srcdir/tmp/man/$i.1 $pkgdir/usr/share/man/man1/$i.1
156 msg "adding system configuration files"
158 mkdir $pkgdir/etc/pam.d
159 install -m0644 $srcdir/scripts/su $pkgdir/etc/pam.d/su
161 # locales and the libstdbuf are lacking in both Heirloom and Busybox
163 msg "The following coreutils binaries are not covered by Heirloom or Busybox"
165 msg "A list of missing functionality is saved in /usr/share/info"
166 mkdir $pkgdir/usr/share/info
167 cp $srcdir/scripts/coreutils.gnuonly.ls $pkgdir/usr/share/info/
169 msg "installing Heirloom-specific licence information"
170 install -D -m0644 /usr/share/licenses/heirloom-cvs/LICENSE $pkgdir/usr/share/licenses/${pkgname}/LICENSE
171 install -D -m0644 /usr/share/licenses/heirloom-cvs/OPENSOLARIS.LICENSE $pkgdir/usr/share/licenses/${pkgname}/OPENSOLARIS.LICENSE
172 install -D -m0644 /usr/share/licenses/heirloom-cvs/LUCENT $pkgdir/usr/share/licenses/${pkgname}/LUCENT
174 msg "WARNING: this package changes fundamental components in your system. DO NOT install on a production system (unless you know what you are doing)"