#!/bin/bash ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..) . ${ROOT_DIR}/config/paths.conf mkdir -p ${ROOT_DIR}/build/sqfs-base cd ${ROOT_DIR}/build/sqfs-base [ ! -f ${BUILDROOT_OUT_PATH}/rootfs.tar ] && \ echo "ERROR: rootfs.tar not found in BUILDROOT_OUT_PATH (${BUILDROOT_OUT_PATH})." && \ echo " check if buildroot run successful and if path in config/paths.conf is correct." && \ exit 1 if [ ! -f .osib_unpacked ]; then tar xf ${BUILDROOT_OUT_PATH}/rootfs.tar touch .osib_unpacked fi rm -f run var/cache var/log var/lock var/pcmcia var/run var/spool var/tmp mkdir -p run var/log/journal tar xzf ${ROOT_DIR}/share/files/dev.tgz if [ ! -f .osib_moved_libs ]; then for f in $(find {lib,usr/lib} |grep "\.so\(\..*\|$\)"); do targetdir=$(dirname $f) if [ ! -d openslx/$targetdir ]; then #echo "creating openslx/$targetdir" mkdir -p openslx/$targetdir fi mv $f openslx/$f done touch .osib_moved_libs fi if [ ! -f .osib_create_ld_links ]; then echo "create ld-*.so links from /lib" for f in $(ls -1 openslx/lib/ld*); do ln -sf "../$f" "lib/$(basename $f)" done touch .osib_create_ld_links fi if [ ! -f .osib_moved_bins ]; then for d in $(find {bin,sbin,usr/bin,usr/sbin,usr/local/bin,usr/local/sbin} -type d); do #echo $d mkdir -p "openslx/$d" mv $d/* openslx/$d/ done touch .osib_moved_bins fi ln -sf /usr/lib/systemd/systemd init if [ ! -f .osib_patched ]; then for p in $(ls -1 ${ROOT_DIR}/share/patches/* | sort); do patch -p1 < $p done touch .osib_patched fi cp ${ROOT_DIR}/share/files/*.service etc/systemd/system/ ln -sf ../debug-shell.service etc/systemd/system/sysinit.target.wants/ ln -sf /usr/lib/systemd/system/getty\@.service etc/systemd/system/getty.target.wants/getty\@tty2.service ln -sf /usr/lib/systemd/system/getty\@.service etc/systemd/system/getty.target.wants/getty\@tty3.service ln -sf /usr/lib/systemd/system/getty\@.service etc/systemd/system/getty.target.wants/getty\@tty4.service ln -sf /usr/lib/systemd/system/getty\@.service etc/systemd/system/getty.target.wants/getty\@tty5.service ln -sf /usr/lib/systemd/system/getty\@.service etc/systemd/system/getty.target.wants/getty\@tty6.service ln -sf /openslx/bin/login bin/login ln -sf /openslx/bin/sh bin/sh ln -sf /openslx/bin/hostname bin/hostname cp ${ROOT_DIR}/share/files/profile etc cp ${ROOT_DIR}/share/files/helper helper chmod +x helper sed -i -e "s,81:81,102:105," etc/passwd sed -i -e "s,81,105," etc/group