#!/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. # # Edited by Jonathan Patrick Davies require 'fileutils.rb' puts "This is intended for NEW packages only." puts "Package name:" pkgName = gets.chomp.downcase puts "Package version:" pkgVersion = gets.chomp puts "Release:" pkgRelease = gets.chomp.downcase puts "Use CDBS? (Y/N)" useCDBS = gets.chomp.downcase puts "Create #{pkgName}.1.docbook? (Y/N)" docbookCreate = gets.chomp.downcase standVersion = "3.7.2.2" # check if dir already exists -> if it does -> remove it if File.exist?("injecttmpdir") FileUtils.remove_dir("injecttmpdir") end # create dirs and enter app/debian Dir.mkdir("injecttmpdir") Dir.chdir("injecttmpdir") Dir.mkdir("#{pkgName}-#{pkgVersion}") Dir.chdir("#{pkgName}-#{pkgVersion}") Dir.mkdir("debian") Dir.chdir("debian") puts "Making debian/compat" # enter compat value `echo "5" > compat` puts "Making debian/changelog" # changelog with var usage `echo "#{pkgName} (#{pkgVersion}-0ubuntu1) #{pkgRelease}; urgency=low * Initial release -- Harald Sitter Mon, 1 Jan 2001 01:01:01 +0100 " > changelog` puts "Making debian/control" # control with var usage controlfile = File.new( "control", File::CREAT | File::RDWR | File::TRUNC ) controlfile << "Source: #{pkgName}\n" controlfile << "Section: kde\n" controlfile << "Priority: optional\n" controlfile << "Maintainer: Ubuntu MOTU Developers \n" controlfile << "Homepage: \n\n" controlfile << "Build-Depends: debhelper (>= 5), cdbs, docbook2x\n" if useCDBS == "y" controlfile << "Build-Depends: debhelper (>= 5), docbook2x\n" if useCDBS == "n" controlfile << "Standards-Version: #{standVersion}\n\n" controlfile << "Package: #{pkgName}\n" controlfile << "Architecture: any\n" controlfile << "Description: this is a fake package!!!!!!!!\n" controlfile << " this is a superious fake package, don't ye love it? :D\n" controlfile.close() if useCDBS == "y" puts "Making debian/rules (cdbs style!)" makefile = File.new( "control", File::CREAT | File::RDWR | File::TRUNC ) makefile << "#!/usr/bin/make -f\n" makefile << "include /usr/share/cdbs/1/rules/debhelper.mk\n" makefile << "#include /usr/share/cdbs/1/rules/simple-patchsys.mk\n" makefile << "include /usr/share/cdbs/1/class/kde.mk\n" if docbookCreate == "y" makefile << "DEB_INSTALL_MANPAGES_#{pkgName} = #{pkgName}.1\n\n" makefile << "build/#{pkgName}::\n" makefile << " # Build man pages from docbooks\n" makefile << " docbook2x-man debian/#{pkgName}.1.docbook\n\n" makefile << "clean::\n" makefile << " # Remove man pages\n" makefile << " rm -f #{pkgName}.1\n" end else puts "Oh... I don't know how to make non-cdbs rules files yet." end makefile.close() if docbookCreate == "y" puts "Making #{pkgName}.1.docbook" `echo ' Jonathan Patrick Davies jpatrick@kubuntu.org 2007 Jonathan Patrick Davies 2007-11-01 #{pkgName} 1 #{pkgName} ADD DESCRIPTION HERE DESCRIPTION #{pkgName} is AND HERE OPTIONS All KDE and Qt programs accept a some common command-line options. #{pkgName} has no application-specific options. Generic options: Show help about options Show Qt specific options Show KDE specific options Show all options Show author information , Show version information Show license information Indicates end of options COPYRIGHT This manual page was written by Jonathan Patrick Davies jpatrick@kubuntu.org for the Ubuntu system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 or any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. ' > #{pkgName}.1.docbook` end puts "Please edit the files as necessary."