]> gitweb.morketsmerke.org Git - H270.git/commitdiff
Dodanie ncspot, firmware-u realteka (problem z adapterem SSD nvme) oraz zmiany prompt...
authorxf0r3m <jakubstasinski@protonmail.com>
Sat, 11 Apr 2026 18:09:34 +0000 (20:09 +0200)
committerxf0r3m <jakubstasinski@protonmail.com>
Sat, 11 Apr 2026 18:09:34 +0000 (20:09 +0200)
base.sh
bashrc [new file with mode: 0755]
immudex-nu.omp.json.nu-deploy [new file with mode: 0755]
oh-my-posh-install.sh [new file with mode: 0755]

diff --git a/base.sh b/base.sh
index 701ede4554296a1808e150d70e579af485fb9fa2..d6fc7b3f14e91d3fcd0ab24c7aaf0d7105536d0b 100644 (file)
--- a/base.sh
+++ b/base.sh
@@ -143,6 +143,7 @@ cp -vv ~/H270/xfce4-panel.xml /etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml
 #cp -vv ~/immudex/files/immudex_hostname.service /etc/systemd/system;
 
 cp -vv ~/immudex/launchers/16844254192.desktop /etc/skel/.config/xfce4/panel/launcher-5;
+cp -vv ~/H270/bashrc /etc/skel/.bashrc;
 
 tar -xzvf ~/immudex/files/mozilla.tgz -C /etc/skel;
 
@@ -197,5 +198,14 @@ apt install -y ./teamviewer_amd64.deb
 kill $(pidof gpg-agent)
 
 bash ~/immudex/addons/nvidiaLatest;
+bash ~/immudex/addons/ncspot;
+bash ~/immudex/addons/realtek;
+bash ~/immudex/addons/kvm;
+
+cp -vv ~/H270/oh-my-posh-install.sh /tmp/oh-my-posh-install.sh;
+bash /tmp/oh-my-posh-install.sh;
+mv /root/.cache/oh-my-posh /usr/share;
+rm /tmp/oh-my-posh-install.sh;
+cp -vv ~/H270/immudex-nu.omp.json.nu-deploy /usr/share/oh-my-posh/immudex-nu.omp.json;
 
 tidy;
