Docker Shortcuts (#43)
* Shrink toolbar icons to 28 from 32. * Add shortcut commands for Docker administration. * Add more docker commands. General improvements.
This commit is contained in:
parent
84844715a6
commit
a9d20be8e0
@ -17,7 +17,7 @@
|
|||||||
create: no
|
create: no
|
||||||
state: present
|
state: present
|
||||||
when: ansible_distribution == "Archlinux"
|
when: ansible_distribution == "Archlinux"
|
||||||
|
|
||||||
#- name: General | Account Management | Users | Use ZSH (Arch+Manjaro)
|
#- name: General | Account Management | Users | Use ZSH (Arch+Manjaro)
|
||||||
# set_fact:
|
# set_fact:
|
||||||
# user_shell: "{{ zsh_exec.stdout }}"
|
# user_shell: "{{ zsh_exec.stdout }}"
|
||||||
@ -62,7 +62,7 @@
|
|||||||
user:
|
user:
|
||||||
name: "{{ user }}"
|
name: "{{ user }}"
|
||||||
comment: "{{ user_desc }}"
|
comment: "{{ user_desc }}"
|
||||||
groups:
|
groups:
|
||||||
- sudo
|
- sudo
|
||||||
- video
|
- video
|
||||||
- render
|
- render
|
||||||
@ -82,7 +82,7 @@
|
|||||||
## Folders ##
|
## Folders ##
|
||||||
|
|
||||||
- name: General | Account Management | Users | Folders | Root | Create bin, Downloads, TRASH
|
- name: General | Account Management | Users | Folders | Root | Create bin, Downloads, TRASH
|
||||||
file:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
@ -93,7 +93,7 @@
|
|||||||
when: user_root.home != ""
|
when: user_root.home != ""
|
||||||
|
|
||||||
- name: General | Account Management | Users | Folders | Hyperling | Create bin, LBRY, TRASH
|
- name: General | Account Management | Users | Folders | Hyperling | Create bin, LBRY, TRASH
|
||||||
file:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
@ -119,7 +119,7 @@
|
|||||||
alias_rm: alias rm='echo "Use mv ~/TRASH/ instead!"'
|
alias_rm: alias rm='echo "Use mv ~/TRASH/ instead!"'
|
||||||
alias_clean_dir: alias clean-dir='mv * ~/TRASH/'
|
alias_clean_dir: alias clean-dir='mv * ~/TRASH/'
|
||||||
alias_clean_trash: alias clean-trash='sh -c "rm -rfv ~/TRASH/*"'
|
alias_clean_trash: alias clean-trash='sh -c "rm -rfv ~/TRASH/*"'
|
||||||
path_additions: export PATH="~/bin:$PATH"
|
export_path_additions: export PATH="~/bin:$PATH"
|
||||||
function_wttr: |
|
function_wttr: |
|
||||||
function weather() {
|
function weather() {
|
||||||
# 20210301 - Someone showed me an awesome weather API! Had to implement it!
|
# 20210301 - Someone showed me an awesome weather API! Had to implement it!
|
||||||
@ -137,13 +137,13 @@
|
|||||||
fi
|
fi
|
||||||
curl "https://wttr.in/${1//\ /+}"
|
curl "https://wttr.in/${1//\ /+}"
|
||||||
}
|
}
|
||||||
PS1: export PS1='[\u@\h \w]\$ '
|
export_PS1: export PS1='[\u@\h \w]\$ '
|
||||||
remount: alias remount='sudo umount /mnt/*; sudo umount /mnt/*/*; sudo mount -a; echo -e "\nRemount completed!"; mount | grep /mnt'
|
alias_remount: alias remount='sudo umount /mnt/*; sudo umount /mnt/*/*; sudo mount -a; echo -e "\nRemount completed!"; mount | grep /mnt'
|
||||||
update: |
|
function_update: |
|
||||||
function update() {
|
function update() {
|
||||||
PROG=$FUNCNAME
|
PROG=$FUNCNAME
|
||||||
usage="Usage: $PROG [-y]
|
usage="Usage: $PROG [-y]
|
||||||
$PROG is used to run all the system's package manager commands
|
$PROG is used to run all the system's package manager commands
|
||||||
in one swoop. Flow stops if any command returns a failure code.
|
in one swoop. Flow stops if any command returns a failure code.
|
||||||
The hope is to run something as easy as 'pacman -Syyu'.
|
The hope is to run something as easy as 'pacman -Syyu'.
|
||||||
-y : Assume yes to any prompts."
|
-y : Assume yes to any prompts."
|
||||||
@ -153,11 +153,11 @@
|
|||||||
while getopts ":hy" opt; do
|
while getopts ":hy" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
h) echo -e "$usage"
|
h) echo -e "$usage"
|
||||||
return 0 ;;
|
return 0 ;;
|
||||||
y) accept="-y" ;;
|
y) accept="-y" ;;
|
||||||
*) echo "ERROR: -$OPTARG is not a recognized option."
|
*) echo "ERROR: -$OPTARG is not a recognized option." >&2
|
||||||
echo -e "$usage"
|
echo -e "$usage"
|
||||||
return 1 ;;
|
return 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -165,30 +165,30 @@
|
|||||||
{{ update_flatpak }}
|
{{ update_flatpak }}
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
echo "ERROR: $PROG experienced a problem and has aborted."
|
echo "ERROR: $PROG experienced a problem and has aborted." >&2
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
sync: alias sync='date && echo "Syncing!" && sync && date'
|
alias_sync: alias sync='date && echo "Syncing!" && sync && date'
|
||||||
editor: export EDITOR='vi'
|
export_editor: export EDITOR='vi'
|
||||||
init_aliases: |
|
init_aliases: |
|
||||||
alias init-video='mkdir -v raw; mkdir -v exports; cp ~/Templates/*video* ./'
|
alias init-video='mkdir -v raw; mkdir -v exports; cp ~/Templates/*video* ./'
|
||||||
alias init-vid=init-video
|
alias init-vid=init-video
|
||||||
alias init-program='echo -e "#!/bin/bash\n# `date +%Y-%m-%d` by Hyperling\n# REASON\n\nexit 0\n"'
|
alias init-program='echo -e "#!/bin/bash\n# `date +%Y-%m-%d` by Hyperling\n# REASON\n\nexit 0\n"'
|
||||||
alias init-prog=init-program
|
alias init-prog=init-program
|
||||||
bye: |
|
bye_aliases: |
|
||||||
alias bye="{{ shutdown_command }}"
|
alias bye="{{ shutdown_command }}"
|
||||||
alias goodbye="update -y && bye"
|
alias goodbye="update -y && bye"
|
||||||
metasploit: |
|
metasploit_aliases: |
|
||||||
alias metasploit="msfconsole"
|
alias metasploit="msfconsole"
|
||||||
alias hax="metasploit"
|
alias hax="metasploit"
|
||||||
show_config: |
|
show_config_aliases: |
|
||||||
alias show-config-gen="cat {{ gen_file }}"
|
alias show-config-gen="cat {{ gen_file }}"
|
||||||
alias show-config-wrk="cat {{ wrk_file }}"
|
alias show-config-wrk="cat {{ wrk_file }}"
|
||||||
alias show-config-mnr="cat {{ mnr_file }}"
|
alias show-config-mnr="cat {{ mnr_file }}"
|
||||||
alias show-config-srv="cat {{ srv_file }}"
|
alias show-config-srv="cat {{ srv_file }}"
|
||||||
alias show-config-all="show-config-gen && echo '' && show-config-wrk && echo '' && show-config-mnr && echo '' && show-config-srv"
|
alias show-config-all="show-config-gen && echo '' && show-config-wrk && echo '' && show-config-mnr && echo '' && show-config-srv"
|
||||||
alias show-config="show-config-all"
|
alias show-config="show-config-all"
|
||||||
edit_config: |
|
edit_config_aliases: |
|
||||||
alias edit-config-gen="sudo $EDITOR {{ gen_file }}"
|
alias edit-config-gen="sudo $EDITOR {{ gen_file }}"
|
||||||
alias edit-config-wrk="sudo $EDITOR {{ wrk_file }}"
|
alias edit-config-wrk="sudo $EDITOR {{ wrk_file }}"
|
||||||
alias edit-config-mnr="sudo $EDITOR {{ mnr_file }}"
|
alias edit-config-mnr="sudo $EDITOR {{ mnr_file }}"
|
||||||
@ -200,13 +200,17 @@
|
|||||||
unset network
|
unset network
|
||||||
while (( $# > 0 )); do
|
while (( $# > 0 )); do
|
||||||
case $1 in
|
case $1 in
|
||||||
-c | -y | --clean ) clean="Y" ;;
|
-c | -y | --clean )
|
||||||
-n | -net | --network ) network="Y" ;;
|
clean="Y" ;;
|
||||||
* ) echo "
|
-n | -net | --network )
|
||||||
ERROR: Option '$1' with value '$2' not recognized.
|
network="Y" ;;
|
||||||
$PROG [-c|-clean|--clean|-y] [-n|-net|--network]
|
* )
|
||||||
"
|
echo "
|
||||||
return 1
|
ERROR: Option '$1' with value '$2' not recognized.
|
||||||
|
$PROG [-c|-clean|--clean|-y] [-n|-net|--network]
|
||||||
|
" >&2
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
@ -218,9 +222,9 @@
|
|||||||
echo "/root"
|
echo "/root"
|
||||||
echo "/home"
|
echo "/home"
|
||||||
}
|
}
|
||||||
dirs_to_check | while read dir; do
|
dirs_to_check | while read dir; do
|
||||||
echo "Checking $dir..."
|
echo "Checking $dir..."
|
||||||
sudo find $dir -name TRASH | while read trash; do
|
sudo find $dir -name TRASH | while read trash; do
|
||||||
if [[ "$trash" != "" && `sudo ls $trash` ]]; then
|
if [[ "$trash" != "" && `sudo ls $trash` ]]; then
|
||||||
echo "Found $trash with contents:"
|
echo "Found $trash with contents:"
|
||||||
sudo ls -lh $trash
|
sudo ls -lh $trash
|
||||||
@ -229,15 +233,15 @@
|
|||||||
sudo sh -c "rm -rfv $trash/*"
|
sudo sh -c "rm -rfv $trash/*"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
if [[ "$network" == "Y" ]]; then
|
if [[ "$network" == "Y" ]]; then
|
||||||
function network_to_check {
|
function network_to_check {
|
||||||
find /mnt -maxdepth 1 -mindepth 1
|
find /mnt -maxdepth 1 -mindepth 1
|
||||||
}
|
}
|
||||||
network_to_check | while read dir; do
|
network_to_check | while read dir; do
|
||||||
echo "Checking $dir..."
|
echo "Checking $dir..."
|
||||||
sudo find $dir -name TRASH | while read trash; do
|
sudo find $dir -name TRASH | while read trash; do
|
||||||
if [[ "$trash" != "" && `sudo ls $trash` ]]; then
|
if [[ "$trash" != "" && `sudo ls $trash` ]]; then
|
||||||
echo "Found $trash with contents:"
|
echo "Found $trash with contents:"
|
||||||
sudo ls -lh $trash
|
sudo ls -lh $trash
|
||||||
@ -246,7 +250,7 @@
|
|||||||
sudo sh -c "rm -rfv $trash/*"
|
sudo sh -c "rm -rfv $trash/*"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
echo "Checking but not cleaning /var/mail..."
|
echo "Checking but not cleaning /var/mail..."
|
||||||
@ -276,37 +280,63 @@
|
|||||||
flatpak repair &&
|
flatpak repair &&
|
||||||
echo "Finished purging all Flatpak apps. Executable may still need uninstalled." &&
|
echo "Finished purging all Flatpak apps. Executable may still need uninstalled." &&
|
||||||
return
|
return
|
||||||
echo "ERROR: Something went wrong while removing Flatpak apps!"
|
echo "ERROR: Something went wrong while removing Flatpak apps!" >&2
|
||||||
}
|
}
|
||||||
alias_vim: alias vi=vim
|
alias_vim: alias vi=vim
|
||||||
alias_here: alias here='ls -lh `pwd`/*'
|
alias_here: alias here='ls -alh `pwd`/*'
|
||||||
|
alias_docker_reload: alias docker-reload='docker compose down && docker compose build && docker compose up -d'
|
||||||
|
alias_docker_update: alias docker-update='docker compose down && docker compose pull && docker compose build && docker compose up -d'
|
||||||
|
function_docker_upgrade: |
|
||||||
|
# Wrapper for a full-scale upgrade of a container.
|
||||||
|
function docker-upgrade() {
|
||||||
|
container=$1
|
||||||
|
if [[ -z $container ]]; then
|
||||||
|
echo "ERROR: Container name or ID is required." >&2
|
||||||
|
return;
|
||||||
|
fi
|
||||||
|
if [[ -s $2 ]]; then
|
||||||
|
echo "ERROR: A second parameter is not expected, aborting." >&2
|
||||||
|
return;
|
||||||
|
fi
|
||||||
|
docker compose down &&
|
||||||
|
docker compose pull &&
|
||||||
|
docker compose build &&
|
||||||
|
docker compose up -d &&
|
||||||
|
echo "Following log." &&
|
||||||
|
docker logs -f $container
|
||||||
|
}
|
||||||
|
alias_docker_restart: alias docker-reload='docker compose down && docker compose up -d'
|
||||||
|
|
||||||
- name: General | Account Management | Users | Files | Common Variable
|
- name: General | Account Management | Users | Files | Common Variable
|
||||||
set_fact:
|
set_fact:
|
||||||
rc_common: |
|
rc_common: |
|
||||||
{{ path_additions }}
|
{{ export_path_additions }}
|
||||||
{{ alias_cp }}
|
{{ alias_cp }}
|
||||||
{{ alias_mv }}
|
{{ alias_mv }}
|
||||||
{{ alias_rm }}
|
{{ alias_rm }}
|
||||||
{{ alias_clean_dir }}
|
{{ alias_clean_dir }}
|
||||||
{{ alias_clean_trash }}
|
{{ alias_clean_trash }}
|
||||||
{{ function_wttr }}
|
{{ function_wttr }}
|
||||||
{{ PS1 }}
|
{{ export_PS1 }}
|
||||||
{{ remount }}
|
{{ alias_remount }}
|
||||||
{{ update }}
|
{{ function_update }}
|
||||||
{{ sync }}
|
{{ alias_sync }}
|
||||||
{{ editor }}
|
{{ export_editor }}
|
||||||
{{ init_aliases }}
|
{{ init_aliases }}
|
||||||
{{ bye }}
|
{{ bye_aliases }}
|
||||||
{{ metasploit }}
|
{{ metasploit_aliases }}
|
||||||
{{ show_config }}
|
{{ show_config_aliases }}
|
||||||
{{ edit_config }}
|
{{ edit_config_aliases }}
|
||||||
{{ function_check_trash }}
|
{{ function_check_trash }}
|
||||||
{{ function_clean }}
|
{{ function_clean }}
|
||||||
{{ function_flatpak_usage }}
|
{{ function_flatpak_usage }}
|
||||||
{{ function_flatpak_purge }}
|
{{ function_flatpak_purge }}
|
||||||
{{ alias_vim }}
|
{{ alias_vim }}
|
||||||
{{ alias_here }}
|
{{ alias_here }}
|
||||||
|
{{ alias_docker_reload }}
|
||||||
|
{{ alias_docker_update }}
|
||||||
|
{{ function_docker_upgrade }}
|
||||||
|
{{ alias_docker_restart }}
|
||||||
|
|
||||||
- name: General | Account Management | Users | Files | .bashrc
|
- name: General | Account Management | Users | Files | .bashrc
|
||||||
blockinfile:
|
blockinfile:
|
||||||
|
@ -158,7 +158,7 @@
|
|||||||
- name: Workstation | Account Management | GNOME | Dash To Dock | Icon Size
|
- name: Workstation | Account Management | GNOME | Dash To Dock | Icon Size
|
||||||
dconf:
|
dconf:
|
||||||
key: /org/gnome/shell/extensions/dash-to-dock/dash-max-icon-size
|
key: /org/gnome/shell/extensions/dash-to-dock/dash-max-icon-size
|
||||||
value: "32"
|
value: "28"
|
||||||
state: present
|
state: present
|
||||||
become_user: "{{ user }}"
|
become_user: "{{ user }}"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user