From c43f7c37468c4d23bb827716d929661905884949 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 9 Sep 2016 12:09:11 +0200 Subject: sbin/bootcmd: extract it from old startup.rc startup.rc used to include this code in order to execute some early boot commands and to mount extra filesystems. Better put that into a dedicated script to allow to clearn up startup.rc. --- .flxfiles | 1 + sbin/bootcmd | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100755 sbin/bootcmd diff --git a/.flxfiles b/.flxfiles index 226caee..c31c451 100644 --- a/.flxfiles +++ b/.flxfiles @@ -26,6 +26,7 @@ sbin/rc.M sbin/rc.S sbin/initscript sbin/autoraid +sbin/bootcmd sbin/bootmodules sbin/fix-date sbin/listpart diff --git a/sbin/bootcmd b/sbin/bootcmd new file mode 100755 index 0000000..377e9a5 --- /dev/null +++ b/sbin/bootcmd @@ -0,0 +1,61 @@ +#!/bin/bash + +# sbin/bootcmd - Formilux early command loader - v0.2 - 2016-09-09 +# +# Copyright (C) 2001-2016 Benoit Dolez & Willy Tarreau +# mailto: benoit@ant-computing.com,willy@ant-computing.com +# +# This program is licenced under GPLv2 ( http://www.gnu.org/licenses/gpl.txt ) + +# This script looks for strings beginning with 'mount=' and "exec=" in +# /proc/modules. It accepts commands following these formats : +# +# - mount=dst:src[!opt1[!opt2...]] with src=/dev/xxx, /dir/file or ip:/dir +# - exec=cmd[!arg1[!arg2...]] + +[ -r /proc/modules ] || exit 0 + +set -- $(/dev/null 2>&1 + mount ${opt:+-o $opt} --bind $src $dst + fi + fi + ;; + "exec") + bin="${arg%%\!*}" + opt="" + if [ -z "${arg%%*\!*}" ]; then + opt="${arg#*\!}" + opt=${opt//\!/ } + fi + command $bin $opt + ;; + esac + shift +done +exit 0 -- 1.7.12.1