From dbbe3cecb3f3924e546a8b7575a374c79b4799c5 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Wed, 3 Aug 2016 10:58:45 +0200 Subject: [PATCH] Debian helper build & install scripts These scripts help a user to configure, build, and install Finit correctly on a Debian 8 (Jessie) server install. Signed-off-by: Joachim Nilsson --- contrib/debian/build.sh | 62 +++++++++++++++++++++++++++++++++ contrib/debian/grub.d/40_custom | 15 ++++++++ contrib/debian/install.sh | 49 ++++++++++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100755 contrib/debian/build.sh create mode 100755 contrib/debian/grub.d/40_custom create mode 100755 contrib/debian/install.sh diff --git a/contrib/debian/build.sh b/contrib/debian/build.sh new file mode 100755 index 00000000..a2e75884 --- /dev/null +++ b/contrib/debian/build.sh @@ -0,0 +1,62 @@ +#!/bin/sh +# +# This script configures Finit for Debian, which needs a few more plugins +# and tweaks than an embedded system usually does. +# +# Usage: +# user@jessie:~/finit$ contrib/debian/build.sh +# + +echo +echo "*** Configuring Finit for Debian" + +if [ ! -e configure ]; then + echo " The configure script is missing, maybe you're using a GIT checkout?" + echo " Attempting to run the autogen.sh script, you need these tools:" + echo " autoconf, automake, libtool, pkg-config ..." + echo + ./autogen.sh +fi +echo + +./configure --enable-rw-rootfs --enable-dbus-plugin --enable-x11-common-plugin \ + --enable-alsa-utils-plugin --with-random-seed=/var/lib/urandom/random-seed \ + --with-heading="Debian GNU/Linux 8.5" --with-hostname=jessie \ + --enable-inetd-echo-plugin --enable-inetd-chargen-plugin \ + --enable-inetd-daytime-plugin --enable-inetd-discard-plugin \ + --enable-inetd-time-plugin + +if [ $? -ne 0 ]; then + echo + echo "*** Configure script failed, have you installed libuEV and libite?" + echo + exit 1 +fi + +echo +echo "*** Building ..." +echo +make + +if [ $? -ne 0 ]; then + echo + echo "*** The build failed for some reason" + echo + exit 1 +fi + +echo +echo "*** Done" +echo + +read -p "*** Run (sudo) install script (y/N)? " yorn +if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then + sudo contrib/debian/install.sh +else + echo + echo "*** Use 'sudo contrib/debian/install.sh' later to install Finit" + echo +fi + + + diff --git a/contrib/debian/grub.d/40_custom b/contrib/debian/grub.d/40_custom new file mode 100755 index 00000000..c41f2028 --- /dev/null +++ b/contrib/debian/grub.d/40_custom @@ -0,0 +1,15 @@ +#!/bin/sh +exec tail -n +3 $0 +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. + +menuentry 'Debian GNU/Linux with Finit' --class debian --class gnu-linux --class gnu --class os --user { + insmod gzio + insmod part_msdos + insmod ext2 + set root='(hd0,0)' + search --no-floppy --fs-uuid --set=root 05831a47-bf7c-4812-9cb2-818537aa68fc + linux /vmlinuz root=UUID=05831a47-bf7c-4812-9cb2-818537aa68fc ro quiet init=/sbin/finit + initrd /initrd.img +} diff --git a/contrib/debian/install.sh b/contrib/debian/install.sh new file mode 100755 index 00000000..ebae59f0 --- /dev/null +++ b/contrib/debian/install.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +SYMLINKS="start.d/*" +FILES="finit.conf grub.d/40_custom" + +if [ "x`id -u`" != "x0" ]; then + echo + echo "=> Unfortunately this script must run as root (sudo) <=" + echo + exit 1 +fi + +# Adjust base directory +grep -q Debian os-release 2>/dev/null +if [ $? -eq 0 ]; then + cd ../.. +elif [ ! -e finit.c ]; then + echo "Please run this script from the Finit base directory." + exit 1 +fi + +echo "Install Finit on Debian 8 (jessie)" +echo "========================================================================" +echo "/sbin/finit - PID 1" +echo "/lib/finit/plugins/* - All enabled Finit plugins" +echo "/etc/finit.conf - Instead of units or /etc/init.d Finit can have" +echo " one config for your system. Or you can split" +echo " it in service(s) per file in /etc/finit.d/" +echo "/etc/start.d/ - Simple Debian setup scripts run with run-parts(8)" +echo "/etc/grub.d/40_custom - Add menu entry to the Grub boot loader" +echo +read -p "Do you want to continue (y/N)? " yorn +echo + +if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then + echo "Installing Finit files ..." + make install + cd `dirname $0` + mkdir -p /etc/start.d + for file in $FILES; do + install -vbD $file /etc/$file + done + for link in $SYMLINKS; do + cp -va $link /etc/$link + done + update-grub +else + echo "Aborting install." +fi