diff --git a/bashrc b/bashrc
new file mode 100755 (executable)
index 0000000..1f121d0
--- /dev/null
+++ b/bashrc
@@ -0,0 +1,191 @@
+# ~/.bashrc: executed by bash(1) for non-login shells.
+# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
+# for examples
+
+# 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
+
+# If set, the pattern "**" used in a pathname expansion context will
+# match all files and zero or more directories and subdirectories.
+#shopt -s globstar
+
+# make less more friendly for non-text input files, see lesspipe(1)
+#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
+
+# set variable identifying the chroot you work in (used in the prompt below)
+if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
+    debian_chroot=$(cat /etc/debian_chroot)
+fi
+
+# set a fancy prompt (non-color, unless we know we "want" color)
+case "$TERM" in
+    xterm-color|*-256color) color_prompt=yes;;
+esac
+
+# uncomment for a colored prompt, if the terminal has the capability; turned
+# off by default to not distract the user: the focus in a terminal window
+# should be on the output of commands, not on the prompt
+#force_color_prompt=yes
+
+if [ -n "$force_color_prompt" ]; then
+    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
+       # We have color support; assume it's compliant with Ecma-48
+       # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
+       # a case would tend to support setf rather than setaf.)
+       color_prompt=yes
+    else
+       color_prompt=
+    fi
+fi
+
+if [ "$color_prompt" = yes ]; then
+    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
+else
+    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
+fi
+unset color_prompt force_color_prompt
+
+# If this is an xterm set the title to user@host:dir
+case "$TERM" in
+xterm*|rxvt*)
+    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
+    ;;
+*)
+    ;;
+esac
+
+# enable color support of ls and also add handy aliases
+if [ -x /usr/bin/dircolors ]; then
+    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
+    alias ls='ls --color=auto'
+    #alias dir='dir --color=auto'
+    #alias vdir='vdir --color=auto'
+
+    #alias grep='grep --color=auto'
+    #alias fgrep='fgrep --color=auto'
+    #alias egrep='egrep --color=auto'
+fi
+
+# colored GCC warnings and errors
+#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
+
+# some more ls aliases
+#alias ll='ls -l'
+#alias la='ls -A'
+#alias l='ls -CF'
+
+# Alias definitions.
+# You may want to put all your additions into a separate file like
+# ~/.bash_aliases, instead of adding them here directly.
+# See /usr/share/doc/bash-doc/examples in the bash-doc package.
+
+if [ -f ~/.bash_aliases ]; then
+    . ~/.bash_aliases
+fi
+
+# enable programmable completion features (you don't need to enable
+# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
+# sources /etc/bash.bashrc).
+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 POSH_THEME=/usr/share/oh-my-posh/immudex-nu.omp.json
+export POSH_SHELL_VERSION=$BASH_VERSION
+export POWERLINE_COMMAND="oh-my-posh"
+export POSH_PID=$$
+export CONDA_PROMPT_MODIFIER=false
+omp_start_time=""
+
+# start timer on command start
+PS0='${omp_start_time:0:$((omp_start_time="$(_omp_start_timer)",0))}$(_omp_ftcs_command_start)'
+# set secondary prompt
+PS2="$(/usr/local/bin/oh-my-posh print secondary --config="$POSH_THEME" --shell=bash --shell-version="$BASH_VERSION")"
+
+function _set_posh_cursor_position() {
+    # not supported in Midnight Commander
+    # see https://github.com/JanDeDobbeleer/oh-my-posh/issues/3415
+    if [[ "false" != "true" ]] || [[ -v MC_SID ]]; then
+        return
+    fi
+
+    local oldstty=$(stty -g)
+    stty raw -echo min 0
+
+    local COL
+    local ROW
+    IFS=';' read -sdR -p $'\E[6n' ROW COL
+
+    stty $oldstty
+
+    export POSH_CURSOR_LINE=${ROW#*[}
+    export POSH_CURSOR_COLUMN=${COL}
+}
+
+function _omp_start_timer() {
+    /usr/local/bin/oh-my-posh get millis
+}
+
+function _omp_ftcs_command_start() {
+    if [ "false" == "true" ]; then
+        printf "\e]133;C\a"
+    fi
+}
+
+# template function for context loading
+function set_poshcontext() {
+    return
+}
+
+function _omp_hook() {
+    local ret=$? pipeStatus=(${PIPESTATUS[@]})
+    if [[ "${#BP_PIPESTATUS[@]}" -gt "${#pipeStatus[@]}" ]]; then
+        pipeStatus=(${BP_PIPESTATUS[@]})
+    fi
+
+    local omp_stack_count=$((${#DIRSTACK[@]} - 1))
+    local omp_elapsed=-1
+    local no_exit_code="true"
+
+    if [[ -n "$omp_start_time" ]]; then
+        local omp_now=$(/usr/local/bin/oh-my-posh get millis --shell=bash)
+        omp_elapsed=$((omp_now-omp_start_time))
+        omp_start_time=""
+        no_exit_code="false"
+    fi
+
+    set_poshcontext
+    _set_posh_cursor_position
+
+    PS1="$(/usr/local/bin/oh-my-posh print primary --config="$POSH_THEME" --shell=bash --shell-version="$BASH_VERSION" --status="$ret" --pipestatus="${pipeStatus[*]}" --execution-time="$omp_elapsed" --stack-count="$omp_stack_count" --no-status="$no_exit_code" | tr -d '\0')"
+    return $ret
+}
+
+if [ "$TERM" != "linux" ] && [ -x "$(command -v /usr/local/bin/oh-my-posh)" ] && ! [[ "$PROMPT_COMMAND" =~ "_omp_hook" ]]; then
+    PROMPT_COMMAND="_omp_hook; $PROMPT_COMMAND"
+fi
+
+if [ "false" == "true" ]; then
+    echo ""
+fi
diff --git a/immudex-nu.omp.json.nu-deploy b/immudex-nu.omp.json.nu-deploy
new file mode 100755 (executable)
index 0000000..c641806
--- /dev/null
@@ -0,0 +1,68 @@
+{
+  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
+  "blocks": [
+    {
+      "alignment": "left",
+      "segments": [
+        {
+          "background": "#000000",
+          "foreground": "#487cff",
+          "style": "plain",
+          "template": "<b>\udb86\ude4a</b> {{ .UserName }}@{{ .HostName }}/",
+          "type": "session"
+        },
+        {
+          "background": "#000000",
+          "foreground": "#5ac8ea",
+          "properties": {
+            "style": "folder"
+          },
+          "style": "plain",
+          "template": "\ue5ff {{ .Path }}/",
+          "type": "path"
+        },
+        {
+          "background": "#000000",
+          "foreground": "#de076f",
+          "properties": {
+            "branch_icon": "",
+            "fetch_upstream_icon": true
+          },
+          "style": "plain",
+          "template": "{{ .UpstreamIcon }}{{ .HEAD }}/",
+          "type": "git"
+        },
+        {
+          "background": "#000000",
+          "foreground": "#491545",
+          "properties": {
+            "paused_icon": "\uf04c ",
+            "playing_icon": "\ue602 ",
+            "stopped_icon": "\uf04d ",
+            "track_separator": " - "
+          },
+          "style": "plain",
+          "template": "\uf1bc {{ .Icon }}{{ if ne .Status \"stopped\" }}{{ .Artist }} - {{ .Track }}{{ end }}/",
+          "type": "spotify"
+        },
+        {
+          "background": "#000000",
+          "foreground": "#05b92d",
+         "foreground_templates": [
+            "{{ if gt .Code 0 }}#f1184c{{ end }}"
+          ],
+          "properties": {
+            "always_enabled": true
+          },
+          "style": "plain",
+          "template": "<f>\udb82\udfc6</f>",
+          "trailing_diamond": "\ue0b4",
+          "type": "status"
+        }
+      ],
+      "type": "prompt"
+    }
+  ],
+  "final_space": true,
+  "version": 2
+}
diff --git a/oh-my-posh-install.sh b/oh-my-posh-install.sh
new file mode 100755 (executable)
index 0000000..5626860
--- /dev/null
@@ -0,0 +1,232 @@
+#!/usr/bin/env bash
+
+install_dir=""
+themes_dir=""
+executable=""
+
+error() {
+    printf "\e[31m$1\e[0m\n"
+    exit 1
+}
+
+info() {
+    printf "$1\n"
+}
+
+warn() {
+    printf "⚠️  \e[33m$1\e[0m\n"
+}
+
+help() {
+    # Display Help
+    echo "Install script for Oh My Posh"
+    echo
+    echo "Syntax: install.sh [-h|d|t]"
+    echo "options:"
+    echo "-h     Print this help."
+    echo "-d     Specify the installation directory. Defaults to /usr/local/bin or the directory where oh-my-posh is installed."
+    echo "-t     Specify the themes installation directory. Defaults to the oh-my-posh cache directory."
+    echo
+}
+
+while getopts ":hd:t:" option; do
+   case $option in
+      h) # display Help
+         help
+         exit;;
+      d) # Enter a name
+         install_dir=${OPTARG};;
+      t) # themes directory
+         themes_dir=${OPTARG};;
+     \?) # Invalid option
+         echo "Invalid option command line option. Use -h for help."
+         exit 1
+   esac
+done
+
+SUPPORTED_TARGETS="linux-386 linux-amd64 linux-arm linux-arm64 darwin-amd64 darwin-arm64 freebsd-386 freebsd-amd64 freebsd-arm freebsd-arm64"
+
+validate_dependency() {
+    if ! command -v $1 >/dev/null; then
+        error "$1 is required to install Oh My Posh. Please install $1 and try again.\n"
+    fi
+}
+
+validate_dependencies() {
+    validate_dependency curl
+    validate_dependency unzip
+    validate_dependency realpath
+    validate_dependency dirname
+}
+
+set_install_directory() {
+    if [ -n "$install_dir" ]; then
+        # expand directory
+        install_dir="${install_dir/#\~/$HOME}"
+        return 0
+    fi
+
+    # check if we have oh-my-posh installed, if so, use the executable directory
+    # to install into and follow symlinks
+    if command -v oh-my-posh >/dev/null; then
+        posh_dir=$(command -v oh-my-posh)
+        real_dir=$(realpath $posh_dir)
+        install_dir=$(dirname $real_dir)
+        info "Oh My Posh is already installed, updating existing installation in:"
+        info "  ${install_dir}"
+    else
+        install_dir="/usr/local/bin"
+    fi
+}
+
+validate_install_directory() {
+    #check if installation dir exists
+    if [ ! -d "$install_dir" ]; then
+        error "Directory ${install_dir} does not exist, set a different directory and try again."
+    fi
+        
+    # Check if regular user has write permission
+    if [ ! -w "$install_dir" ]; then
+        error "Cannot write to ${install_dir}. Please check write permissions or set a different directory and try again: \ncurl -s https://ohmyposh.dev/install.sh | bash -s -- -d {directory}"
+    fi
+
+    # check if the directory is in the PATH
+    good=$(
+        IFS=:
+        for path in $PATH; do
+        if [ "${path%/}" = "${install_dir}" ]; then
+            printf 1
+            break
+        fi
+        done
+    )
+
+    if [ "${good}" != "1" ]; then
+        warn "Installation directory ${install_dir} is not in your \$PATH"
+    fi
+}
+
+validate_themes_directory() {
+    
+    # Validate if the themes directory exists
+    if ! mkdir -p "$themes_dir" > /dev/null 2>&1; then
+        error "Cannot write to ${themes_dir}. Please check write permissions or set a different directory and try again: \ncurl -s https://ohmyposh.dev/install.sh | bash -s -- -t {directory}"
+    fi
+
+    #check user write permission
+    if [ ! -w "$themes_dir" ]; then
+        error "Cannot write to ${themes_dir}. Please check write permissions or set a different directory and try again: \ncurl -s https://ohmyposh.dev/install.sh | bash -s -- -t {directory}"
+    fi
+}
+
+install_themes() {
+    if [ -n "$themes_dir" ]; then
+        # expand directory
+        themes_dir="${themes_dir/#\~/$HOME}"
+    fi
+
+    cache_dir=$($executable cache path)
+
+    # validate if the user set the path to the themes directory
+    if [ -z "$themes_dir" ]; then
+        themes_dir="${cache_dir}/themes"
+    fi
+
+    validate_themes_directory
+
+    info "🎨 Installing oh-my-posh themes in ${themes_dir}\n"
+
+    zip_file="${cache_dir}/themes.zip"
+
+    url="https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v21.9.0/themes.zip"
+
+    http_response=$(curl -s -f -L $url -o $zip_file -w "%{http_code}")
+
+    if [ $http_response = "200" ] && [ -f $zip_file ]; then
+        unzip -o -q $zip_file -d $themes_dir
+        # make sure the files are readable and writable for all users
+        chmod a+rwX ${themes_dir}/*.omp.*
+        rm $zip_file
+    else
+        warn "Unable to download themes at ${url}\nPlease validate your curl, connection and/or proxy settings"
+    fi
+}
+
+install() {
+    arch=$(detect_arch)
+    platform=$(detect_platform)
+    target="${platform}-${arch}"
+
+    good=$(
+        IFS=" "
+        for t in $SUPPORTED_TARGETS; do
+        if [ "${t}" = "${target}" ]; then
+            printf 1
+            break
+        fi
+        done
+    )
+
+    if [ "${good}" != "1" ]; then
+        error "${arch} builds for ${platform} are not available for Oh My Posh"
+    fi
+
+    info "\nℹ️  Installing oh-my-posh for ${target} in ${install_dir}"
+
+    executable=${install_dir}/oh-my-posh
+    url=https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v21.9.0/posh-${target}
+
+    info "⬇️  Downloading oh-my-posh from ${url}"
+
+    http_response=$(curl -s -f -L $url -o $executable -w "%{http_code}")
+
+    if [ $http_response != "200" ] || [ ! -f $executable ]; then
+        error "Unable to download executable at ${url}\nPlease validate your curl, connection and/or proxy settings"
+    fi
+
+    chmod +x $executable
+
+    install_themes
+
+    info "🚀 Installation complete.\n\nYou can follow the instructions at https://ohmyposh.dev/docs/installation/prompt"
+    info "to setup your shell to use oh-my-posh."
+    if [ $http_response = "200" ]; then
+        info "\nIf you want to use a built-in theme, you can find them in the ${themes_dir} directory:"
+        info "  oh-my-posh init {shell} --config ${themes_dir}/{theme}.omp.json\n"
+    fi
+}
+
+detect_arch() {
+  arch="$(uname -m | tr '[:upper:]' '[:lower:]')"
+
+  case "${arch}" in
+    x86_64) arch="amd64" ;;
+    armv*) arch="arm" ;;
+    arm64) arch="arm64" ;;
+    aarch64) arch="arm64" ;;
+    i686) arch="386" ;;
+  esac
+
+  if [ "${arch}" = "arm64" ] && [ "$(getconf LONG_BIT)" -eq 32 ]; then
+    arch=arm
+  fi
+
+  printf '%s' "${arch}"
+}
+
+
+detect_platform() {
+  platform="$(uname -s | awk '{print tolower($0)}')"
+
+  case "${platform}" in
+    linux) platform="linux" ;;
+    darwin) platform="darwin" ;;
+  esac
+
+  printf '%s' "${platform}"
+}
+
+validate_dependencies
+set_install_directory
+validate_install_directory
+install