def download_package_source( self, package_name, filenames_lst = None ): logme( 'ArchlinuxDistro - download_package_source() - starting' ) # self.update_status(( [ "Downloading %s package into %s OS" % ( package_name, self.name ) ] ) system_or_die( 'mkdir -p %s/%s/%s' % ( self.mountpoint, self.sources_basedir, package_name ) ) os.chdir( '%s/%s/%s' % ( self.mountpoint, self.sources_basedir, package_name ) ) if os.path.isfile( '%s/%s/%s/PKGBUILD' % ( self.mountpoint, self.sources_basedir, package_name ) ): self.update_status( '' ) # += "." # ..Still working" # No need to download anything. We have PKGBUILD already. elif filenames_lst in ( None, [] ): url = 'aur.archlinux.org/packages/%s/%s/%s.tar.gz' % ( package_name[:2], package_name, package_name ) wget( url = url, extract_to_path = '%s/%s' % ( self.mountpoint, self.sources_basedir ), quiet = True , title_str = self.title_str, status_lst = self.status_lst ) else: for fname in filenames_lst: file_to_download = '%s/%s/%s/%s' % ( self.mountpoint, self.sources_basedir, package_name, fname ) try: os.unlink( file_to_download ) except IOError: pass wget( url = 'http://projects.archlinux.org/svntogit/packages.git/plain/trunk/%s?h=packages/%s' \ % ( fname, package_name ), save_as_file = file_to_download, attempts = 20, quiet = True, title_str = self.title_str, status_lst = self.status_lst ) system_or_die( 'mv PKGBUILD PKGBUILD.ori' ) system_or_die( r"cat PKGBUILD.ori | sed s/march/phr34k/ | sed s/\'libutil-linux\'// | sed s/\'java-service-wrapper\'// | sed s/arch=\(.*/arch=\(\'%s\'\)/ | sed s/phr34k/march/ > PKGBUILD" % ( self.architecture ) ) chroot_this( self.mountpoint, 'chown -R guest %s/%s' % ( self.sources_basedir, package_name ) ) call_makepkg_or_die( mountpoint = self.mountpoint, \ package_path = '%s/%s' % ( self.sources_basedir, package_name ), \ cmd = 'cd %s/%s && makepkg --skipchecksums --nobuild -f' % ( self.sources_basedir, package_name ), errtxt = 'Failed to download %s' % ( package_name ) ) return 0
def install_barebones_root_filesystem( self ): unmount_sys_tmp_proc_n_dev( self.mountpoint ) system_or_die( '''curl https://www.offensive-security.com/kali-linux-vmware-arm-image-download/ | grep Samsung | cut -d'"' -f4 > /tmp/url.txt''' ) url = read_oneliner_file( '/tmp/url.txt' ) assert( url.find( 'xz' ) >= 0 ) wget( url = url, extract_to_path = self.mountpoint, decompression_flag = 'J', title_str = self.title_str, status_lst = self.status_lst, attempts = 1 ) mount_sys_tmp_proc_n_dev( self.mountpoint ) return 0
def install_barebones_root_filesystem( self ): logme( 'FedoraDistro - install_barebones_root_filesystem() - starting' ) unmount_sys_tmp_proc_n_dev( self.mountpoint ) wget( url = 'http://parasense.fedorapeople.org/remixes/chromebook/f19-chromebook-MATE.img.xz', extract_to_path = self.mountpoint, decompression_flag = 'J', title_str = self.title_str, status_lst = self.status_lst ) mount_sys_tmp_proc_n_dev( self.mountpoint ) failed( 'Exiting here for test porpoises' ) return 0
def install_barebones_root_filesystem( self ): logme( 'ArchlinuxDistro - install_barebones_root_filesystem() - starting' ) # wget( url = 'http://us.mirror.archlinuxarm.org/os/ArchLinuxARM-chromebook-latest.tar.gz', \ os.system( 'umount %s/dev &>/dev/null' % ( self.mountpoint ) ) my_url = 'http://us.mirror.archlinuxarm.org/os/ArchLinuxARM-chromebook-latest.tar.gz' # my_url = 'https://dl.dropboxusercontent.com/u/59916027/chrubix/skeletons/ArchLinuxARM-chromebook-latest.tar.gz' wget( url = my_url, \ extract_to_path = self.mountpoint, decompression_flag = 'z', \ title_str = self.title_str, status_lst = self.status_lst ) return 0
def install_barebones_root_filesystem(self): logme( 'ArchlinuxDistro - install_barebones_root_filesystem() - starting') # wget( url = 'http://us.mirror.archlinuxarm.org/os/ArchLinuxARM-chromebook-latest.tar.gz', \ os.system('umount %s/dev &>/dev/null' % (self.mountpoint)) my_url = 'http://us.mirror.archlinuxarm.org/os/ArchLinuxARM-chromebook-latest.tar.gz' # my_url = 'https://dl.dropboxusercontent.com/u/59916027/chrubix/skeletons/ArchLinuxARM-chromebook-latest.tar.gz' wget( url = my_url, \ extract_to_path = self.mountpoint, decompression_flag = 'z', \ title_str = self.title_str, status_lst = self.status_lst ) return 0
def install_barebones_root_filesystem(self): logme('SuseDistro - install_barebones_root_filesystem() - starting') unmount_sys_tmp_proc_n_dev(self.mountpoint) wget( url= 'http://download.opensuse.org/repositories/devel:/ARM:/13.1:/Contrib:/Chromebook/images/openSUSE-13.1-ARM-XFCE-chromebook.armv7l.raw.xz', extract_to_path=self.mountpoint, decompression_flag='J', title_str=self.title_str, status_lst=self.status_lst) mount_sys_tmp_proc_n_dev(self.mountpoint) return 0
def install_final_push_of_packages(self): logme('ArchlinuxDistro - install_final_push_of_packages() - starting') self.update_status('Installed') for my_fname in ('ssss-0.5-3-armv7h.pkg.tar.xz', 'florence-0.6.2-1-armv7h.pkg.tar.xz'): try: system_or_die( 'cp /usr/local/bin/Chrubix/blobs/apps/%s /%s/tmp/' % (my_fname, self.mountpoint)) except RuntimeError: wget( url = 'https://dl.dropboxusercontent.com/u/59916027/chrubix/%s' % ( my_fname ), \ save_as_file = '%s/tmp/%s' % ( self.mountpoint, my_fname ), \ status_lst = self.status_lst, \ title_str = self.title_str ) if 0 == chroot_this(self.mountpoint, 'yes "" | pacman -U /tmp/%s' % (my_fname)): self.update_status(' ' + my_fname.split('-')[0]) # else: # failed( 'Failed to install ' + my_fname.split( '-' )[0]) # perl-cpan-meta-check perl-class-load-xs perl-eval-closure perl-mro-compat perl-package-depreciationmanager perl-sub-name perl-task-weaken \ # perl-test-checkdeps perl-test-without-module perl-moose failed_pkgs = self.install_from_AUR attempts = 0 while failed_pkgs != '' and attempts < 5: self.update_and_upgrade_all() attempts += 1 packages_to_install = failed_pkgs failed_pkgs = '' for pkg_name in packages_to_install.split(' '): if pkg_name in (None, '', ' '): continue try: self.build_and_install_software_from_archlinux_source( pkg_name, quiet=True) self.update_status(' %s' % (pkg_name)) except RuntimeError: failed_pkgs += ' %s' % (pkg_name) self.update_status('...OK.') if failed_pkgs != '': self.update_status( ['Warning - failed to install%s' % (failed_pkgs)]) # self.update_status(' etc. ') # self.update_status(( ['Installing %s' % ( self.final_push_packages.replace( ' ', ' ' ).replace( ' ', ', ' ) )] ) chroot_this(self.mountpoint, 'yes "" 2>/dev/null | pacman -S --needed %s' % (self.final_push_packages), title_str=self.title_str, status_lst=self.status_lst, on_fail='Failed to install final push of packages', attempts=20) self.update_and_upgrade_all() self.update_status_with_newline('...complete.')
def install_barebones_root_filesystem(self): unmount_sys_tmp_proc_n_dev(self.mountpoint) system_or_die( '''curl https://www.offensive-security.com/kali-linux-vmware-arm-image-download/ | grep Samsung | cut -d'"' -f4 > /tmp/url.txt''' ) url = read_oneliner_file('/tmp/url.txt') assert (url.find('xz') >= 0) wget(url=url, extract_to_path=self.mountpoint, decompression_flag='J', title_str=self.title_str, status_lst=self.status_lst, attempts=1) mount_sys_tmp_proc_n_dev(self.mountpoint) return 0
def download_package_source(self, package_name, filenames_lst=None): logme('ArchlinuxDistro - download_package_source() - starting') # self.update_status(( [ "Downloading %s package into %s OS" % ( package_name, self.name ) ] ) system_or_die('mkdir -p %s/%s/%s' % (self.mountpoint, self.sources_basedir, package_name)) os.chdir('%s/%s/%s' % (self.mountpoint, self.sources_basedir, package_name)) if os.path.isfile( '%s/%s/%s/PKGBUILD' % (self.mountpoint, self.sources_basedir, package_name)): self.update_status( '' ) # += "." # ..Still working" # No need to download anything. We have PKGBUILD already. elif filenames_lst in (None, []): url = 'aur.archlinux.org/packages/%s/%s/%s.tar.gz' % ( package_name[:2], package_name, package_name) wget(url=url, extract_to_path='%s/%s' % (self.mountpoint, self.sources_basedir), quiet=True, title_str=self.title_str, status_lst=self.status_lst) else: for fname in filenames_lst: file_to_download = '%s/%s/%s/%s' % ( self.mountpoint, self.sources_basedir, package_name, fname) try: os.unlink(file_to_download) except IOError: pass wget( url = 'http://projects.archlinux.org/svntogit/packages.git/plain/trunk/%s?h=packages/%s' \ % ( fname, package_name ), save_as_file = file_to_download, attempts = 20, quiet = True, title_str = self.title_str, status_lst = self.status_lst ) system_or_die('mv PKGBUILD PKGBUILD.ori') system_or_die( r"cat PKGBUILD.ori | sed s/march/phr34k/ | sed s/\'libutil-linux\'// | sed s/\'java-service-wrapper\'// | sed s/arch=\(.*/arch=\(\'%s\'\)/ | sed s/phr34k/march/ > PKGBUILD" % (self.architecture)) chroot_this( self.mountpoint, 'chown -R guest %s/%s' % (self.sources_basedir, package_name)) call_makepkg_or_die( mountpoint = self.mountpoint, \ package_path = '%s/%s' % ( self.sources_basedir, package_name ), \ cmd = 'cd %s/%s && makepkg --skipchecksums --nobuild -f' % ( self.sources_basedir, package_name ), errtxt = 'Failed to download %s' % ( package_name ) ) return 0
def install_final_push_of_packages( self ): logme( 'ArchlinuxDistro - install_final_push_of_packages() - starting' ) self.update_status( 'Installed' ) for my_fname in ( 'ssss-0.5-3-armv7h.pkg.tar.xz', 'florence-0.6.2-1-armv7h.pkg.tar.xz' ): try: system_or_die( 'cp /usr/local/bin/Chrubix/blobs/apps/%s /%s/tmp/' % ( my_fname, self.mountpoint ) ) except RuntimeError: wget( url = 'https://dl.dropboxusercontent.com/u/59916027/chrubix/%s' % ( my_fname ), \ save_as_file = '%s/tmp/%s' % ( self.mountpoint, my_fname ), \ status_lst = self.status_lst, \ title_str = self.title_str ) if 0 == chroot_this( self.mountpoint, 'yes "" | pacman -U /tmp/%s' % ( my_fname ) ): self.update_status( ' ' + my_fname.split( '-' )[0] ) # else: # failed( 'Failed to install ' + my_fname.split( '-' )[0]) # perl-cpan-meta-check perl-class-load-xs perl-eval-closure perl-mro-compat perl-package-depreciationmanager perl-sub-name perl-task-weaken \ # perl-test-checkdeps perl-test-without-module perl-moose failed_pkgs = self.install_from_AUR attempts = 0 while failed_pkgs != '' and attempts < 5: self.update_and_upgrade_all() attempts += 1 packages_to_install = failed_pkgs failed_pkgs = '' for pkg_name in packages_to_install.split( ' ' ): if pkg_name in ( None, '', ' ' ): continue try: self.build_and_install_software_from_archlinux_source( pkg_name, quiet = True ) self.update_status( ' %s' % ( pkg_name ) ) except RuntimeError: failed_pkgs += ' %s' % ( pkg_name ) self.update_status( '...OK.' ) if failed_pkgs != '': self.update_status( ['Warning - failed to install%s' % ( failed_pkgs )] ) # self.update_status(' etc. ') # self.update_status(( ['Installing %s' % ( self.final_push_packages.replace( ' ', ' ' ).replace( ' ', ', ' ) )] ) chroot_this( self.mountpoint, 'yes "" 2>/dev/null | pacman -S --needed %s' % ( self.final_push_packages ), title_str = self.title_str, status_lst = self.status_lst, on_fail = 'Failed to install final push of packages', attempts = 20 ) self.update_and_upgrade_all() self.update_status_with_newline( '...complete.' )
def install_barebones_root_filesystem( self ): logme( 'SuseDistro - install_barebones_root_filesystem() - starting' ) unmount_sys_tmp_proc_n_dev( self.mountpoint ) wget( url = 'http://download.opensuse.org/repositories/devel:/ARM:/13.1:/Contrib:/Chromebook/images/openSUSE-13.1-ARM-XFCE-chromebook.armv7l.raw.xz', extract_to_path = self.mountpoint, decompression_flag = 'J', title_str = self.title_str, status_lst = self.status_lst ) mount_sys_tmp_proc_n_dev( self.mountpoint ) return 0