diff options
| -rwxr-xr-x | data/stage3.1/init | 3 | ||||
| -rw-r--r-- | data/stage3.1/lib/modules/aufs.ko | bin | 0 -> 218552 bytes | |||
| -rw-r--r-- | data/stage3.1/lib/modules/squashfs.ko | bin | 0 -> 43108 bytes | |||
| -rwxr-xr-x | remote/setup-tools.sh | 81 | ||||
| -rw-r--r-- | remote/tools/base/base.build | 60 | ||||
| -rw-r--r-- | remote/tools/base/data/profile | 11 | ||||
| -rw-r--r-- | remote/tools/busybox/busybox.build | 2 | ||||
| -rw-r--r-- | remote/tools/plymouth/plymouth.build | 4 | ||||
| -rw-r--r-- | remote/tools/systemd/data/debug-shell.service | 4 | ||||
| -rwxr-xr-x | server/build_core | 2 |
10 files changed, 88 insertions, 79 deletions
diff --git a/data/stage3.1/init b/data/stage3.1/init index 33d5b7b3..b88a3b07 100755 --- a/data/stage3.1/init +++ b/data/stage3.1/init @@ -22,6 +22,9 @@ mount -n -t tmpfs -o 'mode=755' run "/run" #modprobe -a squashfs aufs 2>/dev/null +insmod /lib/modules/aufs.ko +insmod /lib/moudles/squashfs.ko + mkdir -p /dev/shm/union /dev/shm/uniontmp /rorootfs mount -n /mnt/openslx.sqfs /rorootfs diff --git a/data/stage3.1/lib/modules/aufs.ko b/data/stage3.1/lib/modules/aufs.ko Binary files differnew file mode 100644 index 00000000..eb364a10 --- /dev/null +++ b/data/stage3.1/lib/modules/aufs.ko diff --git a/data/stage3.1/lib/modules/squashfs.ko b/data/stage3.1/lib/modules/squashfs.ko Binary files differnew file mode 100644 index 00000000..2a861c78 --- /dev/null +++ b/data/stage3.1/lib/modules/squashfs.ko diff --git a/remote/setup-tools.sh b/remote/setup-tools.sh index 54c4a69f..3139b7bb 100755 --- a/remote/setup-tools.sh +++ b/remote/setup-tools.sh @@ -5,7 +5,7 @@ SELF=$(readlink -f $0) print_usage() { echo "create tools for minilinux" - echo "Usage: $(basename $SELF) TOOL" + echo "Usage: $(basename ${SELF}) TOOL" } if [ "x$1" = "x" ]; then @@ -17,73 +17,72 @@ elif [ "x$(whoami)" != "xroot" ]; then fi #Create tools directory if not exists -TOOL_DIR=$ROOT_DIR/tools -INIT_DIR=$ROOT_DIR/stage3.2 +TOOL_DIR=${ROOT_DIR}/tools +INIT_DIR=${ROOT_DIR}/stage3.2 setup_git () { - if [ ! -z "$GIT" ]; then + if [ ! -z "${GIT}" ]; then GIT_BIN=$(which git) - [ -z "$GIT_BIN" ] && echo "Installing git..." && apt-get install git + [ -z "${GIT_BIN}" ] && echo "Installing git..." && apt-get install git fi } read_config () { - TOOL_CONFIG=$TOOL_DIR/$TOOL/$TOOL.conf + TOOL_CONFIG=${TOOL_DIR}/${TOOL}/${TOOL}.conf - if [ ! -e $TOOL_CONFIG ]; then + if [ ! -e ${TOOL_CONFIG} ]; then echo "ERROR: Config for specified tool not found." exit 1 fi - . $TOOL_CONFIG + . ${TOOL_CONFIG} } read_build () { - BUILD_SCRIPT=$TOOL_DIR/$TOOL/$TOOL.build + BUILD_SCRIPT=${TOOL_DIR}/${TOOL}/${TOOL}.build - if [ ! -e $BUILD_SCRIPT ]; then + if [ ! -e ${BUILD_SCRIPT} ]; then echo "ERROR: Build script for specified tool not found." exit 1 fi - . $BUILD_SCRIPT + . ${BUILD_SCRIPT} } copyfileswithdependencies () { - [ ! -d build ] && echo "No build directory for $TOOL found." && return + [ ! -d build ] && echo "No build directory for ${TOOL} found." && return cd build COPYFILES_LIST="list_wanted_stage3.2" - [ -e $COPYFILES_LIST ] && rm $COPYFILES_LIST + [ -e ${COPYFILES_LIST} ] && rm ${COPYFILES_LIST} - for FILENAME in $REQUIRED_BINARIES + for FILENAME in ${REQUIRED_BINARIES} do - for f in $(find . -name $FILENAME -type f -executable) + for f in $(find . -name ${FILENAME} -type f -executable) do [ $(file $f |grep -c ELF) -eq 1 ] && FILE=$f done - echo "Found $FILENAME at $FILE. Searching libraries..." - echo $FILE >> $COPYFILES_LIST + echo "Found ${FILENAME} at ${FILE}. Searching libraries..." + echo ${FILE} >> ${COPYFILES_LIST} # fetch dependencies # quick fix to exclude libc*, else it copies unneeded libs... - for i in $(ldd $FILE |awk '{print $1 $2 $3}'|grep -v ld-linux|grep -v libc.so*|grep -v linux-gate) + for i in $(ldd ${FILE} |awk '{print $1 $2 $3}'|grep -v ld-linux|grep -v libc.so*|grep -v linux-gate) do arrIN=(${i//=>/ }) echo "--------------------------------------------------------" echo "Searching ${arrIN[0]} under $(pwd)..." LOCAL_MATCHES=$(find . -name $(echo ${arrIN[0]}|awk -F "." '{print $1}').*) - if [ "x$LOCAL_MATCHES" != "x" ]; + if [ "x${LOCAL_MATCHES}" != "x" ]; then - for llib in $LOCAL_MATCHES; + for llib in ${LOCAL_MATCHES}; do - echo "Copying $llib" - echo $llib >> $COPYFILES_LIST - #[ -L $llib ] && echo $(readlink -f $llib) >> $COPYFILES_LIST + echo "Copying ${llib}" + echo ${llib} >> ${COPYFILES_LIST} done else echo "Did not found ${arrIN[0]} in $(pwd)" @@ -91,31 +90,31 @@ copyfileswithdependencies () then echo -n "Trying ${arrIN[1]} ..." echo " found! Copying." - echo ${arrIN[1]} >> $COPYFILES_LIST - [ -L ${arrIN[1]} ] && echo $(readlink -f ${arrIN[1]}) >> $COPYFILES_LIST + echo ${arrIN[1]} >> ${COPYFILES_LIST} + [ -L ${arrIN[1]} ] && echo $(readlink -f ${arrIN[1]}) >> ${COPYFILES_LIST} fi fi done - echo "Copied $FILENAME." + echo "Copied ${FILENAME}." echo "-----------------------------------------------------------------" done - for LIB in $REQUIRED_LIBRARIES + for LIB in ${REQUIRED_LIBRARIES} do - for LOCATION in $(find . -name $LIB*) + for LOCATION in $(find . -name ${LIB}*) do - echo $LOCATION >> $COPYFILES_LIST + echo ${LOCATION} >> ${COPYFILES_LIST} done done echo "Copying required directories and files from config file..." - for ENTRY in $REQUIRED_DIRECTORIES $REQUIRED_FILES + for ENTRY in ${REQUIRED_DIRECTORIES} ${REQUIRED_FILES} do - echo ".$ENTRY" >> $COPYFILES_LIST + echo ".${ENTRY}" >> ${COPYFILES_LIST} done #copy to initramfsdir - tar -cpv $(cat $COPYFILES_LIST|sort -u) | tar -xpv -C $INIT_DIR &>/dev/null + tar -cpv $(cat ${COPYFILES_LIST}|sort -u) | tar -xpv -C ${INIT_DIR} &>/dev/null unset REQUIRED_BINARIES unset REQUIRED_LIBRARIES unset REQUIRED_DIRECTORIES @@ -124,32 +123,32 @@ copyfileswithdependencies () get_basic_libs () { - [ ! -d $INIT_DIR ] && mkdir $INIT_DIR + [ ! -d ${INIT_DIR} ] && mkdir ${INIT_DIR} # copy libc and ld-linux separatly - echo "Looking for libc and ld-linux used for $SHELL..." + echo "Looking for libc and ld-linux used for ${SHELL}..." BASICLIBS="" - for i in $(ldd $SHELL) + for i in $(ldd ${SHELL}) do if [ $(echo $i | grep '^/' | grep -c ld) -eq 1 -o $(echo $i | grep '^/' | grep -c libc.so) -eq 1 ]; then echo "Found basic lib at: $i" - BASICLIBS="$BASICLIBS $i $(readlink -f "$i")" + BASICLIBS="${BASICLIBS} $i $(readlink -f "$i")" fi done - tar -cpv $BASICLIBS | tar -xpv -C $INIT_DIR &>/dev/null + tar -cpv ${BASICLIBS} | tar -xpv -C ${INIT_DIR} &>/dev/null echo "Basic libs copied." } main () { get_basic_libs - cd $TOOL_DIR + cd ${TOOL_DIR} while (( "$#" )); do TOOL=$1 - if [ -d $TOOL ]; + if [ -d ${TOOL} ]; then - cd $TOOL + cd ${TOOL} read_config read_build setup_git @@ -158,7 +157,7 @@ main () { build copyfileswithdependencies post_copy - cd $TOOL_DIR + cd ${TOOL_DIR} else echo "Tool directory not found." fi diff --git a/remote/tools/base/base.build b/remote/tools/base/base.build index 5b1d395b..fb7b7294 100644 --- a/remote/tools/base/base.build +++ b/remote/tools/base/base.build @@ -8,68 +8,72 @@ fetch_source() { build() { - BUILDDIR=$TOOL_DIR/$TOOL/build - [ ! -d $BUILDDIR ] && mkdir -p $BUILDDIR + BUILDDIR=${TOOL_DIR}/${TOOL}/build + [ ! -d ${BUILDDIR} ] && mkdir -p ${BUILDDIR} FILELIST="list_binaries_and_files" - [ -e $FILELIST ] && rm $FILELIST + [ -e ${FILELIST} ] && rm ${FILELIST} - for BIN in $REQUIRED_BINARIES + for BIN in ${REQUIRED_BINARIES} do - echo $(which $BIN) >> $FILELIST + echo $(which ${BIN}) >> ${FILELIST} done - for LIB in $REQUIRED_LIBRARIES + for LIB in ${REQUIRED_LIBRARIES} do - for LIB_LOCATION in $(locate $LIB|grep ^/lib/) + for LIB_LOCATION in $(locate ${LIB}|grep ^/lib/) do - echo $LIB_LOCATION >> $FILELIST + echo ${LIB_LOCATION} >> ${FILELIST} done done - for FILE in $REQUIRED_DIRECTORIES + for FILE in ${REQUIRED_DIRECTORIES} do - [ ! -f $FILE ] && echo $FILE >> $FILELIST + [ ! -f ${FILE} ] && echo ${FILE} >> ${FILELIST} done - for FILE in $REQUIRED_FILES + for FILE in ${REQUIRED_FILES} do - [ ! -d $FILE ] && echo $FILE >> $FILELIST + [ ! -d ${FILE} ] && echo ${FILE} >> ${FILELIST} done - # copy needed files from libc6 - #for FILE in $(dpkg -L libc6|grep -v share/man) - #do - # [ ! -d $FILE ] && echo $FILE >> $FILELIST - #done - - tar -cpv $(cat $FILELIST) | tar -xpv -C $BUILDDIR &>/dev/null + tar -cpv $(cat ${FILELIST}) | tar -xpv -C ${BUILDDIR} &>/dev/null } 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} + mkdir -p ${INIT_DIR}/{bin,dev,proc,lib,etc,mnt,sys,var/run,var/lock,var/log,run/lock,run/shm} # copy devices from running system cp -a /dev/{console,kmsg,mem,null,shm,tty,tty0,tty1,tty9,fb0,urandom,zero} \ - $INIT_DIR/dev + ${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 + > ${INIT_DIR}/etc/environment + + # copy static bash profile + cp ${TOOL_DIR}/${TOOL}/data/profile ${INIT_DIR}/etc # copy pam modules, TODO: better way to find arch-dependant interfix... - tar -cpv $(dirname $(locate pam_unix.so|grep ^/lib/)) | tar -xpv -C $INIT_DIR &>/dev/null + tar -cpv $(dirname $(locate pam_unix.so|grep ^/lib/)) | tar -xpv -C ${INIT_DIR} &>/dev/null # quick fix for /etc/fstab - echo "# no configuration" >> $INIT_DIR/etc/fstab + echo "# no configuration" >> ${INIT_DIR}/etc/fstab # link /etc/mtab, needed for systemd - ln -s /proc/self/mounts $INIT_DIR/etc/mtab + ln -s /proc/self/mounts ${INIT_DIR}/etc/mtab # quick fix for missing group in /etc/group - echo "lock:x:128:" >> $INIT_DIR/etc/group + echo "lock:x:128:" >> ${INIT_DIR}/etc/group + + # setup root account + sed -i "s/root:.*/root:\$6\$QGcBjw6e\$sJvGXBfKuNd4Cx5\.aVxJT7PCq\/AWrP\/JLgvDHBGN164Rp2HRIENPQzieO\/2ctlQS7yRgWwaWTqJkZr7Uq37af1:15657:0:99999:7:::/g" ${INIT_DIR}/etc/shadow + [ ! -d ${INIT_DIR}/root ] && mkdir ${INIT_DIR}/root + + echo "minibox" > ${INIT_DIR}/etc/hostname - # set root password - sed -i "s/root:.*/root:\$6\$QGcBjw6e\$sJvGXBfKuNd4Cx5\.aVxJT7PCq\/AWrP\/JLgvDHBGN164Rp2HRIENPQzieO\/2ctlQS7yRgWwaWTqJkZr7Uq37af1:15657:0:99999:7:::/g" $INIT_DIR/etc/shadow + # 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) } diff --git a/remote/tools/base/data/profile b/remote/tools/base/data/profile index 06bad7b5..12e75661 100644 --- a/remote/tools/base/data/profile +++ b/remote/tools/base/data/profile @@ -5,17 +5,18 @@ export PATH=\ /sbin:\ /usr/bin:\ /usr/sbin:\ -/usr/local/bin:\ /openslx/bin:\ -/openslx/sbin: +/openslx/sbin:\ +/openslx/usr/bin:\ +/openslx/usr/sbin # If running interactively, then: if [ "$PS1" ]; then if [ "$BASH" ]; then export PS1="[\u@\h \W]\\$ " - alias ll='/bin/ls --color=tty -laFh' - alias ls='/bin/ls --color=tty -F' + alias ll='ls -laFh' + alias ls='ls -F' export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:'; else if [ "`id -u`" -eq 0 ]; then @@ -27,7 +28,7 @@ if [ "$PS1" ]; then export USER=`id -un` export LOGNAME=$USER - export HOSTNAME=`/bin/hostname` + export HOSTNAME=`hostname` export HISTSIZE=1000 export HISTFILESIZE=1000 export PAGER='/bin/more ' diff --git a/remote/tools/busybox/busybox.build b/remote/tools/busybox/busybox.build index 7f6fe850..0194bab7 100644 --- a/remote/tools/busybox/busybox.build +++ b/remote/tools/busybox/busybox.build @@ -9,7 +9,7 @@ fetch_source() { [ ! -d src ] && mkdir src if [ ! -e .fetched_source ]; then - git clone $GIT src + git clone ${GIT} src touch .fetched_source fi } diff --git a/remote/tools/plymouth/plymouth.build b/remote/tools/plymouth/plymouth.build index 9f89f3bd..08647498 100644 --- a/remote/tools/plymouth/plymouth.build +++ b/remote/tools/plymouth/plymouth.build @@ -1,6 +1,8 @@ #!/bin/bash install_dependencies() { + + # TODO dev libs check (no gtk) apt-get install --yes $DEPS } @@ -22,7 +24,7 @@ build() { BUILDDIR=$TOOL_DIR/$TOOL/build cd src/$VERSION - ./configure --enable-systemd-integration + ./configure --enable-systemd-integration --disable-gtk make [ ! -d $BUILDDIR ] && mkdir -p $BUILDDIR DESTDIR=$BUILDDIR make install diff --git a/remote/tools/systemd/data/debug-shell.service b/remote/tools/systemd/data/debug-shell.service index 1270c099..063d4995 100644 --- a/remote/tools/systemd/data/debug-shell.service +++ b/remote/tools/systemd/data/debug-shell.service @@ -13,8 +13,8 @@ IgnoreOnIsolate=yes [Service] Environment=TERM=linux -EnvironmentPath=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/openslx/sbin:/openslx/bin -ExecStart=/bin/sh +EnvironmentPath=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/openslx/sbin:/openslx/bin:/openslx/usr/sbin:/openslx/usr/bin +ExecStart=/openslx/bin/ash Restart=always RestartSec=0 StandardInput=tty diff --git a/server/build_core b/server/build_core index 16afa396..d0441c69 100755 --- a/server/build_core +++ b/server/build_core @@ -81,7 +81,7 @@ tar cpv $BASICLIBS | tar xpv -C ${STAGE31_DIR} &>/dev/null [ ! -d ${STAGE32_DIR} ] && echo "No stage3.2 directory found. Please run setup_tools first." && exit 1 [ -e ${STAGE31_DIR}/mnt/openslx.sqfs ] && rm ${STAGE31_DIR}/mnt/openslx.sqfs -mksquashfs ${STAGE32_DIR} ${STAGE31_DIR}/mnt/openslx.sqfs -comp xz -b 1M -no-progress -no-recovery 2>/dev/null +mksquashfs ${STAGE32_DIR} ${STAGE31_DIR}/mnt/openslx.sqfs -comp xz -b 1M -no-recovery 2>/dev/null cd ${STAGE31_DIR} find . | cpio --format="newc" --create | gzip -9 > ${ROOT_DIR}/initramfs |
