def __init__(self, config_file='qt5-configuration.json', cross=True, release=True, dry_run=True): self.config = json.loads(open(config_file, 'r').read()) self.sysroot = xsysroot.XSysroot(profile=self.config['xsysroot_profile']) self.cross=cross self.release=release self.dry_run=dry_run self._complete_config()
if __name__ == '__main__': output_image='pilove-{}.img'.format(__version__) prepare_only=False # Xsysroot profile name that holds the original pipaOS image # (See the file xsysroot.conf for details) if len(sys.argv) < 2: print 'Please specify a xsysroot profile name' sys.exit(1) else: xsysroot_profile_name=sys.argv[1] # Find and activate the xsysroot profile try: pilove=xsysroot.XSysroot(profile=xsysroot_profile_name) except: print 'You need to create a Xsysroot Pilove profile' print 'Please see the README file' sys.exit(1) # start timer time_start=time.time() # make sure the image is not mounted, or not currently in use if pilove.is_mounted(): if not pilove.umount(): sys.exit(1) # renew the image so we start from scratch if not pilove.renew():
xpipa.execute('apt-get -y clean') xpipa.execute('apt-get -y autoclean') return True if __name__ == '__main__': start_time = time.time() print '>>> pipaOS build starting on {}'.format(time.ctime()) if len(sys.argv) < 2: print 'Please specify the xsysroot profile for pipaos build' sys.exit(1) # Load the xsysroot profile xsysroot_profile = sys.argv[1] xpipa = xsysroot.XSysroot(profile=xsysroot_profile) if xpipa.is_mounted(): print '>>> image is currently mounted - aborting'.format( xsysroot_profile) sys.exit(1) # The image is created only the first time backing_image = xpipa.query('backing_image') if not os.path.isfile(backing_image): if not create_core_image(xpipa): print 'Error creating core image - aborting' sys.exit(1) print '>>> Customizing system...' if not xpipa.is_mounted() and not xpipa.mount():
print 'Running in --build-all mode' else: print 'Unrecognized option, use one of --build-all or --prepare-only' sys.exit(1) else: print 'Please specify mode: --build-all or --prepare-only' sys.exit(1) # import the xsysroot module which will help us manipulate the Ubuntu image xsysroot = import_xsysroot() if not xsysroot: sys.exit(1) # Find and activate the ubuntu xsysroot profile try: Xubuntu = xsysroot.XSysroot(profile=xsysroot_profile_name) except: print 'You need to create a Xsysroot ubuntu profile' print 'Please see the README file' sys.exit(1) # start timer time_start = time.time() # make sure the image is not mounted, or currently in use if Xubuntu.is_mounted(): if not Xubuntu.umount(): sys.exit(1) # renew the Ubuntu image from scratch and expand to root file system if not Xubuntu.renew():
# TODO: use command line options mm_version = '1.0' pi_username = '******' hostname = 'raspimirror' print '>>> RaspiMirror builder {} starts on {}'.format( mm_version, time.ctime()) if len(sys.argv) < 2: print 'syntax: magicmirror-build <xsysroot-profile> [RENEW]' sys.exit(1) else: xsysroot_profile = sys.argv[1] renew_image = len(sys.argv) > 2 and sys.argv[2] == 'RENEW' xmagic = xsysroot.XSysroot(xsysroot_profile) # Sanity check if xmagic.running(): print 'Image is busy, please close processes and try again' sys.exit(1) # Either mount the current Raspbian image, or RENEW it to start from a clean copy. if not renew_image: print '>>> Mounting Raspbian image' xmagic.mount() if not xmagic.is_mounted(): sys.exit(1) else: print '>>> Renewing Raspbian image' xmagic.umount()
if len(sys.argv) > 1: if sys.argv[1] == '--prepare-only': prepare_only = True print 'Running in --prepare-only mode' elif sys.argv[1] == '--build-all': print 'Running in --build-all mode' else: print 'Unrecognized option, use one of {}'.format(cmd_options) sys.exit(1) else: print 'Please specify mode: {}'.format(cmd_options) sys.exit(1) # Find and activate the xsysroot profile try: kivypie = xsysroot.XSysroot(profile=xsysroot_profile_name) except: print 'You need to create a Xsysroot kivypie profile' print 'Please see the README file' sys.exit(1) # start timer time_start = time.time() # make sure the image is not mounted, or not currently in use if kivypie.is_mounted(): if not kivypie.umount(): sys.exit(1) # renew the image so we start from scratch if not kivypie.renew():