Exemplo n.º 1
0
 def beta_134_to_beta_200(self):
     if not is_installed('kano-character-cli'):
         logger.info("kano-character-cli not installed,"
                     " attempt to install kano-profile")
         install('kano-profile')
     run_cmd_log(
         'kano-character-cli -c "judoka" "Hair_Black" "Skin_Orange" -s')
Exemplo n.º 2
0
 def beta_110_to_beta_111(self):
     install('kano-sound-files kano-init-flow')
     # Create first boot file so we don't annoy existent users
     username = get_user_unsudoed()
     first_boot = '/home/%s/.kano-settings/first_boot' % username
     try:
         open(first_boot, 'w').close()
     except:
         pass
Exemplo n.º 3
0
 def beta_110_to_beta_111(self, dummy_progress):
     install('kano-sound-files kano-init-flow')
     # Create first boot file so we don't annoy existent users
     username = get_user_unsudoed()
     first_boot = '/home/%s/.kano-settings/first_boot' % username
     try:
         open(first_boot, 'w').close()
     except:
         pass
Exemplo n.º 4
0
 def beta_134_to_beta_200(self, dummy_progress):
     if not is_installed('kano-character-cli'):
         logger.info(
             "kano-character-cli not installed,"
             " attempt to install kano-profile"
         )
         install('kano-profile')
     run_cmd_log(
         'kano-character-cli -c "judoka" "Hair_Black" "Skin_Orange" -s'
     )
Exemplo n.º 5
0
    def beta_210_to_beta_220(self):
        install('telnet python-serial')
        try:
            from kano_profile.apps import save_app_state_variable_all_users

            save_app_state_variable_all_users("init-flow-completed", "level",
                                              1)

        except ImportError:
            logger.error(
                "Could not award Computer Commander badge, import error")
Exemplo n.º 6
0
    def beta_210_to_beta_220(self, dummy_progress):
        install('telnet python-serial')
        try:
            from kano_profile.apps import save_app_state_variable_all_users

            save_app_state_variable_all_users("init-flow-completed", "level", 1)

        except ImportError:
            logger.error(
                "Could not award Computer Commander badge, import error"
            )
Exemplo n.º 7
0
 def beta_3_13_0_to_beta_3_14_0(self, dummy_progress):
     try:
         import apt.cache
         c = apt.cache.Cache()
         if c['rpi-chromium-mods-kano'].installed >= '20170809':
             install('scratch2')
         else:
             logger.error(
                 "beta_3_13_0_to_beta_3_14_0: "
                 "wrong version of rpi-chromium-mods-kano installed: {}"
                 .format(c['rpi-chromium-mods-kano'].installed.version)
             )
     except Exception as e:
         logger.error("beta_3_13_0_to_beta_3_14_0: Failed to install scratch2", exception=e)
Exemplo n.º 8
0
 def beta_3_13_0_to_beta_3_14_0(self):
     try:
         import apt.cache
         c = apt.cache.Cache()
         if c['rpi-chromium-mods-kano'].installed >= '20170809':
             install('scratch2')
         else:
             logger.error(
                 "beta_3_13_0_to_beta_3_14_0: wrong version of rpi-chromium-mods-kano installed: {}"
                 .format(c['rpi-chromium-mods-kano'].installed.version))
     except Exception as e:
         logger.error(
             "beta_3_13_0_to_beta_3_14_0: Failed to install scratch2",
             exception=e)
Exemplo n.º 9
0
 def beta_120_to_beta_121(self, dummy_progress):
     install('espeak')
Exemplo n.º 10
0
    def beta_220_to_beta_230(self):
        # A few helper fns to keep the scenario tidy
        def ensure_system_group_exists(group):
            if (os.system('getent group {}'.format(group)) != 0):
                rc = os.system('groupadd -f -r {}'.format(group))
                if rc != 0:
                    logger.error("could not create group")

        def add_users_to_group(group):
            try:
                linux_users = get_users()
                if not linux_users:
                    logger.error('beta_220_to_beta_230: linux_users is empty!')

                for user in linux_users:
                    os.system('sudo usermod -a -G {} {}'.format(group, user))

            except Exception as e:
                logger.error("Couldn't add users to {} group - [{}]".format(
                    group, e))

        def add_i2c_module_to_auto_loaded():
            try:
                found_i2c_dev = False

                with open('/etc/modules', 'r') as f:
                    for line in f:
                        if line.strip() == 'i2c_dev':
                            found_i2c_dev = True

                if not found_i2c_dev:
                    with open('/etc/modules', 'a') as f:
                        f.write('\ni2c_dev\n')

            except Exception as e:
                logger.error(
                    "Couldn't add i2c_dev to /etc/modules - [{}]".format(e))

        def remove_powerup_lnk_file():
            try:
                linux_users = get_users()
                if not linux_users:
                    logger.error('beta_220_to_beta_230: linux_users is empty!')

                lnk_dir_template = os.path.join(os.sep, 'home', '{user}',
                                                '.kdesktop', 'Powerup.lnk')
                for user in linux_users:
                    lnk_dir = lnk_dir_template.format(user=user)
                    if os.path.exists(lnk_dir):
                        os.remove(lnk_dir)
            except Exception as e:
                logger.error("Couldn't remove Powerup.lnk - [{}]".format(e))

        def enable_spi_device():
            from kano_settings.boot_config import set_config_value
            set_config_value("dtparam=spi", "on")
            try:
                from kano_settings.boot_config import end_config_transaction
                end_config_transaction()
            except ImportError:
                logger.error(
                    "end_config_transaciton not present - update to kano-settings failed?"
                )

        # Scenario work starts here
        install('rsync')
        run_cmd_log('kano-apps install --no-gui powerup')

        remove_powerup_lnk_file()

        ensure_system_group_exists('gpio')
        ensure_system_group_exists('spi')
        add_users_to_group('i2c')
        add_users_to_group('gpio')
        add_users_to_group('spi')
        add_i2c_module_to_auto_loaded()

        # enable spi device
        enable_spi_device()
