def run(self): while True: sleep(1 / self.RefreshRate) syscall('clear') print('Current dir: ', self.scanner.get_status()['currentDir']) print('Has scanner finished?: ', str(self.scanner.get_status()['done'])) for i in range(len(self.inputs)): print(self.inputs[i][plotter.Name]) data = self.inputs[i][plotter.Q].get(block=True) # Assumes that input list was built with DCT input on index 1 if i == 1: # Adjusting gain the_step = self.Step * self.TotalBars else: the_step = self.Step print_data(data, self.MaxPix, the_step, self.TotalBars) print( "The mean is: ", mean(data), ) print("-------------------------") self.inputs[i][plotter.Q].task_done()
def install_dotnet(): from . import stuff if (syscall( 'wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb' )) != 0: stuff.sysERR() print('%sCan\'t install .NET (only for *UBUNTU 20.04 ) \n ' % stuff.RED) elif (syscall('sudo dpkg -i packages-microsoft-prod.deb')) != 0: stuff.sysERR() print('%sCan\'t install .NET (only for *UBUNTU 20.04 ) \n ' % stuff.RED) elif (syscall('sudo apt update')) != 0: stuff.sysERR() print('%sCan\'t install .NET (only for *UBUNTU 20.04 ) \n ' % stuff.RED) elif (syscall('sudo apt install -y apt-transport-https')) != 0: stuff.sysERR() print('%sCan\'t install .NET (only for *UBUNTU 20.04 ) \n ' % stuff.RED) elif (syscall('sudo apt update')) != 0: stuff.sysERR() print('%sCan\'t install .NET (only for *UBUNTU 20.04 ) \n ' % stuff.RED) elif (syscall(' sudo apt install -y dotnet-sdk-3.1')) != 0: stuff.sysERR() print('%sCan\'t install .NET (only for *UBUNTU 20.04 ) \n ' % stuff.RED) elif (syscall('sudo apt install -y aspnetcore-runtime-3.1')) != 0: stuff.sysERR() print('%sCan\'t install .NET (only for *UBUNTU 20.04 ) \n ' % stuff.RED) elif (syscall('sudo apt install -y dotnet-runtime-3.1')) != 0: stuff.sysERR() print('%sCan\'t install .NET (only for *UBUNTU 20.04 ) \n ' % stuff.RED) elif (syscall('sudo apt install -y mono-complete')) != 0: stuff.sysERR() print('%sCan\'t install .NET (only for *UBUNTU 20.04 ) ' % stuff.RED) elif (syscall('sudo apt update')) != 0: stuff.sysERR() print('%sCan\'t install .NET (only for *UBUNTU 20.04 ) ' % stuff.RED) else: stuff.sysOk() print( '%s.NET(microsoft dotnet and MCS compiler (LINUX platform) ) installed ' % stuff.GRN)
def main(args: list, pipe: bool) -> Result: args, parser = parse_args(args) if parser.error_message: return output(f"{__COMMAND__}: {parser.error_message}", pipe, success=False) # If we specific -h/--help, args will be empty, so exit gracefully if not args: return output("", pipe) else: if args.version: return output(f"{__COMMAND__} (blackhat coreutils) {__VERSION__}", pipe) if system() == "Windows": syscall("cls") else: syscall("clear") return output("", pipe)
def uninstall_dotnet(): from . import stuff if (syscall('sudo apt update')) != 0: stuff.sysERR() print('%sCan\'t remove .NET (only for *UBUNTU 20.04 ) \n ' % stuff.RED) elif (syscall('sudo apt purge -y apt-transport-https')) != 0: stuff.sysERR() print('%sCan\'t remove .NET (only for *UBUNTU 20.04 ) \n ' % stuff.RED) elif (syscall('sudo apt update')) != 0: stuff.sysERR() print('%sCan\'t remove .NET (only for *UBUNTU 20.04 ) \n ' % stuff.RED) elif (syscall(' sudo apt purge -y dotnet-sdk-3.1')) != 0: stuff.sysERR() print('%sCan\'t remove .NET (only for *UBUNTU 20.04 ) \n ' % stuff.RED) elif (syscall('sudo apt purge -y aspnetcore-runtime-3.1')) != 0: stuff.sysERR() print('%sCan\'t remove .NET (only for *UBUNTU 20.04 ) \n ' % stuff.RED) elif (syscall('sudo apt purge -y dotnet-runtime-3.1')) != 0: stuff.sysERR() print('%sCan\'t remove .NET (only for *UBUNTU 20.04 ) \n ' % stuff.RED) elif (syscall('sudo apt purge -y mono-complete')) != 0: stuff.sysERR() print('%sCan\'t remove .NET (only for *UBUNTU 20.04 ) ' % stuff.RED) elif (syscall( 'sudo apt update && sudo apt full-upgrade ; sudo apt autoremove -y' )) != 0: stuff.sysERR() print('%sCan\'t remove .NET (only for *UBUNTU 20.04 ) ' % stuff.RED) else: stuff.sysOk() print( '%s.NET(microsoft dotnet and MCS compiler (LINUX platform) ) reomved ' % stuff.GRN)
def wine_installer(): from os import system as syscall from os import getenv, chdir from . import stuff syscall("sudo apt update && sudo apt full-upgrade") home = getenv("HOME") chdir(home) if (syscall(""" sudo dpkg --add-architecture i386; wget -nc https://dl.winehq.org/wine-builds/winehq.key; sudo apt-key add winehq.key; sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main' ; sudo apt install --install-recommends winehq-stable; """)) != 0: print(f"{stuff.sysERR()}{stuff.NRM}") else: syscall("clear") print(stuff.sysOk()) print(f"{stuff.GRN}wine version :") syscall(f"wine --version && echo {stuff.NRM}")
def bar(): # 20% PROGRESS progress['value'] = 20 root.update_idletasks() time.sleep(1) print('Unlinking pck3r (if was installed) ') syscall('sudo unlink /bin/pck3r ') syscall('sudo rm -rf /bin/pck3r*') # 40% PROGRESS progress['value'] = 40 root.update_idletasks() time.sleep(1) syscall('rm -rf ~/.pck3r && sudo rm -rf /root/.pck3r') if (syscall( 'echo %s ; ls ~/.pck3r' % stuff.CYN)) == 0 else print('%sCopy all pck3r directory %s' % (stuff.CYN, stuff.NRM)) syscall('mkdir ~/.pck3r') syscall('cp -rf . ~/.pck3r') syscall('sudo cp -rf . /root/.pck3r') # 50% PROGRESS progress['value'] = 50 root.update_idletasks() time.sleep(1) syscall(make_link) # 60% PROGRESS progress['value'] = 60 root.update_idletasks() time.sleep(1) print('%sCheck link ' % stuff.YEL) print('Link created ') if (syscall('ls -l /bin/pck3r')) == 0 else print( '%s%sNo link (/bin/pck3r)%s ' % (stuff.sysOk(), stuff.RED, stuff.NRM)) progress['value'] = 80 root.update_idletasks() time.sleep(1) # 100% PROGRESS progress['value'] = 100 print('%s%sPck3r installed successfuly %s' % (stuff.sysOk(), stuff.GRN, stuff.NRM)) root.quit()
argc = len(argv) for i in range(argc): # if user just type $ pck3r if argc <= 1: print('%s%sCommand not found !%s\nPlease try:\n$ pck3r help %s' % (stuff.sysERR(), stuff.RED, stuff.CYN, stuff.NRM)) else: # if argument 1 equal to "clear" # clear terminal # do : if argv[1] == 'clear' and argc == 2: syscall('clear') print('%sThis is funny clear command :D ' % stuff.sysOk()) # pck3r updator elif argv[1] == 'update' and argc == 2: chdir('%s/.pck3r' % getenv('HOME')) print('%s/.pck3r/./updator' % getenv('HOME')) syscall('./updator') # if argument 1 equal to "help" # like -> $ pck3r help # do : elif argv[1] == 'help' and argc == 2:
def quit(code): syscall("rm -rfd __pycache__") exit(code)
#!/usr/bin/python3 from os import system as syscall syscall('sudo apt install -f') # fix all broken packages from os import getenv import tkinter as tk from tkinter import ttk from PIL import Image, ImageTk syscall('mkdir -p ~/.heimdallr/ ; cp -rf .. %s/.heimdallr/' % getenv('HOME')) root = tk.Tk() progress = ttk.Progressbar(root, length=100, mode='determinate') def installer_heimdallr(): import time progress['value'] = 20 root.update_idletasks() time.sleep(0.4) syscall('make') syscall('sudo cp heimdallr /usr/bin/') syscall('sudo cp heimdallr-update /usr/bin/') progress['value'] = 50 root.update_idletasks() time.sleep(0.4) syscall('sudo cp -rf ../xdg/heimdallr.desktop /usr/share/applications') syscall('cp -rf ../xdg/heimdallr.desktop ~/.local/share/applications') progress['value'] = 70 root.update_idletasks()
if __name__ == '__main__': print(""" This is a module not an executeable program Alternative command : $ python3 core_pck3r.py OR $ python3 installer.py OR $ chmod 755 core_pck3r.py ; ./core_pck3r.py And for installing : $ chmod 755 installer.py ; ./installer.py """) else: from . import stuff from . import wine from os import system as syscall from os import chdir, getenv chdir(getenv('HOME')) print(f'{stuff.YEL}') syscall('wget "https://archive.org/download/flstudio_202103/flstudio.exe"') print(f'{stuff.NRM}') syscall('wine flstudio.exe')
def process(args, opt, cache_dir): if args[0] == "setup": repo = CmsPkg(opt.jobs) repo.setup(cmspkg_tag, script_path) return if args[0]=="rpm": cmd = rpm_env+" ; "+args[0] for a in args[1:]: cmd+=" '"+a+"'" if syscall(cmd)>0: exit(1) if args[0] in ["rpmenv", "env"]: cmd = rpm_env+" ; "+args[1] for a in args[2:]: cmd+=" '"+a+"'" if syscall(cmd)>0: exit(1) if not exists (cache_dir): makedirs(cache_dir,True) err, out = run_cmd("touch %s/check.write.permission && rm -f %s/check.write.permission" % (cache_dir, cache_dir), exit_on_error=False) if err: cmspkg_print("Error: You do not have write permission for installation area %s" % opts.install_prefix) exit(1) lock = None if args[0] not in ["download"]: lock = cmsLock(cache_dir) if not lock: cmspkg_print("Error: Unable to obtain lock, there is already a process running") return if True: repo = CmsPkg(opt.jobs) if args[0] == "update": repo.update(force=opts.force) elif args[0] == "clean": repo.clean() elif args[0] in ["install","reinstall"]: cDebug = opts.debug opts.debug = False updateForce=False if not exists (join(cache_dir , "active")): updateForce=True repo.update(force=updateForce, silent=True) opts.debug = cDebug for pkg in args[1:]: repo.install(pkg, reinstall=opts.reinstall, force=opts.force) elif args[0] in ["download"]: cDebug = opts.debug opts.debug = False updateForce=False if not exists (join(cache_dir , "active")): updateForce=True repo.update(force=updateForce, silent=True) opts.debug = cDebug for pkg in args[1:]: repo.download(pkg) elif args[0] in ["remove"]: for pkg in args[1:]: repo.remove(pkg) if opts.dist_clean: repo.dist_clean() elif args[0] in ["dist-clean"]: repo.dist_clean() elif args[0] in ["clone"]: repo.update(force=opts.force) repo.clone(opts.install_prefix) elif args[0] == "search": if not exists (join(cache_dir , "active")): repo.update(True) pkg = "" if len(args)==2: pkg =args[1] repo.search(pkg, exact=opts.force) elif args[0] == "showpkg": if not exists (join(cache_dir , "active")): repo.update(True) repo.showpkg(args[1]) elif args[0] == "depends": if not exists (join(cache_dir , "active")): repo.update(True) repo.depends(args[1]) elif args[0] == "show": if not exists (join(cache_dir , "active")): repo.update(True) repo.show(args[1]) elif args[0] == "upgrade": repo.upgrade()
def install(self, package, reinstall=False, force=False): if not self.cache: cmspkg_print("Reading Package Lists...") self.cache = pkgCache() #Error is unknow package if not package in self.cache.packs: cmspkg_print("error: unknown pakcage: %s" % package) exit(1) #Read rpm database self.update_rpm_cache() pk = self.package_data(package, reinstall) if (not reinstall) and (not pk): cmspkg_print("%s is already the newest version.\n0 upgraded, 0 newly installed, 0 removed and 0 not upgraded." % package) package_installed(package) return #make sure that rpm download directory is available makedirs(join(rpm_download,rpm_partial),True) #download the package if not self.downloader.run([pk]): exit(1) deps={} npkgs = [] #Find out package dependencies cmspkg_print("Building Dependency Tree...") for d in get_pkg_deps(pk[1])+pk[4]: if d in deps: continue p = self.package_data(d) deps[d] = p if p: npkgs.append(d) npkgs.sort() pkg_to_install = " "+package+"\n "+"\n ".join(npkgs) cmspkg_print("The following NEW packages will be installed:") cmspkg_print(pkg_to_install) pkg_len = len(npkgs)+1 cmspkg_print("0 upgraded, %s newly installed, 0 removed and 0 not upgraded." % pkg_len) #If not force and there are extra packages to install then ask user to confirm if (not force) and (pkg_len>1): ask_user_to_continue("Continue installation (Y/n): ") #download all the dependencies of the package self.download_deps (sorted(deps), deps) pkg_to_install = pk[1] size_compress, size_uncompress = self.package_size (pk[1]) for d in [p[1] for p in deps.values() if p]: s1, s2 = self.package_size(d) size_compress += s1 size_uncompress += s2 pkg_to_install += " "+d cmspkg_print("Downloaded %s of archives." % human_readable_size(size_compress)) cmspkg_print( "After unpacking %s of additional disk space will be used." % human_readable_size(size_uncompress)) ex_opts = ['-U', '-v', '-h', '-r %s' % opts.install_prefix, '--prefix %s' % opts.install_prefix, '--force', '--ignoreos', '--ignorearch', '--oldpackage'] if reinstall and (package in self.rpm_cache): ex_opts += ['--replacepkgs', '--replacefiles', '--nodeps'] if opts.IgnoreSize: ex_opts.append('--ignoresize') rcmd = "%s; rpm %s" % (rpm_env, getRPMOptions(ex_opts, opts)) cmspkg_print("Executing RPM (%s)..." % rcmd) cmd = "cd %s && %s %s" %(rpm_download, rcmd, pkg_to_install) #Install the nwly downloaded packages(s) if syscall(cmd)>0: exit(1) self.update_rpm_cache(True) if package in self.rpm_cache: package_installed(package) self.clean() return
(update to last release from github.com/amzy-0/pck3r) \"minecraft\" command : $ pck3r minecraft (minecraft runner) "version" command : $ pck3r version (this command show pck3r version) %s """ % (stuff.YEL, stuff.NRM) # pck3r heart runner if (syscall(' %s/.pck3r/scripts/./pck3r-heart.rb' % getenv('HOME'))) == 0: print(message) syscall('~/.pck3r/scripts/./pck3r-heart.rb') # if ruby not installed else: print('%sdependency detected : ruby-full%s' % (stuff.YEL, stuff.NRM)) syscall('sudo apt install ruby-full') syscall('clear') print(message) syscall('~/.pck3r/scripts/./pck3r-heart.rb')
def process(args, opt, cache_dir): if args[0] == "setup": repo = CmsPkg(opt.jobs) repo.setup(cmspkg_tag, script_path) return if args[0]=="rpm": cmd = rpm_env+" ; "+args[0] for a in args[1:]: cmd+=" '"+a+"'" if syscall(cmd)>0: exit(1) if args[0] in ["rpmenv", "env"]: cmd = rpm_env+" ; "+args[1] for a in args[2:]: cmd+=" '"+a+"'" if syscall(cmd)>0: exit(1) if not exists (cache_dir): makedirs(cache_dir,True) err, out = run_cmd("touch %s/check.write.permission && rm -f %s/check.write.permission" % (cache_dir, cache_dir), exit_on_error=False) if err: cmspkg_print("Error: You do not have write permission for installation area %s" % opts.install_prefix) exit(1) lock = cmsLock(cache_dir) if not lock: cmspkg_print("Error: Unable to obtain lock, there is already a process running") return if True: repo = CmsPkg(opt.jobs) if args[0] == "update": repo.update(force=opts.force) elif args[0] == "clean": repo.clean() elif args[0] in ["install","reinstall"]: cDebug = opts.debug opts.debug = False updateForce=False if not exists (join(cache_dir , "active")): updateForce=True repo.update(force=updateForce, silent=True) opts.debug = cDebug for pkg in args[1:]: repo.install(pkg, reinstall=opts.reinstall, force=opts.force) elif args[0] in ["download"]: cDebug = opts.debug opts.debug = False updateForce=False if not exists (join(cache_dir , "active")): updateForce=True repo.update(force=updateForce, silent=True) opts.debug = cDebug for pkg in args[1:]: repo.download(pkg) elif args[0] in ["remove"]: for pkg in args[1:]: repo.remove(pkg) if opts.dist_clean: repo.dist_clean() elif args[0] in ["dist-clean"]: repo.dist_clean() elif args[0] in ["clone"]: repo.update(force=opts.force) repo.clone(opts.install_prefix) elif args[0] == "search": if not exists (join(cache_dir , "active")): repo.update(True) pkg = "" if len(args)==2: pkg =args[1] repo.search(pkg, exact=opts.force) elif args[0] == "showpkg": if not exists (join(cache_dir , "active")): repo.update(True) repo.showpkg(args[1]) elif args[0] == "depends": if not exists (join(cache_dir , "active")): repo.update(True) repo.depends(args[1]) elif args[0] == "show": if not exists (join(cache_dir , "active")): repo.update(True) repo.show(args[1]) elif args[0] == "upgrade": repo.upgrade()
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ''' from os import system as syscall syscall('#sudo pacman -Syyu ; ') # update and upgrade syscall('sudo pip3 install tkintertable ; ') from os import getenv import tkinter as tk from tkinter import ttk from PIL import Image, ImageTk syscall('mkdir -p ~/.heimdallr/makefile/ ; cp -rf ../* %s/.heimdallr/' % getenv('HOME')) syscall('cp -rf ../.git* %s/.heimdallr/' % getenv('HOME')) syscall('cp -rf Makefile %s/.heimdallr/makefile/' % getenv('HOME')) root = tk.Tk() progress = ttk.Progressbar(root, length=100, mode='determinate') def installer_heimdallr():
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ __authors__ = [ 'M.Amin Azimi .K (amzy-0)', 'mehrzero', 'https://github.com/amzy-0/pck3r/graphs/contributors' ] from libs import stuff from os import getcwd, getenv, chdir from os import system as syscall ############################################################################### # preinstall requirements # syscall( 'mkdir -p ~/.pck3r/icon ; cp -rf ./icon/pck3r-logo.png ~/.pck3r/icon') # syscall('sudo apt install python3-tk -y') # syscall('sudo apt install python3-pil python3-pil.imagetk -y') # syscall('sudo apt install g++ -y') # ############################################################################### import tkinter as tk from tkinter.ttk import * import time from PIL import ImageTk, Image # creating tkinter window root = tk.Tk() make_link = 'sudo ln -s %s/.pck3r/core_pck3r.py /bin/pck3r' % getenv('HOME') # Progress bar widget
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ''' from os import system as syscall # syscall('sudo apt install -f') # fix all broken packages from os import getenv import tkinter as tk from tkinter import ttk from PIL import Image, ImageTk syscall('mkdir -p ~/.heimdallr/makefile/ ; cp -rf ../* %s/.heimdallr/' % getenv('HOME')) syscall('cp -rf ../.git* %s/.heimdallr/' % getenv('HOME')) syscall('cp -rf Makefile %s/.heimdallr/makefile/' % getenv('HOME')) root = tk.Tk() progress = ttk.Progressbar(root, length = 100, mode = 'determinate') # def installer_heimdallr(): import time # progress['value'] = 20 root.update_idletasks() time.sleep(0.4) syscall('make') syscall('sudo cp heimdallr /usr/bin/') syscall('sudo cp heimdallr-update /usr/bin/')
you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ''' from os import system as syscall syscall('sudo dnf install 2> /dev/null') # fix all broken packages syscall('pip install Pillow') syscall(''' python3 -m pip install --upgrade pip ; python3 -m pip install --upgrade Pillow ''') from os import getenv import tkinter as tk from tkinter import ttk from PIL import Image, ImageTk syscall('mkdir -p ~/.heimdallr/makefile/ ; cp -rf ../* %s/.heimdallr/' % getenv('HOME')) syscall('cp -rf ../.git* %s/.heimdallr/' % getenv('HOME')) syscall('cp -rf Makefile %s/.heimdallr/makefile/' % getenv('HOME')) root = tk.Tk()
def installer_heimdallr(): import time progress['value'] = 20 root.update_idletasks() time.sleep(0.4) syscall('make') syscall('sudo cp heimdallr /usr/bin/') syscall('sudo cp heimdallr-update /usr/bin/') progress['value'] = 50 root.update_idletasks() time.sleep(0.4) syscall('sudo cp -rf ../xdg/heimdallr.desktop /usr/share/applications') syscall('cp -rf ../xdg/heimdallr.desktop ~/.local/share/applications') progress['value'] = 70 root.update_idletasks() time.sleep(0.4) syscall( "sudo cp -rf ../icon/heimdallr.png /usr/share/icons/hicolor/256x256/apps/" ) syscall( "sudo cp -rf ../icon/heimdallr.png /usr/share/icons/hicolor/256x256/apps/" ) syscall("sudo cp -rf ../icon/heimdallr.png /usr/share/icons/") progress['value'] = 100 root.update_idletasks() time.sleep(0.4) syscall('zenity --info --title Heimdallr --text "Heimdallr installed !"') exit(0)
def rmdirs(*dirnames): for d in dirnames: assert os.path.normpath(d.strip()) not in ['.', '', '/'] os.syscall('rm -rf {}'.format(' '.join(dirnames)))