From de292d018f516fcce504a7a5896138396c5bfae2 Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Sun, 11 Oct 2020 15:09:15 +0200 Subject: [PATCH] Add first version of playbooks and configs Signed-off-by: Matej Focko --- Makefile | 16 ++ playbooks/fedora.yml | 12 ++ playbooks/roles/flatpaks/tasks/main.yml | 9 + playbooks/roles/git/tasks/main.yml | 5 + playbooks/roles/git/templates/gitconfig.j2 | 20 +++ playbooks/roles/set_dnf/tasks/main.yml | 17 ++ playbooks/roles/shell/tasks/main.yml | 18 ++ playbooks/roles/shell/tasks/nvim.yml | 8 + playbooks/roles/shell/tasks/tmux.yml | 13 ++ playbooks/roles/shell/tasks/zsh.yml | 22 +++ playbooks/roles/shell/templates/init.vim.j2 | 158 ++++++++++++++++++ .../roles/shell/templates/starship.toml.j2 | 8 + playbooks/roles/shell/templates/tmux.conf.j2 | 32 ++++ .../roles/shell/templates/tmux_status.conf.j2 | 10 ++ playbooks/roles/shell/templates/zshrc.j2 | 39 +++++ playbooks/roles/ssh/tasks/main.yml | 17 ++ playbooks/roles/ssh/templates/ssh_config.j2 | 37 ++++ playbooks/roles/vscode/tasks/main.yml | 15 ++ .../vscode/templates/code-url.desktop.j2 | 12 ++ .../roles/vscode/templates/code.desktop.j2 | 18 ++ playbooks/roles/vscode/templates/update.sh.j2 | 31 ++++ scripts/generate_gpg.sh | 10 ++ 22 files changed, 527 insertions(+) create mode 100644 Makefile create mode 100644 playbooks/fedora.yml create mode 100644 playbooks/roles/flatpaks/tasks/main.yml create mode 100644 playbooks/roles/git/tasks/main.yml create mode 100644 playbooks/roles/git/templates/gitconfig.j2 create mode 100644 playbooks/roles/set_dnf/tasks/main.yml create mode 100644 playbooks/roles/shell/tasks/main.yml create mode 100644 playbooks/roles/shell/tasks/nvim.yml create mode 100644 playbooks/roles/shell/tasks/tmux.yml create mode 100644 playbooks/roles/shell/tasks/zsh.yml create mode 100644 playbooks/roles/shell/templates/init.vim.j2 create mode 100644 playbooks/roles/shell/templates/starship.toml.j2 create mode 100644 playbooks/roles/shell/templates/tmux.conf.j2 create mode 100644 playbooks/roles/shell/templates/tmux_status.conf.j2 create mode 100644 playbooks/roles/shell/templates/zshrc.j2 create mode 100644 playbooks/roles/ssh/tasks/main.yml create mode 100644 playbooks/roles/ssh/templates/ssh_config.j2 create mode 100644 playbooks/roles/vscode/tasks/main.yml create mode 100644 playbooks/roles/vscode/templates/code-url.desktop.j2 create mode 100644 playbooks/roles/vscode/templates/code.desktop.j2 create mode 100644 playbooks/roles/vscode/templates/update.sh.j2 create mode 100644 scripts/generate_gpg.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4eb897b --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +.PHONY: fedora-bootstrap deps fedora-deps gpg + +ANSIBLE_PYTHON := /usr/bin/python3 +AP := ansible-playbook -vv -c local -i localhost, -e ansible_python_interpreter=$(ANSIBLE_PYTHON) + +fedora-bootstrap: + $(AP) playbooks/fedora.yml + +deps: + ansible-galaxy collection install community.general + +fedora-deps: + sudo dnf install -y ansible ansible-collection-community-general + +gpg: + bash scripts/generate_gpg.sh \ No newline at end of file diff --git a/playbooks/fedora.yml b/playbooks/fedora.yml new file mode 100644 index 0000000..8418eb0 --- /dev/null +++ b/playbooks/fedora.yml @@ -0,0 +1,12 @@ +--- +- name: Fedora bootstrap + hosts: all + roles: + - set_dnf + - flatpaks + - ssh + - shell + - role: git + vars: + git_email: + - vscode \ No newline at end of file diff --git a/playbooks/roles/flatpaks/tasks/main.yml b/playbooks/roles/flatpaks/tasks/main.yml new file mode 100644 index 0000000..9af9366 --- /dev/null +++ b/playbooks/roles/flatpaks/tasks/main.yml @@ -0,0 +1,9 @@ +--- +- name: Install flatpak apps + community.general.flatpak: + name: "{{ item }}" + state: present + loop: + - com.spotify.Client + - com.discordapp.Discord + - org.telegram.desktop \ No newline at end of file diff --git a/playbooks/roles/git/tasks/main.yml b/playbooks/roles/git/tasks/main.yml new file mode 100644 index 0000000..844af79 --- /dev/null +++ b/playbooks/roles/git/tasks/main.yml @@ -0,0 +1,5 @@ +--- +- name: Create git config + template: + src: templates/gitconfig.j2 + dest: ~/.gitconfig \ No newline at end of file diff --git a/playbooks/roles/git/templates/gitconfig.j2 b/playbooks/roles/git/templates/gitconfig.j2 new file mode 100644 index 0000000..85d712b --- /dev/null +++ b/playbooks/roles/git/templates/gitconfig.j2 @@ -0,0 +1,20 @@ +[commit] + gpgsign = true + +[core] + editor = code --wait + excludesfile = ~/.gitignore + +[diff] + tool = vscode-difftool + +[difftool "vscode-difftool"] + cmd = code --wait --diff $LOCAL $REMOTE + +[gpg] + program = gpg2 + +[user] + name = Matej Focko + email = {{ git_email }} + signingkey = diff --git a/playbooks/roles/set_dnf/tasks/main.yml b/playbooks/roles/set_dnf/tasks/main.yml new file mode 100644 index 0000000..20ab521 --- /dev/null +++ b/playbooks/roles/set_dnf/tasks/main.yml @@ -0,0 +1,17 @@ +--- +# TODO: Set up repos + +- name: Upgrade all packages + dnf: + name: '*' + state: latest + +- name: Install playerctl for spotify + dnf: + name: playerctl + state: present + +- name: Install flameshot for screenshots + dnf: + name: flameshot + state: present \ No newline at end of file diff --git a/playbooks/roles/shell/tasks/main.yml b/playbooks/roles/shell/tasks/main.yml new file mode 100644 index 0000000..3705a9b --- /dev/null +++ b/playbooks/roles/shell/tasks/main.yml @@ -0,0 +1,18 @@ +--- +- name: Install all packages for shell + dnf: + name: + - zsh + - tmux + - neovim + - emacs + state: present + +- name: Set default shell and generate SSH key + user: + name: mfocko + shell: /bin/zsh + +- include: nvim.yml +- include: zsh.yml +- include: tmux.yml \ No newline at end of file diff --git a/playbooks/roles/shell/tasks/nvim.yml b/playbooks/roles/shell/tasks/nvim.yml new file mode 100644 index 0000000..730a39f --- /dev/null +++ b/playbooks/roles/shell/tasks/nvim.yml @@ -0,0 +1,8 @@ +--- +- name: Create init.vim + template: + src: templates/init.vim.j2 + dest: ~/.config/nvim/init.vim + +- name: Install vim-plug + shell: sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' \ No newline at end of file diff --git a/playbooks/roles/shell/tasks/tmux.yml b/playbooks/roles/shell/tasks/tmux.yml new file mode 100644 index 0000000..ce5c26c --- /dev/null +++ b/playbooks/roles/shell/tasks/tmux.yml @@ -0,0 +1,13 @@ +--- +- name: Clone tpm + shell: git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm + +- name: Create tmux.conf + template: + src: templates/tmux.conf.j2 + dest: ~/.tmux.conf + +- name: Create tmux status configuration + template: + src: templates/tmux_status.conf.j2 + dest: ~/.tmux/status.conf \ No newline at end of file diff --git a/playbooks/roles/shell/tasks/zsh.yml b/playbooks/roles/shell/tasks/zsh.yml new file mode 100644 index 0000000..9c05676 --- /dev/null +++ b/playbooks/roles/shell/tasks/zsh.yml @@ -0,0 +1,22 @@ +--- +- name: Install oh-my-zsh + shell: sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended + +- name: Clone zsh-autosuggestions + shell: git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions + +- name: Clone zsh-syntax-highlighting + shell: git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting + +- name: Clone starship + shell: curl -fsSL https://starship.rs/install.sh | bash + +- name: Create zshrc + template: + src: templates/zshrc.j2 + dest: ~/.zshrc + +- name: Create starship configuration + template: + src: templates/starship.toml.j2 + dest: ~/.config/starship.toml diff --git a/playbooks/roles/shell/templates/init.vim.j2 b/playbooks/roles/shell/templates/init.vim.j2 new file mode 100644 index 0000000..4632ef8 --- /dev/null +++ b/playbooks/roles/shell/templates/init.vim.j2 @@ -0,0 +1,158 @@ +" Sample config for pb071 students, available at fi.muni.cz/pb071 +" =============================================================== +" Requires VIM-8.0 to enable linting, on aisa run: +" $ module add vim-8.0 +" However, the linting will fail silently, if version is older. +" +" Comes with plugin manager Plug: we added 2 colorschemes +" and linting plugin ALE, which uses clang-tidy and gcc +" to highlight some syntax errors. +" +" Install Plug first in bash: +" $ curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim +" Then run vim and install the plugins using command in normal mode: +" :PlugInstall +" +" Most of the settings come from vimconfig.com. +" We added few handy key mappings: +" +" Ctrl+Up/Down Move line or a block of selected lines +" Ctrl+j/k +" pp Toggle paste mode on and off +" Disable search highlight +" +" is carriage return, "Enter" +" is backspace, "\", complete the combination in 1 second + +set nocompatible +set encoding=utf-8 + +""""" +""""" Plugin manager Plug from https://github.com/junegunn/vim-plug +""""" +call plug#begin('~/.vim/plugged') + Plug 'vim-airline/vim-airline' " status bar mod + Plug 'vim-airline/vim-airline-themes' +" Plug 'tomasiser/vim-code-dark' " colorscheme codedark +" Plug 'romainl/Apprentice' " colorscheme apprentice + Plug 'w0rp/ale' + Plug 'romainl/vim-cool' +" Plug 'drewtempelmeyer/palenight.vim' +" Plug 'connorholyday/vim-snazzy' +" Plug 'altercation/vim-colors-solarized' + Plug 'scrooloose/nerdtree' + Plug 'arcticicestudio/nord-vim' +call plug#end() + +" Setup linting for c99 +let g:ale_completion_enabled = 1 +let g:ale_linters = {'c': ['gcc', 'clangtidy', 'clang-format']} +let g:ale_c_gcc_executable = 'gcc' +let g:ale_c_gcc_options = '-std=c99 -Wall -Wextra -pedantic' +let g:ale_c_clang_executable = 'gcc' +let g:ale_c_clang_options = '-std=c99 -Wall -Wextra -pedantic' +let g:ale_c_clangtidy_executable = 'clang-tidy' +let g:ale_c_clangtidy_options = '-std=c99 -Wall -Wextra -pedantic' + +""""" +""""" Colors +""""" +syntax on + +" hi Normal ctermbg=none +" hi NonText ctermbg=none + +" Color schemes belong to ~/.vim/colors +" Find yours at https://vimcolors.com +set background=dark +" colorscheme codedark +colorscheme nord +" colorscheme solarized +" colorscheme palenight +" let g:SnazzyTransparent = 1 +" colorscheme snazzy + +" If using plugin vim-airline +let g:airline_theme = 'nord' + +if &term =~ '256color' + " disable Background Color Erase (BCE) so that color schemes + " render properly when inside 256-color tmux and GNU screen. + " see also http://snk.tuxfamily.org/log/vim-256color-bce.html + set t_ut= +endif + +" If you happen to still have a problem on some terminal, uncomment: +" set t_Co=256 +" set t_ut= + +" Color 81. character in line to visualize long lines +highlight ColorColumn ctermbg=magenta +call matchadd('ColorColumn', '\%81v', 100) +""""" +""""" General +""""" +set relativenumber " Show line numbers +set linebreak " Break lines at word (requires Wrap lines) +set showbreak=+++ " Wrap-broken line prefix +set textwidth=80 " Line wrap (number of cols) +set showmatch " Highlight matching brace +set showcmd " Show last command on right +set cursorline " Highlight current line + +set hlsearch " Highlight all search results +set smartcase " Enable smart-case search +set ignorecase " Always case-insensitive +set incsearch " Searches for strings incrementally + +set autoindent " Auto-indent new lines +set cindent " Use 'C' style program indenting +set shiftwidth=4 " Number of auto-indent spaces +set smartindent " Enable smart-indent +set smarttab " Enable smart-tabs +set softtabstop=4 expandtab " Number of spaces per Tab +set wrap " Wrap lines + + +""""" +""""" Advanced +""""" +set ruler " Show row and column ruler information +set undolevels=1000 " Number of undo levels +set backspace=indent,eol,start " Backspace behaviour +set guicursor= + +""""" +""""" Key mapping +""""" +" Move lines using Ctrl+Up/Down in normal, insert and visual modes +nnoremap :m-2 +nnoremap :m+ +inoremap :m-2 +inoremap :m+ +vnoremap :m '<-2gv=gv +vnoremap :m '>+1gv=gv +" or Ctrl+j/k +nnoremap :m .+1== +nnoremap :m .-2== +inoremap :m .+1==gi +inoremap :m .-2==gi +vnoremap :m '>+1gv=gv +vnoremap :m '<-2gv=gv + +" Toggle paste mode on and off +" \ + pp +map pp :setlocal paste! + +" Disable search highlight when is pressed +map :noh + +" Tab support +nnoremap :tabnext +nnoremap :tabprevious +nnoremap :tabnew + +" NERDTree +nmap :NERDTreeToggle + +:set guicursor= diff --git a/playbooks/roles/shell/templates/starship.toml.j2 b/playbooks/roles/shell/templates/starship.toml.j2 new file mode 100644 index 0000000..f2a9cae --- /dev/null +++ b/playbooks/roles/shell/templates/starship.toml.j2 @@ -0,0 +1,8 @@ +[username] +show_always = true + +[hostname] +ssh_only = false + +[time] +disabled = false \ No newline at end of file diff --git a/playbooks/roles/shell/templates/tmux.conf.j2 b/playbooks/roles/shell/templates/tmux.conf.j2 new file mode 100644 index 0000000..ced7fee --- /dev/null +++ b/playbooks/roles/shell/templates/tmux.conf.j2 @@ -0,0 +1,32 @@ +set -g default-terminal "xterm-256color" +set -g default-command "${SHELL}" + +set-window-option -g automatic-rename off +set-option -g allow-rename off +set-option -g renumber-windows on + +unbind l + +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +bind > resize-pane -R 2 +bind < resize-pane -L 2 +bind + resize-pane -U 2 +bind - resize-pane -D 2 + +bind-key r clear-history +bind-key R source-file ~/.tmux.conf \; display "Reloaded config file ~/.tmux.conf" +bind-key b set status + +source-file ~/.tmux/status.conf +set -g status-position bottom + +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-resurrect' +set -g @plugin 'tmux-plugins/tmux-continuum' +set -g @continuum-restore 'on' + +run '~/.tmux/plugins/tpm/tpm' \ No newline at end of file diff --git a/playbooks/roles/shell/templates/tmux_status.conf.j2 b/playbooks/roles/shell/templates/tmux_status.conf.j2 new file mode 100644 index 0000000..fd4916f --- /dev/null +++ b/playbooks/roles/shell/templates/tmux_status.conf.j2 @@ -0,0 +1,10 @@ +set -g status-bg colour0 +set -g status-fg colour7 +set -g status-left-length 20 +set -g status-left '[#S@#[fg=colour13]#h#[fg=colour7]]' +set -g status-right ' [%Y%m%d %H:%M:%S]' +set -g status-interval 1 +set -g status-justify centre +set -g status-position top +setw -g window-status-current-format '#[fg=colour2][#I|#W#F]' +setw -g window-status-format '[#I|#W#F]' \ No newline at end of file diff --git a/playbooks/roles/shell/templates/zshrc.j2 b/playbooks/roles/shell/templates/zshrc.j2 new file mode 100644 index 0000000..e735e6e --- /dev/null +++ b/playbooks/roles/shell/templates/zshrc.j2 @@ -0,0 +1,39 @@ +export ZSH=/home/mfocko/.oh-my-zsh + +CASE_SENSITIVE="true" +ENABLE_CORRECTION="true" +plugins=(git common-aliases history systemd sudo zsh-autosuggestions zsh-syntax-highlighting) + +export PATH="$PATH:$HOME/.local/bin" +source $ZSH/oh-my-zsh.sh + +export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10' + +export EDITOR=nvim + +export CC=gcc +export CFLAGS="-std=c11 -Wall -Werror" +export CXXFLAGS="-std=c++14 -Wall -Werror" +# export LDLIBS="-lm -lkarel -lcurses" +export LDLIBS="-lm" + +export LANG="en_US.UTF-8" +export TERM="xterm-256color" +export GPG_TTY=$(tty) + +alias q="exit" +alias k="exit" +alias vim="nvim" +alias ts="tmux new -As default" +alias Reset="reset && tmux clear-history" +alias gcs="git commit -v -s" + +function e() { + if [ $# -gt 0 ]; then + emacs $1 & + else + emacs . & + fi +} + +eval "$(starship init zsh)" diff --git a/playbooks/roles/ssh/tasks/main.yml b/playbooks/roles/ssh/tasks/main.yml new file mode 100644 index 0000000..9680791 --- /dev/null +++ b/playbooks/roles/ssh/tasks/main.yml @@ -0,0 +1,17 @@ +--- +- name: Generate SSH key + user: + name: mfocko + generate_ssh_key: yes + ssh_key_type: ed25519 + ssh_key_comment: "$HOSTNAME" + +- name: Install SSH config + template: + src: templates/ssh_config.j2 + dest: ~/.ssh/config + +- name: Enable sshd + systemd: + name: sshd + enabled: yes \ No newline at end of file diff --git a/playbooks/roles/ssh/templates/ssh_config.j2 b/playbooks/roles/ssh/templates/ssh_config.j2 new file mode 100644 index 0000000..3dab22a --- /dev/null +++ b/playbooks/roles/ssh/templates/ssh_config.j2 @@ -0,0 +1,37 @@ +# Public +Host github.com + User git + Hostname github.com + +Host gitlab.com + User git + Hostname gitlab.com + +# FI +Host gitlab.fi.muni.cz + User git + Hostname gitlab.fi.muni.cz + +Host aisa anxur + User xfocko + Hostname %h.fi.muni.cz + +# Private +Host gauss + User mfocko + Hostname gauss.mfocko.xyz + Port 4444 + +Host poincare + User mfocko + Hostname mfocko.xyz + +Host git.mfocko.xyz + User git + Hostname git.mfocko.xyz + Port 2222 + +Host git.gauss.mfocko.xyz + User git + Hostname git.gauss.mfocko.xyz + Port 2222 \ No newline at end of file diff --git a/playbooks/roles/vscode/tasks/main.yml b/playbooks/roles/vscode/tasks/main.yml new file mode 100644 index 0000000..4696d97 --- /dev/null +++ b/playbooks/roles/vscode/tasks/main.yml @@ -0,0 +1,15 @@ +--- +- name: Install VSCode script + template: + src: templates/update.sh.j2 + dest: ~/.local/bin/code-update.sh + +- name: Create app info for VSCode + template: + src: templates/code.desktop.j2 + dest: ~/.local/share/visual-studio-code-insiders.desktop + +- name: Create app info for VSCode URL handler + template: + src: templates/code-url.desktop.j2 + dest: ~/.local/share/visual-studio-code-insiders-url-handler.desktop \ No newline at end of file diff --git a/playbooks/roles/vscode/templates/code-url.desktop.j2 b/playbooks/roles/vscode/templates/code-url.desktop.j2 new file mode 100644 index 0000000..1540473 --- /dev/null +++ b/playbooks/roles/vscode/templates/code-url.desktop.j2 @@ -0,0 +1,12 @@ +[Desktop Entry] +Name=Visual Studio Code - URL Handler +Comment=Code Editing. Redefined. +GenericName=Text Editor +Exec=/opt/VSCode-linux-x64/bin/code-insiders --no-sandbox --open-url %U +Icon=/opt/VSCode-linux-x64/resources/app/resources/linux/code.png +Type=Application +NoDisplay=true +StartupNotify=true +Categories=Utility;TextEditor;Development;IDE; +MimeType=x-scheme-handler/vscode-insiders; +Keywords=vscode; \ No newline at end of file diff --git a/playbooks/roles/vscode/templates/code.desktop.j2 b/playbooks/roles/vscode/templates/code.desktop.j2 new file mode 100644 index 0000000..d4cf29e --- /dev/null +++ b/playbooks/roles/vscode/templates/code.desktop.j2 @@ -0,0 +1,18 @@ +[Desktop Entry] +Name=Visual Studio Code Insiders +Comment=Code Editing. Refined. +GenericName=Text Editor +Exec=/opt/VSCode-linux-x64/bin/code-insiders --no-sandbox --unity-launch %F +Icon=/opt/VSCode-linux-x64/resources/app/resources/linux/code.png +Type=Application +StartupNotify=false +StartupWMClass=code - insiders +Categories=Utility;TextEditor;Development;IDE; +MimeType=text/plain;inode/directory; +Actions=new-empty-window; +Keywords=vscode; + +[Desktop Action new-empty-window] +Name=New Empty Window +Exec=/opt/VSCode-linux-x64/bin/code-insiders --no-sandbox --new-window %F +Icon=/opt/VSCode-linux-x64/resources/app/resources/linux/code.png diff --git a/playbooks/roles/vscode/templates/update.sh.j2 b/playbooks/roles/vscode/templates/update.sh.j2 new file mode 100644 index 0000000..bd2f1e4 --- /dev/null +++ b/playbooks/roles/vscode/templates/update.sh.j2 @@ -0,0 +1,31 @@ +#!/bin/bash + +# for upstream +URL='https://go.microsoft.com/fwlink/?LinkId=723968' + +# for local +# URL='https://gauss.mfocko.xyz/code-insiders.tar.gz' + +# for local over VPN (also use --no-check-certificate) +# URL='https://10.0.0.2/code-insiders.tar.gz' + +echo ">>> Downloading"; +wget $URL -O /tmp/code.tar.gz + +echo ">>> Removing and extracting"; +rm -rf /opt/VSCode-linux-x64 +tar xvaf /tmp/code.tar.gz -C /opt/ + +# Check for binaries +if ! [ -x /usr/local/bin/code-insiders ]; then + echo ">>> Linking binaries"; + ln -s /opt/VSCode-linux-x64/bin/code-insiders /usr/local/bin/ + ln -s /opt/VSCode-linux-x64/bin/code-insiders /usr/local/bin/code +fi + +# Check for *.desktop +if ! ls /usr/share/applications | grep visual-studio-code; then + echo ">>> Installing desktop files"; + DIRECTORY=/home/mfocko/git/mfocko/dotfiles/code-insiders + sudo cp $DIRECTORY/*.desktop /usr/share/applications/; +fi diff --git a/scripts/generate_gpg.sh b/scripts/generate_gpg.sh new file mode 100644 index 0000000..3ac6e6f --- /dev/null +++ b/scripts/generate_gpg.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +echo ">>> Generating GPG <<<" +gpg --full-generate-key; + +ID=$(gpg --list-secret-keys --keyid-format LONG | perl -n -e'/^sec.*\/(\w*)\s+/ && print $1') +echo ">>> ID: $ID <<<" + +echo ">>> Exporting public key <<<" +gpg --armor --export $ID \ No newline at end of file