Add first version of playbooks and configs
Signed-off-by: Matej Focko <matej.focko@outlook.com>
This commit is contained in:
parent
cf3839f82f
commit
de292d018f
22 changed files with 527 additions and 0 deletions
16
Makefile
Normal file
16
Makefile
Normal file
|
@ -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
|
12
playbooks/fedora.yml
Normal file
12
playbooks/fedora.yml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
- name: Fedora bootstrap
|
||||||
|
hosts: all
|
||||||
|
roles:
|
||||||
|
- set_dnf
|
||||||
|
- flatpaks
|
||||||
|
- ssh
|
||||||
|
- shell
|
||||||
|
- role: git
|
||||||
|
vars:
|
||||||
|
git_email: <insert-email>
|
||||||
|
- vscode
|
9
playbooks/roles/flatpaks/tasks/main.yml
Normal file
9
playbooks/roles/flatpaks/tasks/main.yml
Normal file
|
@ -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
|
5
playbooks/roles/git/tasks/main.yml
Normal file
5
playbooks/roles/git/tasks/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- name: Create git config
|
||||||
|
template:
|
||||||
|
src: templates/gitconfig.j2
|
||||||
|
dest: ~/.gitconfig
|
20
playbooks/roles/git/templates/gitconfig.j2
Normal file
20
playbooks/roles/git/templates/gitconfig.j2
Normal file
|
@ -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 = <insert-key>
|
17
playbooks/roles/set_dnf/tasks/main.yml
Normal file
17
playbooks/roles/set_dnf/tasks/main.yml
Normal file
|
@ -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
|
18
playbooks/roles/shell/tasks/main.yml
Normal file
18
playbooks/roles/shell/tasks/main.yml
Normal file
|
@ -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
|
8
playbooks/roles/shell/tasks/nvim.yml
Normal file
8
playbooks/roles/shell/tasks/nvim.yml
Normal file
|
@ -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'
|
13
playbooks/roles/shell/tasks/tmux.yml
Normal file
13
playbooks/roles/shell/tasks/tmux.yml
Normal file
|
@ -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
|
22
playbooks/roles/shell/tasks/zsh.yml
Normal file
22
playbooks/roles/shell/tasks/zsh.yml
Normal file
|
@ -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
|
158
playbooks/roles/shell/templates/init.vim.j2
Normal file
158
playbooks/roles/shell/templates/init.vim.j2
Normal file
|
@ -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
|
||||||
|
" <leader>pp Toggle paste mode on and off
|
||||||
|
" <leader><cr> Disable search highlight
|
||||||
|
"
|
||||||
|
" <cr> is carriage return, "Enter"
|
||||||
|
" <leader> 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 <C-Up> :m-2<CR>
|
||||||
|
nnoremap <C-Down> :m+<CR>
|
||||||
|
inoremap <C-Up> <Esc>:m-2<CR>
|
||||||
|
inoremap <C-Down> <Esc>:m+<CR>
|
||||||
|
vnoremap <C-Up> :m '<-2<CR>gv=gv
|
||||||
|
vnoremap <C-Down> :m '>+1<CR>gv=gv
|
||||||
|
" or Ctrl+j/k
|
||||||
|
nnoremap <C-j> :m .+1<CR>==
|
||||||
|
nnoremap <C-k> :m .-2<CR>==
|
||||||
|
inoremap <C-j> <ESC>:m .+1<CR>==gi
|
||||||
|
inoremap <C-k> <ESC>:m .-2<CR>==gi
|
||||||
|
vnoremap <C-j> :m '>+1<CR>gv=gv
|
||||||
|
vnoremap <C-k> :m '<-2<CR>gv=gv
|
||||||
|
|
||||||
|
" Toggle paste mode on and off
|
||||||
|
" \ + pp
|
||||||
|
map <leader>pp :setlocal paste!<cr>
|
||||||
|
|
||||||
|
" Disable search highlight when <leader><cr> is pressed
|
||||||
|
map <silent> <leader><cr> :noh<cr>
|
||||||
|
|
||||||
|
" Tab support
|
||||||
|
nnoremap <silent> <C-n> :tabnext<CR>
|
||||||
|
nnoremap <silent> <C-p> :tabprevious<CR>
|
||||||
|
nnoremap <silent> <C-S-t> :tabnew<CR>
|
||||||
|
|
||||||
|
" NERDTree
|
||||||
|
nmap <silent> <F7> :NERDTreeToggle<CR>
|
||||||
|
|
||||||
|
:set guicursor=
|
8
playbooks/roles/shell/templates/starship.toml.j2
Normal file
8
playbooks/roles/shell/templates/starship.toml.j2
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[username]
|
||||||
|
show_always = true
|
||||||
|
|
||||||
|
[hostname]
|
||||||
|
ssh_only = false
|
||||||
|
|
||||||
|
[time]
|
||||||
|
disabled = false
|
32
playbooks/roles/shell/templates/tmux.conf.j2
Normal file
32
playbooks/roles/shell/templates/tmux.conf.j2
Normal file
|
@ -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'
|
10
playbooks/roles/shell/templates/tmux_status.conf.j2
Normal file
10
playbooks/roles/shell/templates/tmux_status.conf.j2
Normal file
|
@ -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]'
|
39
playbooks/roles/shell/templates/zshrc.j2
Normal file
39
playbooks/roles/shell/templates/zshrc.j2
Normal file
|
@ -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)"
|
17
playbooks/roles/ssh/tasks/main.yml
Normal file
17
playbooks/roles/ssh/tasks/main.yml
Normal file
|
@ -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
|
37
playbooks/roles/ssh/templates/ssh_config.j2
Normal file
37
playbooks/roles/ssh/templates/ssh_config.j2
Normal file
|
@ -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
|
15
playbooks/roles/vscode/tasks/main.yml
Normal file
15
playbooks/roles/vscode/tasks/main.yml
Normal file
|
@ -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
|
12
playbooks/roles/vscode/templates/code-url.desktop.j2
Normal file
12
playbooks/roles/vscode/templates/code-url.desktop.j2
Normal file
|
@ -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;
|
18
playbooks/roles/vscode/templates/code.desktop.j2
Normal file
18
playbooks/roles/vscode/templates/code.desktop.j2
Normal file
|
@ -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
|
31
playbooks/roles/vscode/templates/update.sh.j2
Normal file
31
playbooks/roles/vscode/templates/update.sh.j2
Normal file
|
@ -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
|
10
scripts/generate_gpg.sh
Normal file
10
scripts/generate_gpg.sh
Normal file
|
@ -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
|
Loading…
Reference in a new issue