Install module

Botman

Compatibility:

Description

This module is in charge of running installation of a package or system upgrades.

Configuration

You need to write a configuration file for this module.
Create the file /etc/gotham/modules.conf.d/install.conf that might look as follows:

{
   "install": {
      "pre": "",
      "cmd": "yes | pkg install %s",
      "post": ""
   },
   "upgrade": {
      "pre": "",
      "cmd": "freebsd-update install",
      "post": ""
   },
   "vars": [
   ]
}
You have to specify the commands you need to execute for installation of upgrade to be effective.
This allows the module to adapt itself to various distros.

Query botmans through Alfred

It is possible to make Alfred able to query botmans for you by combining the power of the spam and rewrite modules.
You can add the following JSON object as a new rule of the rewrite module’s configuration file:

{
   "name" : ".install",
   "filter" : ".install*",
   "rule" : "sed -r 's/^.install *([^ ]*) (.*)/.spam \\1 .install \\2/'",
   "description" : ".install <pattern> <softwarelist>"
}, {
   "name" : ".upgrade",
   "filter" : ".upgrade*",
   "rule" : "sed -r 's/^.upgrade (.*)/.spam \\1 .upgrade/'",
   "description" : ".upgrade <pattern>"
}, {
   "name" : ".jobs",
   "filter" : ".jobs*",
   "rule" : "sed -r 's/^.jobs (.*)/.spam \\1 .jobs/'",
   "description" : ".jobs <pattern>"
}, {
   "name" : ".kill",
   "filter" : ".kill * *",
   "rule" : "sed -r 's/^.kill *([^ ]*) (.*)/.spam \\1 .kill \\2/'",
   "description" : ".kill <pattern> <job_id>"
}


Commands

The .install command will allow you to install packages on the system.
This command will return the output created by the package manager, and the end of installation.
If you are using this command through the spam module, you have to be aware that the spam module will timeout after 5 minutes.
This means that if the installation of the package lasts more than 5 minutes, you are going to receive a timeout notification from the spam module, and you will never get the output from the .install command.
(31/07/2015 08:45:26) guillaume.friloux@botnet.master.com: .install htop
(08:45:26) botman-xxxx: {
   "command":  ".install_begins",
   "parameters": "htop",
   "status":   "ok",
   "content":  ["Software(s) install/upgrade will begin in a few seconds."]
}
(08:45:45) botman-xxxx: {
   "command":  ".install",
   "parameters": "htop",
   "status":   "ok",
   "content":  [
      "Updating private repository catalogue...",
      "Fetching meta.txz: . done",
      "Fetching packagesite.txz: .. done",
      "Processing entries: ..... done",
      "amtrust repository update completed. 40 packages processed.",
      "Updating FreeBSD repository catalogue...",
      "Fetching meta.txz: . done",
      "Fetching packagesite.txz: .......... done",
      "Processing entries: .......... done",
      "FreeBSD repository update completed. 24389 packages processed.",
      "Updating database digests format: .. done",
      "The following 2 package(s) will be affected (of 0 checked):",
      "New packages to be INSTALLED:",
      "\thtop: 1.0.3 [FreeBSD]",
      "\tlsof: 4.89.e,8 [FreeBSD]",
      "The process will require 377 KiB more space.",
      "170 KiB to be downloaded.",
      "Proceed with this action? [y/N]: Fetching htop-1.0.3.txz: ....... done",
      "Fetching lsof-4.89.e,8.txz: .......... done",
      "Checking integrity... done (0 conflicting)",
      "[1/2] Installing lsof-4.89.e,8...",
      "[1/2] Extracting lsof-4.89.e,8: .......... done",
      "[2/2] Installing htop-1.0.3...",
      "[2/2] Extracting htop-1.0.3: ....... done",
      "Message for htop-1.0.3:",
      "***********************************************************",
      "htop(1) requires linprocfs(5) to be mounted. If you don't",
      "have it mounted already, please add this line to /etc/fstab",
      "and run `mkdir -p /usr/compat/linux/proc; ln -s /usr/compat /compat; mount linproc`:",
      "linproc /compat/linux/proc linprocfs rw,late 0 0",
      "***********************************************************"
   ]
}