Exemplo n.º 11
0
    def beta_3_9_2_to_beta_3_10_0(self):
        # The new Overture onboarding needs to be enabled - disabling old tty-based kano-init
        run_cmd_log('kano-init finalise --force')

        # Install the kano-os metapackage for top level OS packages.
        install('kano-os')
Exemplo n.º 12
0
 def beta_125_to_beta_131(self):
     install('kano-draw')
Exemplo n.º 13
0
 def beta_120_to_beta_121(self):
     install('espeak')
Exemplo n.º 14
0
 def beta_120_to_beta_121(self):
     install('espeak')
Exemplo n.º 15
0
 def beta_125_to_beta_131(self):
     install('kano-draw')
Exemplo n.º 16
0
 def beta_103_to_beta_110(self):
     rclocal_executable()
     remove_user_files(['.kdeskrc'])
     install('kano-widgets')
Exemplo n.º 17
0
    def beta_3_9_2_to_beta_3_10_0(self, dummy_progress):
        # The new Overture onboarding needs to be enabled - disabling old tty-based kano-init
        run_cmd_log('kano-init finalise --force')

        # Install the kano-os metapackage for top level OS packages.
        install('kano-os')
Exemplo n.º 18
0
    def beta_220_to_beta_230(self, dummy_progress):
        # A few helper fns to keep the scenario tidy
        def ensure_system_group_exists(group):
            if(os.system('getent group {}'.format(group)) != 0):
                rc = os.system('groupadd -f -r {}'.format(group))
                if rc != 0:
                    logger.error("could not create group")

        def add_users_to_group(group):
            try:
                linux_users = get_users()
                if not linux_users:
                    logger.error('beta_220_to_beta_230: linux_users is empty!')

                for user in linux_users:
                    os.system('sudo usermod -a -G {} {}'.format(group, user))

            except Exception as e:
                logger.error(
                    "Couldn't add users to {} group - [{}]".format(group, e)
                )

        def add_i2c_module_to_auto_loaded():
            try:
                found_i2c_dev = False

                with open('/etc/modules', 'r') as f:
                    for line in f:
                        if line.strip() == 'i2c_dev':
                            found_i2c_dev = True

                if not found_i2c_dev:
                    with open('/etc/modules', 'a') as f:
                        f.write('\ni2c_dev\n')

            except Exception as e:
                logger.error(
                    "Couldn't add i2c_dev to /etc/modules - [{}]".format(e)
                )

        def remove_powerup_lnk_file():
            try:
                linux_users = get_users()
                if not linux_users:
                    logger.error('beta_220_to_beta_230: linux_users is empty!')

                lnk_dir_template = os.path.join(
                    os.sep,
                    'home',
                    '{user}',
                    '.kdesktop',
                    'Powerup.lnk'
                )
                for user in linux_users:
                    lnk_dir = lnk_dir_template.format(user=user)
                    if os.path.exists(lnk_dir):
                        os.remove(lnk_dir)
            except Exception as e:
                logger.error("Couldn't remove Powerup.lnk - [{}]".format(e))

        def enable_spi_device():
            from kano_settings.boot_config import set_config_value
            set_config_value("dtparam=spi", "on")
            try:
                from kano_settings.boot_config import end_config_transaction
                end_config_transaction()
            except ImportError:
                logger.error("end_config_transaciton not present - update to kano-settings failed?")

        # Scenario work starts here
        install('rsync')
        run_cmd_log('kano-apps install --no-gui powerup')

        remove_powerup_lnk_file()

        ensure_system_group_exists('gpio')
        ensure_system_group_exists('spi')
        add_users_to_group('i2c')
        add_users_to_group('gpio')
        add_users_to_group('spi')
        add_i2c_module_to_auto_loaded()

        # enable spi device
        enable_spi_device()
Exemplo n.º 19
0
 def beta_125_to_beta_131(self, dummy_progress):
     install('kano-draw')
Exemplo n.º 20
0
 def beta_103_to_beta_110(self, dummy_progress):
     rclocal_executable()
     remove_user_files(['.kdeskrc'])
     install('kano-widgets')
Exemplo n.º 21
0
 def beta_125_to_beta_131(self, dummy_progress):
     install('kano-draw')
Exemplo n.º 22
0
 def beta_120_to_beta_121(self, dummy_progress):
     install('espeak')