Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- PATH="/usr/lib/ccache/bin:$HOME/.local/bin:$HOME/bin:/snap/bin:$PATH"
- XDG_DATA_DIRS="$XDG_DATA_DIRS:/var/lib/flatpak/exports/share"
- # If not running interactively, don't do anything
- case $- in
- *i*) ;;
- *) return;;
- esac
- # don't put duplicate lines or lines starting with space in the history.
- # See bash(1) for more options
- HISTCONTROL=ignoreboth
- # append to the history file, don't overwrite it
- shopt -s histappend
- # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
- HISTSIZE=1000
- HISTFILESIZE=2000
- # check the window size after each command and, if necessary,
- # update the values of LINES and COLUMNS.
- shopt -s checkwinsize
- # make less more friendly for non-text input files, see lesspipe(1)
- [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
- # set a fancy prompt (non-color, unless we know we "want" color)
- case "$TERM" in
- xterm-color|*-256color) color_prompt=yes;;
- esac
- if ! shopt -oq posix; then
- if [ -f /usr/share/bash-completion/bash_completion ]; then
- . /usr/share/bash-completion/bash_completion
- elif [ -f /etc/bash_completion ]; then
- . /etc/bash_completion
- fi
- fi
- export VISUAL="nano"
- SYS_ID="$(lsb_release -si)"
- backup_vars() {
- OLDEDITOR=${EDITOR}
- OLDHOME=${HOME}
- OLDLANG=${LANG}
- OLDPATH=${PATH}
- OLDPS1=${PS1}
- OLDTERM=${TERM}
- echo -e "*Backup variables*
- OLDEDITOR=${EDITOR}
- OLDHOME=${HOME}
- OLDLANG=${LANG}
- OLDPATH=${PATH}
- OLDPS1=${PS1}
- OLDTERM=${TERM}"
- }
- restore_vars() {
- EDITOR=${OLDEDITOR}
- HOME=${OLDHOME}
- LANG=${OLDLANG}
- PATH=${OLDPATH}
- PS1=${OLDPS1}
- TERM=${OLDTERM}
- echo -e "*Restore variables*
- EDITOR=${OLDEDITOR}
- HOME=${OLDHOME}
- LANG=${OLDLANG}
- PATH=${OLDPATH}
- PS1=${OLDPS1}
- TERM=${OLDTERM}"
- }
- prepare_mxe(){
- backup_vars
- unset `env | \
- grep -vi '^EDITOR=\|^HOME=\|^LANG=\|MXE\|^PATH=' | \
- grep -vi 'PKG_CONFIG\|PROXY\|^PS1=\|^TERM=' | \
- cut -d '=' -f1 | tr '\n' ' '`
- export PATH=$PATH:/home/vitaly/github/mxe/usr/bin
- }
- run_mxe_cmake(){
- prepare_mxe
- i686-w64-mingw32.shared-cmake $@
- restore_vars
- }
- run_mxe_cmake_64(){
- prepare_mxe
- x86_64-w64-mingw32.shared-cmake $@
- restore_vars
- }
- update_ubuntu_system() {
- sudo apt update && sudo apt dist-upgrade
- }
- update_ubuntu_all() {
- update_ubuntu_system
- sudo update-apt-xapian-index -vf && sudo snap refresh \
- && flatpak update
- }
- clean_ubuntu_system() {
- sudo apt autoremove && sudo apt autoclean
- }
- update_system() {
- trizen -Suy
- }
- clean_system() {
- sudo pacman -Qtdq | sudo pacman -Rns - || echo "Nothing to clean"
- }
- install_custom_pkg() {
- sudo pacman -U $@
- }
- git_commit() {
- if [ ! -z "$1" ]; then
- git commit -am"$@"
- echo "Do you want to push your changes [y/n]"
- read answ
- if [ "${answ}" == "y" ] || [ "${answ}" == "Y" ]; then
- git push
- fi
- else
- echo "Command usage:
- gitcommit \"Description\""
- fi
- }
- build_arch_pkg() {
- if [ ! -z "$1" ]; then
- cdir=$(pwd)
- cd "$@"
- makepkg -ifCc
- cd ${cdir}
- fi
- }
- update_psi_plus() {
- build_arch_pkg /home/vitaly/build/pkgs/psi-plus-git
- }
- update_psi() {
- build_arch_pkg /home/vitaly/build/pkgs/psi-git
- }
- update_psi_plus_plugins() {
- build_arch_pkg /home/vitaly/build/pkgs/psi-plus-plugins-git
- }
- update_psi_plugins() {
- build_arch_pkg /home/vitaly/build/pkgs/psi-plugins-git
- }
- update_psi_plus_l10n() {
- build_arch_pkg /home/vitaly/build/pkgs/psi-plus-l10n-git
- }
- update_psi_l10n() {
- build_arch_pkg /home/vitaly/build/pkgs/psi-l10n-git
- }
- update_psi_resources() {
- build_arch_pkg /home/vitaly/build/pkgs/psi-plus-resources-git
- }
- update_psimedia() {
- build_arch_pkg /home/vitaly/build/pkgs/psimedia-git
- }
- update_psi_all() {
- update_psi
- update_psi_plugins
- update_psi_l10n
- }
- m_deploy_qt() {
- deplbin=/home/vitaly/github/mxedeployqt/mxedeployqt
- mxepath=/home/vitaly/github/mxe
- python $deplbin --mxepath=$mxepath "$@"
- }
- config_psi_mxe32() {
- if [ ! -z "$1" ]; then
- pbtype=$1
- else
- pbtype=basic
- fi
- cmargs="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCHAT_TYPE=${pbtype} -DENABLE_PLUGINS=ON -DBUILD_PSIMEDIA=ON -DBUILD_DEV_PLUGINS=ON -DDEV_MODE=ON -DPSI_PLUS=ON -DBUNDLED_IRIS_ALL=ON -DUSE_CCACHE=ON -DVERBOSE_PROGRAM_NAME=ON"
- run_mxe_cmake $cmargs "$@"
- }
- config_psi_mxe64() {
- if [ ! -z "$1" ]; then
- pbtype=$1
- else
- pbtype=basic
- fi
- cmargs="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCHAT_TYPE=${pbtype} -DENABLE_PLUGINS=ON -DBUILD_PSIMEDIA=ON -DBUILD_DEV_PLUGINS=ON -DDEV_MODE=ON -DPSI_PLUS=ON -DBUNDLED_IRIS_ALL=ON -DUSE_CCACHE=ON -DVERBOSE_PROGRAM_NAME=ON"
- run_mxe_cmake_64 $cmargs "$@"
- }
- build_psi_mxe32() {
- run_mxe_cmake --build . --target all --target prepare-bin --target prepare-bin-libs --parallel $(grep -c ^processor /proc/cpuinfo)
- }
- build_psi_mxe64() {
- run_mxe_cmake_64 --build . --target all --target prepare-bin --target prepare-bin-libs --parallel $(grep -c ^processor /proc/cpuinfo)
- }
- print_aliases() {
- used_aliases='
- alias upsys=update_system
- #alias upsys=update_ubuntu_system
- #alias upsysall=update_ubuntu_all
- alias sysclean=clean_system
- alias gitcommit=git_commit
- alias gitpull="git pull && git submodule init && git submodule update"
- alias gup="sudo update-grub"
- alias mxeprep=prepare_mxe
- alias mcmake=run_mxe_cmake
- alias mcmake64=run_mxe_cmake_64
- alias ls="ls --color=auto"
- alias grep="grep --color=auto"
- alias instpkg=install_custom_pkg
- alias gitreset="git reset --hard && git clean -xfd"
- alias updatepp=update_psi_plus
- alias updatep=update_psi
- alias updateppp=update_psi_plugins
- alias updatepl=update_psi_l10n
- #alias updatepr=update_psi_resources
- alias updatepall=update_psi_all
- alias deployqt=m_deploy_qt
- alias cpsi32=config_psi_mxe32
- alias cpsi32w="config_psi_mxe32 webkit"
- alias bpsi32=build_psi_mxe32
- alias cpsi64=config_psi_mxe64
- alias cpsi64w="config_psi_mxe64 webkit"
- alias bpsi64=build_psi_mxe64
- alias rotatelog="sudo journalctl --vacuum-time=2d"
- '
- echo -e "${used_aliases}"
- }
- alias upsys=update_system
- #alias upsys=update_ubuntu_system
- #alias upsysall=update_ubuntu_all
- alias sysclean=clean_system
- alias gitcommit=git_commit
- alias gitpull="git pull && git submodule init && git submodule update"
- alias gup="sudo update-grub"
- alias mxeprep=prepare_mxe
- alias mcmake=run_mxe_cmake
- alias mcmake64=run_mxe_cmake_64
- alias ls="ls --color=auto"
- alias grep="grep --color=auto"
- alias instpkg=install_custom_pkg
- alias gitreset="git reset --hard && git clean -xfd"
- alias updatepp=update_psi_plus
- alias updatep=update_psi
- alias updateppp=update_psi_plugins
- alias updatepl=update_psi_l10n
- #alias updatepr=update_psi_resources
- alias updatepall=update_psi_all
- alias deployqt=m_deploy_qt
- alias cpsi32=config_psi_mxe32
- alias cpsi32w="config_psi_mxe32 webkit"
- alias bpsi32=build_psi_mxe32
- alias cpsi64=config_psi_mxe64
- alias cpsi64w="config_psi_mxe64 webkit"
- alias bpsi64=build_psi_mxe64
- alias rotatelog="sudo journalctl --vacuum-time=2d"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement