Skip to content

Custom software

Tom edited this page Aug 8, 2019 · 1 revision

Where is custom software used

When installing tos you will get the option to install custom software. An example is to install spotify. The end user will then be able to quickly get a set of software best for then. The software is not forced on them. Alternatively the end user can use the tos tool to install that piece of software eg tos install it will then ask the end user to specify which installer to run.

How to write your own

  • Fork this project.
  • add your script to `installer/<your_script>.sh
  • Once you verified that it works simply make a pull request to this repository
  • Wait for us to approve the pull request.

The script itself

At its most basic level the script must look like the following

#!/bin/bash

source $framework

The source $framework statement will expose your script to our installer API.

Currently there are a few options:

  • prmpt "Hello" prompt the user with information
  • ask "Do you want to install bla theme" "yes" ask the user something the result is stored in the variable $result
  • packages <package_list> Install required packages that the end user needs for the software to work
  • download <dir> <name> <url> save the data of to the directory and the filename is . If the directory doesn't exist we will create it

More functions will be provided by us. But that is it for now.

Here is a basic example of such a installer file

#!/bin/bash
# This source statement must be present at the top of this file
source $framework

# Informe the user of whats about to happen
prmpt "Installing some software"

# install packages to the user system
packages git wget

# Ask the user something "yes" is the default respones
ask "Do you want to install something custom?" "yes"

# $result stores the user respones
if [[ "$result" == "yes" ]]; then
    prmpt "You answered yes"
else
    prmpt "You didn't do what I wanted :( instead you answerd $result "
fi

# download repo.pbfp.xyz to $HOME/test/testfile
# If the directory doesn't exist it will be created
# important dont end the directory with a /
download $HOME/test testfile "https://repo.pbfp.xyz" 

prmpt "The installation is done!!"

To test if it works run tos i and select your install script.

Now make a pull request and we will verify if it works properly. Please also describe in the pull request on how to use the installed software to make it easier for us to test

Clone this wiki locally