| 1 | #!/bin/sh |
| 2 | |
| 3 | if [ "x`id -u`" != "x0" ]; then |
| 4 | echo |
| 5 | echo "=> Unfortunately this script must run as root (sudo) <=" |
| 6 | echo |
| 7 | exit 1 |
| 8 | fi |
| 9 | |
| 10 | # Adjust base directory |
| 11 | grep -q debian Makefile 2>/dev/null |
| 12 | if [ $? -eq 0 ]; then |
| 13 | cd ../.. |
| 14 | elif [ ! -e configure.ac ]; then |
| 15 | echo "*** Please run this script from the Finit base directory." |
| 16 | exit 1 |
| 17 | fi |
| 18 | |
| 19 | echo |
| 20 | echo "*** Install Finit on Debian GNU/Linux" |
| 21 | echo "========================================================================" |
| 22 | echo "/sbin/finit - PID 1" |
| 23 | echo "/lib/finit/plugins/* - All enabled Finit plugins" |
| 24 | echo "/etc/finit.conf - Finit configuration file" |
| 25 | echo "/etc/finit.d/ - Finit services" |
| 26 | echo "/etc/grub.d/10_linux - Add Finit to Grub's SUPPORTED_INITS" |
| 27 | echo |
| 28 | read -p "Do you want to continue (y/N)? " yorn |
| 29 | echo |
| 30 | |
| 31 | if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then |
| 32 | echo "Installing Finit files ..." |
| 33 | make install |
| 34 | cd /usr/share/doc/finit/contrib/debian |
| 35 | for file in finit.conf; do |
| 36 | install -vbD $file /etc/$file |
| 37 | done |
| 38 | cp -va finit.d /etc/ |
| 39 | |
| 40 | echo "*** Setting up a GRUB boot entry ..." |
| 41 | fn=/etc/grub.d/10_linux |
| 42 | if [ -e $fn ]; then |
| 43 | if `grep SUPPORTED_INITS $fn |head -1 |grep -q finit`; then |
| 44 | echo "Already installed, done." |
| 45 | else |
| 46 | echo "Adding Finit to list of SUPPORTED_INITS ..." |
| 47 | sed -i 's/SUPPORTED_INITS="[^"]*/& finit:\/sbin\/finit/' $fn |
| 48 | update-grub |
| 49 | fi |
| 50 | else |
| 51 | echo "Cannot find $fn, you'll have to set up your bootloader on your own." |
| 52 | fi |
| 53 | |
| 54 | echo |
| 55 | echo "*** Done" |
| 56 | echo |
| 57 | else |
| 58 | echo |
| 59 | echo "*** Aborting install." |
| 60 | echo |
| 61 | fi |