Jump to content

Installing pmbootstrap: Difference between revisions

From postmarketOS Wiki
Test installation: zsh needs zprofile
use syntaxhighlight tags
Line 2: Line 2:


==== Download pmbootstrap ====
==== Download pmbootstrap ====
git clone https://gitlab.com/postmarketOS/pmbootstrap.git
<syntaxhighlight lang="shell-session">
$ git clone https://gitlab.com/postmarketOS/pmbootstrap.git
</syntaxhighlight>


==== Create a link ====
==== Create a link ====
If the directory <code>~/.local/bin</code> does not already exist, create it with
If the directory <code>~/.local/bin</code> does not already exist, create it with
mkdir --parents ~/.local/bin
<syntaxhighlight lang="shell-session">
$ mkdir --parents ~/.local/bin
</syntaxhighlight>


Create a symbolic link in <code>~/.local/bin</code> named <code>pmbootstrap</code>
Create a symbolic link in <code>~/.local/bin</code> named <code>pmbootstrap</code>
ln -s "$PWD/pmbootstrap/pmbootstrap.py" ~/.local/bin/pmbootstrap
<syntaxhighlight lang="shell-session">
$ ln -s "$PWD/pmbootstrap/pmbootstrap.py" ~/.local/bin/pmbootstrap
</syntaxhighlight>


==== Test installation ====
==== Test installation ====
To test that pmbootstrap is installed correctly, open a new terminal and run
To test that pmbootstrap is installed correctly, open a new terminal and run
pmbootstrap --version
<syntaxhighlight lang="shell-session">
$ pmbootstrap --version
</syntaxhighlight>


If this returns something like <code>pmbootstrap: command not found</code> instead of a version number, ensure that the following lines are in <code>~/.profile</code> (zsh: <code>~/.zprofile</code>), then open a new terminal and try again.
If this returns something like <code>pmbootstrap: command not found</code> instead of a version number, ensure that the following lines are in <code>~/.profile</code> (zsh: <code>~/.zprofile</code>), then open a new terminal and try again.
# set PATH so it includes user's private bin if it exists
 
if [ -d "$HOME/.local/bin" ] ; then
<syntaxhighlight lang="shell">
    PATH="$HOME/.local/bin:$PATH"
# set PATH so it includes user's private bin if it exists
fi
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi
</syntaxhighlight>


== Tab Completion ==
== Tab Completion ==
{{todo | This is not yet implemented, watch {{MR|1656}} }}
{{todo | This is not yet implemented, watch {{MR|1656}} }}


Line 30: Line 38:


Install [https://argcomplete.readthedocs.io/en/latest/ argcomplete] with
Install [https://argcomplete.readthedocs.io/en/latest/ argcomplete] with
pip3 install --user argcomplete
<syntaxhighlight lang="shell-session">
$ pip3 install --user argcomplete
</syntaxhighlight>


Next, do one of the following depending on the shell you use:
Next, do one of the following depending on the shell you use:
Line 37: Line 47:


Add the following line to <code>~/.bashrc</code>:
Add the following line to <code>~/.bashrc</code>:
eval "$(register-python-argcomplete pmbootstrap)"
<syntaxhighlight lang="shell">
eval "$(register-python-argcomplete pmbootstrap)"
</syntaxhighlight>


Then reload your configuration by opening a new terminal or by running <code>source ~/.bashrc</code>.
Then reload your configuration by opening a new terminal or by running <code>source ~/.bashrc</code>.


==== Zsh ====
==== Zsh ====
Add the following lines to <code>~/.zshrc</code>:
Add the following lines to <code>~/.zshrc</code>:
autoload bashcompinit
<syntaxhighlight lang="shell">
bashcompinit
autoload bashcompinit
eval "$(register-python-argcomplete pmbootstrap)"
bashcompinit
eval "$(register-python-argcomplete pmbootstrap)"
</syntaxhighlight>


Then reload your configuration by opening a new terminal or by running <code>source ~/.zshrc</code>.
Then reload your configuration by opening a new terminal or by running <code>source ~/.zshrc</code>.

Revision as of 21:29, 27 August 2018

Installing Manually

Download pmbootstrap

$ git clone https://gitlab.com/postmarketOS/pmbootstrap.git

Create a link

If the directory ~/.local/bin does not already exist, create it with

$ mkdir --parents ~/.local/bin

Create a symbolic link in ~/.local/bin named pmbootstrap

$ ln -s "$PWD/pmbootstrap/pmbootstrap.py" ~/.local/bin/pmbootstrap

Test installation

To test that pmbootstrap is installed correctly, open a new terminal and run

$ pmbootstrap --version

If this returns something like pmbootstrap: command not found instead of a version number, ensure that the following lines are in ~/.profile (zsh: ~/.zprofile), then open a new terminal and try again.

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

Tab Completion

TODO TODO: This is not yet implemented, watch !1656

Tab completion is an optional feature that saves you time by automatically filling in the rest of a command when you press the tab key. You can also see a list of possible commands by double pressing the tab key.

Install argcomplete with

$ pip3 install --user argcomplete

Next, do one of the following depending on the shell you use:

Note Note: The following assumes you run pmbootstrap with pmbootstrap. If you use pmbootstrap.py, use that instead

Bash

Add the following line to ~/.bashrc:

eval "$(register-python-argcomplete pmbootstrap)"

Then reload your configuration by opening a new terminal or by running source ~/.bashrc.

Zsh

Add the following lines to ~/.zshrc:

autoload bashcompinit
bashcompinit
eval "$(register-python-argcomplete pmbootstrap)"

Then reload your configuration by opening a new terminal or by running source ~/.zshrc.