def install(self): rpmfusion = all([ self.check_package(pack) for pack in ["rpmfusion-nonfree-release", "rpmfusion-free-release"] ]) to_install = [ pack for pack in all_package if not self.check_package(pack) ] + ["kernel", "kernel-devel", "kernel-headers", "@c-development"] to_install = " ".join(to_install) commands = [ "dnf remove VirtualBox-5.0 VirtualBox-5.1 VirtualBox-5.2 VirtualBox-5.3 VirtualBox-6.0 VirtualBox-6.1 VirtualBox-6.2 VirtualBox-6.3 VirtualBox-6.4 --setopt=clean_requirements_on_remove=False \ --setop=strict=False -y --best", "dnf install {} -y --best".format(to_install), "usermod -G vboxusers -a $USER" ] if not rpmfusion: d_version = self.get_distro_version() command_to_install_rpmfusion = "dnf install --best -y --nogpgcheck \ http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-{}.noarch.rpm \ http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-{}.noarch.rpm".format( d_version, d_version) commands.insert(0, command_to_install_rpmfusion) to_run = write_to_tmp(commands) if subprocess.call("pkexec bash {}".format(to_run), shell=True) == 0: return True return False
def remove(self): commands = [ "chmod 755 /opt/xdman/uninstall.sh", "/opt/xdman/uninstall.sh" ] to_run = write_to_tmp(commands) if subprocess.call("pkexec bash {}".format(to_run), shell=True) != 0: return False return True
def install(self): if self.check_package(repo_package): commands = ["dnf install flash-plugin -y --best"] else: commands = command_install + ["dnf install flash-plugin -y --best"] to_run = write_to_tmp(commands) if subprocess.call("pkexec bash {}".format(to_run),shell=True)==0: return True return False
def remove(self): link_icon = "https://static.4kdownload.com/main/img/redesign/videodownloader.b9996289c0e2.svg" commands = ["rm -rf /opt/4kvideodownloader"] for f in ["/usr/share/applications/4kvideodownloader.desktop","/usr/share/pixmaps/{}".format(os.path.basename(link_icon))]: if os.path.isfile(f): commands.append("rm {}".format(f)) to_run = write_to_tmp(commands) if subprocess.call("pkexec bash {}".format(to_run),shell=True)!=0: return False return True
def install(self): if os.path.isfile("/etc/yum.repos.d/opera.repo"): commands = ["dnf install opera-stable -y --best"] else: commands = [ "echo -e '[opera]\nname=Opera packages\ntype=rpm-md\nbaseurl=https://rpm.opera.com/rpm\ngpgcheck=1\ngpgkey=https://rpm.opera.com/rpmrepo.key\nenabled=1' > /etc/yum.repos.d/opera.repo", "dnf install opera-stable -y --best" ] to_run = write_to_tmp(commands) if subprocess.call("pkexec bash {}".format(to_run), shell=True) == 0: return True return False
def install(self): temp = tempfile.gettempdir() packs = [pack for pack in all_package_to_install if not self.check_package(pack)] if packs: packs = " ".join([pack for pack in packs]) commands = ["dnf install {} --best -y".format(packs)] to_run = write_to_tmp(commands) if subprocess.call("pkexec bash {}".format(to_run),shell=True)!=0: return False if os.path.isfile(os.path.join(location,"bin","komodo")) and os.path.isfile(os.path.join(location_bin,"komodo")): return True link_pro = self.get_komodo_downlaod_link() if not link_pro: print("Get Download Link Failed.") return False try: os.makedirs(location,exist_ok=True) except: print("Makedir {} Failed.".format(location)) return False pro_saveas = self.__download(link_pro,temp) if not pro_saveas: print("Download Failed.") return False if subprocess.call("tar -xvzf {} -C {}".format(pro_saveas,temp),shell=True) != 0: print("'tar -xvzf {} -C {}' Failed.".format(pro_saveas,temp)) return False folder_name = os.path.basename(pro_saveas).rsplit(".",2)[0] install_file_location = os.path.join(temp,folder_name) old_cwd = os.getcwd() os.chdir(install_file_location) if subprocess.call("chmod 755 install.sh",shell=True)!=0: print("'chmod 755 install.sh' Failed.") os.chdir(old_cwd) return False if subprocess.call("./install.sh -I {}".format(location),shell=True) != 0 : print("Install To {} Failed.".format(location)) os.chdir(old_cwd) return False os.chdir(old_cwd) try: os.makedirs(location_bin,exist_ok=True) except Exception as e: print(e) return False if subprocess.call("ln -sf {} {}".format(os.path.join(location,"bin","komodo"),os.path.join(location_bin,"komodo")),shell=True)!=0: print("'ln -sf {} {}' Failed.".format(os.path.join(location,"bin","komodo"),os.path.join(location_bin,"komodo"))) return False return True
def install(self): to_install = [ pack for pack in all_package if not self.check_package(pack) ] to_install = " ".join(to_install) commands = [ "dnf install {} -y --best".format(to_install), "firewall-cmd --zone=$(firewall-cmd --get-default-zone) --add-service=kde-connect --permanent", "firewall-cmd --reload" ] to_run = write_to_tmp(commands) if subprocess.call("pkexec bash {}".format(to_run), shell=True) == 0: return True return False
def install(self): temp = tempfile.gettempdir() link_pro = "https://dl.4kdownload.com/app/4kvideodownloader_4.4.11_amd64.tar.bz2" link_icon = "https://static.4kdownload.com/main/img/redesign/videodownloader.b9996289c0e2.svg" pro_saveas = self.__download(link_pro,temp) if not pro_saveas: print("Download Failed.") return False icon_saveas = self.__download(link_icon,temp) if not icon_saveas: print("Download Failed.") return False old_dir = os.getcwd() os.chdir(temp) if subprocess.call("tar jxf {}".format(pro_saveas),shell=True)!=0: print("Extract {} Failed.".format(pro_saveas)) os.chdir(old_dir) return False os.chdir(old_dir) folder_files = os.path.join(temp,"4kvideodownloader") desktop_file = os.path.join(temp,"4kvideodownloader.desktop") desktop_to_write = """[Desktop Entry] Encoding=UTF-8 Name=4kvideodownloader GenericName=youtube Comment=Start 4kvideodownloader Exec=/opt/4kvideodownloader/4kvideodownloader.sh Icon={} Terminal=false Type=Application Categories=AudioVideo;Player; StartupNotify=false """.format(os.path.basename(link_icon)) with open(desktop_file,"w") as mf: mf.write(desktop_to_write) commands = ["cp -r {} /opt".format(folder_files), "cp {} /usr/share/applications".format(desktop_file), "cp {} /usr/share/pixmaps".format(icon_saveas), "chmod 755 /opt/4kvideodownloader/4kvideodownloader-bin", "chmod 755 /opt/4kvideodownloader/4kvideodownloader.sh"] to_run = write_to_tmp(commands) if subprocess.call("pkexec bash {}".format(to_run),shell=True)!=0: return False return True
def install(self): to_install = [ pack for pack in all_package if not self.check_package(pack) ] to_install = " ".join(to_install) if os.path.isfile( "/etc/yum.repos.d/_copr_youssefmsourani-sgvrecord.repo"): commands = ["dnf install {} -y --best".format(to_install)] else: commands = [ "dnf copr enable youssefmsourani/sgvrecord -y", "dnf install {} -y --best".format(to_install) ] to_run = write_to_tmp(commands) if subprocess.call("pkexec bash {}".format(to_run), shell=True) == 0: return True return False
def install(self): rpmfusion = all([ self.check_package(pack) for pack in ["rpmfusion-nonfree-release", "rpmfusion-free-release"]]) to_install = [pack for pack in all_package if not self.check_package(pack)] to_install = " ".join(to_install) commands = ["dnf install {} -y --best".format(to_install)] if not rpmfusion: d_version = self.get_distro_version() command_to_install_rpmfusion = "dnf install --best -y --nogpgcheck \ http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-{}.noarch.rpm \ http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-{}.noarch.rpm".format(d_version,d_version) commands.insert(0,command_to_install_rpmfusion) if self.check_package("audacity"): commands.insert(0,"rpm -v --nodeps -e audacity") to_run = write_to_tmp(commands) if subprocess.call("pkexec bash {}".format(to_run),shell=True)==0: return True return False
def install(self): packs = [ pack for pack in all_package_to_install if not self.check_package(pack) ] if packs: packs = " ".join([pack for pack in packs]) commands = ["dnf install {} --best -y".format(packs)] to_run = write_to_tmp(commands) if subprocess.call("pkexec bash {}".format(to_run), shell=True) != 0: return False if os.path.isfile("{}/bin/netbeans".format(location)): return True link_pro = "http://download.netbeans.org/netbeans/8.2/final/bundles/netbeans-8.2-linux.sh" try: os.makedirs(location, exist_ok=True) except: print("Makedir {} Failed.".format(location)) return False pro_saveas = self.__download(link_pro, tempfile.gettempdir()) if not pro_saveas: print("Download Failed.") return False if subprocess.call("chmod 755 {}".format(pro_saveas), shell=True) != 0: print("'chmod 755 {}' Failed.".format(pro_saveas)) return False if subprocess.call( "{} --silent \"-J-Dnb-base.installation.location={}\" \"-J-Dnb-base.jdk.location=/usr/lib/jvm/java-1.8.0-openjdk\" " .format(pro_saveas, location), shell=True) != 0: print("Install To {} Failed.".format(location)) return False return True
def __download(self, link, location): GLib.idle_add(self.__mainbox__.pack_start, self.__progressbar__, True, True, 0) GLib.idle_add(self.__progressbar__.set_show_text, True) GLib.idle_add(self.__progressbar__.show) try: url = request.Request(link, headers={"User-Agent": "Mozilla/5.0"}) opurl = request.urlopen(url, timeout=10) try: saveas = opurl.headers["Content-Disposition"].split("=", 1)[-1] except Exception as e: #print(e) saveas = os.path.basename(opurl.url) saveas = os.path.join(location, saveas) if os.path.isfile(saveas): q = queue.Queue() GLib.idle_add( self.yesorno__, "An older file with same location '{}' already exists, Remove it?" .format(saveas), q) while q.empty(): pass if q.get(): subprocess.call("rm -rf {}".format(saveas), shell=True) if os.path.isfile("/etc/fedora-release"): packs = [ pack for pack in all_package_to_install if not self.check_package(pack) ] if packs: packs = " ".join([pack for pack in packs]) commands = ["dnf install {} --best -y".format(packs)] to_run = write_to_tmp(commands) if subprocess.call("pkexec bash {}".format(to_run), shell=True) != 0: GLib.idle_add(self.__progressbar__.set_fraction, 0.0) GLib.idle_add(self.__progressbar__.set_text, "Fail") GLib.idle_add(self.__mainbox__.remove, self.__progressbar__) return False if os.path.isfile(saveas): GLib.idle_add(self.__progressbar__.set_fraction, 1.0) GLib.idle_add(self.__progressbar__.set_text, "{} Already Exists".format(saveas)) GLib.idle_add(self.__mainbox__.remove, self.__progressbar__) return saveas else: size = int(opurl.headers["Content-Length"]) psize = 0 with open(saveas, 'wb') as op: while True: chunk = opurl.read(600) if not chunk: break count = int((psize * 100) // size) fraction = count / 100 op.write(chunk) psize += 600 GLib.idle_add(self.__progressbar__.set_fraction, fraction) GLib.idle_add(self.__progressbar__.set_text, "Downloading " + str(count) + "%") GLib.idle_add(self.__progressbar__.set_fraction, 1.0) GLib.idle_add(self.__progressbar__.set_text, "Done") except Exception as e: print(e) GLib.idle_add(self.__progressbar__.set_fraction, 0.0) GLib.idle_add(self.__progressbar__.set_text, "Fail") GLib.idle_add(self.__mainbox__.remove, self.__progressbar__) return False GLib.idle_add(self.__mainbox__.remove, self.__progressbar__) return saveas