Files
Arch-R/packages/sysutils/busybox/install
2013-09-15 21:54:16 +03:00

104 lines
3.7 KiB
Bash
Executable File

#!/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