Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Rakefile to make packing lockrun as a deb easier #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -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