mirror of
https://github.com/codex-storage/deluge.git
synced 2025-03-01 19:40:39 +00:00
fix ubuntu and separate config dir issues
This commit is contained in:
parent
ea953f54b1
commit
c6f69d47e2
@ -46,13 +46,13 @@ import deluge._dbus as dbus
|
|||||||
import deluge.interface
|
import deluge.interface
|
||||||
import deluge.pref
|
import deluge.pref
|
||||||
|
|
||||||
parser = OptionParser(usage="%prog [options] [torrents to add]",
|
|
||||||
version=deluge.common.PROGRAM_VERSION)
|
|
||||||
parser.add_option("-c", "--config", dest="config", help="Sets the configuration path")
|
|
||||||
(options, args) = parser.parse_args()
|
|
||||||
|
|
||||||
if not deluge.common.windows_check():
|
if not deluge.common.windows_check():
|
||||||
import platform
|
import platform
|
||||||
|
i = 1
|
||||||
|
arguments = ""
|
||||||
|
while i < len(sys.argv):
|
||||||
|
arguments = arguments + " " + sys.argv[i]
|
||||||
|
i+=1
|
||||||
if platform.system() == "Linux": # Add this, FreeBSD and other OSs than Linux do not have /etc/issue.
|
if platform.system() == "Linux": # Add this, FreeBSD and other OSs than Linux do not have /etc/issue.
|
||||||
print "checking for ubuntu..."
|
print "checking for ubuntu..."
|
||||||
if os.WEXITSTATUS(os.system('grep -iq "Ubuntu" /etc/issue')) == 0:
|
if os.WEXITSTATUS(os.system('grep -iq "Ubuntu" /etc/issue')) == 0:
|
||||||
@ -60,26 +60,21 @@ if not deluge.common.windows_check():
|
|||||||
print "found and fixing ubuntu"
|
print "found and fixing ubuntu"
|
||||||
os.environ["MOZILLA_FIVE_HOME"] = "/usr/lib/firefox"
|
os.environ["MOZILLA_FIVE_HOME"] = "/usr/lib/firefox"
|
||||||
os.environ["LD_LIBRARY_PATH"] = "/usr/lib/firefox"
|
os.environ["LD_LIBRARY_PATH"] = "/usr/lib/firefox"
|
||||||
if (options.config != None):
|
os.system("/usr/bin/deluge %s" % arguments)
|
||||||
os.system("/usr/bin/deluge --config %s %s" %(options.config, args))
|
|
||||||
elif args:
|
|
||||||
os.system("/usr/bin/deluge %s" %(args))
|
|
||||||
else:
|
|
||||||
os.system("/usr/bin/deluge")
|
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
elif platform.system() == "FreeBSD":
|
elif platform.system() == "FreeBSD":
|
||||||
if os.environ.get("MOZILLA_FIVE_HOME") != "/usr/local/lib/firefox":
|
if os.environ.get("MOZILLA_FIVE_HOME") != "/usr/local/lib/firefox":
|
||||||
print "found and fixing freebsd..."
|
print "found and fixing freebsd..."
|
||||||
os.environ["MOZILLA_FIVE_HOME"] = "/usr/local/lib/firefox"
|
os.environ["MOZILLA_FIVE_HOME"] = "/usr/local/lib/firefox"
|
||||||
os.environ["LD_LIBRARY_PATH"] = "/usr/local/lib/firefox"
|
os.environ["LD_LIBRARY_PATH"] = "/usr/local/lib/firefox"
|
||||||
if (options.config != None):
|
os.system("/usr/local/bin/deluge %s" % arguments)
|
||||||
os.system("/usr/local/bin/deluge --config %s %s" %(options.config, args))
|
|
||||||
elif args:
|
|
||||||
os.system("/usr/local/bin/deluge %s" %(args))
|
|
||||||
else:
|
|
||||||
os.system("/usr/local/bin/deluge")
|
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
|
|
||||||
|
parser = OptionParser(usage="%prog [options] [torrents to add]",
|
||||||
|
version=deluge.common.PROGRAM_VERSION)
|
||||||
|
parser.add_option("-c", "--config", dest="config", help="Sets the configuration path")
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if (options.config != None):
|
if (options.config != None):
|
||||||
deluge.common.CONFIG_DIR = options.config
|
deluge.common.CONFIG_DIR = options.config
|
||||||
|
|
||||||
@ -126,7 +121,6 @@ Continuing...""" % pstate_file_path
|
|||||||
|
|
||||||
def get_cmd_line_torrents():
|
def get_cmd_line_torrents():
|
||||||
cmd_line_torrents = []
|
cmd_line_torrents = []
|
||||||
|
|
||||||
for torrent in args:
|
for torrent in args:
|
||||||
if deluge.common.is_url(torrent):
|
if deluge.common.is_url(torrent):
|
||||||
filename = deluge.common.fetch_url(torrent)
|
filename = deluge.common.fetch_url(torrent)
|
||||||
@ -137,7 +131,6 @@ def get_cmd_line_torrents():
|
|||||||
print "Error,", torrent, " does not seem to be a .torrent file"
|
print "Error,", torrent, " does not seem to be a .torrent file"
|
||||||
else:
|
else:
|
||||||
cmd_line_torrents.append(os.path.abspath(torrent))
|
cmd_line_torrents.append(os.path.abspath(torrent))
|
||||||
|
|
||||||
return cmd_line_torrents
|
return cmd_line_torrents
|
||||||
|
|
||||||
def start_deluge():
|
def start_deluge():
|
||||||
@ -150,12 +143,12 @@ try:
|
|||||||
bus = dbus.SessionBus()
|
bus = dbus.SessionBus()
|
||||||
except:
|
except:
|
||||||
if not deluge.common.windows_check():
|
if not deluge.common.windows_check():
|
||||||
|
while i < len(sys.argv):
|
||||||
|
arguments = arguments + " " + sys.argv[i]
|
||||||
|
i+=1
|
||||||
pid = os.fork()
|
pid = os.fork()
|
||||||
if not pid:
|
if not pid:
|
||||||
if args:
|
os.popen('dbus-launch deluge %s' %arguments)
|
||||||
os.popen('dbus-launch deluge %s' %args)
|
|
||||||
else:
|
|
||||||
os.popen('dbus-launch deluge')
|
|
||||||
else:
|
else:
|
||||||
dbus_objects = dbus.Interface(bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'), 'org.freedesktop.DBus').ListNames()
|
dbus_objects = dbus.Interface(bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'), 'org.freedesktop.DBus').ListNames()
|
||||||
|
|
||||||
|
@ -237,6 +237,8 @@ def send_info():
|
|||||||
except IOError:
|
except IOError:
|
||||||
print "Network error while trying to send info"
|
print "Network error while trying to send info"
|
||||||
else:
|
else:
|
||||||
|
if not os.path.exists(CONFIG_DIR):
|
||||||
|
os.makedirs(CONFIG_DIR)
|
||||||
f = open(os.path.join(CONFIG_DIR, 'infosent'), 'w')
|
f = open(os.path.join(CONFIG_DIR, 'infosent'), 'w')
|
||||||
f.write("")
|
f.write("")
|
||||||
f.close
|
f.close
|
||||||
|
@ -321,7 +321,8 @@ class Manager:
|
|||||||
# Pickle the state so if we experience a crash, the latest state is
|
# Pickle the state so if we experience a crash, the latest state is
|
||||||
# available
|
# available
|
||||||
print "Pickling state..."
|
print "Pickling state..."
|
||||||
|
if not os.path.exists(self.base_dir):
|
||||||
|
os.makedirs(self.base_dir)
|
||||||
output = open(os.path.join(self.base_dir, STATE_FILENAME), 'wb')
|
output = open(os.path.join(self.base_dir, STATE_FILENAME), 'wb')
|
||||||
pickle.dump(self.state, output)
|
pickle.dump(self.state, output)
|
||||||
output.close()
|
output.close()
|
||||||
|
@ -75,6 +75,8 @@ class WizardGTK:
|
|||||||
self.window.set_page_complete(self.wtree.get_widget('vbox3'), True)
|
self.window.set_page_complete(self.wtree.get_widget('vbox3'), True)
|
||||||
self.window.set_page_complete(self.wtree.get_widget('chk_send_info'), \
|
self.window.set_page_complete(self.wtree.get_widget('chk_send_info'), \
|
||||||
True)
|
True)
|
||||||
|
if not os.path.exists(deluge.common.CONFIG_DIR):
|
||||||
|
os.makedirs(deluge.common.CONFIG_DIR)
|
||||||
config_file = deluge.common.CONFIG_DIR + "/prefs.state"
|
config_file = deluge.common.CONFIG_DIR + "/prefs.state"
|
||||||
self.config = deluge.pref.Preferences(config_file, False,
|
self.config = deluge.pref.Preferences(config_file, False,
|
||||||
defaults={"listen_on" : [6881,6889],
|
defaults={"listen_on" : [6881,6889],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user