install_dependencies() { apt-get install -y $DEPS } fetch_source() { : } build() { BUILDDIR=${TOOL_DIR}/${TOOL}/build mkdir -p ${BUILDDIR} FILELIST="list_binaries_and_files" [ -e ${FILELIST} ] && rm ${FILELIST} for BIN in ${REQUIRED_BINARIES} do BIN_LOCATION=$(which ${BIN}) if [ ! -z ${BIN_LOCATION} -a -e ${BIN_LOCATION} ]; then pdebug "Processing $BIN at $BIN_LOCATION ..." echo ${BIN_LOCATION} >> "${FILELIST}" [ -L "${BIN_LOCATION}" ] \ && pdebug "${BIN_LOCATION} is a symbolic link, copying $(readlink -f "${BIN_LOCATION}")" \ && echo $(readlink -f "${BIN_LOCATION}") >> "${FILELIST}" else perror "${BIN} not found on the system! Please install it." fi done for LIB in ${REQUIRED_LIBRARIES} do for LIB_LOCATION in $(locate ${LIB} | grep ^/lib/) do echo ${LIB_LOCATION} >> "${FILELIST}" done done for FILE in ${REQUIRED_DIRECTORIES} do [ ! -d ${FILE} ] && perror "Missing required directory $FILE" echo ${FILE} >> "${FILELIST}" done for FILE in ${REQUIRED_FILES} do [ ! -f ${FILE} ] && perror "Missing required file $FILE" echo ${FILE} >> "${FILELIST}" done local NUMFILES=$(cat "${FILELIST}" | wc -l) if [ "x$NUMFILES" != "x" -a "x$NUMFILES" != "x0" ]; then pinfo "File list generated at ${BUILDDIR}/${FILELIST} ($NUMFILES entries)" tar -cp $(cat "${FILELIST}") | tar -xp -C "${BUILDDIR}" local RET=$? [ $RET -ne 0 ] && perror "tar-copy from '$FILELIST' to '$BUILDDIR' failed." fi } post_copy() { # make basic directory structure mkdir -p "${INIT_DIR}"/{bin,dev,proc,lib,etc,mnt,sys,var/run,var/lock,var/log,run/lock,run/shm,openslx/mnt} # copy devices from running system cp -a /dev/{console,kmsg,mem,null,shm,tty,tty0,tty1,tty9,fb0,urandom,zero} \ "${INIT_DIR}"/dev # set /etc/environment to include /openslx/bin and /openslx/sbin echo "PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/openslx/sbin:/openslx/bin\"" \ > "${INIT_DIR}/etc/environment" # copy static files cp -r "${TOOL_DIR}/${TOOL}/data/*" "${INIT_DIR}" # better: dirname $(ldd $SHELL|grep libc | awk -F " " '{print $3}') # copy pam modules, TODO: better way to find arch-dependant interfix... tarcopy "$(dirname $(locate pam_unix.so | grep ^/lib/))" "${INIT_DIR}" # quick fix for /etc/fstab echo "# no configuration" >> "${INIT_DIR}/etc/fstab" # link /etc/mtab, needed for systemd [ ! -e ${INIT_DIR}/etc/mtab ] && ln -s /proc/self/mounts ${INIT_DIR}/etc/mtab # passwd, group, shadow init_users_and_groups # quick fix for missing group in /etc/group add_group "lock" # setup root accoun USER=root PASSWORD='!r00t' add_user [ ! -d ${INIT_DIR}/root ] && mkdir ${INIT_DIR}/root echo "minilinux-$(hostname)" > "${INIT_DIR}/etc/hostname" # copy kernel modules #[ ! -d ${INIT_DIR}/lib/modules/$(uname -r) ] && mkdir -p ${INIT_DIR}/lib/modules/$(uname -r) #cp -r /lib/modules/$(uname -r) ${INIT_DIR}/lib/modules/$(uname -r) #quick fix xterm symlink [ -e /usr/lib/libXaw7.so.7.0.0 ] && \ ln -s "/usr/lib/libXaw7.so.7.0.0" "${INIT_DIR}/usr/lib/libXaw7.so.7" }