#!/usr/bin/env ruby # # Copyright (C) 2007 Harald Sitter # # fake package injector for kubuntu/debian # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies of the Software and its documentation and acknowledgment shall be # given in the documentation and software packages that this Software was # used. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. require 'fileutils.rb' def help puts "Usage: ruby #{$0} [PACKAGENAME] [DISTROVERSION]\n\n" puts "fake package injector for kubuntu/debian" end # ensure that all args are avilable if $*[0] == nil or $*[1] == nil or $*[0] == "--help" or $*[0] == "-help" or $*[0] == "-h" then help exit 1 end # ensure that used apps are available `which fakeroot` if $? == nil then puts "please install fakeroot" exit 1 end `which dh_installdeb` if $? == nil then puts "please install debhelper" exit 1 end # check if dir already exists -> if it does -> remove it if File.exist?("injecttmpdir") then FileUtils.remove_dir("injecttmpdir") end # create dirs and enter app/debian Dir.mkdir("injecttmpdir") Dir.chdir("injecttmpdir") Dir.mkdir($*[0]) Dir.chdir($*[0]) Dir.mkdir("debian") Dir.chdir("debian") # enter compat value `echo "5" > compat` # changelog with var usage `echo "#{$*[0]} (99:99.9-0aplg1) #{$*[1]}; urgency=low * Initial release -- Harald Sitter Mon, 1 Jan 2001 01:01:01 +0100 " > changelog` # control with var usage `echo "Source: #{$*[0]} Section: kde Priority: optional Maintainer: Harald Sitter Build-Depends: debhelper (>= 5) Standards-Version: 3.7.2 Package: #{$*[0]} Architecture: any Description: this is a fake package!!!!!!!! this is a superious fake package, don't ye love it? :D " > control` # go back to app dir Dir.chdir("..") # build package `fakeroot dh_installdeb` `fakeroot dh_gencontrol` `fakeroot dh_md5sums` `fakeroot dh_builddeb` # go level up Dir.chdir("..") # install package `sudo dpkg -i #{$*[0]}_99.9-0aplg1_i386.deb` # clean up Dir.chdir("..") FileUtils.remove_dir("injecttmpdir")