summaryrefslogtreecommitdiffstats
path: root/tasks
diff options
context:
space:
mode:
authorSebastian2010-04-09 23:56:28 +0200
committerSebastian2010-04-09 23:56:28 +0200
commitbbf39bd59f31084d499c2cdd064274093b39dad8 (patch)
tree6715dffc0fc60fec9df5efdbe6a127faf454881b /tasks
parentadded caching (diff)
downloadbroot-bbf39bd59f31084d499c2cdd064274093b39dad8.tar.gz
broot-bbf39bd59f31084d499c2cdd064274093b39dad8.tar.xz
broot-bbf39bd59f31084d499c2cdd064274093b39dad8.zip
added dependency based system to run defined tasks
Diffstat (limited to 'tasks')
-rw-r--r--tasks/bootstrap.task.sh47
-rw-r--r--tasks/bootstrap_precheck.task.sh10
-rw-r--r--tasks/build_busybox.task.sh7
-rw-r--r--tasks/buildtools.task.sh17
-rw-r--r--tasks/cleanup.task.sh6
-rw-r--r--tasks/locales.task.sh11
-rw-r--r--tasks/update.task.sh10
-rw-r--r--tasks/update_chrootscripts.task.sh7
8 files changed, 115 insertions, 0 deletions
diff --git a/tasks/bootstrap.task.sh b/tasks/bootstrap.task.sh
new file mode 100644
index 0000000..2f0624b
--- /dev/null
+++ b/tasks/bootstrap.task.sh
@@ -0,0 +1,47 @@
+bootstrap_append="update update_chrootscripts locales"
+bootstrap_runtime_dependencies="bootstrap_precheck"
+
+bootstrap () {
+
+ local ME=bootstrap
+
+ [ ! -d $BROOT_BUILDROOT_PATH ] && mkdir -p $BROOT_BUILDROOT_PATH
+
+ echo " broot is going to run debootsrap now: ~-_"
+ echo " depending on your machine/connection this can _-~ "
+ echo " take up to 20min.. time enough for a coffee ;) c|_| "
+ echo " press Strg-c to abbort"
+ echo -n " Starting debootsrap in .. "
+ echo -en "${R}3${NONE} " && sleep 1 && \
+ echo -en "${R}2${NONE} " && sleep 1 && \
+ echo -en "${R}1${NONE} " && sleep 1 && \
+ echo ".. go "
+
+ export DEBOOTSTRAP_DIR="$BROOT_BASE_DIR/contrib/debootstrap"
+
+ # create directory for scripts to be run inside the buildroot
+ mkdir -p "$BROOT_BUILDROOT_PATH/root/bin"
+
+ # create bindmount outside to apt cache outside chroot
+ mkdir -p "/tmp/deb/partial"
+ mkdir -p "$BROOT_BUILDROOT_PATH/var/cache/apt/archives"
+ mount -o bind "/tmp/deb" "$BROOT_BUILDROOT_PATH/var/cache/apt/archives"
+
+ # run bootstrap itself
+ echo -n " debootstrap running: "
+ $DEBOOTSTRAP_DIR/debootstrap --arch="i386" squeeze $BROOT_BUILDROOT_PATH http://ftp.de.debian.org/debian | tee $BROOT_LOG.$ME - | awk '{printf "."}'
+ lastline=$(tail -n 1 $BROOT_LOG.$ME)
+ echo "done"
+ echo " debootstrap finished with: $lastline"
+
+ # write bootstrap lock
+ touch $BROOT_BUILDROOT_PATH/bootstraped
+
+ # add non-free to apt sources
+ sed -i -e "s,main,main non-free," $BROOT_BUILDROOT_PATH/etc/apt/sources.list
+
+ echo " update package list"
+ # update package list
+ chroot-exec aptitude update >> $BROOT_LOG.$ME
+ echo " finished all for bootstrap"
+}
diff --git a/tasks/bootstrap_precheck.task.sh b/tasks/bootstrap_precheck.task.sh
new file mode 100644
index 0000000..f2ab6dd
--- /dev/null
+++ b/tasks/bootstrap_precheck.task.sh
@@ -0,0 +1,10 @@
+bootstrap_precheck () {
+
+ local ME=bootstrap_precheck
+
+ if [ -f $BROOT_BUILDROOT_PATH/bootstraped ]; then
+ tasks=${tmp_tasks#bootstrap}
+ echo "tasks=(update $tasks)" > /tmp/.broot.tasks.replace
+ echo " System already bootstraped, run update instead"
+ fi
+}
diff --git a/tasks/build_busybox.task.sh b/tasks/build_busybox.task.sh
new file mode 100644
index 0000000..eaf373e
--- /dev/null
+++ b/tasks/build_busybox.task.sh
@@ -0,0 +1,7 @@
+build_busybox_package_dependencies="buildtools"
+
+build_busybox() {
+ local ME=build_busybox
+ echo " Building busybox"
+ chroot-exec /root/bin/build-bb.sh >> $BROOT_LOG.$ME
+}
diff --git a/tasks/buildtools.task.sh b/tasks/buildtools.task.sh
new file mode 100644
index 0000000..da8544a
--- /dev/null
+++ b/tasks/buildtools.task.sh
@@ -0,0 +1,17 @@
+buildtools_package_dependencies="update"
+
+buildtools() {
+ local ME=buildtools
+
+ echo -n " Install build-essentials "
+ chroot-aptinstall build-essential | tee - $DEBUG.$ME | awk '{printf "."}' 2>&1
+ echo "done"
+
+ echo -n " Install git, svn "
+ chroot-aptinstall git-core subversion | tee -a - $DEBUG.$ME | awk '{printf "."}' 2>&1
+ echo "done"
+
+ echo -n " Install kernelsources and firmware packages "
+ chroot-aptinstall firmware-iwlwifi firmware-linux firmware-linux-free firmware-linux-nonfree linux-image-2.6.32-trunk-686-bigmem | tee -a - $DEBUG.$ME | awk '{printf "."}' 2>&1
+ echo "done"
+}
diff --git a/tasks/cleanup.task.sh b/tasks/cleanup.task.sh
new file mode 100644
index 0000000..1f25878
--- /dev/null
+++ b/tasks/cleanup.task.sh
@@ -0,0 +1,6 @@
+cleanup() {
+ # make sure all bindmounts have been umounted
+ echo " Umount temporary (bind)mounts"
+ destroyBindmounts
+ touch /tmp/.broot.exit
+}
diff --git a/tasks/locales.task.sh b/tasks/locales.task.sh
new file mode 100644
index 0000000..3afc19f
--- /dev/null
+++ b/tasks/locales.task.sh
@@ -0,0 +1,11 @@
+locales_require_bindmounts=1
+
+locales() {
+ local ME=locales
+ # fix locales
+ chroot-aptinstall locales > $BROOT_LOG.$ME 2>&1
+ sed -i -e "s,^#.*\(en_US.*\)$,\1," $BROOT_BUILDROOT_PATH/etc/locale.gen
+ chroot-exec locale-gen >> $BROOT_LOG.$ME 2>&1
+ lastline=$(tail -n 1 $BROOT_LOG.$ME)
+ echo " $lastline"
+}
diff --git a/tasks/update.task.sh b/tasks/update.task.sh
new file mode 100644
index 0000000..f6ec089
--- /dev/null
+++ b/tasks/update.task.sh
@@ -0,0 +1,10 @@
+update_package_dependencies="bootstrap"
+
+update() {
+ ME=update
+ echo " Refresh apt sources"
+ chroot-exec aptitude update > $DEBUG.$ME 2>&1
+ echo -n " Running system update "
+ chroot-exec aptitude -y safe-upgrade | tee -a - $DEBUG.$ME | awk '{printf "."}' 2>&1
+ echo "done"
+}
diff --git a/tasks/update_chrootscripts.task.sh b/tasks/update_chrootscripts.task.sh
new file mode 100644
index 0000000..9302fae
--- /dev/null
+++ b/tasks/update_chrootscripts.task.sh
@@ -0,0 +1,7 @@
+update_chrootscripts () {
+ rm -f $BROOT_BUILDROOT_PATH/root/bin/*.sh 2>&1 > /dev/null
+ cp ./chroot-scripts/* $BROOT_BUILDROOT_PATH/root/bin/
+ chmod 700 $BROOT_BUILDROOT_PATH/root/bin/*
+ count=$(ls -1 $BROOT_BUILDROOT_PATH/root/bin/*.sh|wc -l)
+ echo " Reinstalled $count scripts"
+}