]>
cloud.milkyroute.net Git - dolphin.git/blob - src/settings/services/servicemenuinstallation
5 $servicedir = `qtpaths --writable-path GenericDataLocation`.strip! +
"/kservices5/ServiceMenus/"
6 FileUtils
.mkdir_p($servicedir) if !File
.exist
?($servicedir)
7 if archive
[(archive
.length
- 8)..(archive
.length
- 1)] == ".desktop"
8 puts
"Single-File Service-Menu"
11 FileUtils
.cp(archive
, $servicedir);
14 def mimeType(filename
)
15 IO
.popen("file --mime-type -b " + filename
).gets().strip!
()
17 $archivetypes = { "application/x-tar" => :"tar -xf %s -C %s",
18 "application/tar" => :"tar -xf %s -C %s",
19 "application/x-gzip" => :"tar -zxf %s -C %s",
20 "application/gzip" => :"tar -zxf %s -C %s",
21 "application/x-gzip-compressed-tar" => :"tar -zxf %s -C %s",
22 "application/gzip-compressed-tar" => :"tar -zxf %s -C %s",
23 "application/x-gzip-compressed" => :"tar -zxf %s -C %s",
24 "application/gzip-compressed" => :"tar -zxf %s -C %s",
25 "application/bzip" => :"tar -jxf %s -C %s",
26 "application/bzip2" => :"tar -jxf %s -C %s",
27 "application/x-bzip" => :"tar -jxf %s -C %s",
28 "application/x-bzip2" => :"tar -jxf %s -C %s",
29 "application/bzip-compressed" => :"tar -jxf %s -C %s",
30 "application/bzip2-compressed" => :"tar -jxf %s -C %s",
31 "application/x-bzip-compressed" => :"tar -jxf %s -C %s",
32 "application/x-bzip2-compressed" => :"tar -jxf %s -C %s",
33 "application/bzip-compressed-tar" => :"tar -jxf %s -C %s",
34 "application/bzip2-compressed-tar" => :"tar -jxf %s -C %s",
35 "application/x-bzip-compressed-tar" => :"tar -jxf %s -C %s",
36 "application/x-bzip2-compressed-tar" => :"tar -jxf %s -C %s",
37 "application/zip" => :"unzip %s -d %s",
38 "application/x-zip" => :"unzip %s -d %s",
39 "application/x-zip-compressed" => :"unzip %s -d %s",
40 "multipart/x-zip" => :"unzip %s -d %s",
41 "application/tgz" => :"tar -zxf %s -C %s",
42 "application/x-compressed-gtar" => :"tar -zxf %s -C %s",
43 "application/x-gtar" => :"tar -zxf %s -C %s",
44 "file/tgz" => :"tar -zxf %s -C %s",
45 "multipart/x-tar-gz" => :"tar -zxf %s -C %s",
46 "application/x-gunzip" => :"tar -zxf %s -C %s",
47 "application/gzipped" => :"tar -zxf %s -C %s",
48 "gzip/document" => :"tar -zxf %s -C %s",
49 "application/x-bz2 " => :"tar -jxf %s -C %s",
50 "application/x-gtar" => :"tar -xf %s -C %s",
51 "multipart/x-tar" => :"tar -xf %s -C %s"
53 def uncompress(filename
, output
)
54 system(sprintf($archivetypes[mimeType(filename
)].to_s
, filename
, output
))
56 dir
= archive +
"-dir"
61 exit(-1) if !
uncompress(archive
, dir
)
70 break if dd
.count !
= 3
73 dir +
= "/" + entry
if entry !
= "." && entry !
= ".."
75 if !File
.directory
? dir
82 system("kdialog --passivepopup \"Installation failed\" 15")
85 if !
((File
.exist
?(file
= "./install-it.sh") || File
.exist
?(file
= "./install-it")) && system(file
))
86 fail() if !File
.exist
?(file
= "./installKDE4.sh") && !File
.exist
?(file
= "./installKDE4") && !File
.exist
?(file
= "./install.sh") && !File
.exist
?(file
= "./install")
87 File
.new(file
).chmod(0700)
88 fail() if !
system(file +
" --local") && !
system(file +
"--local-install") && !
system(file +
" --install")