#!/usr/bin/env ruby # 28 05 2009 # Lindsay Holmwood # # Copies various scripts to appropriate places so Flapjack can be # started as a daemon. # # I abhor these sort of scripts. It's only a stopgap until Flapjack # gets packaged properly. # # If you would like to package, please let me know! Patches welcome. # unless ENV["USERNAME"] == "root" puts 'You need to be root to run this script' exit 1 end # prompt/warn the user what is about to happen puts "This script sets up Flapjack to run as a daemon. Specifically it: " puts puts " * installs init scripts and configs into /etc" puts " * sets up /var/run/flapjack " puts " * sets Flapjack to run on boot" puts puts "It will prompt you if it wants to overwrite an existing file." puts print "Do you want to continue? [y/n] " continue = gets.strip puts unless continue == "y" puts "Exiting." exit end # setup system("mkdir -p /var/run/flapjack") system("chmod a+rw /var/run/flapjack") etc_path=`gem contents auxesis-flapjack |grep etc`.split.first.gsub(/etc\/.+/, 'etc').strip system("cp -aiv #{etc_path}/* /etc") # set sequence number to 50 so beanstalkd has a chance to boot system("update-rc.d flapjack-workers defaults 50") system("update-rc.d flapjack-notifier defaults 50") puts puts "Setup complete!" puts puts "You will want to customise:" puts " * /etc/flapjack/recipients.yaml" puts " * /etc/flapjack/flapjack-notifier.yaml" puts puts ".examples of these files exist in /etc/flapjack/'