Skip to content

Instantly share code, notes, and snippets.

@opamp
Created September 21, 2011 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save opamp/1232199 to your computer and use it in GitHub Desktop.
Save opamp/1232199 to your computer and use it in GitHub Desktop.
This can install korundum to ruby 1.9.2 of rvm on ArchLinux.
#!/usr/bin/env ruby
#-*- encoding:utf-8 -*-
=begin
Copyright (c) 2011,opamp
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=end
# You have to run on Ruby1.9.2(or 1.9.3) in rvm.
=begin
This script can run on ArchLinux-KDE.
1. Install rvm.
2. Install ruby 1.9.2 (or 1.9.3)
3. rvm use 1.9.2 (or 1.9.3) --default
4. Run this script.
(If you use 1.9.3-p0,you have to add to option '--rubyname=ruby-1.9.3-p0'.)
But,you should not trust 100% this script and me.
=end
$rvm_ruby_name="ruby-1.9.2-p290"
$systemRubyLIBPrefix="/usr/lib"
$rvmLibPrefix=ENV["HOME"] + "/.rvm/rubies/" + $rvm_ruby_name + "/lib"
$archt = `uname -m`;$archt = $archt.chomp
ARGV.each do |ag|
if ag =~ /^--syslib=/ then
puts "system ruby lib prefix is changed."
puts "default -> " + $systemRubyLIBPrefix
$systemRubyLIBPrefix = ag[9..(ag.size - 1)]
puts "to -> " + $systemRubyLIBPrefix
end
if ag =~ /^--rvmlib=/ then
puts "rvm ruby lib prefix is changed."
puts "default -> " + $rvmLibPrefix
$rvmLibPrefix = ag[9..(ag.size - 1)]
puts "to -> " + $rvmLibPrefix
end
if ag =~ /^--rubyname=/ then
puts "rvm ruby name changed."
puts "default -> " + $rvm_ruby_name
$rvm_ruby_name = ag[11..(ag.size - 1)]
puts "to -> " + $rvm_ruby_name
$rvmLibPrefix=ENV["HOME"] + "/.rvm/rubies/" + $rvm_ruby_name + "/lib"
end
end
print %Q{Have you finished installing "kdebindings-qtruby" and "kdebindings-korundum"?[y/n] }
unless STDIN.gets.chomp == "y" then
if File.executable?("/usr/bin/pacman") == false then
puts "Not found pacman command."
exit 1
end
system "sudo pacman -Syu"
if system("sudo pacman -S kdebindings-qtruby kdebindings-korundum") != true then
puts "ERROR:: package install."
exit 1
end
end
puts "OK."
st = "/ruby/site_ruby/1.9.1/"
$systemRubyLIBPrefix += st
$rvmLibPrefix += st
sodir = $archt + "-linux/"
symtgfiles = %W{KDE Qt.rb Qt4.rb khtml ktexteditor okular qscintilla qtscript qtuitools solid Qt Qt3.rb akonadi kio nepomuk phonon qtdeclarative qttest qtwebkit soprano}
symtgsofiles = %W{akonadi.so kio.so nepomuk.so plasma_applet.so qtruby4.so qtuitools.so soprano.so kate.so korundum4.so okular.so qscintilla.so qtscript.so qtwebkit.so khtml.so ktexteditor.so phonon.so qtdeclarative.so qttest.so solid.so}
puts "Start to make symlink."
symtgfiles.each do |f|
begin
c = File.symlink($systemRubyLIBPrefix + f,$rvmLibPrefix + f)
rescue Errno::EEXIST => e
puts "#{f} is already exists."
next
rescue
puts "unknow error."
exit 1
end
puts "Create #{f} " if c == 0
end
puts "NEXT"
symtgsofiles.each do |f|
begin
c = File.symlink($systemRubyLIBPrefix + sodir + f,$rvmLibPrefix + sodir + f)
rescue Errno::EEXIST => e
puts "#{f} is already exists."
next
rescue
pust "unknow error."
exit 1
end
puts "Create #{f} " if c == 0
end
puts "Finished."
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment