1
# -*- coding: utf-8 -*-
3
# Copyright 2012 Canonical Ltd.
5
# This program is free software: you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 3, as published
7
# by the Free Software Foundation.
9
# This program is distributed in the hope that it will be useful, but
10
# WITHOUT ANY WARRANTY; without even the implied warranties of
11
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12
# PURPOSE. See the GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License along
15
# with this program. If not, see <http://www.gnu.org/licenses/>.
17
"""Miscelaneous functions and constants for darwin."""
23
from twisted.internet import defer
25
from dirspec.basedir import save_config_path
26
from ubuntuone.controlpanel.logger import setup_logging
28
logger = setup_logging('utils.darwin')
29
AUTOUPDATE_BIN_NAME = 'autoupdate-darwin'
30
UNINSTALL_BIN_NAME = 'uninstall-darwin'
33
def add_to_autostart():
34
"""Add syncdaemon to the session's autostart."""
38
@defer.inlineCallbacks
39
def are_updates_present():
40
"""Return if there are updates for Ubuntu One."""
43
defer.returnValue(result)
46
def default_folders(user_home=None):
47
"""Return a list of the folders to add by default."""
53
def install_config_and_daemons():
54
"""Install required data files and fsevents daemon.
56
This function is a replacement for an installer. As such it is
57
required on first-run, but it's also called every time we start
58
up, in case anything has moved or been deleted.
61
# Do nothing if we are running from source:
62
if getattr(sys, 'frozen', None) is None:
65
main_app_dir = ''.join(__file__.partition('.app')[:-1])
66
main_app_resources_dir = os.path.join(main_app_dir,
70
config_path = save_config_path('ubuntuone')
72
conf_filenames = ['syncdaemon.conf',
74
for conf_filename in conf_filenames:
75
src_path = os.path.join(main_app_resources_dir,
77
dest_path = os.path.join(config_path,
80
if not os.path.exists(dest_path):
81
shutil.copyfile(src_path, dest_path)
85
"""Spawn the autoupdate process and call the stop function."""
89
def uninstall_application():
90
"""Uninstall Ubuntu One."""