From cfc62d1fe977490f158f1e8f824586a74b6737cb Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Wed, 18 Dec 2013 17:25:18 +0100 Subject: [PATCH] busybox, busybox-initramfs, busybox-hosttools: convert to new package format Signed-off-by: Stephan Raue --- packages/initramfs/package.mk | 4 +- .../sysutils/busybox-initramfs/build | 50 ---- .../sysutils/busybox-initramfs/install | 46 ---- .../initramfs/sysutils/busybox-initramfs/meta | 36 --- packages/sysutils/busybox-hosttools/build | 40 --- packages/sysutils/busybox-hosttools/meta | 36 --- packages/sysutils/busybox/build | 60 ----- .../config/busybox-host.conf} | 0 .../busybox/config/busybox-init.conf} | 0 .../{busybox.conf => busybox-target.conf} | 0 packages/sysutils/busybox/install | 103 -------- packages/sysutils/busybox/meta | 46 ---- packages/sysutils/busybox/package.mk | 249 ++++++++++++++++++ .../busybox}/scripts/init | 8 + 14 files changed, 259 insertions(+), 419 deletions(-) delete mode 100755 packages/initramfs/sysutils/busybox-initramfs/build delete mode 100755 packages/initramfs/sysutils/busybox-initramfs/install delete mode 100644 packages/initramfs/sysutils/busybox-initramfs/meta delete mode 100755 packages/sysutils/busybox-hosttools/build delete mode 100644 packages/sysutils/busybox-hosttools/meta delete mode 100755 packages/sysutils/busybox/build rename packages/sysutils/{busybox-hosttools/config/busybox-hosttools.conf => busybox/config/busybox-host.conf} (100%) rename packages/{initramfs/sysutils/busybox-initramfs/config/busybox-initramfs.conf => sysutils/busybox/config/busybox-init.conf} (100%) rename packages/sysutils/busybox/config/{busybox.conf => busybox-target.conf} (100%) delete mode 100755 packages/sysutils/busybox/install delete mode 100644 packages/sysutils/busybox/meta create mode 100644 packages/sysutils/busybox/package.mk rename packages/{initramfs/sysutils/busybox-initramfs => sysutils/busybox}/scripts/init (98%) diff --git a/packages/initramfs/package.mk b/packages/initramfs/package.mk index 71233d4e88..4885f46030 100644 --- a/packages/initramfs/package.mk +++ b/packages/initramfs/package.mk @@ -25,8 +25,8 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.openelec.tv" PKG_URL="" -PKG_DEPENDS="eglibc:init busybox-initramfs linux-initramfs plymouth-lite:init diskdev_cmds:init" -PKG_BUILD_DEPENDS_TARGET="toolchain busybox-initramfs" +PKG_DEPENDS="eglibc:init busybox:init linux-initramfs plymouth-lite:init diskdev_cmds:init" +PKG_BUILD_DEPENDS_TARGET="toolchain" PKG_PRIORITY="optional" PKG_SECTION="virtual" PKG_SHORTDESC="initramfs: Metapackage for installing initramfs" diff --git a/packages/initramfs/sysutils/busybox-initramfs/build b/packages/initramfs/sysutils/busybox-initramfs/build deleted file mode 100755 index bd6fb25c94..0000000000 --- a/packages/initramfs/sysutils/busybox-initramfs/build +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# This Program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This Program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -$SCRIPTS/unpack busybox - -if [ -f $PROJECT_DIR/$PROJECT/busybox/$1.conf ]; then - BUSYBOX_CFG_FILE=$PROJECT_DIR/$PROJECT/busybox/$1.conf -else - BUSYBOX_CFG_FILE=$PKG_DIR/config/$1.conf -fi - -# optimize for size - CFLAGS=`echo $CFLAGS | sed -e "s|-Ofast|-Os|"` - CFLAGS=`echo $CFLAGS | sed -e "s|-O.|-Os|"` - -LDFLAGS="$LDFLAGS -fwhole-program" - -cd $BUILD/busybox* - -# Build Busybox for initramfs - make distclean - cp $BUSYBOX_CFG_FILE .config - make oldconfig - - make ARCH=$TARGET_ARCH \ - HOSTCC=$HOST_CC \ - CROSS_COMPILE=$TARGET_PREFIX \ - KBUILD_VERBOSE="1" \ - install diff --git a/packages/initramfs/sysutils/busybox-initramfs/install b/packages/initramfs/sysutils/busybox-initramfs/install deleted file mode 100755 index 35bfb23c4f..0000000000 --- a/packages/initramfs/sysutils/busybox-initramfs/install +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# This Program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This Program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -mkdir -p $INSTALL/bin - cp -PR $BUILD/busybox*/_install-initramfs/bin/busybox $INSTALL/bin - ln -sf busybox $INSTALL/bin/sh - chmod 4755 $INSTALL/bin/busybox - -mkdir -p $INSTALL/etc - touch $INSTALL/etc/fstab - ln -sf /proc/self/mounts $INSTALL/etc/mtab - - if [ -f $PROJECT_DIR/$PROJECT/initramfs/initramfs.conf ]; then - cp $PROJECT_DIR/$PROJECT/initramfs/initramfs.conf $INSTALL/etc - fi - -mkdir -p $INSTALL/dev -mkdir -p $INSTALL/proc -mkdir -p $INSTALL/sys -mkdir -p $INSTALL/flash -mkdir -p $INSTALL/sysroot -mkdir -p $INSTALL/storage - - cp $PKG_DIR/scripts/init $INSTALL - chmod 755 $INSTALL/init diff --git a/packages/initramfs/sysutils/busybox-initramfs/meta b/packages/initramfs/sysutils/busybox-initramfs/meta deleted file mode 100644 index 0ed191ea17..0000000000 --- a/packages/initramfs/sysutils/busybox-initramfs/meta +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# This Program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This Program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="busybox-initramfs" -PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.busybox.net" -PKG_URL="" -PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" -PKG_PRIORITY="required" -PKG_SECTION="system" -PKG_SHORTDESC="BusyBox: The Swiss Army Knife of Embedded Linux" -PKG_LONGDESC="BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete environment for any small or embedded system." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" diff --git a/packages/sysutils/busybox-hosttools/build b/packages/sysutils/busybox-hosttools/build deleted file mode 100755 index d005eabfba..0000000000 --- a/packages/sysutils/busybox-hosttools/build +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# This Program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This Program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -$SCRIPTS/unpack busybox - -setup_toolchain host - -cd $BUILD/busybox* - make distclean - cp $PKG_DIR/config/$1.conf .config - make oldconfig - - ARCH=$TARGET_ARCH make CROSS_COMPILE="" KBUILD_VERBOSE="1" install - - mkdir -p $ROOT/$TOOLCHAIN/bin - cp -R _install-hosttools/bin/* $ROOT/$TOOLCHAIN/bin - chmod 4755 $ROOT/$TOOLCHAIN/bin/busybox - ln -sf busybox $ROOT/$TOOLCHAIN/bin/cryptpw - ln -sf busybox $ROOT/$TOOLCHAIN/bin/mkpasswd diff --git a/packages/sysutils/busybox-hosttools/meta b/packages/sysutils/busybox-hosttools/meta deleted file mode 100644 index 5aacfb5fae..0000000000 --- a/packages/sysutils/busybox-hosttools/meta +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# This Program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This Program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="busybox-hosttools" -PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.busybox.net" -PKG_URL="" -PKG_DEPENDS="" -PKG_BUILD_DEPENDS="toolchain" -PKG_PRIORITY="required" -PKG_SECTION="system" -PKG_SHORTDESC="BusyBox: The Swiss Army Knife of Embedded Linux" -PKG_LONGDESC="BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete environment for any small or embedded system." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" diff --git a/packages/sysutils/busybox/build b/packages/sysutils/busybox/build deleted file mode 100755 index f4c7d1787e..0000000000 --- a/packages/sysutils/busybox/build +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# This Program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This Program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -if [ -f $PROJECT_DIR/$PROJECT/busybox/$1.conf ]; then - BUSYBOX_CFG_FILE=$PROJECT_DIR/$PROJECT/busybox/$1.conf -else - BUSYBOX_CFG_FILE=$PKG_DIR/config/$1.conf -fi - -# optimize for size - CFLAGS=`echo $CFLAGS | sed -e "s|-Ofast|-Os|"` - CFLAGS=`echo $CFLAGS | sed -e "s|-O.|-Os|"` - -LDFLAGS="$LDFLAGS -fwhole-program" - -cd $BUILD/busybox* - -# Build Busybox for system - make distclean - cp $BUSYBOX_CFG_FILE .config - if [ ! "$CRON_SUPPORT" = "yes" ] ; then - sed -i -e "s|^CONFIG_CROND=.*$|# CONFIG_CROND is not set|" .config - sed -i -e "s|^CONFIG_FEATURE_CROND_D=.*$|# CONFIG_FEATURE_CROND_D is not set|" .config - sed -i -e "s|^CONFIG_CRONTAB=.*$|# CONFIG_CRONTAB is not set|" .config - fi - if [ ! "$NFS_SUPPORT" = yes ]; then - sed -i -e "s|^CONFIG_FEATURE_MOUNT_NFS=.*$|# CONFIG_FEATURE_MOUNT_NFS is not set|" .config - fi - if [ ! "$SAMBA_SUPPORT" = yes ]; then - sed -i -e "s|^CONFIG_FEATURE_MOUNT_CIFS=.*$|# CONFIG_FEATURE_MOUNT_CIFS is not set|" .config - fi - - make oldconfig - - make ARCH=$TARGET_ARCH \ - HOSTCC=$HOST_CC \ - CROSS_COMPILE=$TARGET_PREFIX \ - KBUILD_VERBOSE="1" \ - install diff --git a/packages/sysutils/busybox-hosttools/config/busybox-hosttools.conf b/packages/sysutils/busybox/config/busybox-host.conf similarity index 100% rename from packages/sysutils/busybox-hosttools/config/busybox-hosttools.conf rename to packages/sysutils/busybox/config/busybox-host.conf diff --git a/packages/initramfs/sysutils/busybox-initramfs/config/busybox-initramfs.conf b/packages/sysutils/busybox/config/busybox-init.conf similarity index 100% rename from packages/initramfs/sysutils/busybox-initramfs/config/busybox-initramfs.conf rename to packages/sysutils/busybox/config/busybox-init.conf diff --git a/packages/sysutils/busybox/config/busybox.conf b/packages/sysutils/busybox/config/busybox-target.conf similarity index 100% rename from packages/sysutils/busybox/config/busybox.conf rename to packages/sysutils/busybox/config/busybox-target.conf diff --git a/packages/sysutils/busybox/install b/packages/sysutils/busybox/install deleted file mode 100755 index 7145774f7e..0000000000 --- a/packages/sysutils/busybox/install +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# This Program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This Program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. config/options $1 - -ROOT_PWD="`$ROOT/$TOOLCHAIN/bin/cryptpw -m sha512 $ROOT_PASSWORD`" -USER_PWD="`$ROOT/$TOOLCHAIN/bin/cryptpw -m sha512 $USER_PASSWORD`" - - add_user root "$ROOT_PWD" 0 0 "Root User" "/storage" "/bin/sh" - add_group root 0 - add_group users 100 - - add_user $USER_NAME "$USER_PWD" 1000 1000 "User" "/storage" "/bin/sh" - add_group $USER_GROUP 1000 - - cp -PR $BUILD/busybox*/_install-system/* $INSTALL - echo "chmod 4755 $INSTALL/bin/busybox" >> $FAKEROOT_SCRIPT - - mkdir -p $INSTALL/usr/bin - cp $PKG_DIR/scripts/createlog $INSTALL/usr/bin/ - cp $PKG_DIR/scripts/lsb_release $INSTALL/usr/bin/ - cp $PKG_DIR/scripts/apt-get $INSTALL/usr/bin/ - cp $PKG_DIR/scripts/passwd $INSTALL/usr/bin/ - ln -sf /bin/busybox $INSTALL/usr/bin/env #/usr/bin/env is needed for most python scripts - cp $PKG_DIR/scripts/pastebinit $INSTALL/usr/bin/ - ln -sf pastebinit $INSTALL/usr/bin/paste - - mkdir -p $INSTALL/usr/lib/openelec - cp $PKG_DIR/scripts/fs-resize $INSTALL/usr/lib/openelec - - mkdir -p $INSTALL/etc - cp $PKG_DIR/config/profile $INSTALL/etc - cp $PKG_DIR/config/inputrc $INSTALL/etc - cp $PKG_DIR/config/httpd.conf $INSTALL/etc - cp $PKG_DIR/config/suspend-modules.conf $INSTALL/etc - echo "chmod 000 $INSTALL/etc/shadow" >> $FAKEROOT_SCRIPT - - mkdir -p $INSTALL/usr/config/sysctl.d - cp $PKG_DIR/config/transmission.conf $INSTALL/usr/config/sysctl.d - - # /etc/fstab is needed by... - touch $INSTALL/etc/fstab - - # /etc/machine-id, needed by systemd and dbus - ln -sf /run/machine-id $INSTALL/etc/machine-id - - # /etc/hosts must be writeable - ln -sf /var/cache/hosts $INSTALL/etc/hosts - - # /etc/mtab is needed by udisks etc... - ln -sf /proc/self/mounts $INSTALL/etc/mtab - - # create /etc/hostname - ln -sf /proc/sys/kernel/hostname $INSTALL/etc/hostname - - # systemd wahts /usr/bin/mkdir - mkdir -p $INSTALL/usr/bin - ln -sf /bin/busybox $INSTALL/usr/bin/mkdir - - # add webroot - mkdir -p $INSTALL/usr/www - echo "It works" > $INSTALL/usr/www/index.html - - mkdir -p $INSTALL/usr/www/error - echo "404" > $INSTALL/usr/www/error/404.html - - # cron support - if [ "$CRON_SUPPORT" = "yes" ] ; then - mkdir -p $INSTALL/lib/systemd/system - cp $PKG_DIR/system.d.opt/cron.service $INSTALL/lib/systemd/system - enable_service cron.service - mkdir -p $INSTALL/usr/share/services - cp -P $PKG_DIR/default.d/*.conf $INSTALL/usr/share/services - cp $PKG_DIR/system.d.opt/cron-defaults.service $INSTALL/lib/systemd/system - enable_service cron-defaults.service - fi - - enable_service debug-shell.service - enable_service shell.service - enable_service show-version.service - enable_service var.mount - enable_service var-log-debug.service - enable_service fs-resize.service - diff --git a/packages/sysutils/busybox/meta b/packages/sysutils/busybox/meta deleted file mode 100644 index ccd78e3111..0000000000 --- a/packages/sysutils/busybox/meta +++ /dev/null @@ -1,46 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# This Program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This Program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="busybox" -PKG_VERSION="1.21.1" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.busybox.net" -PKG_URL="http://busybox.net/downloads/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS="hdparm dosfstools e2fsprogs speedcontrol zip pciutils usbutils parted" -PKG_BUILD_DEPENDS="toolchain busybox-hosttools" -PKG_PRIORITY="required" -PKG_SECTION="system" -PKG_SHORTDESC="BusyBox: The Swiss Army Knife of Embedded Linux" -PKG_LONGDESC="BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete environment for any small or embedded system." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" - -# nano text editor - if [ "$NANO_EDITOR" = "yes" ]; then - PKG_DEPENDS="$PKG_DEPENDS nano" - fi - -# nfs support -if [ "$NFS_SUPPORT" = yes ]; then - PKG_DEPENDS="$PKG_DEPENDS rpcbind" -fi diff --git a/packages/sysutils/busybox/package.mk b/packages/sysutils/busybox/package.mk new file mode 100644 index 0000000000..20570653cc --- /dev/null +++ b/packages/sysutils/busybox/package.mk @@ -0,0 +1,249 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="busybox" +PKG_VERSION="1.21.1" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.busybox.net" +PKG_URL="http://busybox.net/downloads/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_HOST="" +PKG_DEPENDS_TARGET="hdparm dosfstools e2fsprogs speedcontrol zip pciutils usbutils parted" +PKG_DEPENDS_INIT="" +PKG_BUILD_DEPENDS_HOST="toolchain" +PKG_BUILD_DEPENDS_TARGET="toolchain busybox:host" +PKG_BUILD_DEPENDS_INIT="toolchain" +PKG_PRIORITY="required" +PKG_SECTION="system" +PKG_SHORTDESC="BusyBox: The Swiss Army Knife of Embedded Linux" +PKG_LONGDESC="BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete environment for any small or embedded system." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +PKG_MAKE_OPTS_HOST="ARCH=$TARGET_ARCH CROSS_COMPILE= KBUILD_VERBOSE=1 install" +PKG_MAKE_OPTS_TARGET="ARCH=$TARGET_ARCH \ + HOSTCC=$HOST_CC \ + CROSS_COMPILE=$TARGET_PREFIX \ + KBUILD_VERBOSE=1 \ + install" +PKG_MAKE_OPTS_INIT="ARCH=$TARGET_ARCH \ + HOSTCC=$HOST_CC \ + CROSS_COMPILE=$TARGET_PREFIX \ + KBUILD_VERBOSE=1 \ + install" + +# nano text editor + if [ "$NANO_EDITOR" = "yes" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET nano" + fi + +# nfs support +if [ "$NFS_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET rpcbind" +fi + +if [ -f $PROJECT_DIR/$PROJECT/busybox/busybox-target.conf ]; then + BUSYBOX_CFG_FILE_TARGET=$PROJECT_DIR/$PROJECT/busybox/busybox-target.conf +else + BUSYBOX_CFG_FILE_TARGET=$PKG_DIR/config/busybox-target.conf +fi + +if [ -f $PROJECT_DIR/$PROJECT/busybox/busybox-init.conf ]; then + BUSYBOX_CFG_FILE_INIT=$PROJECT_DIR/$PROJECT/busybox/busybox-init.conf +else + BUSYBOX_CFG_FILE_INIT=$PKG_DIR/config/busybox-init.conf +fi + +pre_build_target() { + mkdir -p $PKG_BUILD/.$TARGET_NAME + cp -RP $PKG_BUILD/* $PKG_BUILD/.$TARGET_NAME +} + +pre_build_host() { + mkdir -p $PKG_BUILD/.$HOST_NAME + cp -RP $PKG_BUILD/* $PKG_BUILD/.$HOST_NAME +} + +pre_build_init() { + mkdir -p $PKG_BUILD/.$TARGET_NAME-init + cp -RP $PKG_BUILD/* $PKG_BUILD/.$TARGET_NAME-init +} + +configure_host() { + cd $ROOT/$PKG_BUILD/.$HOST_NAME + cp $PKG_DIR/config/busybox-host.conf .config + + # set install dir + sed -i -e "s|^CONFIG_PREFIX=.*$|CONFIG_PREFIX=\"$ROOT/$PKG_BUILD/.install_host\"|" .config + + make oldconfig +} + +configure_target() { + cd $ROOT/$PKG_BUILD/.$TARGET_NAME + cp $BUSYBOX_CFG_FILE_TARGET .config + + # set install dir + sed -i -e "s|^CONFIG_PREFIX=.*$|CONFIG_PREFIX=\"$INSTALL\"|" .config + + if [ ! "$CRON_SUPPORT" = "yes" ] ; then + sed -i -e "s|^CONFIG_CROND=.*$|# CONFIG_CROND is not set|" .config + sed -i -e "s|^CONFIG_FEATURE_CROND_D=.*$|# CONFIG_FEATURE_CROND_D is not set|" .config + sed -i -e "s|^CONFIG_CRONTAB=.*$|# CONFIG_CRONTAB is not set|" .config + fi + + if [ ! "$NFS_SUPPORT" = yes ]; then + sed -i -e "s|^CONFIG_FEATURE_MOUNT_NFS=.*$|# CONFIG_FEATURE_MOUNT_NFS is not set|" .config + fi + + if [ ! "$SAMBA_SUPPORT" = yes ]; then + sed -i -e "s|^CONFIG_FEATURE_MOUNT_CIFS=.*$|# CONFIG_FEATURE_MOUNT_CIFS is not set|" .config + fi + + # optimize for size + CFLAGS=`echo $CFLAGS | sed -e "s|-Ofast|-Os|"` + CFLAGS=`echo $CFLAGS | sed -e "s|-O.|-Os|"` + + LDFLAGS="$LDFLAGS -fwhole-program" + + make oldconfig +} + +configure_init() { + cd $ROOT/$PKG_BUILD/.$TARGET_NAME-init + cp $BUSYBOX_CFG_FILE_INIT .config + + # set install dir + sed -i -e "s|^CONFIG_PREFIX=.*$|CONFIG_PREFIX=\"$INSTALL\"|" .config + + # optimize for size + CFLAGS=`echo $CFLAGS | sed -e "s|-Ofast|-Os|"` + CFLAGS=`echo $CFLAGS | sed -e "s|-O.|-Os|"` + + LDFLAGS="$LDFLAGS -fwhole-program" + + make oldconfig +} + +makeinstall_host() { + mkdir -p $ROOT/$TOOLCHAIN/bin + cp -R $ROOT/$PKG_BUILD/.install_host/bin/* $ROOT/$TOOLCHAIN/bin +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/bin + cp $PKG_DIR/scripts/createlog $INSTALL/usr/bin/ + cp $PKG_DIR/scripts/lsb_release $INSTALL/usr/bin/ + cp $PKG_DIR/scripts/apt-get $INSTALL/usr/bin/ + cp $PKG_DIR/scripts/passwd $INSTALL/usr/bin/ + ln -sf /bin/busybox $INSTALL/usr/bin/env #/usr/bin/env is needed for most python scripts + cp $PKG_DIR/scripts/pastebinit $INSTALL/usr/bin/ + ln -sf pastebinit $INSTALL/usr/bin/paste + + mkdir -p $INSTALL/usr/lib/openelec + cp $PKG_DIR/scripts/fs-resize $INSTALL/usr/lib/openelec + + mkdir -p $INSTALL/etc + cp $PKG_DIR/config/profile $INSTALL/etc + cp $PKG_DIR/config/inputrc $INSTALL/etc + cp $PKG_DIR/config/httpd.conf $INSTALL/etc + cp $PKG_DIR/config/suspend-modules.conf $INSTALL/etc + + mkdir -p $INSTALL/usr/config/sysctl.d + cp $PKG_DIR/config/transmission.conf $INSTALL/usr/config/sysctl.d + + # /etc/fstab is needed by... + touch $INSTALL/etc/fstab + + # /etc/machine-id, needed by systemd and dbus + ln -sf /run/machine-id $INSTALL/etc/machine-id + + # /etc/hosts must be writeable + ln -sf /var/cache/hosts $INSTALL/etc/hosts + + # /etc/mtab is needed by udisks etc... + ln -sf /proc/self/mounts $INSTALL/etc/mtab + + # create /etc/hostname + ln -sf /proc/sys/kernel/hostname $INSTALL/etc/hostname + + # systemd wants /usr/bin/mkdir + mkdir -p $INSTALL/usr/bin + ln -sf /bin/busybox $INSTALL/usr/bin/mkdir + + # add webroot + mkdir -p $INSTALL/usr/www + echo "It works" > $INSTALL/usr/www/index.html + + mkdir -p $INSTALL/usr/www/error + echo "404" > $INSTALL/usr/www/error/404.html +} + +post_install() { + ROOT_PWD="`$ROOT/$TOOLCHAIN/bin/cryptpw -m sha512 $ROOT_PASSWORD`" + USER_PWD="`$ROOT/$TOOLCHAIN/bin/cryptpw -m sha512 $USER_PASSWORD`" + + echo "chmod 4755 $INSTALL/bin/busybox" >> $FAKEROOT_SCRIPT + echo "chmod 000 $INSTALL/etc/shadow" >> $FAKEROOT_SCRIPT + + add_user root "$ROOT_PWD" 0 0 "Root User" "/storage" "/bin/sh" + add_group root 0 + add_group users 100 + + add_user $USER_NAME "$USER_PWD" 1000 1000 "User" "/storage" "/bin/sh" + add_group $USER_GROUP 1000 + + enable_service debug-shell.service + enable_service shell.service + enable_service show-version.service + enable_service var.mount + enable_service var-log-debug.service + enable_service fs-resize.service + + # cron support + if [ "$CRON_SUPPORT" = "yes" ] ; then + mkdir -p $INSTALL/lib/systemd/system + cp $PKG_DIR/system.d.opt/cron.service $INSTALL/lib/systemd/system + enable_service cron.service + mkdir -p $INSTALL/usr/share/services + cp -P $PKG_DIR/default.d/*.conf $INSTALL/usr/share/services + cp $PKG_DIR/system.d.opt/cron-defaults.service $INSTALL/lib/systemd/system + enable_service cron-defaults.service + fi +} + +makeinstall_init() { + mkdir -p $INSTALL/bin + ln -sf busybox $INSTALL/bin/sh + chmod 4755 $INSTALL/bin/busybox + + mkdir -p $INSTALL/etc + touch $INSTALL/etc/fstab + ln -sf /proc/self/mounts $INSTALL/etc/mtab + + if [ -f $PROJECT_DIR/$PROJECT/initramfs/initramfs.conf ]; then + cp $PROJECT_DIR/$PROJECT/initramfs/initramfs.conf $INSTALL/etc + fi + + cp $PKG_DIR/scripts/init $INSTALL + chmod 755 $INSTALL/init +} diff --git a/packages/initramfs/sysutils/busybox-initramfs/scripts/init b/packages/sysutils/busybox/scripts/init similarity index 98% rename from packages/initramfs/sysutils/busybox-initramfs/scripts/init rename to packages/sysutils/busybox/scripts/init index 7df6cc475a..4a18da6152 100755 --- a/packages/initramfs/sysutils/busybox-initramfs/scripts/init +++ b/packages/sysutils/busybox/scripts/init @@ -22,6 +22,14 @@ # http://www.gnu.org/copyleft/gpl.html ################################################################################ + # create directories + /bin/busybox mkdir -p /dev + /bin/busybox mkdir -p /proc + /bin/busybox mkdir -p /sys + /bin/busybox mkdir -p /flash + /bin/busybox mkdir -p /sysroot + /bin/busybox mkdir -p /storage + # mount all needed special filesystems /bin/busybox mount -t devtmpfs devtmpfs /dev /bin/busybox mount -t proc proc /proc