Mycroft Community Forum

Testing and Feedback - Voice Assisted Package Manager

Hi,

This is a bit of a non orthodox skill, that will (for now) require some work to install. (GitHub: https://github.com/whtecmp/vapm)

How to install Vapm

For now, only works with APT. The following instructions assume you are on a Linux machine with APT and sudo.

The installation process is a bit complicated, because the skill requires some root access (for installing and removing stuff).

If you want to just test the skill, without using it, you can skip many of the parts. Also the only non functional parts will be installing and removing packages.

First clone the repo to /opt/mycroft/skills/:

cd /opt/mycroft/skills/
git clone https://github.com/whtecmp/vapm.git

As root, create root directory for Mycroft and copy scripts there:

mkdir -p /opt/mycroft-root/skills/vapm/
cp -r /opt/mycroft/skills/vapm/scripts/ /opt/mycroft-root/skills/vapm/
chmod +x /opt/mycroft-root/skills/vapm/scripts/*.sh

(IF YOU WANT TO ONLY TEST THE SKILL, WITHOUT ACTUALLY INSTALLING AND REMOVING PACKAGES YOU CAN STOP HERE)

So in order to keep it safe you’ll need to create a new user on your Linux and allow it to execute some specific scripts as root (using sudo). The mycroft process will be ran as that user.

Create new user. As root run:

useradd mycroft
mkdir -p /home/mycroft
chown mycroft:mycroft -R /home/mycroft
visudo

In the text editor that had been opened, add the following lines:

mycroft ALL=(ALL) NOPASSWD: /opt/mycroft-root/vapm/scripts/install.sh
mycroft ALL=(ALL) NOPASSWD: /opt/mycroft-root/vapm/scripts/remove.sh

Lock the mycroft acount with passwd -l mycroft.

Anytime you need to loging as mycroft run sudo -u mycroft bash.


Now, you’ll need to move ownership of mycroft to the new mycroft user. chown the following files like so, as root run:

chown mycroft:mycroft -R /opt/mycroft/
chown mycroft:mycroft -R /tmp/mycroft/
chown mycroft:mycroft -R /var/log/mycroft/
chown mycroft:mycroft /var/tmp/mycroft_web_cache.json
chown mycroft:mycroft /tmp/mycroft-msm.lck

You’ll also have to reinstall mycroft. First login as mycroft with sudo -u mycroft bash, then run cd ~.

Follow the installation instructions from the mycroft official site.

Note that any other skill you have will also be ran as mycroft user, so if it creates files or otherwise interacts with your system, permission issues could happen. Mostly, you’ll just have to make sure to chown stuff correctly though.

(IMPORTANT: The security of this skill is still in question so don’t use it in any sensitive enviornmet)

How to test Vapm

You have to first initiate a search:

  • Find package python.

Then you can further query on the results:

  • Filter by contains word python and ends with dev.
  • Describe second package.
  • Read five of them.

Or you can just install/remove packages:

  • Download package python.
  • Remove package gcc.

(You can’t use “install” and instead have to use “download” because “install” is reserved for installing mycroft skills)

When vapm refers finds a full match, this means you can use the pronoune “it” instead of the package name.

Where feedback on Vapm should be directed

Here or in GitHub.

I’m guessing you’ve heard of Pako

Yep, it is in my todo list :slight_smile:

I would use another example, like xterm or xeyes or something less useful than gcc :stuck_out_tongue:

It seems this skill will work nicely on mark1, as mycroft user is already created and has the proper permissions all directories, and mycroft is being running by this user; it just would need to have superpowers to execute install.sh and remove.sh.

I think it would be also cool to upgrade.sh the system and control another package manager like pacman, dnf, zypper or emerge, to name a few, Pako seems useful for that purpose