def detach(mountpoint): args = { "hdiutil": cmd_hdiutil, "mountpoint": mountpoint } cmd = "{hdiutil} detach {mountpoint}".format(**args) local(cmd)
def attach(dmg_path, mountpoint): args = { "hdiutil": cmd_hdiutil, "dmg_path": dmg_path, "mountpoint": mountpoint } cmd = "{hdiutil} attach {dmg_path} -mountpoint {mountpoint}".format(**args) local(cmd)
def launch_firefox(profile_path, channel): """ This function will rely on the other functions (download, install, profile) having successfully done their business. """ FIREFOX_APP_BIN = env.get(channel, 'PATH_FIREFOX_BIN_ENV') print("Launching Firefox {0} with profile: {1}".format( channel, profile_path)) cmd = '"{0}" -profile "{1}"'.format(FIREFOX_APP_BIN, profile_path) local(cmd)
def launch_firefox(profile_path, channel): """ This function will rely on the other functions (download, install, profile) having successfully done their business. """ FIREFOX_APP_BIN = env.get(channel, 'PATH_FIREFOX_BIN_ENV') print("Launching Firefox {0} with profile: {1}".format( channel, profile_path) ) cmd = '"{0}" -profile "{1}"'.format(FIREFOX_APP_BIN, profile_path) local(cmd)
def uninstall_channel(self, channel, force=False): was_cached = self.cache.config.getboolean("cached", channel) if force or not was_cached: path_firefox_app = self.config.get(channel, "PATH_FIREFOX_APP") if not os.path.isdir(path_firefox_app): print(('Firefox not found: {0}'.format(path_firefox_app))) return # If we're on Windows/Cygwin, use the uninstaller. if self.config.is_windows(): local("\"{0}/uninstall/helper.exe\" -ms".format(path_firefox_app)) # NOQA # Otherwise just `rm -rf` the Firefox folder. else: rimraf(path_firefox_app, False) else: print(("[%s] was cached, skipping uninstall." % (channel)))
def uninstall_channel(self, channel, force=False): was_cached = self.cache.config.getboolean("cached", channel) if force or not was_cached: path_firefox_app = self.config.get(channel, "PATH_FIREFOX_APP") if not os.path.isdir(path_firefox_app): print(('Firefox not found: {0}'.format(path_firefox_app))) return # If we're on Windows/Cygwin, use the uninstaller. if self.config.is_windows(): local("\"{0}/uninstall/helper.exe\" -ms".format( path_firefox_app)) # NOQA # Otherwise just `rm -rf` the Firefox folder. else: rimraf(path_firefox_app, False) else: print(("[%s] was cached, skipping uninstall." % (channel)))
def install(channel): if channel == 'ALL': install_all() return install_dir = env.get(channel, 'PATH_FIREFOX_APP') filename = env.get(channel, 'DOWNLOAD_FILENAME') installer = os.path.join(BASE_DIR, filename) if IniHandler.is_linux(): local('tar -jxf {0} && mv firefox {1}'.format(installer, install_dir)) # NOQA elif IniHandler.is_windows(): chmodx(installer) local('{0} -ms'.format(installer)) if channel == 'beta': # Since Beta and General Release channels install # to the same directory, install Beta first then # rename the directory. release_install_dir = env.config.get('release', 'PATH_FIREFOX_APP') local('mv {0} {1}'.format(release_install_dir, install_dir)) elif IniHandler.is_mac(): from hdiutil import extract_dmg app_src_filename = env.get(channel, "APP_SRC_FILENAME") app_dest_filename = env.get(channel, "APP_DEST_FILENAME") extract_dmg(installer, app_src_filename, app_dest_filename, channel) try: firefox_version = get_firefox_version(channel) except: print("YOU FAIL") exit() Log.header("Installed {0} ({1})".format(firefox_version, channel))
""" NOTE: THIS IS AN OSX SPECIFIC FILE, SPECIFICALLY FOR MOUNTING DMG FILES. """ import os import shutil from fftool import local cmd_hdiutil = local("which hdiutil") def attach(dmg_path, mountpoint): args = { "hdiutil": cmd_hdiutil, "dmg_path": dmg_path, "mountpoint": mountpoint } cmd = "{hdiutil} attach {dmg_path} -mountpoint {mountpoint}".format(**args) local(cmd) def detach(mountpoint): args = { "hdiutil": cmd_hdiutil, "mountpoint": mountpoint } cmd = "{hdiutil} detach {mountpoint}".format(**args) local(cmd)
def get_firefox_version(channel): path_firefox_bin = env.get(channel, "PATH_FIREFOX_BIN_ENV") cmd = '{0} --version'.format(path_firefox_bin) return local(cmd)