/usr/bin/servicemenuinstallation is in dolphin 4:4.14.2-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | #!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
archive = ARGV[0]
$servicedir = `kde4-config --localprefix`.strip! + "share/kde4/services/ServiceMenus/"
FileUtils.mkdir_p($servicedir) if !File.exist?($servicedir)
if archive[(archive.length - 8)..(archive.length - 1)] == ".desktop"
puts "Single-File Service-Menu"
puts archive
puts $servicedir
FileUtils.cp(archive, $servicedir);
exit(0)
end
def mimeType(filename)
IO.popen("file --mime-type -b " + filename).gets().strip!()
end
$archivetypes = { "application/x-tar" => :"tar -xf %s -C %s",
"application/tar" => :"tar -xf %s -C %s",
"application/x-gzip" => :"tar -zxf %s -C %s",
"application/gzip" => :"tar -zxf %s -C %s",
"application/x-gzip-compressed-tar" => :"tar -zxf %s -C %s",
"application/gzip-compressed-tar" => :"tar -zxf %s -C %s",
"application/x-gzip-compressed" => :"tar -zxf %s -C %s",
"application/gzip-compressed" => :"tar -zxf %s -C %s",
"application/bzip" => :"tar -jxf %s -C %s",
"application/bzip2" => :"tar -jxf %s -C %s",
"application/x-bzip" => :"tar -jxf %s -C %s",
"application/x-bzip2" => :"tar -jxf %s -C %s",
"application/bzip-compressed" => :"tar -jxf %s -C %s",
"application/bzip2-compressed" => :"tar -jxf %s -C %s",
"application/x-bzip-compressed" => :"tar -jxf %s -C %s",
"application/x-bzip2-compressed" => :"tar -jxf %s -C %s",
"application/bzip-compressed-tar" => :"tar -jxf %s -C %s",
"application/bzip2-compressed-tar" => :"tar -jxf %s -C %s",
"application/x-bzip-compressed-tar" => :"tar -jxf %s -C %s",
"application/x-bzip2-compressed-tar" => :"tar -jxf %s -C %s",
"application/zip" => :"unzip %s -d %s",
"application/x-zip" => :"unzip %s -d %s",
"application/x-zip-compressed" => :"unzip %s -d %s",
"multipart/x-zip" => :"unzip %s -d %s",
"application/tgz" => :"tar -zxf %s -C %s",
"application/x-compressed-gtar" => :"tar -zxf %s -C %s",
"application/x-gtar" => :"tar -zxf %s -C %s",
"file/tgz" => :"tar -zxf %s -C %s",
"multipart/x-tar-gz" => :"tar -zxf %s -C %s",
"application/x-gunzip" => :"tar -zxf %s -C %s",
"application/gzipped" => :"tar -zxf %s -C %s",
"gzip/document" => :"tar -zxf %s -C %s",
"application/x-bz2 " => :"tar -jxf %s -C %s",
"application/x-gtar" => :"tar -xf %s -C %s",
"multipart/x-tar" => :"tar -xf %s -C %s"
}
def uncompress(filename, output)
system(sprintf($archivetypes[mimeType(filename)].to_s, filename, output))
end
dir = archive + "-dir"
if File.exist?(dir)
FileUtils.rm_r(dir)
end
FileUtils.mkdir(dir)
exit(-1) if !uncompress(archive, dir)
# try: install-it.sh
# try: install-it
# try: installKDE4.sh
# try: installKDE4
# try: install.sh
# try: install
while true
dd = Dir.new(dir)
break if dd.count != 3
odir = dir
for entry in dd
dir += "/" + entry if entry != "." && entry != ".."
end
if !File.directory? dir
dir = odir
break
end
end
Dir.chdir(dir)
def fail()
system("kdialog --passivepopup \"Installation failed\" 15")
exit(-1)
end
if !((File.exist?(file = "./install-it.sh") || File.exist?(file = "./install-it")) && system(file))
fail() if !File.exist?(file = "./installKDE4.sh") && !File.exist?(file = "./installKDE4") && !File.exist?(file = "./install.sh") && !File.exist?(file = "./install")
File.new(file).chmod(0700)
fail() if !system(file + " --local") && !system(file + "--local-install") && !system(file + " --install")
end
|