]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/services/servicemenudeinstallation
make services GHNS work with store.kde.org
[dolphin.git] / src / settings / services / servicemenudeinstallation
1 #!/usr/bin/env ruby
2 require 'fileutils'
3 archive = ARGV[0]
4 if archive[(archive.length - 8)..(archive.length)] == ".desktop"
5 FileUtils.rm(`qtpaths --writable-path GenericDataLocation`.strip! + "/kservices5/ServiceMenus/" + File.basename(archive))
6 exit(0)
7 end
8 dir = archive + "-dir"
9 # try: deinstall.sh
10 # try: deinstall
11 # try: installKDE4.sh
12 # try: installKDE4
13 # try: install.sh
14 # try: install
15 while true
16 dd = Dir.new(dir)
17 break if dd.count != 3
18 odir = dir
19 for entry in dd
20 dir += "/" + entry if entry != "." && entry != ".."
21 end
22 if !File.directory? dir
23 dir = odir
24 break
25 end
26 end
27 Dir.chdir(dir)
28 def fail()
29 system("kdialog --passivepopup \"Deinstallation failed\" 15")
30 exit(-1)
31 end
32 if !((File.exist?(file = "./deinstall.sh") || File.exist?(file = "./deinstall")) && system(file))
33 fail() if !File.exist?(file = "./installKDE4.sh") && !File.exist?(file = "./installKDE4") && !File.exist?(file = "./install.sh") && !File.exist?(file = "./install")
34 File.new(file).chmod(0700)
35 fail() if !system(file + " --remove") && !system(file + " --delete") && !system(file + " --uninstall") && !system(file + " --deinstall")
36 end
37 FileUtils.rm_r(dir)