commit 8a157ec7a7fa4e9e9c29b02697c9aefa5ed4904e Author: Andrey Zimin Date: Wed Feb 21 12:55:18 2024 +0300 initial commit diff --git a/PKGBUILD b/PKGBUILD new file mode 100755 index 0000000..00f4128 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,27 @@ +pkgname=tarch-misc +pkgver=1.0 +pkgrel=1 +pkgdesc="Home config file for Tarch OS" +arch=('any') +url="https://gitcast.ru/tarch_os/tarch-misc.git" +license=('GPL3') +install=${pkgname}.install + +prepare() { + cp -af ../misc/. ${srcdir} +} + +package() { + local SKEL_DIR=${pkgdir}/etc/skel + mkdir -p ${SKEL_DIR} + + cp -r ${srcdir}/.Xresources.d ${SKEL_DIR} + + install -Dm 644 ${srcdir}/.dmrc ${SKEL_DIR}/.dmrc + install -Dm 644 ${srcdir}/.face ${SKEL_DIR}/.face + install -Dm 644 ${srcdir}/.gtkrc-2.0 ${SKEL_DIR}/.gtkrc-2.0 + install -Dm 644 ${srcdir}/.hushlogin ${SKEL_DIR}/.hushlogin + install -Dm 644 ${srcdir}/.p10k.zsh ${SKEL_DIR}/.p10k.zsh + install -Dm 644 ${srcdir}/.Xresources ${SKEL_DIR}/.Xresources + install -Dm 644 ${srcdir}/.zshrc ${SKEL_DIR}/.zshrc +} diff --git a/makepkg.sh b/makepkg.sh new file mode 100755 index 0000000..4c0b4e4 --- /dev/null +++ b/makepkg.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +source "$HOME/bin/scripts/system/style" + +BUILDING_DIR="build" + +# Script Termination # +exit_on_signal_SIGINT () { + { printf "\n\n%s\n" "Script interrupted." 2>&1; echo; } + exit 0 +} + +exit_on_signal_SIGTERM () { + { printf "\n\n%s\n" "Script terminated." 2>&1; echo; } + exit 0 +} + +# Этот скрипт устанавливает ловушку (trap) для сигнала SIGINT и SIGTERM. +# Когда скрипт получает сигнал SIGINT (например, когда пользователь нажимает Ctrl+C), он будет вызывать функцию +trap exit_on_signal_SIGINT SIGINT +trap exit_on_signal_SIGTERM SIGTERM + +CLEANINH_BUILDING_DIR (){ + cd .. + rm -rf ${BUILDING_DIR} + sleep 0.5 +} + +BUILD_PKG () { + echo -e "\n ${BOLD}${GREEN}[+] создаем дирректорию сборки... ${RESET_COLOR}" + mkdir -p ${BUILDING_DIR} + sleep 0.5 + + echo -e "\n ${CYAN} ==> копируем файлы в дирректорию сборки... ${RESET_COLOR}" + cp -r `ls | grep -v '^build$'` ${BUILDING_DIR} + sleep 0.5 + + echo -e "\n ${CYAN} ==> копируем файлы в дирректорию сборки... ${RESET_COLOR}" + cd ${BUILDING_DIR} + sleep 0.5 + + # Building # + echo -e "\n ${CYAN}[+] собираем пакет... ${RESET_COLOR}" + makepkg -s -f + sleep 0.5 + + if ls *.pkg.tar.zst 1> /dev/null 2>&1; then + echo -e "\n ${CYAN}[+] переносим пакеты и очищаем дирректорию... ${RESET_COLOR}" + mv ./*.pkg.tar.zst ../../tarch-bin/x86_64/ + sleep 0.5 + CLEANINH_BUILDING_DIR + echo -e "\n ${BOLD}${GREEN}[✔] завершено... ${RESET_COLOR}" + else + echo -e "\n ${BOLD}${RED}[✘] сборка не удалась... ${RESET_COLOR}" + fi + echo -e "\n" +} + +BUILD_PKG diff --git a/misc/.Xresources b/misc/.Xresources new file mode 100644 index 0000000..8f1c028 --- /dev/null +++ b/misc/.Xresources @@ -0,0 +1,3 @@ +#include ".Xresources.d/colors" +#include ".Xresources.d/fonts" +#include ".Xresources.d/rxvt-unicode" diff --git a/misc/.Xresources.d/colors b/misc/.Xresources.d/colors new file mode 100644 index 0000000..12bed99 --- /dev/null +++ b/misc/.Xresources.d/colors @@ -0,0 +1,93 @@ + +*background: #1E222A +*foreground: #ABB2BF + +*color0: #4d5361 +*color8: #4d5361 + +*color1: #E06C75 +*color9: #E06C75 + +*color2: #98C379 +*color10: #98C379 + +*color3: #E5C07B +*color11: #E5C07B + +*color4: #61AFEF +*color12: #61AFEF + +*color5: #C678DD +*color13: #C678DD + +*color6: #56B6C2 +*color14: #56B6C2 + +*color7: #ABB2BF +*color15: #ABB2BF + + +/* + +*background: #101419 +*foreground: #b6beca + +*color0: #384148 +*color8: #1c252c + +*color1: #fc7b81 +*color9: #e05f65 + +*color2: #94f7c5 +*color10: #78dba9 + +*color3: #ffeba6 +*color11: #f1cf8a + +*color4: #8cc1ff +*color12: #70a5eb + +*color5: #e2a6ff +*color13: #c68aee + +*color6: #90daff +*color14: #74bee9 + +*color7: #fafdff +*color15: #dee1e6 + +*/ + + +/* EFO */ + +/* + +*background: #1E222A +*foreground: #ABB2BF + +*color0: #282C34 +*color8: #16181c + +*color1: #E06C75 +*color9: #853a40 + +*color2: #98C379 +*color10: #3f592d + +*color3: #E5C07B +*color11: #78643e + +*color4: #61AFEF +*color12: #3b6c94 + +*color5: #C678DD +*color13: #5f376b + +*color6: #56B6C2 +*color14: #2d646b + +*color7: #ABB2BF +*color15: #70757d + +*/ diff --git a/misc/.Xresources.d/fonts b/misc/.Xresources.d/fonts new file mode 100644 index 0000000..e5ad017 --- /dev/null +++ b/misc/.Xresources.d/fonts @@ -0,0 +1,4 @@ +URxvt.font: xft:Terminus:regular:size=8 +URxvt.boldFont: xft:Terminus:bold:size=8 +URxvt.italicFont: xft:Terminus:italic:size=8 +URxvt.boldItalicfont: xft:Terminus:boldItalic:size=8 diff --git a/misc/.Xresources.d/rxvt-unicode b/misc/.Xresources.d/rxvt-unicode new file mode 100644 index 0000000..2ed5c06 --- /dev/null +++ b/misc/.Xresources.d/rxvt-unicode @@ -0,0 +1,40 @@ +! font spacing +URxvt*letterSpace: 1 +URxvt.lineSpace: 1 + +! general settings +URxvt*saveline: 15000 +URxvt*termName: rxvt-256color +URxvt*iso14755: false +URxvt*urgentOnBell: true + +! appearance +URxvt*depth: 24 +URxvt*scrollBar: false +URxvt*scrollBar_right: false +URxvt*internalBorder: 16 +URxvt*externalBorder: 0 +URxvt.geometry: 85x25 + +! scroll one line +URxvt.keysym.Shift-Up: command:\033]720;1\007 +URxvt.keysym.Shift-Down: command:\033]721;1\007 + +! control arrow +URxvt.keysym.Control-Up: \033[1;5A +URxvt.keysym.Control-Down: \033[1;5B +URxvt.keysym.Control-Right: \033[1;5C +URxvt.keysym.Control-Left: \033[1;5D + +! ------------------------------------------------------------------------------ +! Xft Font Configuration +! ------------------------------------------------------------------------------ + +Xft.autohint: 0 +Xft.lcdfilter: lcddefault +Xft.hintstyle: hintslight +Xft.hinting: 1 +Xft.antialias: 1 +Xft.rgba: rgb + +Xcursor.size: 10 diff --git a/misc/.dmrc b/misc/.dmrc new file mode 100644 index 0000000..2b64b74 --- /dev/null +++ b/misc/.dmrc @@ -0,0 +1,3 @@ +# Set Default Session # +[Desktop] +Session=bspwm diff --git a/misc/.face b/misc/.face new file mode 100644 index 0000000..e4dc6a8 Binary files /dev/null and b/misc/.face differ diff --git a/misc/.gtkrc-2.0 b/misc/.gtkrc-2.0 new file mode 100644 index 0000000..4eb4607 --- /dev/null +++ b/misc/.gtkrc-2.0 @@ -0,0 +1,19 @@ +# DO NOT EDIT! This file will be overwritten by LXAppearance. +# Any customization should be done in ~/.gtkrc-2.0.mine instead. + +include "/home/chatlanin/.gtkrc-2.0.mine" +gtk-theme-name="Qogir-dark" +gtk-icon-theme-name="Qogir-Dark" +gtk-font-name="Noto Sans 9" +gtk-cursor-theme-name="Fluent-dark-cursors" +gtk-cursor-theme-size=0 +gtk-toolbar-style=GTK_TOOLBAR_ICONS +gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR +gtk-button-images=0 +gtk-menu-images=1 +gtk-enable-event-sounds=0 +gtk-enable-input-feedback-sounds=0 +gtk-xft-antialias=1 +gtk-xft-hinting=1 +gtk-xft-hintstyle="hintslight" +gtk-xft-rgba="none" diff --git a/misc/.hushlogin b/misc/.hushlogin new file mode 100644 index 0000000..e69de29 diff --git a/misc/.p10k.zsh b/misc/.p10k.zsh new file mode 100644 index 0000000..3a1dd28 --- /dev/null +++ b/misc/.p10k.zsh @@ -0,0 +1,193 @@ +# Generated by Powerlevel10k configuration wizard on 2024-02-05 at 17:14 MSK. +# Based on romkatv/powerlevel10k/config/p10k-pure.zsh, checksum 13301. +# Wizard options: nerdfont-complete + powerline, small icons, pure, snazzy, rprompt, +# 1 line, compact, instant_prompt=off. +# Type `p10k configure` to generate another config. +# +# Config file for Powerlevel10k with the style of Pure (https://github.com/sindresorhus/pure). +# +# Differences from Pure: +# +# - Git: +# - `@c4d3ec2c` instead of something like `v1.4.0~11` when in detached HEAD state. +# - No automatic `git fetch` (the same as in Pure with `PURE_GIT_PULL=0`). +# +# Apart from the differences listed above, the replication of Pure prompt is exact. This includes +# even the questionable parts. For example, just like in Pure, there is no indication of Git status +# being stale; prompt symbol is the same in command, visual and overwrite vi modes; when prompt +# doesn't fit on one line, it wraps around with no attempt to shorten it. +# +# If you like the general style of Pure but not particularly attached to all its quirks, type +# `p10k configure` and pick "Lean" style. This will give you slick minimalist prompt while taking +# advantage of Powerlevel10k features that aren't present in Pure. + +# Temporarily change options. +'builtin' 'local' '-a' 'p10k_config_opts' +[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases') +[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob') +[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand') +'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' + +() { + emulate -L zsh -o extended_glob + + # Unset all configuration options. + unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR' + + # Zsh >= 5.1 is required. + autoload -Uz is-at-least && is-at-least 5.1 || return + + # Prompt colors. + local grey='242' + local red='#FF5C57' + local yellow='#F3F99D' + local blue='#57C7FF' + local magenta='#FF6AC1' + local cyan='#9AEDFE' + local white='#F1F1F0' + + # Left prompt segments. + typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( + # context # user@host + dir # current directory + vcs # git status + # command_execution_time # previous command duration + # virtualenv # python virtual environment + prompt_char # prompt symbol + ) + + # Right prompt segments. + typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( + command_execution_time # previous command duration + virtualenv # python virtual environment + context # user@host + # time # current time + ) + + # Basic style options that define the overall prompt look. + typeset -g POWERLEVEL9K_BACKGROUND= # transparent background + typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace + typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space + typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol + typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION= # no segment icons + + # Add an empty line before each prompt except the first. This doesn't emulate the bug + # in Pure that makes prompt drift down whenever you use the Alt-C binding from fzf or similar. + typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=false + + # Magenta prompt symbol if the last command succeeded. + typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$magenta + # Red prompt symbol if the last command failed. + typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red + # Default prompt symbol. + typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯' + # Prompt symbol in command vi mode. + typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮' + # Prompt symbol in visual vi mode is the same as in command mode. + typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='❮' + # Prompt symbol in overwrite vi mode is the same as in command mode. + typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false + + # Grey Python Virtual Environment. + typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=$grey + # Don't show Python version. + typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false + typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER= + + # Blue current directory. + typeset -g POWERLEVEL9K_DIR_FOREGROUND=$blue + + # Context format when root: user@host. The first part white, the rest grey. + typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE="%F{$white}%n%f%F{$grey}@%m%f" + # Context format when not root: user@host. The whole thing grey. + typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE="%F{$grey}%n@%m%f" + # Don't show context unless root or in SSH. + typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION= + + # Show previous command duration only if it's >= 5s. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5 + # Don't show fractional seconds. Thus, 7s rather than 7.3s. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 + # Duration format: 1d 2h 3m 4s. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' + # Yellow previous command duration. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=$yellow + + # Grey Git prompt. This makes stale prompts indistinguishable from up-to-date ones. + typeset -g POWERLEVEL9K_VCS_FOREGROUND=$grey + + # Disable async loading indicator to make directories that aren't Git repositories + # indistinguishable from large Git repositories without known state. + typeset -g POWERLEVEL9K_VCS_LOADING_TEXT= + + # Don't wait for Git status even for a millisecond, so that prompt always updates + # asynchronously when Git state changes. + typeset -g POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0 + + # Cyan ahead/behind arrows. + typeset -g POWERLEVEL9K_VCS_{INCOMING,OUTGOING}_CHANGESFORMAT_FOREGROUND=$cyan + # Don't show remote branch, current tag or stashes. + typeset -g POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind) + # Don't show the branch icon. + typeset -g POWERLEVEL9K_VCS_BRANCH_ICON= + # When in detached HEAD state, show @commit where branch normally goes. + typeset -g POWERLEVEL9K_VCS_COMMIT_ICON='@' + # Don't show staged, unstaged, untracked indicators. + typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED}_ICON= + # Show '*' when there are staged, unstaged or untracked files. + typeset -g POWERLEVEL9K_VCS_DIRTY_ICON='*' + # Show '⇣' if local branch is behind remote. + typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=':⇣' + # Show '⇡' if local branch is ahead of remote. + typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=':⇡' + # Don't show the number of commits next to the ahead/behind arrows. + typeset -g POWERLEVEL9K_VCS_{COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=1 + # Remove space between '⇣' and '⇡' and all trailing spaces. + typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${${${P9K_CONTENT/⇣* :⇡/⇣⇡}// }//:/ }' + + # Grey current time. + typeset -g POWERLEVEL9K_TIME_FOREGROUND=$grey + # Format for the current time: 09:51:02. See `man 3 strftime`. + typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}' + # If set to true, time will update when you hit enter. This way prompts for the past + # commands will contain the start times of their commands rather than the end times of + # their preceding commands. + typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false + + # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt + # when accepting a command line. Supported values: + # + # - off: Don't change prompt when accepting a command line. + # - always: Trim down prompt when accepting a command line. + # - same-dir: Trim down prompt when accepting a command line unless this is the first command + # typed after changing current working directory. + typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off + + # Instant prompt mode. + # + # - off: Disable instant prompt. Choose this if you've tried instant prompt and found + # it incompatible with your zsh configuration files. + # - quiet: Enable instant prompt and don't print warnings when detecting console output + # during zsh initialization. Choose this if you've read and understood + # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt. + # - verbose: Enable instant prompt and print a warning when detecting console output during + # zsh initialization. Choose this if you've never tried instant prompt, haven't + # seen the warning, or if you are unsure what this all means. + typeset -g POWERLEVEL9K_INSTANT_PROMPT=off + + # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized. + # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload + # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you + # really need it. + typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true + + # If p10k is already loaded, reload configuration. + # This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true. + (( ! $+functions[p10k] )) || p10k reload +} + +# Tell `p10k configure` which file it should overwrite. +typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a} + +(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]} +'builtin' 'unset' 'p10k_config_opts' diff --git a/misc/.zshrc b/misc/.zshrc new file mode 100644 index 0000000..d9edf5a --- /dev/null +++ b/misc/.zshrc @@ -0,0 +1,121 @@ + # # # # # # + # EDITORS # +# # # # # # + +# for ranger +export VISUAL=nvim; +# for default editor +export EDITOR=nvim; + + # # # # + # ZSH # +# # # # +if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then + source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" +fi + +export ZSH="$HOME/.oh-my-zsh" +#ZSH_THEME="af-magic" +ZSH_THEME="powerlevel10k/powerlevel10k" +plugins=(git zsh-autosuggestions) +# disable bi-weekly auto-update checks +DISABLE_AUTO_UPDATE="true" + +# Path to your oh-my-zsh installation +source $ZSH/oh-my-zsh.sh + + + # # # # # # + # ALIASES # +# # # # # # + +# delete package +alias delete_pkg="yay -R" + +# question before delete +alias rm="\rm -i" + +# cpp projects +alias rrr="/mnt/raid/projects/cpp/rrr/rrr.v2/build/bin/rrr.v2" +alias diskinfo="/mnt/raid/projects/cpp/disk-info/build/bin/disk-info" + +# ./run for develp +alias run="./run" +alias deploy="./deploy" +alias update="./update" + +# goto +alias srv=". srv" + +# show image in kitty (use: image ./patch_to_img) +alias image="kitty +kitten icat" + +# cat aliase +alias cat="bat --style=plain --color=always" + +# goto to dir +alias ..="cd .." +alias ...="cd ../../" +alias ....="cd ../../../" + +# previous command +alias pr="fc -s" + +# bpytop +alias bp="bpytop" + +# z.lua +alias goto="z -I" + +alias nv="nvim" + +alias ls="lst" + + # # # # # # # + # SETTINGS # +# # # # # # + +# убираем цветовой окрас папок в терминале +export LS_COLORS="$LS_COLORS:ow=1;34:tw=1;34:" + +# text to speech +# export GOOGLE_APPLICATION_CREDENTIALS=/mnt/raid/application/Golang/TextToSpeach/TextToSpeech-862311f87938.json + +# chatlanin +export CHATLANIN_PATH=$HOME/bin/scripts/system +export PROJECT_CPP_PATH=/mnt/raid/projects/cpp +export PATH=$PATH:$CHATLANIN_PATH:$PROJECT_CPP_PATH:/usr/include:/usr:$HOME/.local/bin:/mnt/raid/projects/cpp/rrr/rrr.v2/build/bin + +# нужно добавить переменную окружения $VAMPY_PATH для работы анотатора +# export PATH=$PATH:$CHATLANIN_PATH:$PROJECT_CPP_PATH:/usr/include:$VAMPY_PATH + +# устанавливаем кэширование пароля от git. после этого можно делать обновление месона +# и скачивание репозиториев без ввода пароля по https +git config --global credential.helper 'cache --timeout=108000' + +# set history size in the file +HISTFILESIZE=12000 + +# set no write file data if exist +set -o noclobber + +# автоподсказки для перемещения goto +# this is https://github.com/skywind3000/z.lua +eval "$(lua $HOME/bin/z.lua/z.lua --init zsh)" + +neofetch + +# для применения настроек fzf по умолчанию +export FZF_DEFAULT_OPTS='--height=40% --layout=reverse --info=inline --border --margin=1 --padding=1 -e' + +# для переопределения стилей qt приложений на gtk +export QT_STYLE_OVERRIDE=kvantum +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion + +# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. +[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh + +# change sudo prompt # +export sudo_PROMPT="[] Enter sudo Password, Mr.${USER}: " diff --git a/tarch-misc.install b/tarch-misc.install new file mode 100644 index 0000000..5d0be18 --- /dev/null +++ b/tarch-misc.install @@ -0,0 +1,92 @@ +#!/bin/bash + +source "$HOME/bin/scripts/system/style" + +USER=`echo ${SUDO_USER:-$(whoami)}` +GID=`echo ${SUDO_GID}` +GROUB=`cat /etc/group | grep ${GID} | cut -d: -f1 | head -1` +HOME_DIR="home/${USER}" +BACKUP_DIR="/home/${HOME_DIR}/.tarch-backups" +CONFIG_DIR_SKEL="/etc/skel" +PKG_NAME="tarch-misc" + +BACKUP (){ + local FILES_NAME="tarch-misc-backup" + echo -e ${BOLD}${GREEN}"\n[*] создаем backup текущего конфига для: ${CYAN}${PKG_NAME}${GREEN} ..." ${RESET_COLOR} + BACKUP_NAME=`date +%m-%d` + BACKUP_RANDOM="`echo $RANDOM`" + mkdir -p ${BACKUP_DIR}/${FILES_NAME}-${BACKUP_NAME}-${BACKUP_RANDOM} + + echo -e ${CYAN}" ==> перемещаем текущий конфиг в backup дирректорию." ${RESET_COLOR} + mv ${HOME_DIR}/.mplayer ${BACKUP_DIR}/${FILES_NAME}-${BACKUP_NAME}-${BACKUP_RANDOM} + mv ${HOME_DIR}/.Xresources.d ${BACKUP_DIR}/${FILES_NAME}-${BACKUP_NAME}-${BACKUP_RANDOM} + mv ${HOME_DIR}/.dmrc ${BACKUP_DIR}/${FILES_NAME}-${BACKUP_NAME}-${BACKUP_RANDOM} + mv ${HOME_DIR}/.face ${BACKUP_DIR}/${FILES_NAME}-${BACKUP_NAME}-${BACKUP_RANDOM} + mv ${HOME_DIR}/.gtkrc-2.0 ${BACKUP_DIR}/${FILES_NAME}-${BACKUP_NAME}-${BACKUP_RANDOM} + mv ${HOME_DIR}/.hushlogin ${BACKUP_DIR}/${FILES_NAME}-${BACKUP_NAME}-${BACKUP_RANDOM} + mv ${HOME_DIR}/.p10k.zsh ${BACKUP_DIR}/${FILES_NAME}-${BACKUP_NAME}-${BACKUP_RANDOM} + mv ${HOME_DIR}/.Xresources ${BACKUP_DIR}/${FILES_NAME}-${BACKUP_NAME}-${BACKUP_RANDOM} + mv ${HOME_DIR}/.zshrc ${BACKUP_DIR}/${FILES_NAME}-${BACKUP_NAME}-${BACKUP_RANDOM} + + echo -e ${CYAN}" ==> предоставление разрешений для пользователя: ${PURPLE}${USER}" ${RESET_COLOR} + chown -R ${USER}:${GROUB} ${BACKUP_DIR}/${FILES_NAME}-${BACKUP_NAME}-${BACKUP_RANDOM} + echo -e ${BOLD}${GREEN}"[✔] backup завершен ..." ${RESET_COLOR} +} + +INSTALL (){ + echo -e ${BOLD}${GREEN}"\n[*] устанавливаем пакет: ${CYAN}${PKG_NAME}${GREEN} ..." ${RESET_COLOR} + + mkdir -p ${HOME_DIR} + + cp -rf ${HOME_DIR_SKEL}/.mplayer ${HOME_DIR} + cp -rf ${HOME_DIR_SKEL}/.Xresources.d ${HOME_DIR} + cp ${HOME_DIR_SKEL}/.dmrc ${HOME_DIR} + cp ${HOME_DIR_SKEL}/.face ${HOME_DIR} + cp ${HOME_DIR_SKEL}/.gtkrc-2.0 ${HOME_DIR} + cp ${HOME_DIR_SKEL}/.hushlogin ${HOME_DIR} + cp ${HOME_DIR_SKEL}/.p10k.zsh ${HOME_DIR} + cp ${HOME_DIR_SKEL}/.Xresources ${HOME_DIR} + cp ${HOME_DIR_SKEL}/.zshrc ${HOME_DIR} + + echo -e ${CYAN}" ==> предоставление разрешений для пользователя: ${PURPLE}${USER}" ${RESET_COLOR} + chown -R ${USER}:${GROUB} ${HOME_DIR}/.mplayer + chown -R ${USER}:${GROUB} ${HOME_DIR}/.Xresources.d + chown -R ${USER}:${GROUB} ${HOME_DIR}/.dmrc + chown -R ${USER}:${GROUB} ${HOME_DIR}/.face + chown -R ${USER}:${GROUB} ${HOME_DIR}/.gtkrc-2.0 + chown -R ${USER}:${GROUB} ${HOME_DIR}/.hushlogin + chown -R ${USER}:${GROUB} ${HOME_DIR}/.p10k.zsh + chown -R ${USER}:${GROUB} ${HOME_DIR}/.Xresources + chown -R ${USER}:${GROUB} ${HOME_DIR}/.zshrc + + if [[ -d "${HOME_DIR}/.mplayer" && -d "${HOME_DIR}/.Xresources.d" && -f "${HOME_DIR}/.dmrc" && -f "${HOME_DIR}/.face" && -f "${HOME_DIR}/.fehbg" && -f "${HOME_DIR}/.gtkrc-2.0" && -f "${HOME_DIR}/.hushlogin" && -f "${HOME_DIR}/.p10k.zsh" && -f "${HOME_DIR}/.Xresources" && -f "${HOME_DIR}/.xsettingsd" && -f "${HOME_DIR}/.zshrc" ]]; then + echo -e ${BOLD}${GREEN}"[✔] конфигурационные файлы установлены..." ${RESET_COLOR} + echo -e "\n" + else + echo -e ${BOLD}${RED}"[✘] ошибка установки..." ${RESET_COLOR} + fi + + echo -e "\n" +} + +RUN_MAIN (){ + if [[ "${GROUB}" == 'liveuser' ]]; then + exit + else + if [[ ! -d "${CONFIG_DIR}/${FILES_NAME}" ]]; then + INSTALL + else + BACKUP + INSTALL + fi + fi +} + + +post_install() { + RUN_MAIN +} + +post_upgrade() { + RUN_MAIN +}