This is against 2.11u-2. Most of it is straightforward, except the changes to debian/rules, which are a bit drastic.
---Nathan
diff -urN util-linux-2.11u/MCONFIG util-linux-2.11u-freebsd/MCONFIG --- util-linux-2.11u/MCONFIG 2002-11-07 01:06:47.000000000 -0500 +++ util-linux-2.11u-freebsd/MCONFIG 2002-11-01 13:38:25.000000000 -0500 @@ -11,6 +11,7 @@ # Select for CPU i386 if the binaries must be able to run on an intel 386 # (by default i486 code is generated, see below) CPU=$(shell uname -m) +OS=$(shell uname -s | tr '[:upper:]' '[:lower:]') ARCH=$(shell echo $(CPU) | sed 's/i.86/intel/;s/arm.*/arm/') # If HAVE_PAM is set to "yes", then login, chfn, chsh, and newgrp diff -urN util-linux-2.11u/Makefile util-linux-2.11u-freebsd/Makefile --- util-linux-2.11u/Makefile 2001-07-01 14:59:39.000000000 -0400 +++ util-linux-2.11u-freebsd/Makefile 2002-11-02 00:18:17.000000000 -0500 @@ -8,6 +8,15 @@ include ./make_include include ./MCONFIG +ifeq "$(OS)" "freebsd" +SUBDIRS=po \ + lib \ + getopt-1.1.2 \ + login-utils \ + misc-utils \ + sys-utils \ + text-utils +else SUBDIRS=po \ lib \ getopt-1.1.2 \ @@ -19,6 +28,7 @@ hwclock \ sys-utils \ text-utils +endif .PHONEY: all install clean now all: defines.h diff -urN util-linux-2.11u/debian/mk/geninstall.pl util-linux-2.11u-freebsd/debian/mk/geninstall.pl --- util-linux-2.11u/debian/mk/geninstall.pl 1969-12-31 19:00:00.000000000 -0500 +++ util-linux-2.11u-freebsd/debian/mk/geninstall.pl 2002-11-07 00:49:48.000000000 -0500 @@ -0,0 +1,68 @@ +#!/usr/bin/perl + +%varchtable=( + 'bsd' => '(free|net)bsd-.+', + 'freebsd' => 'freebsd-.+', + 'hurd' => 'hurd-.+', + 'linux' => '[^-]+', + 'netbsd' => 'netbsd-.+' +); +sub varchmatch { + my ($arch,$varch)[EMAIL PROTECTED]; + my $vre=$varchtable{$varch}; + + if($vre eq '') { + return(0); + } + if($arch=~/$vre/) { + return(1); + } else { + return(0); + } +} + +sub evalarchrule { + my ($arch,@select)[EMAIL PROTECTED]; + my $reversed=0; + my $t; + + foreach $rule (@select) { + if($rule eq "all") { + $reversed=1; + next; + } + if($rule=~m/^!(.+)/) { + $t=$1; + $reversed=1; + if(varchmatch($arch,$t) or $arch eq $t) { + return(0); + } else { + next; + } + } + if(varchmatch($arch,$rule) or $arch eq $rule) { + return(1); + } + } + if($reversed) { + return(1); + } else { + return(0); + } +} + +$arch=shift @ARGV; +print "install:\n"; +while (<>) { + next if /^#/; # handle comment lines + ($src,$select,$dest)=split(/\s+/); + @select=split(",",$select); + if(evalarchrule($arch,@select)) { + if($dest=~m#/[s]*bin#) { + $flags='-m 755'; + } else { + $flags='-m 644'; + } + print "\tinstall $flags $src debian/$dest\n"; + } +} diff -urN util-linux-2.11u/debian/mk/install.in util-linux-2.11u-freebsd/debian/mk/install.in --- util-linux-2.11u/debian/mk/install.in 1969-12-31 19:00:00.000000000 -0500 +++ util-linux-2.11u-freebsd/debian/mk/install.in 2002-11-07 00:50:28.000000000 -0500 @@ -0,0 +1,129 @@ +# source path arch install path +HISTORY all tmp/usr/share/doc/util-linux/changelog +HISTORY all tmp-util-linux-locales/usr/share/doc/util-linux-locales/changelog +HISTORY !freebsd-i386 tmp-mount/usr/share/doc/mount/changelog +HISTORY all tmp-bsd/usr/share/doc/bsdutils/changelog +debian/README.script all tmp-bsd/usr/share/doc/bsdutils +debian/README.Debian.hwclock !freebsd-i386,!s390 tmp/usr/share/doc/util-linux +debian/changelog all tmp/usr/share/doc/util-linux/changelog.Debian +debian/changelog all tmp-util-linux-locales/usr/share/doc/util-linux-locales/changelog.Debian +debian/changelog !freebsd-i386 tmp-mount/usr/share/doc/mount/changelog.Debian +debian/changelog all tmp-bsd/usr/share/doc/bsdutils/changelog.Debian +debian/changelog.Debian-mount.old !freebsd-i386 tmp-mount/usr/share/doc/mount/changelog.Debian-mount.old +debian/conffiles !freebsd-i386,!s390 tmp/DEBIAN +debian/fstab.example2 all tmp/usr/share/doc/util-linux/examples +debian/hwclock.sh !freebsd-i386,!s390 tmp/etc/init.d +debian/hwclockfirst.sh !freebsd-i386,!s390 tmp/etc/init.d +debian/lintian-override all tmp/usr/share/lintian/overrides/util-linux +debian/mime.util-linux all tmp/DEBIAN +debian/mount.fstab !freebsd-i386 tmp-mount/usr/share/doc/mount/examples/fstab +debian/postinst all tmp/DEBIAN +debian/postrm all tmp/DEBIAN +debian/preinst all tmp/DEBIAN +debian/prerm all tmp/DEBIAN +debian/util-linux-locales.postinst all tmp-util-linux-locales/DEBIAN +debian/util-linux-locales.prerm all tmp-util-linux-locales/DEBIAN +debian/mount.postinst !freebsd-i386 tmp-mount/DEBIAN +debian/mount.prerm !freebsd-i386 tmp-mount/DEBIAN +debian/bsdutils.postinst all tmp-bsd/DEBIAN +debian/bsdutils.prerm all tmp-bsd/DEBIAN +disk-utils/blockdev !freebsd-i386 tmp/sbin +disk-utils/blockdev.8 !freebsd-i386 tmp/usr/share/man/man8 +disk-utils/elvtune !freebsd-i386 tmp/usr/sbin +disk-utils/elvtune.8 !freebsd-i386 tmp/usr/share/man/man8 +disk-utils/fdformat !freebsd-i386 tmp/usr/bin +disk-utils/fdformat.8 !freebsd-i386 tmp/usr/share/man/man8 +disk-utils/fsck.minix !freebsd-i386,!sparc tmp/sbin +disk-utils/fsck.minix.8 !freebsd-i386,!sparc tmp/usr/share/man/man8 +disk-utils/mkfs !freebsd-i386,!sparc tmp/sbin +disk-utils/mkfs.8 !freebsd-i386,!sparc tmp/usr/share/man/man8 +disk-utils/mkfs.minix !freebsd-i386,!sparc tmp/sbin +disk-utils/mkfs.minix.8 !freebsd-i386,!sparc tmp/usr/share/man/man8 +disk-utils/mkswap !freebsd-i386 tmp/sbin +disk-utils/mkswap.8 !freebsd-i386 tmp/usr/share/man/man8 +disk-utils/raw !freebsd-i386 tmp/sbin +disk-utils/raw.8 !freebsd-i386 tmp/usr/share/man/man8 +fdisk/README.cfdisk !sparc,!freebsd-i386,!s390,!m68k tmp/usr/share/doc/util-linux +fdisk/README.fdisk !freebsd-i386,!s390,!m68k tmp/usr/share/doc/util-linux +fdisk/sfdisk.examples all tmp/usr/share/doc/util-linux/examples +fdisk/fdisk !freebsd-i386,!s390,!m68k tmp/sbin +fdisk/fdisk.8 !freebsd-i386,!s390,!m68k tmp/usr/share/man/man8 +fdisk/cfdisk !sparc,!freebsd-i386,!s390,!m68k tmp/sbin +fdisk/cfdisk.8 !sparc,!freebsd-i386,!s390,!m68k tmp/usr/share/man/man8 +fdisk/sfdisk !sparc,!freebsd-i386,!s390,!m68k tmp/sbin +fdisk/sfdisk.8 !sparc,!freebsd-i386,!s390,!m68k tmp/usr/share/man/man8 +getopt-1.1.2/getopt all tmp/usr/bin +getopt-1.1.2/getopt.1 all tmp/usr/share/man/man1 +getopt-1.1.2/parse.bash all tmp/usr/share/doc/util-linux/examples +getopt-1.1.2/parse.tcsh all tmp/usr/share/doc/util-linux/examples +getopt-1.1.2/test.bash all tmp/usr/share/doc/util-linux/examples +getopt-1.1.2/test.tcsh all tmp/usr/share/doc/util-linux/examples +hwclock/hwclock !freebsd-i386,!s390 tmp/sbin +hwclock/hwclock.8 !freebsd-i386,!s390 tmp/usr/share/man/man8 +login-utils/README.getty all tmp/usr/share/doc/util-linux +login-utils/README.modems-with-agetty all tmp/usr/share/doc/util-linux +login-utils/README.poeigl all tmp/usr/share/doc/util-linux +login-utils/agetty all tmp/sbin +login-utils/agetty.8 all tmp/usr/share/man/man8 +login-utils/wall all tmp-bsd/usr/bin +login-utils/wall.1 all tmp-bsd/usr/share/man/man1 +misc-utils/chkdupexe all tmp/usr/bin +misc-utils/chkdupexe.1 all tmp/usr/share/man/man1 +misc-utils/ddate all tmp/usr/bin +misc-utils/ddate.1 all tmp/usr/share/man/man1 +misc-utils/logger all tmp-bsd/usr/bin +misc-utils/logger.1 all tmp-bsd/usr/share/man/man1 +misc-utils/mcookie all tmp/usr/bin +misc-utils/mcookie.1 all tmp/usr/share/man/man1 +misc-utils/namei all tmp/usr/bin +misc-utils/namei.1 all tmp/usr/share/man/man1 +misc-utils/replay.1 all tmp-bsd/usr/share/man/man1 +misc-utils/script all tmp-bsd/usr/bin +misc-utils/script.1 all tmp-bsd/usr/share/man/man1 +misc-utils/setterm !freebsd-i386 tmp/usr/bin +misc-utils/setterm.1 !freebsd-i386 tmp/usr/share/man/man1 +misc-utils/whereis all tmp/usr/bin +misc-utils/whereis.1 all tmp/usr/share/man/man1 +mount/README.mount !freebsd-i386 tmp-mount/usr/share/doc/mount +mount/fstab.5 !freebsd-i386 tmp/usr/share/man/man5 +mount/nfs.5 !freebsd-i386 tmp/usr/share/man/man5 +mount/losetup !freebsd-i386 tmp-mount/sbin +mount/losetup.8 !freebsd-i386 tmp-mount/usr/share/man/man8 +mount/mount !freebsd-i386 tmp-mount/bin +mount/mount.8 !freebsd-i386 tmp-mount/usr/share/man/man8 +mount/pivot_root !freebsd-i386 tmp/sbin +mount/pivot_root.8 !freebsd-i386 tmp/usr/share/man/man8 +mount/swapon !freebsd-i386 tmp-mount/sbin +mount/swapon.8 !freebsd-i386 tmp-mount/usr/share/man/man8 +mount/swapoff.8 !freebsd-i386 tmp-mount/usr/share/man/man8 +mount/umount !freebsd-i386 tmp-mount/bin +mount/umount.8 !freebsd-i386 tmp-mount/usr/share/man/man8 +sys-utils/arch all tmp/bin +sys-utils/arch.1 all tmp/usr/share/man/man1 +sys-utils/cytune !sparc,!freebsd-i386,!s390,!m68k tmp/usr/sbin +sys-utils/cytune.8 !sparc,!freebsd-i386,!s390,!m68k tmp/usr/share/man/man8 +sys-utils/dmesg !freebsd-i386 tmp/bin +sys-utils/dmesg.8 !freebsd-i386 tmp/usr/share/man/man8 +sys-utils/ipc.info !freebsd-i386 tmp/usr/share/info +sys-utils/ipcrm !freebsd-i386 tmp/usr/bin +sys-utils/ipcrm.8 !freebsd-i386 tmp/usr/share/man/man8 +sys-utils/ipcs !freebsd-i386 tmp/usr/bin +sys-utils/ipcs.8 !freebsd-i386 tmp/usr/share/man/man8 +sys-utils/ramsize.8 i386 tmp/usr/share/man/man8 +sys-utils/rdev i386 tmp/usr/sbin +sys-utils/rdev.8 i386 tmp/usr/share/man/man8 +sys-utils/readprofile !freebsd-i386 tmp/usr/sbin +sys-utils/readprofile.1 !freebsd-i386 tmp/usr/share/man/man1 +sys-utils/renice all tmp-bsd/usr/bin +sys-utils/renice.8 all tmp-bsd/usr/share/man/man8 +sys-utils/rootflags.8 i386 tmp/usr/share/man/man8 +sys-utils/setsid all tmp/usr/bin +sys-utils/setsid.8 all tmp/usr/share/man/man8 +sys-utils/tunelp !sparc,!freebsd-i386,!s390,!m68k tmp/usr/sbin +sys-utils/tunelp.8 !sparc,!freebsd-i386,!s390,!m68k tmp/usr/share/man/man8 +sys-utils/vidmode.8 i386 tmp/usr/share/man/man8 +text-utils/more all tmp/bin +text-utils/more.1 all tmp/usr/share/man/man1 +text-utils/more.help all tmp/usr/share/util-linux +text-utils/rev all tmp/usr/bin +text-utils/rev.1 all tmp/usr/share/man/man1 diff -urN util-linux-2.11u/debian/postinst util-linux-2.11u-freebsd/debian/postinst --- util-linux-2.11u/debian/postinst 2002-11-07 01:06:47.000000000 -0500 +++ util-linux-2.11u-freebsd/debian/postinst 2002-11-07 01:04:18.000000000 -0500 @@ -20,7 +20,7 @@ fi # hwclock does not work on s390 systems -if [ `uname -m` != "s390" ] +if [ `uname -m` != "s390" -a `uname -s` != "FreeBSD" ] then update-rc.d -f hwclock.sh remove 2>/dev/null > /dev/null update-rc.d hwclock.sh start 50 S . stop 25 0 6 . > /dev/null diff -urN util-linux-2.11u/debian/rules util-linux-2.11u-freebsd/debian/rules --- util-linux-2.11u/debian/rules 2002-11-07 01:06:47.000000000 -0500 +++ util-linux-2.11u-freebsd/debian/rules 2002-11-07 01:01:02.000000000 -0500 @@ -9,7 +9,7 @@ endif export arch = $(DEB_HOST_ARCH) -version := $(shell sed -e '1{;s|^util-linux (\(.*\))\ .*|\1|;q;}' debian/changelog) +version := $(shell dpkg-parsechangelog | sed -ne 's/^Version: *\([^2]*\)/\1/p') fdisk_arch = $(findstring $(arch),alpha i386 powerpc arm mips mipsel hppa ia64) sparc = $(findstring $(arch),sparc) @@ -19,12 +19,14 @@ $(checkdir) ./configure $(MAKE) all arch=$(arch) +ifneq "$(arch)" "freebsd-i386" $(MAKE) disk-utils/raw +endif touch build clean: $(checkdir) - rm -f build sys-utils/rdev + rm -f install build sys-utils/rdev debian/mk/install.mk touch make_include $(MAKE) distclean find . -name '*~' -print0 | xargs -0r rm @@ -34,159 +36,65 @@ # Architecture independant stuff -SUIDFILES = debian/tmp-mount/bin/{u,}mount - -ifneq ($(arch),$(nohwclock)) -INITFILES = debian/hwclock.sh debian/hwclockfirst.sh -endif -BINFILES = sys-utils/{arch,dmesg} \ - text-utils/more -SBINFILES = disk-utils/{mkswap,blockdev} login-utils/agetty disk-utils/raw -ifneq ($(arch),$(nohwclock)) -SBINFILES += hwclock/hwclock -endif -SBINFILES += mount/pivot_root -UBINFILES = sys-utils/{ipcs,ipcrm,setsid} \ - misc-utils/{namei,setterm,mcookie,whereis,ddate} \ - getopt-1.1.2/getopt text-utils/rev disk-utils/fdformat -UBINFILES2= misc-utils/chkdupexe # debian/fdformat # don't strip these -ULIBFILES = text-utils/more.help -USBINFILES= sys-utils/readprofile disk-utils/elvtune # disk-utils/setfdprm - -MOUNTBINFILES = mount/mount mount/umount -MOUNTSBINFILES = mount/swapon mount/losetup - -#BSDBINFILES = # misc-utils/kill -BSDUBINFILES = misc-utils/script misc-utils/logger sys-utils/renice \ - login-utils/wall - # misc-utils/replay is handled seperately -BSDMAN1FILES = login-utils/wall.1 misc-utils/script.1 \ - misc-utils/logger.1 misc-utils/replay.1 # misc-utils/kill.1 -BSDMAN8FILES = sys-utils/renice.8 -BSDDOCFILES = debian/README.script - -# Architecture independant docs - -MAN1FILES = text-utils/{more,rev}.1 misc-utils/{namei.1,mcookie.1} \ - sys-utils/{arch,readprofile}.1 \ - misc-utils/{chkdupexe.1,setterm.1,whereis.1,ddate.1} \ - getopt-1.1.2/getopt.1 -MAN8FILES = sys-utils/{dmesg.8,ipcrm.8,ipcs.8,setsid.8} login-utils/agetty.8 \ - disk-utils/{mkswap.8,blockdev.8} disk-utils/elvtune.8 \ - disk-utils/fdformat.8 disk-utils/raw.8 # disk-utils/setfdprm.8 -ifneq ($(arch),$(nohwclock)) -MAN8FILES += hwclock/hwclock.8 -endif -MAN8FILES += mount/pivot_root.8 - -EXAMPLES = debian/fstab.example2 fdisk/sfdisk.examples \ - getopt-1.1.2/{test,parse}.{ba,tc}sh - +debian/mk/install.mk: debian/mk/install.in + debian/mk/geninstall.pl $(arch) <$< >$@ -INFOFILES = sys-utils/ipc.info -DOCFILES = login-utils/{README.getty,README.modems-with-agetty,README.poeigl} -ifneq ($(arch),$(nohwclock)) -DOCFILES += debian/README.Debian.hwclock -endif - -MOUNTMAN5FILES = mount/fstab.5 mount/nfs.5 -MOUNTMAN8FILES = mount/losetup.8 mount/swapoff.8 mount/umount.8 \ - mount/mount.8 mount/swapon.8 -MOUNTDOCFILES = mount/README.mount - -ifneq ($(arch),$(sparc)) -SBINFILES := $(SBINFILES) disk-utils/{fsck.minix,mkfs,mkfs.minix} -MAN8FILES := $(MAN8FILES) disk-utils/{{fsck,mkfs}.minix.8,mkfs.8} -endif -ifeq ($(arch),$(fdisk_arch)) -USBINFILES:= $(USBINFILES) sys-utils/{tunelp,cytune} -SBINFILES := $(SBINFILES) fdisk/{cfdisk,fdisk,sfdisk} -MAN8FILES := $(MAN8FILES) fdisk/{cfdisk.8,fdisk.8,sfdisk.8} \ - sys-utils/{tunelp.8,cytune.8} -DOCFILES := $(DOCFILES) fdisk/README.{c,}fdisk -endif -ifeq ($(arch),$(sparc)) -SBINFILES := $(SBINFILES) fdisk/fdisk -MAN8FILES := $(MAN8FILES) fdisk/fdisk.8 -DOCFILES := $(DOCFILES) fdisk/README.fdisk -endif -ifeq ($(arch),i386) -USBINFILES:= $(USBINFILES) sys-utils/rdev -MAN8FILES := $(MAN8FILES) sys-utils/{rdev.8,vidmode.8} \ - sys-utils/{ramsize.8,rootflags.8} -endif - -install: - -binary-indep: checkroot build binary-arch - $(checkdir) - # This assumes non-native, and only one hyphen in the version number. - dpkg-gencontrol -isp -putil-linux-locales -Pdebian/tmp-util-linux-locales -VUpstream=$$(sed 's/^.*(\(.*\)-.*).*/\1/; q' debian/changelog) - dpkg --build debian/tmp-util-linux-locales .. - -binary-arch: checkroot build +install: build debian/mk/install.mk rm -rf debian/tmp* install -d debian/tmp/{DEBIAN,bin,sbin,etc/init.d,usr/{share/locale/{cs,da,de,es,fr,it,ja,nl,pt_BR,sv,tr}/LC_MESSAGES,lib/mime/packages,sbin,bin,share/man/{man1,man8},share/info,lib,share/util-linux,share/doc/$(package)/examples,share/lintian/overrides}} - - install -s $(BINFILES) debian/tmp/bin - install -s $(SBINFILES) debian/tmp/sbin - install -s $(UBINFILES) debian/tmp/usr/bin - install $(UBINFILES2) debian/tmp/usr/bin -ifneq ($(USBINFILES),) - install -s $(USBINFILES) debian/tmp/usr/sbin + install -d debian/tmp-util-linux-locales/usr/share/doc/util-linux-locales + install -d debian/tmp-util-linux-locales/DEBIAN + install -d debian/tmp-mount/{DEBIAN,bin,sbin,usr/share/{man/{man8,man5},doc/mount/examples}} + install -d debian/tmp-bsd/{DEBIAN,bin,usr/{bin,share/man/{man8,man1},share/doc/bsdutils}} + # run the autogenerate install script + $(MAKE) -f debian/mk/install.mk install + # this could be replaced by a test to see if rdev was installed ifeq ($(arch), i386) ln -s rdev debian/tmp/usr/sbin/ramsize ln -s rdev debian/tmp/usr/sbin/vidmode ln -s rdev debian/tmp/usr/sbin/rootflags endif -endif -ifneq ($(INITFILES),) - install -m 755 $(INITFILES) debian/tmp/etc/init.d -endif - install -m 644 $(ULIBFILES) debian/tmp/usr/share/util-linux - install -m 644 $(MAN1FILES) debian/tmp/usr/share/man/man1 - install -m 644 $(MAN8FILES) debian/tmp/usr/share/man/man8 - install -m 644 $(INFOFILES) debian/tmp/usr/share/info - install -m 644 debian/lintian-override debian/tmp/usr/share/lintian/overrides/util-linux cd po && make install DESTDIR=../debian/tmp - install -m 644 $(DOCFILES) debian/tmp/usr/share/doc/$(package) - install -m 644 $(EXAMPLES) debian/tmp/usr/share/doc/$(package)/examples ifeq ($(arch), powerpc) mv -f debian/tmp/sbin/fdisk debian/tmp/sbin/ddisk mv -f debian/tmp/usr/share/man/man8/fdisk.8 debian/tmp/usr/share/man/man8/ddisk.8 endif - (cd debian/tmp/sbin ; mv agetty getty) - (cd debian/tmp/usr/share/man/man8 ; mv agetty.8 getty.8) + # FIXME: should use a test to see if hwclock was installed, instead of nohwclock ifneq ($(arch), $(nohwclock)) ifneq ($(arch), powerpc) (cd debian/tmp/usr/share/man/man8 && ln -s hwclock.8.gz clock.8.gz) endif endif + # change agetty to getty + (cd debian/tmp/sbin ; mv agetty getty) + (cd debian/tmp/usr/share/man/man8 ; mv agetty.8 getty.8) (cd debian/tmp/usr/share/doc/$(package) ; mv README.modems-with-agetty README.modems-with-getty ) perl -pi.bak -e 's/agetty/getty/g' debian/tmp/usr/share/man/man8/getty.8 \ debian/tmp/usr/share/doc/$(package)/README.getty \ debian/tmp/usr/share/doc/$(package)/README.modems-with-getty rm `find debian/tmp/usr -name \*.bak` - install -m 644 debian/changelog \ - debian/tmp/usr/share/doc/$(package)/changelog.Debian - install -m 644 HISTORY debian/tmp/usr/share/doc/$(package)/changelog + # gzip all docs find debian/tmp/usr/share/{info,doc,man} -type f | xargs gzip -9 - install -m 644 debian/mime.util-linux debian/tmp/usr/lib/mime/packages/util-linux - install -m 644 debian/copyright debian/tmp/usr/share/doc/$(package)/copyright - install debian/{preinst,postinst,prerm,postrm} debian/tmp/DEBIAN/ -ifneq ($(arch),$(nohwclock)) - install -m 644 debian/conffiles debian/tmp/DEBIAN/ -endif + install -m 644 debian/copyright debian/tmp/usr/share/doc/util-linux/copyright + ls debian/tmp/{bin,sbin,usr/{bin,sbin}}/* | xargs dpkg-shlibdeps -putil-linux - install -d debian/tmp-util-linux-locales/usr/share/doc/util-linux-locales - install -d debian/tmp-util-linux-locales/DEBIAN - install -m 755 debian/util-linux-locales.postinst debian/tmp-util-linux-locales/DEBIAN/postinst - install -m 755 debian/util-linux-locales.prerm debian/tmp-util-linux-locales/DEBIAN/prerm - mv debian/tmp/usr/share/locale debian/tmp-util-linux-locales/usr/share/ - install -m 644 HISTORY debian/tmp-util-linux-locales/usr/share/doc/util-linux-locales/changelog - install -m 644 debian/changelog debian/tmp-util-linux-locales/usr/share/doc/util-linux-locales/changelog.Debian + + # gzip docs for util-linux-locales find debian/tmp-util-linux-locales/usr/share/doc -type f | xargs gzip -9 install -m 644 debian/copyright debian/tmp-util-linux-locales/usr/share/doc/util-linux-locales/copyright + + # fix package scripts + chmod 755 debian/tmp*/DEBIAN/{preinst,postinst,prerm,postrm} + + touch install + +binary-indep: checkroot build binary-arch + $(checkdir) + # This assumes non-native, and only one hyphen in the version number. + dpkg-gencontrol -isp -putil-linux-locales -Pdebian/tmp-util-linux-locales -VUpstream=$$(sed 's/^.*(\(.*\)-.*).*/\1/; q' debian/changelog) + dpkg --build debian/tmp-util-linux-locales .. + +binary-arch: checkroot build install dpkg-gencontrol -isp -putil-linux dpkg --build debian/tmp .. @@ -203,48 +111,25 @@ dpkg --build debian/tmp-fdisk-udeb ../fdisk-udeb_$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)_$(arch).udeb endif + # FIXME: this should instead check to see if mount was installed +ifneq ($(arch),freebsd-i386) # Mount - install -d debian/tmp-mount/{DEBIAN,bin,sbin,usr/share/{man/{man8,man5},doc/mount/examples}} - install -m 4755 -o root -s $(MOUNTBINFILES) debian/tmp-mount/bin/. - install -m 755 -s $(MOUNTSBINFILES) debian/tmp-mount/sbin/. - install -m 644 $(MOUNTMAN8FILES) debian/tmp-mount/usr/share/man/man8 - install -m 644 $(MOUNTMAN5FILES) debian/tmp-mount/usr/share/man/man5 - install -m 644 $(MOUNTDOCFILES) debian/tmp-mount/usr/share/doc/mount + chmod 4775 debian/tmp-mount/bin/* (cd debian/tmp-mount/sbin ; ln -s swapon swapoff) - install -m 644 debian/mount.fstab \ - debian/tmp-mount/usr/share/doc/mount/examples/fstab - install -m 644 debian/changelog \ - debian/tmp-mount/usr/share/doc/mount/changelog.Debian - install -m 644 debian/changelog.Debian-mount.old \ - debian/tmp-mount/usr/share/doc/mount/changelog.Debian-mount.old - install -m 644 HISTORY debian/tmp/usr/share/doc/$(package)/changelog find debian/tmp-mount/usr/share/{doc,man} -type f | xargs gzip -9 install -m 644 debian/copyright debian/tmp-mount/usr/share/doc/mount/copyright - install debian/mount.postinst debian/tmp-mount/DEBIAN/postinst - install debian/mount.prerm debian/tmp-mount/DEBIAN/prerm ls debian/tmp-mount/{bin,sbin}/* | xargs dpkg-shlibdeps -pmount dpkg-gencontrol -isp -pmount -Pdebian/tmp-mount dpkg --build debian/tmp-mount .. +endif # Bsdutils - install -d debian/tmp-bsd/{DEBIAN,bin,usr/{bin,share/man/{man8,man1},share/doc/bsdutils}} - # install -m 755 -o root -s $(BSDBINFILES) debian/tmp-bsd/bin/. - install -m 755 -s $(BSDUBINFILES) debian/tmp-bsd/usr/bin/. - cp misc-utils/replay.pl debian/tmp-bsd/usr/bin/replay - chmod 755 debian/tmp-bsd/usr/bin/replay - install -m 644 $(BSDMAN8FILES) debian/tmp-bsd/usr/share/man/man8 + install -m 755 misc-utils/replay.pl debian/tmp-bsd/usr/bin/replay mv debian/tmp-bsd/usr/share/man/man8/renice.8 debian/tmp-bsd/usr/share/man/man1/renice.1 - install -m 644 $(BSDMAN1FILES) debian/tmp-bsd/usr/share/man/man1 - install -m 644 $(BSDDOCFILES) debian/tmp-bsd/usr/share/doc/bsdutils chown root.tty debian/tmp-bsd/usr/bin/wall chmod g+s debian/tmp-bsd/usr/bin/wall - install -m 644 debian/changelog \ - debian/tmp-bsd/usr/share/doc/bsdutils/changelog.Debian - install -m 644 HISTORY debian/tmp/usr/share/doc/$(package)/changelog find debian/tmp-bsd/usr/share/{doc,man} -type f | xargs gzip -9 install -m 644 debian/copyright debian/tmp-bsd/usr/share/doc/bsdutils/copyright - install debian/bsdutils.postinst debian/tmp-bsd/DEBIAN/postinst - install debian/bsdutils.prerm debian/tmp-bsd/DEBIAN/prerm ls debian/tmp-bsd/usr/bin/* | xargs dpkg-shlibdeps -pbsdutils dpkg-gencontrol -isp -pbsdutils -Pdebian/tmp-bsd -v1:$(version) dpkg --build debian/tmp-bsd .. diff -urN util-linux-2.11u/login-utils/agetty.c util-linux-2.11u-freebsd/login-utils/agetty.c --- util-linux-2.11u/login-utils/agetty.c 2002-07-29 03:36:42.000000000 -0400 +++ util-linux-2.11u-freebsd/login-utils/agetty.c 2002-11-01 13:51:01.000000000 -0500 @@ -18,7 +18,7 @@ #include <stdlib.h> #include <string.h> #include <sys/ioctl.h> -#include <termio.h> +#include <termios.h> #include <signal.h> #include <errno.h> #include <sys/types.h> @@ -33,7 +33,7 @@ #include "xstrncpy.h" #include "nls.h" -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) #include "pathnames.h" #include <sys/param.h> #define USE_SYSLOG @@ -113,6 +113,11 @@ #define TCSETAW TCSETSW #endif +#ifdef __FreeBSD__ +#define termio termios +#define CBAUD 0010017 +#endif + /* * This program tries to not use the standard-i/o library. This keeps the * executable small on systems that do not have shared libraries (System V @@ -686,8 +691,13 @@ * 5 seconds seems to be a good value. */ +#ifndef TCGETA + if (tcgetattr(0, tp) <0) + error("%s: tcgetattr: %m", tty); +#else if (ioctl(0, TCGETA, tp) < 0) error("%s: ioctl: %m", tty); +#endif /* * It seems to be a terminal. Set proper protections and ownership. Mode @@ -726,6 +736,8 @@ #ifdef __linux__ /* flush input and output queues, important for modems! */ (void) ioctl(0, TCFLSH, TCIOFLUSH); +#else + tcflush(0, TCIOFLUSH); #endif tp->c_cflag = CS8 | HUPCL | CREAD | speed; @@ -733,7 +745,7 @@ tp->c_cflag |= CLOCAL; } - tp->c_iflag = tp->c_lflag = tp->c_oflag = tp->c_line = 0; + tp->c_iflag = tp->c_lflag = tp->c_oflag = 0; tp->c_cc[VMIN] = 1; tp->c_cc[VTIME] = 0; @@ -744,7 +756,11 @@ tp->c_cflag |= CRTSCTS; #endif +#ifdef __FreeBSD__ + (void) tcsetattr(0,TCSANOW,tp); +#else (void) ioctl(0, TCSETA, tp); +#endif /* go to blocking input even in local mode */ fcntl(0, F_SETFL, fcntl(0, F_GETFL, 0) & ~O_NONBLOCK); @@ -788,7 +804,11 @@ tp->c_iflag |= ISTRIP; /* enable 8th-bit stripping */ vmin = tp->c_cc[VMIN]; tp->c_cc[VMIN] = 0; /* don't block if queue empty */ +#ifdef __FreeBSD__ + (void) tcsetattr(0,TCSANOW,tp); +#else (void) ioctl(0, TCSETA, tp); +#endif /* * Wait for a while, then read everything the modem has said so far and @@ -812,7 +832,11 @@ tp->c_iflag = iflag; tp->c_cc[VMIN] = vmin; +#ifdef __FreeBSD__ + tcsetattr(0, TCSANOW, tp); +#else (void) ioctl(0, TCSETA, tp); +#endif } /* do_prompt - show login prompt, optionally preceded by /etc/issue contents */ @@ -835,7 +859,11 @@ if ((op->flags & F_ISSUE) && (fd = fopen(op->issue, "r"))) { oflag = tp->c_oflag; /* save current setting */ tp->c_oflag |= (ONLCR | OPOST); /* map NL in output to CR-NL */ +#ifdef __FreeBSD__ + tcsetattr(0, TCSADRAIN, tp); +#else (void) ioctl(0, TCSETAW, tp); +#endif while ((c = getc(fd)) != EOF) @@ -947,7 +975,11 @@ fflush(stdout); tp->c_oflag = oflag; /* restore settings */ +#ifdef __FreeBSD__ + (void) tcsetattr(0,TCSADRAIN, tp); +#else (void) ioctl(0, TCSETAW, tp); /* wait till output is gone */ +#endif (void) fclose(fd); } #endif @@ -973,7 +1005,11 @@ baud_index = (baud_index + 1) % op->numspeed; tp->c_cflag &= ~CBAUD; tp->c_cflag |= op->speeds[baud_index]; +#ifdef __FreeBSD__ + (void) tcsetattr(0,TCSANOW,tp); +#else (void) ioctl(0, TCSETA, tp); +#endif } /* get_logname - get user name, establish parity, speed, erase, kill, eol */ @@ -1003,7 +1039,11 @@ /* Flush pending input (esp. after parsing or switching the baud rate). */ (void) sleep(1); +#ifdef __linux__ (void) ioctl(0, TCFLSH, TCIFLUSH); +#else + tcflush(0, TCIOFLUSH); +#endif /* Prompt for and read a login name. */ @@ -1105,11 +1145,6 @@ tp->c_cc[VQUIT] = DEF_QUIT; /* default quit */ tp->c_cc[VEOF] = DEF_EOF; /* default EOF character */ tp->c_cc[VEOL] = DEF_EOL; -#ifdef __linux__ - tp->c_cc[VSWTC] = DEF_SWITCH; /* default switch character */ -#else - tp->c_cc[VSWTCH] = DEF_SWITCH; /* default switch character */ -#endif /* Account for special characters seen in input. */ @@ -1139,11 +1174,13 @@ } /* Account for upper case without lower case. */ +#ifndef __FreeBSD__ if (cp->capslock) { tp->c_iflag |= IUCLC; tp->c_lflag |= XCASE; tp->c_oflag |= OLCUC; } +#endif /* Optionally enable hardware flow control */ #ifdef CRTSCTS @@ -1153,8 +1190,13 @@ /* Finally, make the new settings effective */ +#ifdef __FreeBSD__ + if (tcsetattr(0,TCSANOW,tp) < 0) + error("%s: tcsetattr: %m", op->tty); +#else if (ioctl(0, TCSETA, tp) < 0) error("%s: ioctl: TCSETA: %m", op->tty); +#endif } /* caps_lock - string contains upper case without lower case */ diff -urN util-linux-2.11u/misc-utils/Makefile util-linux-2.11u-freebsd/misc-utils/Makefile --- util-linux-2.11u/misc-utils/Makefile 2002-04-05 07:03:36.000000000 -0500 +++ util-linux-2.11u-freebsd/misc-utils/Makefile 2002-11-07 00:44:04.000000000 -0500 @@ -40,9 +40,11 @@ endif ifeq "$(HAVE_NCURSES)" "yes" +ifneq "$(OS)" "freebsd" USRBIN:=$(USRBIN) setterm MAN1:=$(MAN1) setterm.1 endif +endif # For script only LIBPTY= @@ -60,6 +62,9 @@ $(NEEDS_CURSES): ifeq "$(HAVE_NCURSES)" "yes" $(CC) $(LDFLAGS) $^ -o $@ $(LIBCURSES) + ifeq $(OS) "freebsd" + @echo $@ not available on this platform + endif else @echo $@ not made since it requires ncurses endif @@ -92,8 +97,10 @@ write: write.o $(LIB)/carefulputc.o ifeq "$(HAVE_NCURSES)" "yes" +ifneq "$(OS)" "freebsd" setterm: setterm.o endif +endif install: all $(INSTALLDIR) $(BINDIR) $(USRBINDIR) diff -urN util-linux-2.11u/misc-utils/mcookie.c util-linux-2.11u-freebsd/misc-utils/mcookie.c --- util-linux-2.11u/misc-utils/mcookie.c 2002-03-08 18:00:52.000000000 -0500 +++ util-linux-2.11u-freebsd/misc-utils/mcookie.c 2002-11-01 13:52:04.000000000 -0500 @@ -20,7 +20,7 @@ * */ -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) #define HAVE_GETTIMEOFDAY 1 #endif diff -urN util-linux-2.11u/sys-utils/Makefile util-linux-2.11u-freebsd/sys-utils/Makefile --- util-linux-2.11u/sys-utils/Makefile 2001-11-09 12:13:50.000000000 -0500 +++ util-linux-2.11u-freebsd/sys-utils/Makefile 2002-11-02 00:07:06.000000000 -0500 @@ -17,13 +17,19 @@ # Where to put binaries? # See the "install" rule for the links. . . +ifeq "$(OS)" "freebsd" +BIN= arch +else BIN= arch dmesg +endif +ifeq "$(OS)" "freebsd" +USRBIN= renice setsid +else USRBIN= cytune ipcrm ipcs renice setsid - USRSBIN= readprofile tunelp - SBIN= ctrlaltdel +endif NOTMADE= @@ -37,10 +43,12 @@ endif endif +ifneq "$(OS)" "freebsd" ifeq "$(ARCH)" "intel" MAN8:=$(MAN8) rdev.8 ramsize.8 rootflags.8 vidmode.8 USRSBIN:=$(USRSBIN) rdev endif +endif # Where to put datebase files? diff -urN util-linux-2.11u/text-utils/more.c util-linux-2.11u-freebsd/text-utils/more.c --- util-linux-2.11u/text-utils/more.c 2002-11-07 01:06:47.000000000 -0500 +++ util-linux-2.11u-freebsd/text-utils/more.c 2002-11-02 00:15:46.000000000 -0500 @@ -63,6 +63,11 @@ #include <regex.h> #undef _REGEX_RE_COMP +/* define CBAUD for FreeBSD */ +#ifndef CBAUD +#define CBAUD 0010017 +#endif + /* #define MOREHELPFILE "/usr/share/util-linux/more.help" */ #define VI "vi" /* found on the user's path */ @@ -1645,7 +1650,7 @@ } if (feof (file)) { if (!no_intty) { -#ifndef __linux__ +#if !defined(__linux__) && !defined(__FreeBSD__) /* No longer in libc 4.5.8. . . */ file->_flags &= ~STDIO_S_EOF_SEEN; /* why doesn't fseek do this ??!!??! */ #endif @@ -1892,7 +1897,11 @@ tcgetattr(fileno(stderr), &otty); savetty0 = otty; slow_tty = (otty.c_cflag & CBAUD) < B1200; +#ifdef __FreeBSD__ + hardtabs = 1; +#else hardtabs = (otty.c_oflag & TABDLY) != XTABS; +#endif if (!no_tty) { otty.c_lflag &= ~(ICANON|ECHO); otty.c_cc[VMIN] = 1;