├── .editorconfig ├── .github └── workflows │ └── docker-publish.yml ├── .gitignore ├── Dockerfile.template ├── LICENSE ├── Makefile ├── README.md ├── exclude ├── pacman-conf.d-noextract.conf └── rootfs └── etc ├── locale.conf ├── locale.gen ├── os-release └── skel └── .bashrc /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | [*] 3 | indent_style = space 4 | end_of_line = lf 5 | charset = utf-8 6 | [Makefile] 7 | indent_style = tab 8 | -------------------------------------------------------------------------------- /.github/workflows/docker-publish.yml: -------------------------------------------------------------------------------- 1 | name: Scheduled Publish 2 | 3 | on: 4 | schedule: 5 | - cron: '22 3 * * 0' 6 | workflow_dispatch: 7 | 8 | env: 9 | BASE_DEVEL_IMG: base-devel 10 | LATEST_IMG: latest 11 | BASE_IMG: base 12 | 13 | # IMPORTANT NOTE: The first time this automation is run, the invoked container in "image" field must access to Athena and Chaotic repositories otherwise 14 | # when the building image tries to install chaotic-mirrorlist, it cannot find the package because the invoked container is not linked to its repository. 15 | # It is the case where the original athenaos/base-devel image in Docker Hub is corrupted or has been pushed an image with no repositories reported above. 16 | # In this case, just push the Athena Base-devel image atleast one time to Docker by using your local Athena machine with Athena and Chaotic repositories enabled. 17 | 18 | jobs: 19 | publish: 20 | runs-on: ubuntu-latest 21 | container: 22 | image: athenaos/base-devel:latest 23 | 24 | steps: 25 | - uses: actions/checkout@v4 26 | 27 | - name: Set fastest mirrors 28 | run: | 29 | pacman -Syyu --noconfirm reflector 30 | reflector --age 6 --connection-timeout 15 --download-timeout 15 --latest 21 --fastest 21 --threads 21 --sort rate --protocol https --save /etc/pacman.d/mirrorlist 31 | 32 | - name: Install dependencies 33 | run: pacman -Syyu --noconfirm --needed make docker docker-buildx devtools fakeroot fakechroot 34 | 35 | - name: Build base 36 | run: | 37 | make athena-base 38 | docker tag athenaos/base docker.io/athenaos/$BASE_IMG:$LATEST_IMG 39 | 40 | - name: Build base-devel 41 | run: | 42 | make athena-base-devel 43 | docker tag athenaos/base-devel docker.io/athenaos/$BASE_DEVEL_IMG:$LATEST_IMG 44 | 45 | - name: Log into registry 46 | uses: docker/login-action@v3 47 | with: 48 | username: ${{ secrets.DOCKER_HUB_USER }} 49 | password: ${{ secrets.DOCKER_HUB_TOKEN }} 50 | 51 | - name: Push image 52 | run: | 53 | docker push docker.io/athenaos/$BASE_IMG:$LATEST_IMG 54 | docker push docker.io/athenaos/$BASE_DEVEL_IMG:$LATEST_IMG 55 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | output 3 | -------------------------------------------------------------------------------- /Dockerfile.template: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | ADD TEMPLATE_ROOTFS_FILE / 3 | ENV LANG=en_US.UTF-8 4 | CMD ["/usr/bin/bash"] 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Athena OS 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | BUILDDIR=$(shell pwd)/build 2 | OUTPUTDIR=$(shell pwd)/output 3 | 4 | define rootfs 5 | mkdir -vp $(BUILDDIR)/alpm-hooks/usr/share/libalpm/hooks 6 | find /usr/share/libalpm/hooks -exec ln -sf /dev/null $(BUILDDIR)/alpm-hooks{} \; 7 | 8 | mkdir -vp $(BUILDDIR)/var/lib/pacman/ $(OUTPUTDIR) 9 | install -Dm644 /usr/share/devtools/pacman.conf.d/multilib.conf $(BUILDDIR)/etc/pacman.conf 10 | sed -i "s/NoProgressBar/#NoProgressBar/g" $(BUILDDIR)/etc/pacman.conf 11 | cat pacman-conf.d-noextract.conf >> $(BUILDDIR)/etc/pacman.conf 12 | 13 | fakechroot -- fakeroot -- pacman -Syyu -r $(BUILDDIR) \ 14 | --noconfirm --dbpath $(BUILDDIR)/var/lib/pacman \ 15 | --config $(BUILDDIR)/etc/pacman.conf \ 16 | --noscriptlet \ 17 | --hookdir $(BUILDDIR)/alpm-hooks/usr/share/libalpm/hooks/ $(2) $(3) $(4) $(5) $(6) $(7) $(8) $(9) $(10) $(11) 18 | 19 | cp --recursive --preserve=timestamps --backup --suffix=.pacnew rootfs/* $(BUILDDIR)/ 20 | 21 | fakechroot -- fakeroot -- chroot $(BUILDDIR) update-ca-trust 22 | fakechroot -- fakeroot -- chroot $(BUILDDIR) locale-gen 23 | fakechroot -- fakeroot -- chroot $(BUILDDIR) sh -c 'pacman-key --init && pacman-key --populate && bash -c "rm -rf etc/pacman.d/gnupg/{openpgp-revocs.d/,private-keys-v1.d/,pubring.gpg~,gnupg.S.}*"' 24 | 25 | ln -fs /etc/os-release $(BUILDDIR)/usr/lib/os-release 26 | 27 | # add system users 28 | fakechroot -- fakeroot -- chroot $(BUILDDIR) /usr/bin/systemd-sysusers --root "/" 29 | 30 | # remove passwordless login for root (see CVE-2019-5021 for reference) 31 | sed -i -e 's/^root::/root:!:/' "$(BUILDDIR)/etc/shadow" 32 | 33 | # uncomment all mirrorlist servers 34 | sed -i -e "s/#Server/Server/g" "$(BUILDDIR)/etc/pacman.d/mirrorlist" 35 | 36 | # remove problematic mirror servers 37 | sed -i -e "/geo.mirror.pkgbuild.com/d" "$(BUILDDIR)/etc/pacman.d/mirrorlist" 38 | sed -i -e "/mirrors.eze.sysarmy.com/d" "$(BUILDDIR)/etc/pacman.d/mirrorlist" 39 | sed -i -e "/mirror.osbeck.com/d" "$(BUILDDIR)/etc/pacman.d/mirrorlist" 40 | sed -i -e "/mirror.theo546.fr/d" "$(BUILDDIR)/etc/pacman.d/mirrorlist" 41 | sed -i -e "/cdn-mirror.chaotic.cx/d" "$(BUILDDIR)/etc/pacman.d/chaotic-mirrorlist" 42 | 43 | 44 | # fakeroot to map the gid/uid of the builder process to root 45 | 46 | fakeroot -- tar --numeric-owner --xattrs --acls --exclude-from=exclude -C $(BUILDDIR) -c . -f $(OUTPUTDIR)/$(1).tar 47 | 48 | # keep XZ as extension. If you use ZST instead of XZ, GitHub Actions workflow is not able to build and push correctly the image 49 | 50 | cd $(OUTPUTDIR); xz -9 -T0 -f $(1).tar; sha256sum $(1).tar.xz > $(1).tar.xz.SHA256 51 | endef 52 | 53 | define dockerfile 54 | sed -e "s|TEMPLATE_ROOTFS_FILE|$(1).tar.xz|" \ 55 | Dockerfile.template > $(OUTPUTDIR)/Dockerfile.$(1) 56 | endef 57 | 58 | .PHONY: clean 59 | clean: 60 | rm -rf $(BUILDDIR) $(OUTPUTDIR) 61 | 62 | $(OUTPUTDIR)/base.tar.xz: 63 | $(call rootfs,base,base,archlinux-keyring,pacman-mirrorlist,athena-keyring,athena-mirrorlist,chaotic-keyring,chaotic-mirrorlist,rate-mirrors) 64 | 65 | $(OUTPUTDIR)/base-devel.tar.xz: 66 | $(call rootfs,base-devel,base base-devel,archlinux-keyring,pacman-mirrorlist,athena-keyring,athena-mirrorlist,chaotic-keyring,chaotic-mirrorlist,rate-mirrors) 67 | 68 | $(OUTPUTDIR)/Dockerfile.base: $(OUTPUTDIR)/base.tar.xz 69 | $(call dockerfile,base) 70 | 71 | $(OUTPUTDIR)/Dockerfile.base-devel: $(OUTPUTDIR)/base-devel.tar.xz 72 | $(call dockerfile,base-devel) 73 | 74 | .PHONY: docker-base 75 | athena-base: $(OUTPUTDIR)/Dockerfile.base 76 | docker buildx build -f $(OUTPUTDIR)/Dockerfile.base -t athenaos/base:latest $(OUTPUTDIR) 77 | 78 | .PHONY: docker-base-devel 79 | athena-base-devel: $(OUTPUTDIR)/Dockerfile.base-devel 80 | docker buildx build -f $(OUTPUTDIR)/Dockerfile.base-devel -t athenaos/base-devel:latest $(OUTPUTDIR) 81 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Athena OS Docker Image 2 | 3 | 4 | 5 | Athena OS provides Docker images in the [official DockerHub library](https://hub.docker.com/u/athenaos) (`docker pull athenaos/base:latest`). 6 | 7 | Images in the official library are updated weekly while our own repository is updated daily. 8 | 9 | Two versions of the image are provided: `base` (approx. 135MB) and `base-devel` (approx. 240MB), containing the respective meta package / package group. Both are available as tags with `latest` pointing to `base`. 10 | 11 | While the images are regularly kept up to date it is strongly recommended running `pacman -Syu` right after starting a container due to the rolling release nature of Athena OS. 12 | 13 | ## Principles 14 | * Provide the Athena OS experience in a Docker image 15 | * Provide the simplest but complete image to `base` and `base-devel` on a regular basis 16 | * `pacman` needs to work out of the box 17 | * All installed packages have to be kept unmodified 18 | 19 | ## Building your own image 20 | 21 | [This repository](https://github.com/Athena-OS/athena-base-docker) contains all scripts and files needed to create a Docker image for Athena OS. 22 | 23 | ### Dependencies 24 | Install the following packages: 25 | * make 26 | * devtools 27 | * docker 28 | * docker-buildx 29 | * fakechroot 30 | * fakeroot 31 | 32 | ``` 33 | sudo pacman -S make devtools docker docker-buildx fakechroot fakeroot 34 | ``` 35 | 36 | Make sure your user can directly interact with Docker (i.e. `docker info` works). 37 | 38 | ### Usage 39 | Start Docker daemon: 40 | ``` 41 | sudo systemctl start docker 42 | ``` 43 | 44 | Run 45 | ``` 46 | sudo make clean 47 | sudo make athena-base 48 | ``` 49 | to build the `base` image with the `base` meta package installed. Push the image to Docker Hub by: 50 | ``` 51 | sudo docker push athenaos/base:latest 52 | ``` 53 | 54 | You can also run 55 | ``` 56 | sudo make clean 57 | sudo make athena-base-devel 58 | ``` 59 | to build the image `base-devel` which additionally has the `base-devel` group installed. Push the image to Docker Hub by: 60 | ``` 61 | sudo docker push athenaos/base-devel:latest 62 | ``` 63 | If requested, the login must be performed by: 64 | ``` 65 | sudo docker login 66 | ``` 67 | To create and run a container from the created image: 68 | ``` 69 | sudo docker run --rm -it --entrypoint bash athenaos/base 70 | ``` 71 | 72 | ### Weekly builds 73 | 74 | Weekly images are build with scheduled [GitHub Actions](https://github.com/Athena-OS/athena-base-docker/blob/main/.github/workflows/docker-publish.yml) using our own runner infrastructure. Initially root filesystem archives are constructed and provided in this repository. The released multi-stage Dockerfile downloads those archives and verifies their integrity before unpacking it into a Docker image layer. Images could be built using [kaniko](https://github.com/GoogleContainerTools/kaniko) to avoid using privileged Docker containers, which also publishes them to our Docker Hub repository. 75 | 76 | ### Development 77 | 78 | Changes in Git feature branches are built and tested using the pipeline as well. Development images are uploaded to our [Docker Hub Registry](https://hub.docker.com/u/athenaos). 79 | -------------------------------------------------------------------------------- /exclude: -------------------------------------------------------------------------------- 1 | ./.dockerenv 2 | ./.dockerinit 3 | ./sys 4 | ./proc 5 | ./dev 6 | ./etc/hostname 7 | ./etc/machine-id 8 | ./etc/resolv.conf 9 | ./etc/pacman.d/gnupg/openpgp-revocs.d/* 10 | ./etc/pacman.d/gnupg/private-keys-v1.d/* 11 | ./etc/pacman.d/gnupg/pubring.gpg~ 12 | ./etc/pacman.d/gnupg/S.* 13 | ./tmp/* 14 | ./var/cache/pacman/pkg/* 15 | ./var/lib/pacman/sync/* 16 | ./var/tmp/* 17 | ./alpm-hooks 18 | -------------------------------------------------------------------------------- /pacman-conf.d-noextract.conf: -------------------------------------------------------------------------------- 1 | [athena] 2 | Include = /etc/pacman.d/athena-mirrorlist 3 | 4 | [chaotic-aur] 5 | Include = /etc/pacman.d/chaotic-mirrorlist 6 | 7 | [options] 8 | NoExtract = usr/lib/os-release 9 | NoExtract = usr/share/help/* !usr/share/help/en* 10 | NoExtract = usr/share/gtk-doc/html/* usr/share/doc/* 11 | NoExtract = usr/share/locale/* usr/share/X11/locale/* usr/share/i18n/* 12 | NoExtract = !*locale*/en*/* !usr/share/i18n/charmaps/UTF-8.gz !usr/share/*locale*/locale.* 13 | NoExtract = !usr/share/*locales/en_?? !usr/share/*locales/i18n* !usr/share/*locales/iso* 14 | NoExtract = !usr/share/*locales/trans* 15 | NoExtract = usr/share/man/* usr/share/info/* 16 | NoExtract = usr/share/vim/vim*/lang/* 17 | -------------------------------------------------------------------------------- /rootfs/etc/locale.conf: -------------------------------------------------------------------------------- 1 | LANG=en_US.UTF-8 2 | -------------------------------------------------------------------------------- /rootfs/etc/locale.gen: -------------------------------------------------------------------------------- 1 | en_US.UTF-8 UTF-8 2 | -------------------------------------------------------------------------------- /rootfs/etc/os-release: -------------------------------------------------------------------------------- 1 | NAME="Athena OS" 2 | PRETTY_NAME="Athena OS" 3 | ID=athena 4 | BUILD_ID=rolling 5 | VERSION_ID=stable 6 | ANSI_COLOR="38;2;255;230;0" 7 | HOME_URL="https://www.athenaos.org" 8 | DOCUMENTATION_URL="https://www.athenaos.org" 9 | SUPPORT_URL="https://bbs.archlinux.org" 10 | BUG_REPORT_URL="https://github.com/Athena-OS/athena-iso/issues" 11 | PRIVACY_POLICY_URL="https://www.athenaos.org/en/policy/privacy-policy/" 12 | LOGO=athena-hello-logo 13 | IMAGE_ID=athena 14 | IMAGE_VERSION=2023.06.23 15 | -------------------------------------------------------------------------------- /rootfs/etc/skel/.bashrc: -------------------------------------------------------------------------------- 1 | # ~/.bashrc 2 | 3 | # Append "$1" to $PATH when not already in. 4 | append_path () { 5 | case ":$PATH:" in 6 | *:"$1":*) 7 | ;; 8 | *) 9 | export PATH="${PATH:+$PATH:}$1" 10 | esac 11 | } 12 | append_path "$HOME/bin" 13 | append_path "$HOME/.local/bin" 14 | 15 | ### EXPORT ### Should be before the change of the shell 16 | export EDITOR=/usr/bin/nvim 17 | export VISUAL='nano' 18 | export HISTCONTROL=ignoreboth:erasedups:ignorespace 19 | HISTSIZE=100000 20 | HISTFILESIZE=2000000 21 | shopt -s histappend 22 | export PAGER='most' 23 | 24 | #Ibus settings if you need them 25 | #type ibus-setup in terminal to change settings and start the daemon 26 | #delete the hashtags of the next lines and restart 27 | #export GTK_IM_MODULE=ibus 28 | #export XMODIFIERS=@im=dbus 29 | #export QT_IM_MODULE=ibus 30 | 31 | # COLOURS! YAAAY! 32 | export TERM=xterm-256color 33 | 34 | #export BFETCH_INFO="pfetch" 35 | #export BFETCH_ART="$HOME/.local/textart/fetch/unix.textart" 36 | #export PF_INFO="Unix Genius" 37 | 38 | #export BFETCH_INFO="curl --silent --location 'wttr.in/rome?0pq'" 39 | #export BFETCH_ART="printf \"\033[35m\"; figlet -f Bloody Spooky" 40 | #export BFETCH_COLOR="$HOME/.local/textart/color/icon/ghosts.textart" 41 | 42 | #export BFETCH_INFO="exa -la" 43 | #export BFETCH_ART="$HOME/.local/textart/fetch/pacman-maze.textart" 44 | #export BFETCH_COLOR="$HOME/.local/textart/color/icon/pacman.textart" 45 | 46 | export BFETCH_INFO="pfetch" 47 | export BFETCH_ART="cowsay '<3 Athena OS'" 48 | export BFETCH_COLOR="$HOME/.local/textart/color/icon/panes.textart" 49 | 50 | export PAYLOADS="/usr/share/payloads" 51 | export SECLISTS="$PAYLOADS/SecLists" 52 | export PAYLOADSALLTHETHINGS="$PAYLOADS/PayloadsAllTheThings" 53 | export FUZZDB="$PAYLOADS/FuzzDB" 54 | export AUTOWORDLISTS="$PAYLOADS/Auto_Wordlists" 55 | export SECURITYWORDLIST="$PAYLOADS/Security-Wordlist" 56 | 57 | export MIMIKATZ="/usr/share/windows/mimikatz/" 58 | export POWERSPLOIT="/usr/share/windows/powersploit/" 59 | 60 | export ROCKYOU="$SECLISTS/Passwords/Leaked-Databases/rockyou.txt" 61 | export DIRSMALL="$SECLISTS/Discovery/Web-Content/directory-list-2.3-small.txt" 62 | export DIRMEDIUM="$SECLISTS/Discovery/Web-Content/directory-list-2.3-medium.txt" 63 | export DIRBIG="$SECLISTS/Discovery/Web-Content/directory-list-2.3-big.txt" 64 | export WEBAPI_COMMON="$SECLISTS/Discovery/Web-Content/api/api-endpoints.txt" 65 | export WEBAPI_MAZEN="$SECLISTS/Discovery/Web-Content/common-api-endpoints-mazen160.txt" 66 | export WEBCOMMON="$SECLISTS/Discovery/Web-Content/common.txt" 67 | export WEBPARAM="$SECLISTS/Discovery/Web-Content/burp-parameter-names.txt" 68 | 69 | # If not running interactively, don't do anything 70 | [[ $- != *i* ]] && return 71 | 72 | # switch shell 73 | #[[ $(ps --no-header --pid=$PPID --format=comm) != "${SHELL#/usr/bin/}" && -z ${BASH_EXECUTION_STRING} && ${SHELL} != "/usr/bin/bash" ]] && exec $SHELL 74 | 75 | #Configure zoxide for bash 76 | eval "$(zoxide init bash)" 77 | 78 | if [[ $(tty) == */dev/tty* ]]; then 79 | PS1="\e[1;32m[HQ:\e[1;31m$(ip -4 addr | grep -v '127.0.0.1' | grep -v 'secondary' | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | sed -z 's/\n/|/g;s/|\$/\n/' | rev | cut -c 2- | rev) | \u\e[1;32m]\n[>]\[\e[1;36m\]\$(pwd) $ \[\e[0m\]" 80 | else 81 | PS1="\e[1;32m┌──[HQ🚀🌐\e[1;31m$(ip -4 addr | grep -v '127.0.0.1' | grep -v 'secondary' | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | sed -z 's/\n/|/g;s/|\$/\n/' | rev | cut -c 2- | rev)🔥\u\e[1;32m]\n└──╼[👾]\[\e[1;36m\]\$(pwd) $ \[\e[0m\]" 82 | fi 83 | 84 | # Use bash-completion, if available 85 | #[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \ 86 | # . /usr/share/bash-completion/bash_completion 87 | 88 | # Bash aliases 89 | if [ -f ~/.bash_aliases ]; then 90 | . ~/.bash_aliases 91 | fi 92 | 93 | # Change up a variable number of directories 94 | # E.g: 95 | # cu -> cd ../ 96 | # cu 2 -> cd ../../ 97 | # cu 3 -> cd ../../../ 98 | function cu { 99 | local count=$1 100 | if [ -z "${count}" ]; then 101 | count=1 102 | fi 103 | local path="" 104 | for i in $(seq 1 ${count}); do 105 | path="${path}../" 106 | done 107 | cd $path 108 | } 109 | 110 | 111 | # Open all modified files in vim tabs 112 | function vimod { 113 | vim -p $(git status -suall | awk '{print $2}') 114 | } 115 | 116 | # Open files modified in a git commit in vim tabs; defaults to HEAD. Pop it in your .bashrc 117 | # Examples: 118 | # virev 49808d5 119 | # virev HEAD~3 120 | function virev { 121 | commit=$1 122 | if [ -z "${commit}" ]; then 123 | commit="HEAD" 124 | fi 125 | rootdir=$(git rev-parse --show-toplevel) 126 | sourceFiles=$(git show --name-only --pretty="format:" ${commit} | grep -v '^$') 127 | toOpen="" 128 | for file in ${sourceFiles}; do 129 | file="${rootdir}/${file}" 130 | if [ -e "${file}" ]; then 131 | toOpen="${toOpen} ${file}" 132 | fi 133 | done 134 | if [ -z "${toOpen}" ]; then 135 | echo "No files were modified in ${commit}" 136 | return 1 137 | fi 138 | vim -p ${toOpen} 139 | } 140 | 141 | # 'Safe' version of __git_ps1 to avoid errors on systems that don't have it 142 | function gitPrompt { 143 | command -v __git_ps1 > /dev/null && __git_ps1 " (%s)" 144 | } 145 | 146 | # Colours have names too. Stolen from Arch wiki 147 | txtblk='\[\e[0;30m\]' # Black - Regular 148 | txtred='\[\e[0;31m\]' # Red 149 | txtgrn='\[\e[0;32m\]' # Green 150 | txtylw='\[\e[0;33m\]' # Yellow 151 | txtblu='\[\e[0;34m\]' # Blue 152 | txtpur='\[\e[0;35m\]' # Purple 153 | txtcyn='\[\e[0;36m\]' # Cyan 154 | txtwht='\[\e[0;37m\]' # White 155 | bldblk='\[\e[1;30m\]' # Black - Bold 156 | bldred='\[\e[1;31m\]' # Red 157 | bldgrn='\[\e[1;32m\]' # Green 158 | bldylw='\[\e[1;33m\]' # Yellow 159 | bldblu='\[\e[1;34m\]' # Blue 160 | bldpur='\[\e[1;35m\]' # Purple 161 | bldcyn='\[\e[1;36m\]' # Cyan 162 | bldwht='\[\e[1;37m\]' # White 163 | unkblk='\[\e[4;30m\]' # Black - Underline 164 | undred='\[\e[4;31m\]' # Red 165 | undgrn='\[\e[4;32m\]' # Green 166 | undylw='\[\e[4;33m\]' # Yellow 167 | undblu='\[\e[4;34m\]' # Blue 168 | undpur='\[\e[4;35m\]' # Purple 169 | undcyn='\[\e[4;36m\]' # Cyan 170 | undwht='\[\e[4;37m\]' # White 171 | bakblk='\[\e[40m\]' # Black - Background 172 | bakred='\[\e[41m\]' # Red 173 | badgrn='\[\e[42m\]' # Green 174 | bakylw='\[\e[43m\]' # Yellow 175 | bakblu='\[\e[44m\]' # Blue 176 | bakpur='\[\e[45m\]' # Purple 177 | bakcyn='\[\e[46m\]' # Cyan 178 | bakwht='\[\e[47m\]' # White 179 | txtrst='\[\e[0m\]' # Text Reset 180 | 181 | # Prompt colours 182 | atC="${txtpur}" 183 | nameC="${txtpur}" 184 | hostC="${txtpur}" 185 | pathC="${txtgrn}" 186 | gitC="${txtpur}" 187 | pointerC="${txtgrn}" 188 | normalC="${txtwht}" 189 | 190 | # Red name for root 191 | if [ "${UID}" -eq "0" ]; then 192 | nameC="${txtred}" 193 | fi 194 | 195 | #shopt 196 | shopt -s autocd # change to named directory 197 | shopt -s cdspell # autocorrects cd misspellings 198 | shopt -s cmdhist # save multi-line commands in history as single line 199 | shopt -s dotglob 200 | shopt -s histappend # do not overwrite history 201 | shopt -s expand_aliases # expand aliases 202 | 203 | # # ex = EXtractor for all kinds of archives 204 | # # usage: ex 205 | ex () 206 | { 207 | if [ -f $1 ] ; then 208 | case $1 in 209 | *.tar.bz2) tar xjf $1 ;; 210 | *.tar.gz) tar xzf $1 ;; 211 | *.bz2) bunzip2 $1 ;; 212 | *.rar) unrar x $1 ;; 213 | *.gz) gunzip $1 ;; 214 | *.tar) tar xf $1 ;; 215 | *.tbz2) tar xjf $1 ;; 216 | *.tgz) tar xzf $1 ;; 217 | *.zip) unzip $1 ;; 218 | *.Z) uncompress $1;; 219 | *.7z) 7z x $1 ;; 220 | *.deb) ar x $1 ;; 221 | *.tar.xz) tar xf $1 ;; 222 | *.tar.zst) tar xf $1 ;; 223 | *) echo "'$1' cannot be extracted via ex()" ;; 224 | esac 225 | else 226 | echo "'$1' is not a valid file" 227 | fi 228 | } 229 | 230 | export PROMPT_COMMAND='source ~/.bashrc no-repeat-flag' 231 | 232 | buffer_clean(){ 233 | free -h && sudo sh -c 'echo 1 > /proc/sys/vm/drop_caches' && free -h 234 | } 235 | 236 | # reporting tools - install when not installed and uncomment your favourite 237 | #if [[ $1 != no-repeat-flag ]]; then 238 | # neofetch 239 | #fi 240 | 241 | #[[ $1 != no-repeat-flag && -f /usr/share/blesh/ble.sh ]] && source /usr/share/blesh/ble.sh 242 | --------------------------------------------------------------------------------