summaryrefslogtreecommitdiff
path: root/packaging
diff options
context:
space:
mode:
authorYeongdeok Suh <yduck.suh@samsung.com>2015-07-27 11:12:37 +0900
committerHyejin Kim <hyejin0906.kim@samsung.com>2015-07-27 13:42:46 +0900
commit8c34957838dc085ab8c60d395d3f18101d1d3d46 (patch)
tree0d5312e1134390d1874d106121f009bf0decc691 /packaging
parent34f0321cc97943163134a3d3e223dc944cb24791 (diff)
downloadtoybox-8c34957838dc085ab8c60d395d3f18101d1d3d46.tar.gz
toybox-8c34957838dc085ab8c60d395d3f18101d1d3d46.tar.bz2
toybox-8c34957838dc085ab8c60d395d3f18101d1d3d46.zip
Change-Id: I7514d01cee8d9f9b0cd9382b3d9649ca30202265 Signed-off-by: Yeongdeok Suh <yduck.suh@samsung.com>
Diffstat (limited to 'packaging')
-rw-r--r--packaging/bin.links0
-rw-r--r--packaging/bin_tv.links2
-rw-r--r--packaging/config262
-rw-r--r--packaging/klogd.manifest14
-rw-r--r--packaging/klogd.service17
-rw-r--r--packaging/sbin.links2
-rw-r--r--packaging/sbin_tv.links4
-rw-r--r--packaging/syslogd.manifest14
-rw-r--r--packaging/syslogd.service17
-rw-r--r--packaging/toybox.manifest8
-rw-r--r--packaging/toybox.spec156
-rw-r--r--packaging/usrbin.links2
-rw-r--r--packaging/usrbin_tv.links1
-rw-r--r--packaging/usrsbin.links1
14 files changed, 350 insertions, 150 deletions
diff --git a/packaging/bin.links b/packaging/bin.links
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/packaging/bin.links
diff --git a/packaging/bin_tv.links b/packaging/bin_tv.links
new file mode 100644
index 0000000..5c3aa65
--- /dev/null
+++ b/packaging/bin_tv.links
@@ -0,0 +1,2 @@
+ping
+ping6
diff --git a/packaging/config b/packaging/config
index 35f64bf..7178c4d 100644
--- a/packaging/config
+++ b/packaging/config
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# ToyBox version: KCONFIG_VERSION
-# Mon Jul 20 13:45:50 2015
+# Mon Jul 27 13:41:41 2015
#
CONFIG_TOYBOX_CONTAINER=y
CONFIG_TOYBOX_FIFREEZE=y
@@ -15,88 +15,88 @@ CONFIG_TOYBOX_FORK=y
#
# Posix commands
#
-CONFIG_BASENAME=y
+# CONFIG_BASENAME is not set
# CONFIG_CAL is not set
-CONFIG_CAT=y
+# CONFIG_CAT is not set
# CONFIG_CAT_V is not set
-# CONFIG_CATV is not set
-CONFIG_CHGRP=y
-CONFIG_CHOWN=y
-CONFIG_CHMOD=y
-CONFIG_CKSUM=y
-CONFIG_CMP=y
-CONFIG_COMM=y
-CONFIG_CP=y
-CONFIG_CP_MORE=y
-CONFIG_CP_PRESERVE=y
-CONFIG_MV=y
-CONFIG_MV_MORE=y
-CONFIG_INSTALL=y
-CONFIG_CPIO=y
-CONFIG_CUT=y
-CONFIG_DATE=y
-CONFIG_DF=y
-CONFIG_DIRNAME=y
-CONFIG_DU=y
-CONFIG_ECHO=y
-CONFIG_ENV=y
-CONFIG_EXPAND=y
-CONFIG_FALSE=y
-CONFIG_FIND=y
-CONFIG_GREP=y
-CONFIG_EGREP=y
-CONFIG_FGREP=y
-CONFIG_HEAD=y
-CONFIG_ID=y
+CONFIG_CATV=y
+# CONFIG_CHGRP is not set
+# CONFIG_CHOWN is not set
+# CONFIG_CHMOD is not set
+# CONFIG_CKSUM is not set
+# CONFIG_CMP is not set
+# CONFIG_COMM is not set
+# CONFIG_CP is not set
+# CONFIG_CP_MORE is not set
+# CONFIG_CP_PRESERVE is not set
+# CONFIG_MV is not set
+# CONFIG_MV_MORE is not set
+# CONFIG_INSTALL is not set
+# CONFIG_CPIO is not set
+# CONFIG_CUT is not set
+# CONFIG_DATE is not set
+# CONFIG_DF is not set
+# CONFIG_DIRNAME is not set
+# CONFIG_DU is not set
+# CONFIG_ECHO is not set
+# CONFIG_ENV is not set
+# CONFIG_EXPAND is not set
+# CONFIG_FALSE is not set
+# CONFIG_FIND is not set
+# CONFIG_GREP is not set
+# CONFIG_EGREP is not set
+# CONFIG_FGREP is not set
+# CONFIG_HEAD is not set
+# CONFIG_ID is not set
# CONFIG_ID_Z is not set
-CONFIG_GROUPS=y
-CONFIG_LOGNAME=y
-CONFIG_WHOAMI=y
-CONFIG_KILL=y
+# CONFIG_GROUPS is not set
+# CONFIG_LOGNAME is not set
+# CONFIG_WHOAMI is not set
+# CONFIG_KILL is not set
# CONFIG_KILLALL5 is not set
-CONFIG_LINK=y
-CONFIG_LN=y
-CONFIG_LS=y
-CONFIG_LS_COLOR=y
-CONFIG_MKDIR=y
+# CONFIG_LINK is not set
+# CONFIG_LN is not set
+# CONFIG_LS is not set
+# CONFIG_LS_COLOR is not set
+# CONFIG_MKDIR is not set
# CONFIG_MKDIR_Z is not set
-CONFIG_MKFIFO=y
+# CONFIG_MKFIFO is not set
# CONFIG_MKFIFO_Z is not set
-CONFIG_NICE=y
-CONFIG_NL=y
-CONFIG_NOHUP=y
-CONFIG_OD=y
-CONFIG_PASTE=y
-CONFIG_PATCH=y
-CONFIG_PRINTF=y
-CONFIG_PWD=y
+# CONFIG_NICE is not set
+# CONFIG_NL is not set
+# CONFIG_NOHUP is not set
+# CONFIG_OD is not set
+# CONFIG_PASTE is not set
+# CONFIG_PATCH is not set
+# CONFIG_PRINTF is not set
+# CONFIG_PWD is not set
# CONFIG_RENICE is not set
CONFIG_RM=y
-CONFIG_RMDIR=y
-CONFIG_SED=y
-CONFIG_SLEEP=y
-CONFIG_SLEEP_FLOAT=y
-CONFIG_SORT=y
-CONFIG_SORT_BIG=y
-CONFIG_SORT_FLOAT=y
-CONFIG_SPLIT=y
-CONFIG_STRINGS=y
-CONFIG_TAIL=y
-CONFIG_TAIL_SEEK=y
-CONFIG_TEE=y
+# CONFIG_RMDIR is not set
+# CONFIG_SED is not set
+# CONFIG_SLEEP is not set
+# CONFIG_SLEEP_FLOAT is not set
+# CONFIG_SORT is not set
+# CONFIG_SORT_BIG is not set
+# CONFIG_SORT_FLOAT is not set
+# CONFIG_SPLIT is not set
+# CONFIG_STRINGS is not set
+# CONFIG_TAIL is not set
+# CONFIG_TAIL_SEEK is not set
+# CONFIG_TEE is not set
# CONFIG_TIME is not set
-CONFIG_TOUCH=y
-CONFIG_TRUE=y
-CONFIG_TTY=y
-CONFIG_UNAME=y
-CONFIG_UNIQ=y
-CONFIG_UNLINK=y
+# CONFIG_TOUCH is not set
+# CONFIG_TRUE is not set
+# CONFIG_TTY is not set
+# CONFIG_UNAME is not set
+# CONFIG_UNIQ is not set
+# CONFIG_UNLINK is not set
# CONFIG_UUDECODE is not set
# CONFIG_UUENCODE is not set
-CONFIG_WC=y
-CONFIG_WHO=y
-CONFIG_XARGS=y
-CONFIG_XARGS_PEDANTIC=y
+# CONFIG_WC is not set
+# CONFIG_WHO is not set
+# CONFIG_XARGS is not set
+# CONFIG_XARGS_PEDANTIC is not set
#
# pending (see toys/pending/README)
@@ -105,24 +105,24 @@ CONFIG_XARGS_PEDANTIC=y
# CONFIG_ARPING is not set
# CONFIG_BOOTCHARTD is not set
# CONFIG_BRCTL is not set
-CONFIG_COMPRESS=y
-CONFIG_GZIP=y
+# CONFIG_COMPRESS is not set
+# CONFIG_GZIP is not set
# CONFIG_GZIP_D is not set
# CONFIG_DECOMPRESS is not set
# CONFIG_ZCAT is not set
# CONFIG_GUNZIP is not set
# CONFIG_CROND is not set
# CONFIG_CRONTAB is not set
-CONFIG_DD=y
-# CONFIG_DHCP is not set
-# CONFIG_DHCPD is not set
-# CONFIG_DEBUG_DHCP is not set
-CONFIG_DIFF=y
-# CONFIG_DUMPLEASES is not set
-CONFIG_EXPR=y
+# CONFIG_DD is not set
+CONFIG_DHCP=y
+CONFIG_DHCPD=y
+CONFIG_DEBUG_DHCP=y
+# CONFIG_DIFF is not set
+CONFIG_DUMPLEASES=y
+# CONFIG_EXPR is not set
# CONFIG_FDISK is not set
-CONFIG_FOLD=y
-CONFIG_FSCK=y
+# CONFIG_FOLD is not set
+# CONFIG_FSCK is not set
# CONFIG_FTPGET is not set
# CONFIG_GETTY is not set
# CONFIG_GROUPADD is not set
@@ -133,10 +133,10 @@ CONFIG_FSCK=y
# CONFIG_IP is not set
# CONFIG_IPCRM is not set
# CONFIG_IPCS is not set
-# CONFIG_KLOGD is not set
-# CONFIG_KLOGD_SOURCE_RING_BUFFER is not set
+CONFIG_KLOGD=y
+CONFIG_KLOGD_SOURCE_RING_BUFFER=y
# CONFIG_LAST is not set
-# CONFIG_LOGGER is not set
+CONFIG_LOGGER=y
# CONFIG_MDEV is not set
# CONFIG_MDEV_CONF is not set
# CONFIG_MKE2FS is not set
@@ -147,63 +147,62 @@ CONFIG_FSCK=y
# CONFIG_MODPROBE is not set
# CONFIG_MORE is not set
# CONFIG_NETSTAT is not set
-# CONFIG_NSENTER is not set
# CONFIG_OPENVT is not set
# CONFIG_DEALLOCVT is not set
# CONFIG_PGREP is not set
-# CONFIG_PING is not set
+CONFIG_PING=y
# CONFIG_PS is not set
# CONFIG_ROUTE is not set
-CONFIG_SH=y
+# CONFIG_SH is not set
# CONFIG_EXIT is not set
# CONFIG_CD is not set
# CONFIG_SULOGIN is not set
-# CONFIG_SYSLOGD is not set
-CONFIG_TAR=y
+CONFIG_SYSLOGD=y
+# CONFIG_TAR is not set
# CONFIG_TCPSVD is not set
# CONFIG_TELNET is not set
# CONFIG_TELNETD is not set
-CONFIG_TEST=y
+# CONFIG_TEST is not set
# CONFIG_TFTPD is not set
# CONFIG_TOP is not set
-CONFIG_TR=y
-# CONFIG_TRACEROUTE is not set
+# CONFIG_TR is not set
+CONFIG_TRACEROUTE=y
# CONFIG_USERADD is not set
# CONFIG_USERDEL is not set
# CONFIG_WATCH is not set
-CONFIG_XZCAT=y
+# CONFIG_XZCAT is not set
#
# Other commands
#
# CONFIG_ACPI is not set
-CONFIG_BASE64=y
+# CONFIG_BASE64 is not set
# CONFIG_BLKID is not set
-CONFIG_FSTYPE=y
-# CONFIG_BLOCKDEV is not set
-CONFIG_BZCAT=y
+# CONFIG_FSTYPE is not set
+CONFIG_BLOCKDEV=y
+# CONFIG_BZCAT is not set
# CONFIG_CHCON is not set
-CONFIG_CHROOT=y
+# CONFIG_CHROOT is not set
# CONFIG_CHVT is not set
# CONFIG_CLEAR is not set
# CONFIG_COUNT is not set
-CONFIG_DOS2UNIX=y
-CONFIG_UNIX2DOS=y
+# CONFIG_DOS2UNIX is not set
+# CONFIG_UNIX2DOS is not set
# CONFIG_EJECT is not set
-CONFIG_FACTOR=y
+# CONFIG_FACTOR is not set
# CONFIG_FALLOCATE is not set
# CONFIG_FREE is not set
# CONFIG_FREERAMDISK is not set
# CONFIG_FSFREEZE is not set
CONFIG_HELP=y
CONFIG_HELP_EXTRAS=y
-CONFIG_HEXEDIT=y
+# CONFIG_HEXEDIT is not set
# CONFIG_HWCLOCK is not set
# CONFIG_IFCONFIG is not set
# CONFIG_INOTIFYD is not set
-# CONFIG_INSMOD is not set
-CONFIG_IONICE=y
-CONFIG_IORENICE=y
+CONFIG_INSMOD=y
+# CONFIG_IONICE is not set
+# CONFIG_IORENICE is not set
# CONFIG_LOGIN is not set
# CONFIG_LOSETUP is not set
# CONFIG_LSATTR is not set
@@ -222,40 +221,41 @@ CONFIG_IORENICE=y
# CONFIG_NETCAT is not set
# CONFIG_NETCAT_LISTEN is not set
# CONFIG_UNSHARE is not set
+# CONFIG_NSENTER is not set
# CONFIG_ONEIT is not set
-CONFIG_PARTPROBE=y
+# CONFIG_PARTPROBE is not set
# CONFIG_PIVOT_ROOT is not set
# CONFIG_PMAP is not set
-CONFIG_PRINTENV=y
+# CONFIG_PRINTENV is not set
# CONFIG_PWDX is not set
# CONFIG_READAHEAD is not set
-CONFIG_READLINK=y
-CONFIG_REALPATH=y
+# CONFIG_READLINK is not set
+# CONFIG_REALPATH is not set
# CONFIG_REBOOT is not set
# CONFIG_RESET is not set
# CONFIG_REV is not set
# CONFIG_RFKILL is not set
# CONFIG_RMMOD is not set
# CONFIG_SETSID is not set
-CONFIG_SHRED=y
-CONFIG_STAT=y
+# CONFIG_SHRED is not set
+# CONFIG_STAT is not set
# CONFIG_SWAPOFF is not set
# CONFIG_SWAPON is not set
# CONFIG_SWITCH_ROOT is not set
# CONFIG_SYSCTL is not set
-CONFIG_TAC=y
-CONFIG_NPROC=y
+# CONFIG_TAC is not set
+# CONFIG_NPROC is not set
# CONFIG_TASKSET is not set
-CONFIG_TIMEOUT=y
-CONFIG_TRUNCATE=y
+# CONFIG_TIMEOUT is not set
+# CONFIG_TRUNCATE is not set
# CONFIG_UPTIME is not set
# CONFIG_USLEEP is not set
# CONFIG_VCONFIG is not set
# CONFIG_VMSTAT is not set
# CONFIG_W is not set
# CONFIG_WHICH is not set
-CONFIG_XXD=y
-CONFIG_YES=y
+# CONFIG_XXD is not set
+# CONFIG_YES is not set
#
# Linux Standard Base commands
@@ -263,18 +263,18 @@ CONFIG_YES=y
# CONFIG_DMESG is not set
# CONFIG_HOSTNAME is not set
# CONFIG_KILLALL is not set
-CONFIG_MD5SUM=y
-CONFIG_SHA1SUM=y
-CONFIG_MKNOD=y
+# CONFIG_MD5SUM is not set
+# CONFIG_SHA1SUM is not set
+# CONFIG_MKNOD is not set
# CONFIG_MKNOD_Z is not set
-CONFIG_MKTEMP=y
-# CONFIG_MOUNT is not set
+# CONFIG_MKTEMP is not set
+CONFIG_MOUNT=y
# CONFIG_PASSWD is not set
# CONFIG_PIDOF is not set
-CONFIG_SEQ=y
+# CONFIG_SEQ is not set
# CONFIG_SU is not set
-CONFIG_SYNC=y
-# CONFIG_UMOUNT is not set
+# CONFIG_SYNC is not set
+CONFIG_UMOUNT=y
#
# Example commands
@@ -302,16 +302,16 @@ CONFIG_SYNC=y
# Toybox global settings
#
CONFIG_TOYBOX=y
-CONFIG_TOYBOX_SUID=y
+# CONFIG_TOYBOX_SUID is not set
CONFIG_TOYBOX_LSM_NONE=y
# CONFIG_TOYBOX_SELINUX is not set
# CONFIG_TOYBOX_SMACK is not set
-CONFIG_TOYBOX_FLOAT=y
+# CONFIG_TOYBOX_FLOAT is not set
CONFIG_TOYBOX_HELP=y
CONFIG_TOYBOX_HELP_DASHDASH=y
-CONFIG_TOYBOX_I18N=y
+# CONFIG_TOYBOX_I18N is not set
# CONFIG_TOYBOX_FREE is not set
# CONFIG_TOYBOX_NORECURSE is not set
-CONFIG_TOYBOX_DEBUG=y
+# CONFIG_TOYBOX_DEBUG is not set
CONFIG_TOYBOX_UID_SYS=100
CONFIG_TOYBOX_UID_USR=500
diff --git a/packaging/klogd.manifest b/packaging/klogd.manifest
new file mode 100644
index 0000000..aa34fac
--- /dev/null
+++ b/packaging/klogd.manifest
@@ -0,0 +1,14 @@
+<manifest>
+ <define>
+ <domain name="klogd"/>
+ <permit>
+ <smack permit="_" type="w"/>
+ </permit>
+ </define>
+ <request>
+ <domain name="_"/>
+ </request>
+ <assign>
+ <filesystem path="/sbin/klogd" exec_label="klogd" />
+ </assign>
+</manifest>
diff --git a/packaging/klogd.service b/packaging/klogd.service
new file mode 100644
index 0000000..d6cf657
--- /dev/null
+++ b/packaging/klogd.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Run syslog
+DefaultDependencies=no
+After=syslogd.service
+ConditionKernelCommandLine=|!sec_debug.enable=0
+ConditionKernelCommandLine=|!sec_debug.enable_user=0
+
+[Service]
+Type=forking
+ExecStart=/sbin/klogd
+OOMScoreAdjust=-1000
+Restart=always
+RestartSec=0
+SmackProcessLabel=klogd
+
+[Install]
+WantedBy=basic.target
diff --git a/packaging/sbin.links b/packaging/sbin.links
new file mode 100644
index 0000000..ff4418a
--- /dev/null
+++ b/packaging/sbin.links
@@ -0,0 +1,2 @@
+klogd
+syslogd
diff --git a/packaging/sbin_tv.links b/packaging/sbin_tv.links
new file mode 100644
index 0000000..02d4a98
--- /dev/null
+++ b/packaging/sbin_tv.links
@@ -0,0 +1,4 @@
+klogd
+syslogd
+ping
+ping6
diff --git a/packaging/syslogd.manifest b/packaging/syslogd.manifest
new file mode 100644
index 0000000..70bcf4e
--- /dev/null
+++ b/packaging/syslogd.manifest
@@ -0,0 +1,14 @@
+<manifest>
+ <define>
+ <domain name="syslogd"/>
+ <permit>
+ <smack permit="_" type="w"/>
+ </permit>
+ </define>
+ <request>
+ <domain name="_"/>
+ </request>
+ <assign>
+ <filesystem path="/sbin/syslogd" exec_label="syslogd" />
+ </assign>
+</manifest>
diff --git a/packaging/syslogd.service b/packaging/syslogd.service
new file mode 100644
index 0000000..24a75a6
--- /dev/null
+++ b/packaging/syslogd.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Run syslog
+DefaultDependencies=no
+After=local-fs.target
+ConditionKernelCommandLine=|!sec_debug.enable=0
+ConditionKernelCommandLine=|!sec_debug.enable_user=0
+
+[Service]
+Type=forking
+ExecStart=/sbin/syslogd -b 5 -B 99
+OOMScoreAdjust=-1000
+Restart=always
+RestartSec=0
+SmackProcessLabel=syslogd
+
+[Install]
+WantedBy=basic.target
diff --git a/packaging/toybox.manifest b/packaging/toybox.manifest
new file mode 100644
index 0000000..c922afb
--- /dev/null
+++ b/packaging/toybox.manifest
@@ -0,0 +1,8 @@
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+ <assign>
+ <filesystem path="/bin/*" exec_label="none" />
+ </assign>
+</manifest>
diff --git a/packaging/toybox.spec b/packaging/toybox.spec
index c613f9d..94c8966 100644
--- a/packaging/toybox.spec
+++ b/packaging/toybox.spec
@@ -1,38 +1,156 @@
Name: toybox
Version: 0.5.1
Release: 1%{?dist}
-Summary: ToyBox Core utilities
+Summary: Single binary providing simplified versions of system commands
Group: Base/Utilities
-License: BSD-2-Clause-FreeBSD
-URL: http://landley.net/toybox/about.html
+License: BSD-2-Clause-FreeBSD
+URL: http://www.landley.net/toybox/
Source: %{name}-%{version}.tar.bz2
Source1: config
+%if "%{?profile}"=="tv"
+Source2: bin_tv.links
+Source3: sbin_tv.links
+Source4: usrbin_tv.links
+%else
+Source2: bin.links
+Source3: sbin.links
+Source4: usrbin.links
+%endif
+Source5: usrsbin.links
+Source101: klogd.service
+Source102: syslogd.service
+Source1001: toybox.manifest
+Source1002: syslogd.manifest
+Source1003: klogd.manifest
BuildRequires : smack-devel
BuildRequires : libattr-devel
-Requires : libattr
-%description
-Toybox combines the most common Linux command line utilities together into a single BSD-licensed executable
+%description
+Toybox is a single binary which includes versions of a large number
+of system commands, including a shell. This package can be very
+useful for recovering from certain types of system failures,
+particularly those involving broken shared libraries.
+
+%package symlinks-klogd
+Group: tools
+Summary: ToyBox symlinks to provide 'klogd'
+Requires: %{name} = %{version}-%{release}
+
+%description symlinks-klogd
+ToyBox symlinks for utilities corresponding to 'klogd' package.
+
+%package symlinks-sysklogd
+Group: tools
+Summary: ToyBox symlinks to provide 'sysklogd'
+Requires: %{name} = %{version}-%{release}
+
+%description symlinks-sysklogd
+ToyBox symlinks for utilities corresponding to 'sysklogd' package.
+
+%package symlinks-dhcp
+Group: tools
+Summary: ToyBox symlinks to provide 'dhcp'
+Requires: %{name} = %{version}-%{release}
+
+%description symlinks-dhcp
+ToyBox symlinks for utilities corresponding to 'dhcp' package.
+
+%package symlinks-dhcpd
+Group: tools
+Summary: ToyBox symlinks to provide 'dhcpd'
+Requires: %{name} = %{version}-%{release}
+
+%description symlinks-dhcpd
+ToyBox symlinks for utilities corresponding to 'dhcpd' package.
%prep
%setup -q
%build
-cp %{SOURCE1} ./.config
-USE_SMACK=1 make %{?_smp_mflags} toybox
+cp %{SOURCE1001} .
+cp %{SOURCE1002} .
+cp %{SOURCE1003} .
+# create dynamic toybox - the executable is toybox
+cp %{SOURCE1} .config
+make -j 4 CC="gcc $RPM_OPT_FLAGS" CFLAGS="$CFLAGS -fPIE" LDOPTIMIZE="-Wl,--gc-sections -pie"
+cp toybox toybox-dynamic
%install
-output="build"
-mkdir -p ./${output}
-make PREFIX=./${output} install
-mkdir -p %{buildroot}%{_bindir}
-mkdir -p %{buildroot}%{_sbindir}
-cp --preserve=links ./${output}/bin/* %{buildroot}%{_bindir}
-cp --preserve=links ./${output}/sbin/* %{buildroot}%{_sbindir}
-cp --preserve=links ./${output}/usr/bin/* %{buildroot}%{_bindir}
-cp --preserve=links ./${output}/usr/sbin/* %{buildroot}%{_sbindir}
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT/bin
+mkdir -p $RPM_BUILD_ROOT/sbin
+install -m 755 toybox-dynamic $RPM_BUILD_ROOT/bin/toybox
+
+# debian/toybox.links
+pushd %{buildroot}
+mkdir -p usr/bin usr/sbin sbin
+cd bin
+for f in `cat %SOURCE2` ; do ln -s toybox $f ; done
+cd ../sbin
+for f in `cat %SOURCE3` ; do ln -s ../bin/toybox $f ; done
+cd ../usr/bin
+for f in `cat %SOURCE4` ; do ln -s ../../bin/toybox $f ; done
+cd ../../usr/sbin
+for f in `cat %SOURCE5` ; do ln -s ../../bin/toybox $f ; done
+popd
+
+# install systemd service files for syslogd and klogd
+mkdir -p %{buildroot}%{_libdir}/systemd/system/basic.target.wants
+install -m 644 %SOURCE101 %{buildroot}%{_libdir}/systemd/system/klogd.service
+ln -s ../klogd.service %{buildroot}%{_libdir}/systemd/system/basic.target.wants/klogd.service
+install -m 644 %SOURCE102 %{buildroot}%{_libdir}/systemd/system/syslogd.service
+ln -s ../syslogd.service %{buildroot}%{_libdir}/systemd/system/basic.target.wants/syslogd.service
+rm -rf $RPM_BUILD_ROOT/sbin/syslogd
+cp -f $RPM_BUILD_ROOT/bin/toybox $RPM_BUILD_ROOT/sbin/syslogd
+rm -rf $RPM_BUILD_ROOT/sbin/klogd
+cp -f $RPM_BUILD_ROOT/bin/toybox $RPM_BUILD_ROOT/sbin/klogd
+
+mkdir -p $RPM_BUILD_ROOT%{_datadir}/license
+cat LICENSE > $RPM_BUILD_ROOT%{_datadir}/license/toybox
+cat LICENSE > $RPM_BUILD_ROOT%{_datadir}/license/toybox-symlinks-klogd
+cat LICENSE > $RPM_BUILD_ROOT%{_datadir}/license/toybox-symlinks-sysklogd
+cat LICENSE > $RPM_BUILD_ROOT%{_datadir}/license/toybox-symlinks-dhcp
+cat LICENSE > $RPM_BUILD_ROOT%{_datadir}/license/toybox-symlinks-dhcpd
%files
-%{_bindir}/*
-%{_sbindir}/*
+%defattr(-,root,root,-)
+%doc LICENSE
+%{_datadir}/license/toybox
+/bin/toybox
+%if "%{?profile}"=="tv"
+/sbin/ping
+/bin/ping
+/sbin/ping6
+/bin/ping6
+%endif
+%manifest toybox.manifest
+
+%files symlinks-klogd
+%defattr(-,root,root,-)
+%{_datadir}/license/toybox-symlinks-klogd
+/sbin/klogd
+%{_libdir}/systemd/system/klogd.service
+%{_libdir}/systemd/system/basic.target.wants/klogd.service
+%manifest klogd.manifest
+
+%files symlinks-sysklogd
+%defattr(-,root,root,-)
+%{_datadir}/license/toybox-symlinks-sysklogd
+/sbin/syslogd
+%{_libdir}/systemd/system/syslogd.service
+%{_libdir}/systemd/system/basic.target.wants/syslogd.service
+%manifest syslogd.manifest
+
+%files symlinks-dhcp
+%defattr(-,root,root,-)
+%{_datadir}/license/toybox-symlinks-dhcp
+%{_bindir}/dhcp
+%manifest toybox.manifest
+
+%files symlinks-dhcpd
+%defattr(-,root,root,-)
+%{_datadir}/license/toybox-symlinks-dhcpd
+%{_bindir}/dumpleases
+%{_sbindir}/dhcpd
+%manifest toybox.manifest
diff --git a/packaging/usrbin.links b/packaging/usrbin.links
new file mode 100644
index 0000000..424150e
--- /dev/null
+++ b/packaging/usrbin.links
@@ -0,0 +1,2 @@
+dumpleases
+dhcp
diff --git a/packaging/usrbin_tv.links b/packaging/usrbin_tv.links
new file mode 100644
index 0000000..72ab18f
--- /dev/null
+++ b/packaging/usrbin_tv.links
@@ -0,0 +1 @@
+dhcp
diff --git a/packaging/usrsbin.links b/packaging/usrsbin.links
new file mode 100644
index 0000000..d860423
--- /dev/null
+++ b/packaging/usrsbin.links
@@ -0,0 +1 @@
+dhcpd