Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MVP of how to add custom scripts to the amnesia terminal on TailsOS #4

Open
fititnt opened this issue Oct 19, 2020 · 4 comments
Open
Labels
optionated Issue likely to have optionated implementation to make things glue easier. Not strong standard.

Comments

@fititnt
Copy link
Owner

fititnt commented Oct 19, 2020

Document (or maybe do some shell scripting) of an minimum viable product (MVP) of how do deploy scripts that are acessible by the user on TailsOS.

As reference, the /home/amnesia/.profile alredy seems to load to the path the /home/amnesia/bin if already was created when starting a new shell

amnesia@amnesia:~$ cat .profile

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
umask 077

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

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

Edit: missed last line of code on sample code. Added.

fititnt added a commit that referenced this issue Oct 20, 2020
@fititnt
Copy link
Owner Author

fititnt commented Oct 21, 2020

We're already doing this. Maybe we could just document better (than people look at the dotfiles, in special the dotfiles/example/rocha/.bash_profile if they want know about startup scripts) or we assume it's done.

@fititnt
Copy link
Owner Author

fititnt commented Oct 25, 2020

Oh f**k me. Did not work as expected.

I think instead of do the rigth way (read the documentation and undestand how it is suposed to work) I will just reinvent the wheel!
Anyway, either for my future self (or anyone trying to do the less wrong way) this was the current version of .bash_profile.

The main error I found was, when restarting the Tails, neither /home/amnesia/Persistent/software/bin or /home/amnesia/Persistent/bin was added to the path (maybe .bash_profile is ignored.. for every new terminal).

https://github.com/fititnt/TailsOS-for-non-whistleblowers/blob/ef1777ee53e65f108c8b4b42059a3f865441cf14/dotfiles/example/rocha/.bash_profile

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
umask 077

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

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

#### Custom additions from original ~/.profile, START __________________________

#### /home/amnesia/Persistent/software/bin .....................................
# @see docs/portable-software.sh
# If this path exists, executable binaries here will have priority over
# /home/amnesia/bin.
if [ -d "/home/amnesia/Persistent/software/bin" ] ; then
    PATH="/home/amnesia/Persistent/software/bin:$PATH"
fi

#### /home/amnesia/Persistent/bin ..............................................
# @see docs/portable-software.sh
# If this path exists, executable binaries here will have priority over
# /home/amnesia/Persistent/software/bin and /home/amnesia/bin.
if [ -d "/home/amnesia/Persistent/bin" ] ; then
    PATH="/home/amnesia/Persistent/bin:$PATH"
fi

#### Startup scripts ...........................................................
# TODO: this feature was not fully tested yet. (fititnt, 2020-10-24 18:42 UTC)
#
# Note: this code exists both on the my-git-repo/bin/startup-scripts.sh and
#       my-git-repo/dotfiles/example/rocha/.bash_profile

# If ~/bin/startup-scripts/ (or ~/bin/startup-scripts-examples/) exists, we
# execute every .sh file there
if [ -d "$HOME/bin/startup-scripts" ];
then
    run-parts --regex '.*sh$' "$HOME/bin/startup-scripts/"
elif [ -d "$HOME/bin/startup-scripts-examples" ];
then
    run-parts --regex '.*sh$' "$HOME/bin/startup-scripts-examples/"
fi

#### Custom additions from original ~/.profile, END ____________________________

On the docs/zzz-undocumented.sh I was using just

rm -r ~/bin
ln -s /home/amnesia/Persistent/git/fititnt/TailsOS-for-non-whistleblowers/bin ~/bin

So maybe lets call this a feature.

@fititnt fititnt reopened this Oct 25, 2020
@fititnt fititnt pinned this issue Oct 25, 2020
@fititnt
Copy link
Owner Author

fititnt commented Oct 25, 2020

Ok, I just created a release here https://github.com/fititnt/TailsOS-for-non-whistleblowers/releases/tag/v1.0. So I will do some refactoring.

I may not do new releases on future, but this release is just to I care less of more severe refactoring.

@fititnt
Copy link
Owner Author

fititnt commented Oct 25, 2020

Things are improving

  • tails-do-it : add our custom place to store files
  • tails-ui-options-import: import terminal colors, gedit themes, etc
  • tails-code: load one portable vscode on disk to the ram and executes

Screenshot from 2020-10-25 19-00-16

@fititnt fititnt added the optionated Issue likely to have optionated implementation to make things glue easier. Not strong standard. label Oct 25, 2020
@fititnt fititnt unpinned this issue Nov 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optionated Issue likely to have optionated implementation to make things glue easier. Not strong standard.
Projects
None yet
Development

No branches or pull requests

1 participant