summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Schmelzer2012-06-26 19:13:45 +0200
committerSebastian Schmelzer2012-06-26 19:13:45 +0200
commit8c5112e5c97181fec92227333909613b7159cea5 (patch)
tree5329ff2e2e86355ca1aa6c9642f35ac7ce6c3559
parentadd patch for systemd path fixes (diff)
downloadosib-8c5112e5c97181fec92227333909613b7159cea5.tar.gz
osib-8c5112e5c97181fec92227333909613b7159cea5.tar.xz
osib-8c5112e5c97181fec92227333909613b7159cea5.zip
remove udev stuff from patch, add osib main script
-rwxr-xr-x[-rw-r--r--]bin/osib84
-rwxr-xr-xinc/env.setup-sqfs-base.sh5
-rw-r--r--share/patches/01-systemd-diff.patch30
3 files changed, 81 insertions, 38 deletions
diff --git a/bin/osib b/bin/osib
index 28d8e50..89d954f 100644..100755
--- a/bin/osib
+++ b/bin/osib
@@ -3,14 +3,82 @@
ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..)
SELF=$(readlink -f $0)
-print_module_usage() {
+print_usage() {
echo "Toolkit for creating systemd based initramfs images (osid)"
- echo "Usage: $(basename $SELF) MODULE [OPTIONS]"
- echo "Modules:"
- echo -e " env \t fetch, update, recreate kernel/initramfs"
- echo -e " iso \t create preboot isos"
- echo -e " usb \t create preboot usb sticks"
- echo -e " installer \t create self-extracting installers"
- echo "For more help run: $(basename $SELF) MODULE --help"
+ echo "Usage: $(basename $SELF) [OPTIONS] CMD"
+ echo "Options:"
+ echo -e " --rebuild-all, -r \t force recreation of build env"
+ echo -e " --rebuild-cpio \t force recreation of cpio base"
+ echo -e " --rebuild-sqfs \t force recreation of sqfs base"
+ echo -e " --help, -h \t print help"
+ echo "Commands (CMD):"
+ echo -e " clean \t clean build dir"
+ echo -e " initramfs \t create only initramfs"
+ echo -e " iso \t create iso"
}
+
+rebuild_cpio=0
+rebuild_sqfs=0
+build_initramfs=0
+build_iso=0
+clean=0
+
+if [ "x$1" = "x" ]; then
+ print_usage
+ exit 0
+elif [ "x$(whoami)" != "xroot" ]; then
+ echo "ERROR: You need root rights to run $SELF."
+ echo " (required for creating dev files)"
+ exit 1
+fi
+
+while [ "x$1" != "x" ]; do
+ arg=$1
+ if [ "x$arg" = "x--rebuild-all" -o "x$arg" = "x-r" ]; then
+ rebuild_cpio=1
+ rebuild_sqfs=1
+ elif [ "x$arg" = "x--rebuild-cpio" ]; then
+ rebuild_cpio=1
+ elif [ "x$arg" = "x--rebuild-sqfs" -o "x$arg" = "x-s" ]; then
+ rebuild_sqfs=1
+ elif [ "x$arg" = "x--help" -o "x$arg" = "x-h" ]; then
+ print_usage
+ exit 0
+ elif [ "x$arg" = "xiso" ]; then
+ build_initramfs=1
+ build_iso=1
+ elif [ "x$arg" = "xinitramfs" ]; then
+ build_initramfs=1
+ elif [ "x$arg" = "xclean" ]; then
+ clean=1
+ else
+ echo "ERROR: Unkown argument ($arg)."
+ print_usage
+ exit 1
+ fi
+ shift
+done
+
+if [ $rebuild_cpio -eq 1 ]; then
+ rm -rf ${ROOT_DIR}/build/cpio-base
+fi
+
+if [ $rebuild_sqfs -eq 1 ]; then
+ rm -rf ${ROOT_DIR}/build/sqfs-base
+fi
+
+if [ $clean -eq 1 ]; then
+ rm -rf ${ROOT_DIR}/build
+fi
+
+
+if [ $build_initramfs -eq 1 ]; then
+ ${ROOT_DIR}/inc/build.initramfs.sh && exit 0
+fi
+
+if [ $build_iso -eq 1 ]; then
+ ${ROOT_DIR}/inc/build.iso.sh
+fi
+
+exit 0
diff --git a/inc/env.setup-sqfs-base.sh b/inc/env.setup-sqfs-base.sh
index c217437..dfae1bf 100755
--- a/inc/env.setup-sqfs-base.sh
+++ b/inc/env.setup-sqfs-base.sh
@@ -7,6 +7,11 @@ ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..)
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
diff --git a/share/patches/01-systemd-diff.patch b/share/patches/01-systemd-diff.patch
index 9598592..18ef999 100644
--- a/share/patches/01-systemd-diff.patch
+++ b/share/patches/01-systemd-diff.patch
@@ -1,12 +1,3 @@
-diff -wur sqfs-base/lib/systemd/system/basic.target.wants/udev-trigger.service sqfs-base.new/lib/systemd/system/basic.target.wants/udev-trigger.service
---- sqfs-base/lib/systemd/system/basic.target.wants/udev-trigger.service 2012-06-26 11:55:53.000000000 +0200
-+++ sqfs-base.new/lib/systemd/system/basic.target.wants/udev-trigger.service 2012-06-26 14:28:51.041281949 +0200
-@@ -7,4 +7,4 @@
- [Service]
- Type=oneshot
- RemainAfterExit=yes
--ExecStart=/usr/bin/udevadm trigger --type=subsystems --action=add ; /usr/bin/udevadm trigger --type=devices --action=add
-+ExecStart=/openslx/usr/bin/udevadm trigger --type=subsystems --action=add ; /openslx/usr/bin/udevadm trigger --type=devices --action=add
diff -wur sqfs-base/lib/systemd/system/dbus.service sqfs-base.new/lib/systemd/system/dbus.service
--- sqfs-base/lib/systemd/system/dbus.service 2012-06-26 11:27:29.000000000 +0200
+++ sqfs-base.new/lib/systemd/system/dbus.service 2012-06-26 14:29:40.721281652 +0200
@@ -23,27 +14,6 @@ diff -wur sqfs-base/lib/systemd/system/dbus.service sqfs-base.new/lib/systemd/sy
+ExecStart=/openslx/usr/bin/dbus-daemon --system --address=systemd: --nofork --systemd-activation
+ExecReload=/openslx/usr/bin/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
OOMScoreAdjust=-900
-diff -wur sqfs-base/lib/systemd/system/udev-settle.service sqfs-base.new/lib/systemd/system/udev-settle.service
---- sqfs-base/lib/systemd/system/udev-settle.service 2012-06-26 11:55:53.000000000 +0200
-+++ sqfs-base.new/lib/systemd/system/udev-settle.service 2012-06-26 14:29:57.987948214 +0200
-@@ -19,7 +19,7 @@
- Type=oneshot
- TimeoutSec=180
- RemainAfterExit=yes
--ExecStart=/usr/bin/udevadm settle
-+ExecStart=/openslx/usr/bin/udevadm settle
-
- [Install]
- WantedBy=basic.target
-diff -wur sqfs-base/lib/systemd/system/udev-trigger.service sqfs-base.new/lib/systemd/system/udev-trigger.service
---- sqfs-base/lib/systemd/system/udev-trigger.service 2012-06-26 11:55:53.000000000 +0200
-+++ sqfs-base.new/lib/systemd/system/udev-trigger.service 2012-06-26 14:28:51.041281949 +0200
-@@ -7,4 +7,4 @@
- [Service]
- Type=oneshot
- RemainAfterExit=yes
--ExecStart=/usr/bin/udevadm trigger --type=subsystems --action=add ; /usr/bin/udevadm trigger --type=devices --action=add
-+ExecStart=/openslx/usr/bin/udevadm trigger --type=subsystems --action=add ; /openslx/usr/bin/udevadm trigger --type=devices --action=add
diff -wur sqfs-base/usr/lib/systemd/system/console-shell.service sqfs-base.new/usr/lib/systemd/system/console-shell.service
--- sqfs-base/usr/lib/systemd/system/console-shell.service 2012-06-26 14:07:18.000000000 +0200
+++ sqfs-base.new/usr/lib/systemd/system/console-shell.service 2012-06-26 14:45:23.777942684 +0200