From 1bc1d45f778501bcc7b4029edaf40785e5a0b786 Mon Sep 17 00:00:00 2001 From: Joe Block Date: Sun, 3 Jan 2016 12:21:18 -0800 Subject: [PATCH 1/2] Add a Rakefile to make packing lockrun as a deb easier --- Rakefile | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Rakefile diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..c2d388a --- /dev/null +++ b/Rakefile @@ -0,0 +1,42 @@ +# +# Make it easy to package lockrun +require 'fileutils' + +SEMVER='1.2' +iteration=`git rev-list HEAD --count`.chomp + +task :default => [:usage] +task :help => [:usage] + +task :usage do + puts "rake deb: create an deb for lockrun" + puts "rake lockrun: compile lockrun" + puts + puts "You must gem install fpm to build deb files" +end + +task :deb => [:fakeroot, :lockrun] do + sh %{ fpm -s dir -t deb -n lockrun \ + -v #{SEMVER} --iteration #{iteration} \ + --url https://github.com/pushcx/lockrun \ + --description "Lockrun allows you to use a lock to prevent multiple simultaneous executions of an executable." \ + -C .fakeroot -d libc6 --license "Public Domain" usr } +end + +task :fakeroot => [:lockrun] do + puts "iteration: #{iteration}" + sh %{ rm -fr .fakeroot } + FileUtils::mkdir_p '.fakeroot/usr/local/bin' + sh %{ cp lockrun .fakeroot/usr/local/bin} + sh %{ chown -R root.root .fakeroot } +end + +task :lockrun do + sh %{ gcc lockrun.c -o lockrun } +end + +desc "Cleanup after build" +task :cleanup do + sh %{ find . -name '*.un~' '*.o' -exec rm '{}' ';' } + sh %{ rm -fr .fakeroot } +end From 9582d4cc12f7b3d835bf51cb2dc1b5bb5915be59 Mon Sep 17 00:00:00 2001 From: Joe Block Date: Sun, 3 Jan 2016 20:39:54 -0800 Subject: [PATCH 2/2] Fix format of usage --- Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index c2d388a..800db41 100644 --- a/Rakefile +++ b/Rakefile @@ -9,8 +9,8 @@ task :default => [:usage] task :help => [:usage] task :usage do - puts "rake deb: create an deb for lockrun" - puts "rake lockrun: compile lockrun" + puts "rake deb: Create an deb for lockrun" + puts "rake lockrun: Compile lockrun" puts puts "You must gem install fpm to build deb files" end