addet some needed functions/aliase
This commit is contained in:
parent
963fcf8ab6
commit
3389fe8cc7
1 changed files with 170 additions and 203 deletions
359
.bash_aliases
359
.bash_aliases
|
@ -36,13 +36,16 @@ echo_info() {
|
||||||
_MESSAGES[info]+="${CYAN}ℹ️ $@${NC}\n"
|
_MESSAGES[info]+="${CYAN}ℹ️ $@${NC}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# INFO:
|
||||||
|
# ╭──────────╮
|
||||||
|
# │ defaults │
|
||||||
|
# ╰──────────╯
|
||||||
alias sudo="sudo -E"
|
alias sudo="sudo -E"
|
||||||
alias please="sudo"
|
alias please="sudo"
|
||||||
|
|
||||||
alias whoami="command echo 'Ghost in a shell..'"
|
|
||||||
|
|
||||||
# ─< easier dir up >────────────────────────────────────────────────────────────────────────
|
# ─< easier dir up >────────────────────────────────────────────────────────────────────────
|
||||||
alias ..="cd .."
|
alias ..="cd .."
|
||||||
|
alias ...="cd ../.."
|
||||||
|
|
||||||
# ─< colored ip >───────────────────────────────────────────────────────────────────
|
# ─< colored ip >───────────────────────────────────────────────────────────────────
|
||||||
alias ip="ip --color=always"
|
alias ip="ip --color=always"
|
||||||
|
@ -68,6 +71,14 @@ else
|
||||||
alias hl="grep --passthrough"
|
alias hl="grep --passthrough"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
hm() {
|
||||||
|
find -type f -name "${1}" | wc -l
|
||||||
|
}
|
||||||
|
|
||||||
|
if command_exists dog; then
|
||||||
|
alias dig="dog"
|
||||||
|
fi
|
||||||
|
|
||||||
# ─< define copy command >────────────────────────────────────────────────────────────────
|
# ─< define copy command >────────────────────────────────────────────────────────────────
|
||||||
if command_exists wl-copy; then
|
if command_exists wl-copy; then
|
||||||
copy() {
|
copy() {
|
||||||
|
@ -122,6 +133,7 @@ choose_nvim() {
|
||||||
# Default to nvim
|
# Default to nvim
|
||||||
echo "command nvim"
|
echo "command nvim"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set up Neovim aliases based on environment
|
# Set up Neovim aliases based on environment
|
||||||
if command_exists nvim; then
|
if command_exists nvim; then
|
||||||
alias cnvim="command nvim"
|
alias cnvim="command nvim"
|
||||||
|
@ -253,82 +265,10 @@ __docker__() {
|
||||||
alias dr="docker run --rm -it"
|
alias dr="docker run --rm -it"
|
||||||
alias drs="docker compose down && docker compose up -d --remove-orphans --force-recreate"
|
alias drs="docker compose down && docker compose up -d --remove-orphans --force-recreate"
|
||||||
alias ds="docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}'"
|
alias ds="docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}'"
|
||||||
alias dcs="docker compose ps -a --format 'table {{.Name}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}'"
|
|
||||||
alias dl="docker compose logs -f"
|
|
||||||
alias dc="docker compose"
|
alias dc="docker compose"
|
||||||
# check_for_updates() {
|
alias dcs="docker compose ps -a --format 'table {{.Name}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}'"
|
||||||
# if ! command -v jq &>/dev/null; then
|
alias dlog="docker compose logs"
|
||||||
# echo -e "${RED}Error: jq is required but not installed. Please install jq.${NC}"
|
|
||||||
# return 1
|
|
||||||
# fi
|
|
||||||
#
|
|
||||||
# if ! docker compose version &>/dev/null; then
|
|
||||||
# echo -e "${RED}Error: docker compose is not available.${NC}"
|
|
||||||
# return 1
|
|
||||||
# fi
|
|
||||||
#
|
|
||||||
# local updated=false
|
|
||||||
# local images
|
|
||||||
# images=$(docker compose config --format json | jq -r '.services[] | .image' 2>/dev/null)
|
|
||||||
#
|
|
||||||
# if [[ -z "$images" ]]; then
|
|
||||||
# echo -e "${RED}Error: No Docker images found in the compose configuration.${NC}"
|
|
||||||
# return 1
|
|
||||||
# fi
|
|
||||||
#
|
|
||||||
# for image in $images; do
|
|
||||||
# echo -e "${CYAN}Checking for updates for image: ${YELLOW}$image${NC}"
|
|
||||||
#
|
|
||||||
# # Get local image digest
|
|
||||||
# local local_digest
|
|
||||||
# local_digest=$(docker image inspect "$image" --format '{{index .RepoDigests 0}}') # 2>/dev/null
|
|
||||||
#
|
|
||||||
# # If no local digest exists, force check
|
|
||||||
# if [[ -z "$local_digest" ]]; then
|
|
||||||
# echo -e "${YELLOW}Image not present locally. Update needed.${NC}"
|
|
||||||
# updated=true
|
|
||||||
# continue
|
|
||||||
# fi
|
|
||||||
#
|
|
||||||
# # Get remote digest using pull --dry-run
|
|
||||||
# local remote_digest
|
|
||||||
# remote_digest=$(docker pull --quiet "$image" 2>/dev/null | awk '/Digest:/{print $2}')
|
|
||||||
#
|
|
||||||
# # Fallback to manifest inspect if dry-run fails
|
|
||||||
# if [[ -z "$remote_digest" ]]; then
|
|
||||||
# remote_digest=$(DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect -v "$image" | jq -r '.Descriptor.digest')
|
|
||||||
# fi
|
|
||||||
#
|
|
||||||
# if [[ -z "$remote_digest" ]]; then
|
|
||||||
# echo -e "${RED}Failed to retrieve remote digest. Performing forced check...${NC}"
|
|
||||||
# # Fallback method: Pull image and compare before/after digests
|
|
||||||
# local pre_pull_digest=$(docker image inspect "$image" --format '{{index .RepoDigests 0}}')
|
|
||||||
# docker pull --quiet "$image" >/dev/null
|
|
||||||
# local post_pull_digest=$(docker image inspect "$image" --format '{{index .RepoDigests 0}}')
|
|
||||||
#
|
|
||||||
# if [[ "$pre_pull_digest" != "$post_pull_digest" ]]; then
|
|
||||||
# echo -e "${GREEN}Update found during forced pull${NC}"
|
|
||||||
# updated=true
|
|
||||||
# fi
|
|
||||||
# continue
|
|
||||||
# fi
|
|
||||||
#
|
|
||||||
# # Compare digests
|
|
||||||
# if [[ "$local_digest" != "$remote_digest" ]]; then
|
|
||||||
# echo -e "${GREEN}Update available for $image${NC}"
|
|
||||||
# updated=true
|
|
||||||
# else
|
|
||||||
# echo -e "${YELLOW}No update available for $image${NC}"
|
|
||||||
# fi
|
|
||||||
# done
|
|
||||||
#
|
|
||||||
# if $updated; then
|
|
||||||
# echo -e "${CYAN}Pulling updates and recreating containers...${NC}"
|
|
||||||
# docker compose pull --quiet && docker compose up -d --force-recreate
|
|
||||||
# else
|
|
||||||
# echo -e "${GREEN}All images are up to date. No action needed.${NC}"
|
|
||||||
# fi
|
|
||||||
# }
|
|
||||||
# Check for required dependencies
|
# Check for required dependencies
|
||||||
check_for_updates() {
|
check_for_updates() {
|
||||||
local compose_cmd
|
local compose_cmd
|
||||||
|
@ -424,8 +364,6 @@ __git__() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# ──────────────────────────────────────< functions >────────────────────────────────────
|
# ──────────────────────────────────────< functions >────────────────────────────────────
|
||||||
# use git clone directly with <username>/<repo>
|
|
||||||
# ex: gcl pik4li/ReDeploy.git --> https://github.com/pik4li/ReDeploy.git
|
|
||||||
gcl() {
|
gcl() {
|
||||||
if [ -z "$2" ]; then
|
if [ -z "$2" ]; then
|
||||||
git clone --depth=1 "https://github.com/$1"
|
git clone --depth=1 "https://github.com/$1"
|
||||||
|
@ -434,7 +372,6 @@ __git__() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# the same with my own github server
|
|
||||||
gck() {
|
gck() {
|
||||||
if [ -z "$2" ]; then
|
if [ -z "$2" ]; then
|
||||||
git clone --recurse-submodules --depth=1 "https://git.k4li.de/$1"
|
git clone --recurse-submodules --depth=1 "https://git.k4li.de/$1"
|
||||||
|
@ -443,7 +380,6 @@ __git__() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# and to clone with ssh
|
|
||||||
gcs() {
|
gcs() {
|
||||||
if [ -z "$2" ]; then
|
if [ -z "$2" ]; then
|
||||||
git clone --recurse-submodules --depth=1 "git@git.k4li.de:$1"
|
git clone --recurse-submodules --depth=1 "git@git.k4li.de:$1"
|
||||||
|
@ -452,8 +388,6 @@ __git__() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# submodule update, goes in every submodule, put't it to main, and pulls down the changes
|
|
||||||
# It then pulls down every change and commits it
|
|
||||||
gsu() {
|
gsu() {
|
||||||
echo "${CYAN}Updating submodules recursively with -> ${YELLOW}${BOLD}git submodule update --init --recursive${NC}"
|
echo "${CYAN}Updating submodules recursively with -> ${YELLOW}${BOLD}git submodule update --init --recursive${NC}"
|
||||||
git submodule update --init --recursive &&
|
git submodule update --init --recursive &&
|
||||||
|
@ -503,10 +437,6 @@ __git__() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# gwip command, to quickly add files and commit and push them directly in one command
|
|
||||||
# ex: gwip . -> will git add . && git commit -m "gwip" && git push
|
|
||||||
# ex: gwip "Files changed" -> "Files changed" is now the description, instead of gwip.
|
|
||||||
# ex: gwip install.sh -> will only add and commit/push the file 'install.sh' and commit with wip
|
|
||||||
gwip() {
|
gwip() {
|
||||||
# Fetch the latest changes from the remote
|
# Fetch the latest changes from the remote
|
||||||
git fetch
|
git fetch
|
||||||
|
@ -517,17 +447,71 @@ __git__() {
|
||||||
|
|
||||||
# Check if there are any changes on the remote branch
|
# Check if there are any changes on the remote branch
|
||||||
if git diff --quiet "$branch" "origin/$branch"; then
|
if git diff --quiet "$branch" "origin/$branch"; then
|
||||||
if [ -n "$2" ]; then
|
local commit_files=()
|
||||||
local commit_files="${1:-.}"
|
local commit_message
|
||||||
local commit_message="${2:-wip}"
|
|
||||||
|
# case "$1" in
|
||||||
|
# '.')
|
||||||
|
# commit_files=.
|
||||||
|
# commit_message="wip"
|
||||||
|
#
|
||||||
|
# echo "${CYAN}No changes on the remote branch. Adding changes and pushing with ${RED}${BOLD}'$commit_message'${NC}${CYAN} commit.${NC}"
|
||||||
|
#
|
||||||
|
# git add "$commit_files"
|
||||||
|
# git commit -m "$commit_message"
|
||||||
|
# git push
|
||||||
|
# ;;
|
||||||
|
# *)
|
||||||
|
if [[ -n "$1" ]]; then
|
||||||
|
for f in "$@"; do
|
||||||
|
if [ -f "./${f}" ] || [ -d "./${f}/" ]; then
|
||||||
|
commit_files+=("./${f}")
|
||||||
else
|
else
|
||||||
local commit_message="${1:-wip}"
|
commit_message+="${f}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "${BOLD}${YELLOW}You have to provide the command like..:"
|
||||||
|
echo "${GREEN}'gwip <list of files> <commit message>' or like 'gwip .'${NC}"
|
||||||
|
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case $commit_files in
|
||||||
|
'./.') commit_message="wip" ;;
|
||||||
|
*)
|
||||||
|
local trimmed_files
|
||||||
|
|
||||||
|
for f in "${commit_files[@]}"; do
|
||||||
|
trimmed_files+=("${f#./}")
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "${GREEN}Committed files/folders: ${BOLD}${trimmed_files[*]}${NC}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -n "$commit_files" ] || [ -n "$commit_message" ]; then
|
||||||
|
[[ -z "$commit_files" ]] && commit_files=.
|
||||||
|
[[ -z "$commit_message" ]] && commit_message=wip
|
||||||
|
|
||||||
echo "${CYAN}No changes on the remote branch. Adding changes and pushing with ${RED}${BOLD}'$commit_message'${NC}${CYAN} commit.${NC}"
|
echo "${CYAN}No changes on the remote branch. Adding changes and pushing with ${RED}${BOLD}'$commit_message'${NC}${CYAN} commit.${NC}"
|
||||||
git add "${commit_files:-.}"
|
|
||||||
git commit -m "$commit_message"
|
if (("${#commit_files}" <= 1)); then
|
||||||
|
git add $commit_files
|
||||||
|
else
|
||||||
|
for f in "${commit_files[@]}"; do
|
||||||
|
git add $f
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
git commit -m "${commit_message:-wip}"
|
||||||
git push
|
git push
|
||||||
|
else
|
||||||
|
echo "${RED}${BOLD}There was something wrong with:${NC}"
|
||||||
|
echo "${YELLOW}- commit-files '$commit_files'"
|
||||||
|
echo "or.."
|
||||||
|
echo "${YELLOW}- commit-message '$commit_message'${NC}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "${RED}${BOLD}There are changes on the remote branch. Please pull the latest changes first.${NC}"
|
echo "${RED}${BOLD}There are changes on the remote branch. Please pull the latest changes first.${NC}"
|
||||||
fi
|
fi
|
||||||
|
@ -545,14 +529,27 @@ fi
|
||||||
|
|
||||||
# Tmux session manager
|
# Tmux session manager
|
||||||
if command_exists tmux; then
|
if command_exists tmux; then
|
||||||
|
sleep 0.01
|
||||||
|
if [ -z "$TMUX" ]; then
|
||||||
|
sleep 0.01
|
||||||
|
# Attach to existing session if any, otherwise create one named 'main'
|
||||||
|
if tmux ls &>/dev/null; then
|
||||||
|
sleep 0.01
|
||||||
|
tmux attach-session
|
||||||
|
else
|
||||||
|
sleep 0.01
|
||||||
|
tmux new-session
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
ta() {
|
ta() {
|
||||||
if tmux list-sessions >/dev/null 2>&1; then
|
if tmux list-sessions >/dev/null 2>&1; then
|
||||||
echo "-- tmux session active! | Connecting to active session --"
|
echo "-- tmux session active! | Connecting to active session --"
|
||||||
sleep 0.1
|
sleep 0.3
|
||||||
tmux attach
|
tmux attach
|
||||||
else
|
else
|
||||||
echo "-- No tmux session found! | Creating one --"
|
echo "-- No tmux session found! | Creating one --"
|
||||||
sleep 0.1
|
sleep 0.3
|
||||||
tmux
|
tmux
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -562,29 +559,6 @@ else
|
||||||
echo_missing "tmux"
|
echo_missing "tmux"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Zellij session manager
|
|
||||||
# if command_exists zellij; then
|
|
||||||
# za() {
|
|
||||||
# # local zsession='zellij list-sessions | tail -1 | grep -q EXITED'
|
|
||||||
# if ! zellij list-sessions >/dev/null 2>&1; then
|
|
||||||
# echo "-- Zellij session active! | Connecting to existing session --"
|
|
||||||
# sleep 0.3
|
|
||||||
# zellij attach
|
|
||||||
# elif ! zellij list-sessions | tail -1 | grep -q EXITED; then
|
|
||||||
# echo "-- Zellij session active! | Connecting to existing session --"
|
|
||||||
# sleep 0.3
|
|
||||||
# zellij attach
|
|
||||||
# else
|
|
||||||
# echo "-- No Zellij session active! | Creating one --"
|
|
||||||
# sleep 0.3
|
|
||||||
# zellij
|
|
||||||
# fi
|
|
||||||
# }
|
|
||||||
# alias ta="za"
|
|
||||||
#
|
|
||||||
# # alias zs="zellij setup --dump-config > $HOME/.config/zellij/config.yaml"
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# Function to get the IP address
|
# Function to get the IP address
|
||||||
get_ip() {
|
get_ip() {
|
||||||
ip a | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d/ -f1 | head -n 1
|
ip a | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d/ -f1 | head -n 1
|
||||||
|
@ -596,97 +570,90 @@ if command_exists hugo; then
|
||||||
alias hs='hugo server -D --noHTTPCache --disableFastRender' # --bind "$(get_ip)"'
|
alias hs='hugo server -D --noHTTPCache --disableFastRender' # --bind "$(get_ip)"'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
__get_Packager__() {
|
missing() {
|
||||||
# Load OS release information
|
local e=(
|
||||||
[ -f /etc/os-release ] && . /etc/os-release || return 1
|
bash
|
||||||
|
zsh
|
||||||
|
fzf
|
||||||
|
curl
|
||||||
|
git
|
||||||
|
docker
|
||||||
|
nvim
|
||||||
|
)
|
||||||
|
|
||||||
DISTRO="${ID}:${ID_LIKE}"
|
for i in "$e{[@]}"; do
|
||||||
|
if ! command_exists $i; then
|
||||||
|
echo_missing "$i"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
case "$DISTRO" in
|
# INFO:
|
||||||
*debian*)
|
# ╭─────────────────╮
|
||||||
pkg_install() {
|
# │ other functions │
|
||||||
if command_exists nala; then
|
# ╰─────────────────╯
|
||||||
$_sudo nala install --assume-yes "$@"
|
source-script() {
|
||||||
|
local url="$1"
|
||||||
|
local import="$(mktemp)"
|
||||||
|
|
||||||
|
# ─< if $1 is a local file, source this one instead >─────────────────────────────────────
|
||||||
|
if [ -f "$url" ]; then
|
||||||
|
source "$url"
|
||||||
|
sleep 0.1
|
||||||
|
return 0
|
||||||
else
|
else
|
||||||
$_sudo apt install --assume-yes "$@"
|
echo_info "Sourcing external script:${NC} $url"
|
||||||
|
# ─< if $1 is a url, grab it and source it, also deletes afterwards >─────────────────────
|
||||||
|
if command_exists curl; then
|
||||||
|
curl -fsSL $url -o $import
|
||||||
|
elif command_exists wget; then
|
||||||
|
wget -o $import $url
|
||||||
|
else
|
||||||
|
echo "curl/wget is required, but missing.."
|
||||||
|
exit 69
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "$import"
|
||||||
|
sleep 0.1
|
||||||
|
rm -f "$import"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if command_exists nala; then
|
resolve() {
|
||||||
alias search="nala search"
|
local quiet=false
|
||||||
alias update="$_sudo nala update && $_sudo nala upgrade --full"
|
if [[ "$1" == "-q" ]]; then
|
||||||
alias remove="$_sudo nala purge"
|
quiet=true
|
||||||
else
|
shift
|
||||||
alias search="apt-cache search"
|
|
||||||
alias update="$_sudo apt update && $_sudo apt upgrade"
|
|
||||||
alias remove="$_sudo apt purge"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias unbreak="$_sudo dpkg --configure -a"
|
local ip="$1"
|
||||||
alias install="pkg_install"
|
local server="$2"
|
||||||
;;
|
local dig_out
|
||||||
*arch*)
|
dig_out=$(command dig +noall +answer -x "$ip" ${server:+@$server} 2>/dev/null)
|
||||||
pkg_install() {
|
|
||||||
if command_exists paru; then
|
local line ptr hostname time
|
||||||
paru -S --color always --noconfirm --needed "$@"
|
line=$(grep 'PTR' <<<"$dig_out")
|
||||||
elif command_exists yay; then
|
ptr=$(awk '{print $4}' <<<"$line")
|
||||||
yay -S --color always --noconfirm --needed "$@"
|
time=$(awk '{print $2}' <<<"$dig_out")
|
||||||
else
|
hostname=$(awk '{print $5}' <<<"$line" | sed 's/\.$//')
|
||||||
$_sudo pacman -S --color always --noconfirm --needed "$@"
|
|
||||||
|
if $quiet; then
|
||||||
|
[[ -n "$hostname" ]] && echo "$hostname"
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
if command_exists paru; then
|
if [[ -n "$hostname" ]]; then
|
||||||
alias search="paru -Ss --color always"
|
# ✅ resolved
|
||||||
# alias install="paru -S --color always --noconfirm"
|
printf "✅ ${BOLD}${GREEN}%s${NC} \033[1;90m%s${NC} \033[32m%s${NC} \033[2m%s ms${NC}\n" \
|
||||||
alias update="paru -Syu --color always"
|
"$ptr" "$ip" "$hostname" "$time"
|
||||||
alias remove="paru -R --color always"
|
|
||||||
elif command_exists yay; then
|
|
||||||
alias search="yay -Ss --color always"
|
|
||||||
# alias install="yay -S --noconfirm --color always"
|
|
||||||
alias update="yay -Syu --color always"
|
|
||||||
alias remove="yay -R --color always"
|
|
||||||
else
|
else
|
||||||
alias search="$_sudo pacman -Ss --color always"
|
# ❌ not resolved
|
||||||
# alias install="$_sudo pacman -S --noconfirm --color always"
|
printf "❌ \033[1;31m%s${NC} \033[1;90m%s${NC} \033[1;31mNOT FOUND${NC} \033[2m%s ms\033[0m\n" \
|
||||||
alias update="$_sudo pacman -Syu --color always"
|
"PTR" "$ip" "${time:-0}"
|
||||||
alias remove="$_sudo pacman -R --color always"
|
|
||||||
fi
|
fi
|
||||||
alias install="pkg_install"
|
|
||||||
;;
|
|
||||||
*rhel* | *fedora*)
|
|
||||||
alias search="dnf search"
|
|
||||||
alias install="$_sudo dnf install -y --skip-missing"
|
|
||||||
alias update="$_sudo dnf update -y"
|
|
||||||
alias remove="$_sudo dnf remove -y"
|
|
||||||
;;
|
|
||||||
*suse*)
|
|
||||||
alias search="zypper search"
|
|
||||||
alias install="$_sudo zypper install --no-confirm"
|
|
||||||
alias update="$_sudo zypper update"
|
|
||||||
alias remove="$_sudo zypper remove"
|
|
||||||
;;
|
|
||||||
*alpine*)
|
|
||||||
alias install="$_sudo apk add"
|
|
||||||
alias update="$_sudo apk update && $_sudo apk upgrade"
|
|
||||||
alias remove="$_sudo apk del"
|
|
||||||
;;
|
|
||||||
*nixos*)
|
|
||||||
echo_info "Using NIX!!"
|
|
||||||
alias update="$_sudo nixos-rebuild switch"
|
|
||||||
# alias install="$_sudo nix-env -iA nixos."
|
|
||||||
install() {
|
|
||||||
"$_sudo nix-end -iA nixos.$@"
|
|
||||||
}
|
|
||||||
alias edit="$_sudo -E $EDITOR /etc/nixos/configuration.nix"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo_error "Unsupported distro: $ID"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
__get_Packager__
|
|
||||||
# ─< g stands for GIT >─────────────────────────────────────────────────────────────────────
|
# ─< g stands for GIT >─────────────────────────────────────────────────────────────────────
|
||||||
if command_exists git; then
|
if command_exists git; then
|
||||||
__git__
|
__git__
|
||||||
|
@ -697,7 +664,7 @@ main() {
|
||||||
# ─< d stands for docker >──────────────────────────────────────────────────────────────────
|
# ─< d stands for docker >──────────────────────────────────────────────────────────────────
|
||||||
if command_exists docker; then
|
if command_exists docker; then
|
||||||
__docker__
|
__docker__
|
||||||
elif command_exists podman-compose; then
|
elif command_exists podman; then
|
||||||
__podman__
|
__podman__
|
||||||
else
|
else
|
||||||
echo_missing "docker | podman"
|
echo_missing "docker | podman"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue