wip3
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Autogenerated at 24.03.2026 00:34 using ./gen-makefile
|
||||
# Autogenerated at 10.07.2026 15:03 using ./gen-makefile
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
#===============================================
|
||||
@@ -41,10 +41,6 @@ composer:
|
||||
docker:
|
||||
@./install/docker install
|
||||
|
||||
##dots: Install dotfiles
|
||||
dots:
|
||||
@./install/dots install
|
||||
|
||||
##droidcam: Install droidcam v1.9.0
|
||||
droidcam:
|
||||
@./install/droidcam install
|
||||
@@ -221,7 +217,7 @@ telebit:
|
||||
telegram:
|
||||
@./install/telegram install
|
||||
|
||||
##tilt: <no description>
|
||||
##tilt: Install tilt (k8s dev env)
|
||||
tilt:
|
||||
@./install/tilt install
|
||||
|
||||
@@ -257,7 +253,6 @@ zint:
|
||||
zsh:
|
||||
@./install/zsh install
|
||||
|
||||
|
||||
#===============================================
|
||||
# Scripts listed in ./packs
|
||||
#===============================================
|
||||
@@ -280,64 +275,144 @@ phptools: composer php-psalm phpcs phpmd phpstan phpunit
|
||||
phpstack: php phptools
|
||||
|
||||
#===============================================
|
||||
# Scripts listed in ./upgrade
|
||||
# Upgrade targets (use install script with 'upgrade' arg)
|
||||
#===============================================
|
||||
|
||||
##^omz: Upgrade omz
|
||||
^omz:
|
||||
@./upgrade/omz upgrade
|
||||
##^apache2: Manage apache2 (apt)
|
||||
^apache2:
|
||||
@./install/apache2 upgrade
|
||||
|
||||
##^apt: Install basic software from apt
|
||||
^apt:
|
||||
@./install/apt upgrade
|
||||
|
||||
##^canon-mg2500: Canon Pixma MG2500 + ppa
|
||||
^canon-mg2500:
|
||||
@./install/canon-mg2500 upgrade
|
||||
|
||||
##^chrome: Google Chrome (latest)
|
||||
^chrome:
|
||||
@./install/chrome upgrade
|
||||
|
||||
##^clamav: ClamAV
|
||||
^clamav:
|
||||
@./install/clamav upgrade
|
||||
|
||||
##^composer: Install composer (latest)
|
||||
^composer:
|
||||
@./install/composer upgrade
|
||||
|
||||
##^docker: Docker + ppa
|
||||
^docker:
|
||||
@./install/docker upgrade
|
||||
|
||||
##^golang: Install golang
|
||||
^golang:
|
||||
@./install/golang upgrade
|
||||
|
||||
##^keyd: Install keyd
|
||||
^keyd:
|
||||
@./install/keyd upgrade
|
||||
|
||||
##^llmfit: Install llmfit
|
||||
^llmfit:
|
||||
@./install/llmfit upgrade
|
||||
|
||||
##^omz-clean: Install omz (latest)
|
||||
^omz-clean:
|
||||
@./install/omz-clean upgrade
|
||||
|
||||
#===============================================
|
||||
# Scripts listed in ./uninstall
|
||||
# Remove targets (use install script with 'remove' arg)
|
||||
#===============================================
|
||||
|
||||
##/chrome: Uninstall google chrome
|
||||
##/anytype: Manage anytype (deb)
|
||||
/anytype:
|
||||
@./install/anytype remove
|
||||
|
||||
##/apache2: Manage apache2 (apt)
|
||||
/apache2:
|
||||
@./install/apache2 remove
|
||||
|
||||
##/canon-mg2500: Canon Pixma MG2500 + ppa
|
||||
/canon-mg2500:
|
||||
@./install/canon-mg2500 remove
|
||||
|
||||
##/chrome: Google Chrome (latest)
|
||||
/chrome:
|
||||
@./uninstall/chrome remove
|
||||
@./install/chrome remove
|
||||
|
||||
##/composer: Uninstall composer
|
||||
##/clamav: ClamAV
|
||||
/clamav:
|
||||
@./install/clamav remove
|
||||
|
||||
##/composer: Install composer (latest)
|
||||
/composer:
|
||||
@./uninstall/composer remove
|
||||
@./install/composer remove
|
||||
|
||||
##/docker: Uninstall docker + ppa
|
||||
##/docker: Docker + ppa
|
||||
/docker:
|
||||
@./uninstall/docker remove
|
||||
@./install/docker remove
|
||||
|
||||
##/grub-customizer: Uninstall grub-customizer with ppa
|
||||
##/golang: Install golang
|
||||
/golang:
|
||||
@./install/golang remove
|
||||
|
||||
##/grub-customizer: Install grub-customizer (latest + ppa)
|
||||
/grub-customizer:
|
||||
@./uninstall/grub-customizer remove
|
||||
@./install/grub-customizer remove
|
||||
|
||||
##/lazynvim: <no description>
|
||||
/lazynvim:
|
||||
@./uninstall/lazynvim remove
|
||||
##/keyd: Install keyd
|
||||
/keyd:
|
||||
@./install/keyd remove
|
||||
|
||||
##/lite-xl: Uninstall lite-xl
|
||||
##/lite-xl: Install lite-xl v2.1.7
|
||||
/lite-xl:
|
||||
@./uninstall/lite-xl remove
|
||||
@./install/lite-xl remove
|
||||
|
||||
##/omz: Uninstall omz
|
||||
/omz:
|
||||
@./uninstall/omz remove
|
||||
##/llmfit: Install llmfit
|
||||
/llmfit:
|
||||
@./install/llmfit remove
|
||||
|
||||
##/rustdesk: Uninstall rustdesk client
|
||||
##/nerd-fonts: Install nerd-fonts
|
||||
/nerd-fonts:
|
||||
@./install/nerd-fonts remove
|
||||
|
||||
##/nodejs: Install nodejs + npm via nvm
|
||||
/nodejs:
|
||||
@./install/nodejs remove
|
||||
|
||||
##/nvim: Install nvim + lazyvim
|
||||
/nvim:
|
||||
@./install/nvim remove
|
||||
|
||||
##/ollama: Install ollama
|
||||
/ollama:
|
||||
@./install/ollama remove
|
||||
|
||||
##/omz-clean: Install omz (latest)
|
||||
/omz-clean:
|
||||
@./install/omz-clean remove
|
||||
|
||||
##/rustdesk: Install rustdesk client v1.4.2 (deb)
|
||||
/rustdesk:
|
||||
@./uninstall/rustdesk remove
|
||||
@./install/rustdesk remove
|
||||
|
||||
##/sublimemerge: Uninstall Sublime Merge
|
||||
##/sublimemerge: Install Sublime Merge
|
||||
/sublimemerge:
|
||||
@./uninstall/sublimemerge remove
|
||||
@./install/sublimemerge remove
|
||||
|
||||
##/sublimetext: Uninstall Sublime Text
|
||||
##/sublimetext: Install Sublime Text
|
||||
/sublimetext:
|
||||
@./uninstall/sublimetext remove
|
||||
@./install/sublimetext remove
|
||||
|
||||
##/vivaldi: Uninstall vivaldi + ppa
|
||||
##/vivaldi: Install Vivaldi + ppa
|
||||
/vivaldi:
|
||||
@./uninstall/vivaldi remove
|
||||
@./install/vivaldi remove
|
||||
|
||||
##/wine: Uninstall wine
|
||||
##/wine: Install wine (latest) + ppa
|
||||
/wine:
|
||||
@./uninstall/wine remove
|
||||
@./install/wine remove
|
||||
|
||||
#===============================================
|
||||
# Service goals
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* `wget` (required for some scripts)
|
||||
* `git` (required for some scripts)
|
||||
|
||||
If some dependecies are missed for some of these scripts it is enougth to run `./install/apt` in most cases, otherwise script will suggest (or even install) them.
|
||||
If some dependencies are missed for some of these scripts, it is enough to run `./install/apt` in most cases; otherwise the script will suggest (or even install) them.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -27,18 +27,24 @@ cd shell && make
|
||||
|
||||
## How to add my script?
|
||||
|
||||
1. Create a new shell script in `./install`, `./upgrade` or `./uninstall` directory.
|
||||
At the beggining of a file you must write these two lines:
|
||||
1. Create a new shell script in `./install` directory.
|
||||
At the beginning of a file you must write these two lines:
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Your description for Makefile
|
||||
```
|
||||
2. Make this script executable, e.g.:
|
||||
2. Implement `install()`, `upgrade()` and/or `remove()` functions with `set -eo pipefail` and a trailing `case "$1"` block.
|
||||
3. Make this script executable, e.g.:
|
||||
```shell
|
||||
sudo chmod a+x ./install/myscript
|
||||
chmod +x ./install/myscript
|
||||
```
|
||||
3. Test your script
|
||||
4. Run `make self` to generate new `./Makefile`
|
||||
4. Test your script standalone:
|
||||
```shell
|
||||
./install/myscript install
|
||||
./install/myscript upgrade
|
||||
./install/myscript remove
|
||||
```
|
||||
5. Run `make self` to regenerate `./Makefile`
|
||||
|
||||
## How to create a pack?
|
||||
|
||||
|
||||
+11
-6
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[ -f Makefile ] && mv Makefile Makefile.bak
|
||||
CHR_UPGRADE='^'
|
||||
CHR_UNINSTALL='/'
|
||||
@@ -22,7 +23,6 @@ for file in ./install/*; do
|
||||
done;
|
||||
|
||||
cat << EOF >> Makefile
|
||||
|
||||
#===============================================
|
||||
# Scripts listed in ./packs
|
||||
#===============================================
|
||||
@@ -34,17 +34,19 @@ for file in ./packs/*; do
|
||||
echo >> Makefile
|
||||
done;
|
||||
|
||||
|
||||
cat << EOF >> Makefile
|
||||
#===============================================
|
||||
# Scripts listed in ./upgrade
|
||||
# Upgrade targets (use install script with 'upgrade' arg)
|
||||
#===============================================
|
||||
|
||||
EOF
|
||||
|
||||
for file in ./upgrade/*; do
|
||||
for file in ./install/*; do
|
||||
name=${file##*/}
|
||||
name=${name%.sh}
|
||||
[ "$name" = "_example" ] && continue
|
||||
has_upgrade=$(grep -q '^upgrade() {' ${file} && echo yes || echo no)
|
||||
[ "$has_upgrade" = "no" ] && continue
|
||||
desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
|
||||
[ -z "$desc" ] && desc='<no description>'
|
||||
echo -e "##${CHR_UPGRADE}${name}: ${desc}\n${CHR_UPGRADE}${name}:\n\t@${file} upgrade\n" >> Makefile
|
||||
@@ -52,14 +54,17 @@ done;
|
||||
|
||||
cat << EOF >> Makefile
|
||||
#===============================================
|
||||
# Scripts listed in ./uninstall
|
||||
# Remove targets (use install script with 'remove' arg)
|
||||
#===============================================
|
||||
|
||||
EOF
|
||||
|
||||
for file in ./uninstall/*; do
|
||||
for file in ./install/*; do
|
||||
name=${file##*/}
|
||||
name=${name%.sh}
|
||||
[ "$name" = "_example" ] && continue
|
||||
has_remove=$(grep -q '^remove() {' ${file} && echo yes || echo no)
|
||||
[ "$has_remove" = "no" ] && continue
|
||||
desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
|
||||
[ -z "$desc" ] && desc='<no description>'
|
||||
echo -e "##${CHR_UNINSTALL}${name}: ${desc}\n${CHR_UNINSTALL}${name}:\n\t@${file} remove\n" >> Makefile
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Manage apache2 (apt)
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
|
||||
+30
-2
@@ -1,8 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install basic software from apt
|
||||
|
||||
sudo apt update && \
|
||||
sudo apt upgrade -y --autoremove && \
|
||||
set -eo pipefail
|
||||
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: This script is for Debian/Ubuntu only. Use 'make brew' on macOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing basic software from apt"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo apt update
|
||||
sudo apt upgrade -y --autoremove
|
||||
sudo apt install -y \
|
||||
alien \
|
||||
apt-transport-https \
|
||||
@@ -48,3 +62,17 @@ sudo apt update && \
|
||||
# xclip
|
||||
# sqlitebrowser
|
||||
# etckeeper
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
upgrade() {
|
||||
install
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
u|upgrade|update) upgrade ;;
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+36
-8
@@ -1,13 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install software from brew
|
||||
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
set -eo pipefail
|
||||
|
||||
brew install \
|
||||
bash \
|
||||
stow \
|
||||
gnupg \
|
||||
pinentry-mac
|
||||
if [ "$(uname -s)" != "Darwin" ]; then
|
||||
echo "ERROR: This script is for MacOS only." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "pinentry-program $(which pinentry-mac)" >> ~/.gnupg/gpg-agent.conf
|
||||
gpgconf --kill gpg-agent
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing software from brew"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
if ! installed brew; then
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
fi
|
||||
|
||||
brew install \
|
||||
bash \
|
||||
stow \
|
||||
gnupg \
|
||||
pinentry-mac
|
||||
|
||||
mkdir -p ~/.gnupg
|
||||
echo "pinentry-program $(which pinentry-mac)" >> ~/.gnupg/gpg-agent.conf
|
||||
gpgconf --kill gpg-agent
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+12
-5
@@ -1,6 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Canon Pixma MG2500 + ppa
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: Canon Pixma MG2500 drivers are not supported on macOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
@@ -24,7 +31,7 @@ upgrade() {
|
||||
echo
|
||||
sudo apt upgrade -y cnijfilter-mg2500series scangearmp-mg2500series
|
||||
echo
|
||||
echo "Finish! Canon Pixma MG2500 + ppa"
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
@@ -35,10 +42,10 @@ remove() {
|
||||
echo "==============================================="
|
||||
echo
|
||||
# sudo apt purge -y cnijfilter-mg2500series scangearmp-mg2500series
|
||||
sudp dpkg -r cnijfilter-mg2500series
|
||||
sudp dpkg -r cnijfilter-common
|
||||
sudp dpkg -r scangearmp-mg2500series
|
||||
sudp dpkg -r scangearmp-common
|
||||
sudo dpkg -r cnijfilter-mg2500series
|
||||
sudo dpkg -r cnijfilter-common
|
||||
sudo dpkg -r scangearmp-mg2500series
|
||||
sudo dpkg -r scangearmp-common
|
||||
sudo add-apt-repository -ry ppa:thierry-f/fork-michael-gruz
|
||||
echo
|
||||
echo "Finish!"
|
||||
|
||||
+47
-5
@@ -3,6 +3,8 @@
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
# https://t.me/axenov_blog/251
|
||||
|
||||
dest="$HOME/install/deb"
|
||||
@@ -10,40 +12,80 @@ deb="$dest/google-chrome.deb"
|
||||
url="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
|
||||
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install --cask google-chrome
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing Google Chrome"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
mkdir -p "$dest"
|
||||
wget "$url" -O "$deb"
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$url" -O "$deb"
|
||||
else
|
||||
curl -fsSL "$url" -o "$deb"
|
||||
fi
|
||||
|
||||
sudo dpkg -i "$deb"
|
||||
|
||||
echo
|
||||
echo "Finish! $(google-chrome --version)"
|
||||
echo "Finish!"
|
||||
google-chrome --version
|
||||
echo
|
||||
}
|
||||
|
||||
upgrade() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew upgrade --cask google-chrome
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Upgrading Google Chrome"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
mkdir -p "$dest"
|
||||
wget "$url" -O "$deb"
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$url" -O "$deb"
|
||||
else
|
||||
curl -fsSL "$url" -o "$deb"
|
||||
fi
|
||||
|
||||
sudo dpkg -i "$deb"
|
||||
|
||||
echo
|
||||
echo "Finish! $(google-chrome --version)"
|
||||
echo "Finish!"
|
||||
google-chrome --version
|
||||
echo
|
||||
}
|
||||
|
||||
remove() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew uninstall --cask google-chrome
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Removing Google Chrome"
|
||||
echo "==============================================="
|
||||
echo
|
||||
sudo dpkg -r google-chrome
|
||||
sudo dpkg -r google-chrome-stable
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: clamav are not supported on macOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
|
||||
+97
-28
@@ -1,38 +1,107 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install composer (latest)
|
||||
here=$( dirname $(readlink -e -- "${BASH_SOURCE}"))
|
||||
source "$here/../helpers.sh" || exit 255
|
||||
|
||||
# https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
|
||||
set -eo pipefail
|
||||
|
||||
title
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
require php
|
||||
warn() { echo "WARNING: $*" >&2; }
|
||||
|
||||
if installed composer; then
|
||||
warn "WARNING: Removing current composer to install latest one"
|
||||
composer --version
|
||||
__AAA_NO_TITLE=1 source $here/../uninstall/composer
|
||||
fi
|
||||
|
||||
mkdir -p "$HOME/install/other" "$HOME/.local/bin"
|
||||
|
||||
download "https://getcomposer.org/installer" \
|
||||
"$HOME/install/other/composer-setup.php"
|
||||
|
||||
php "$HOME/install/other/composer-setup.php" \
|
||||
--install-dir="$HOME/.local/bin/" \
|
||||
--filename="composer"
|
||||
|
||||
COMPOSER_GLOBAL_HOME="$($HOME/.local/bin/composer config -g home)"
|
||||
NEWPATH="PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
|
||||
cat "$HOME/.profile" | grep -qoh "$NEWPATH" || {
|
||||
export "$NEWPATH"
|
||||
echo "export $NEWPATH" >> "$HOME/.profile"
|
||||
require() {
|
||||
local missing=()
|
||||
for pkg in "$@"; do
|
||||
installed "$pkg" || missing+=("$pkg")
|
||||
done
|
||||
if [ ${#missing[@]} -gt 0 ]; then
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install "${missing[@]}"
|
||||
else
|
||||
echo "ERROR: Missing: ${missing[*]}. Install manually or use brew." >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
sudo apt install -y "${missing[@]}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
source "$HOME/.profile"
|
||||
download() {
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$1" -O "$2"
|
||||
else
|
||||
curl -fsSL "$1" -o "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
success "composer installed!"
|
||||
composer --version
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing composer"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
# https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
|
||||
|
||||
require php
|
||||
|
||||
if installed composer; then
|
||||
warn "Removing current composer to install latest one"
|
||||
composer --version
|
||||
rm -f "$HOME/.local/bin/composer" /usr/local/bin/composer /usr/bin/composer 2>/dev/null || true
|
||||
fi
|
||||
|
||||
mkdir -p "$HOME/install/other" "$HOME/.local/bin"
|
||||
|
||||
download "https://getcomposer.org/installer" \
|
||||
"$HOME/install/other/composer-setup.php"
|
||||
|
||||
php "$HOME/install/other/composer-setup.php" \
|
||||
--install-dir="$HOME/.local/bin/" \
|
||||
--filename="composer"
|
||||
|
||||
COMPOSER_GLOBAL_HOME="$($HOME/.local/bin/composer config -g home)"
|
||||
NEWPATH="PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
|
||||
if ! grep -qoh "$NEWPATH" "$HOME/.profile" 2>/dev/null; then
|
||||
export "$NEWPATH"
|
||||
echo "export $NEWPATH" >> "$HOME/.profile"
|
||||
fi
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
source "$HOME/.profile"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
composer --version
|
||||
echo
|
||||
}
|
||||
|
||||
upgrade() {
|
||||
install
|
||||
}
|
||||
|
||||
remove() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Removing composer"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo apt remove -y --autoremove composer 2>/dev/null || true
|
||||
rm -f \
|
||||
"$HOME/.local/bin/composer" \
|
||||
/bin/composer \
|
||||
/usr/bin/composer \
|
||||
/usr/local/bin/composer \
|
||||
/usr/src/composer 2>/dev/null || true
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
u|upgrade|update) upgrade ;;
|
||||
r|remove|d|delete|p|purge) remove ;;
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+16
-3
@@ -23,7 +23,7 @@ installRepo() {
|
||||
sudo apt update
|
||||
}
|
||||
|
||||
install() {
|
||||
doInstall() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing Docker"
|
||||
@@ -69,7 +69,20 @@ remove() {
|
||||
echo "Removing Docker"
|
||||
echo "==============================================="
|
||||
echo
|
||||
doRemove
|
||||
|
||||
sudo apt remove -y --autoremove \
|
||||
docker-ce \
|
||||
docker-ce-cli \
|
||||
containerd.io \
|
||||
docker-buildx-plugin \
|
||||
docker-compose-plugin \
|
||||
docker-ce-rootless-extras
|
||||
sudo rm -rf \
|
||||
/var/lib/docker \
|
||||
/var/lib/containerd \
|
||||
/etc/apt/sources.list.d/docker.list \
|
||||
/etc/apt/keyrings/docker.asc
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
@@ -80,5 +93,5 @@ case "$1" in
|
||||
r|remove|d|delete|p|purge) remove ;;
|
||||
install-repo) installRepo ;;
|
||||
# remove-repo) removeRepo ;; #TODO
|
||||
*) install ;;
|
||||
*) doInstall ;;
|
||||
esac
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install dotfiles
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
title
|
||||
|
||||
install_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
dotfiles_src_dir="`dirname $install_dir`/dotfiles"
|
||||
postfix=".bak-`date '+%Y%m%d%H%M'`"
|
||||
|
||||
install_dotfile() {
|
||||
mv "$HOME/$1" "$HOME/$1$postfix"
|
||||
cp "$dotfiles_src_dir/$1" "$HOME/$1"
|
||||
success "- $1"
|
||||
}
|
||||
|
||||
install_dotfile ".bash_aliases" && \
|
||||
install_dotfile ".profile" && \
|
||||
install_dotfile ".bashrc" && \
|
||||
install_dotfile ".gitconfig" && \
|
||||
install_dotfile ".gitignore" && \
|
||||
install_dotfile ".git_aliases"
|
||||
+31
-12
@@ -1,21 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install droidcam v1.9.0
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
#TODO
|
||||
exit
|
||||
set -eo pipefail
|
||||
|
||||
# https://droidcam.app/linux/
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: droidcam is not supported on macOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
title
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing droidcam"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
mkdir -p "$HOME/install/deb/"
|
||||
# https://droidcam.app/linux/
|
||||
|
||||
download "https://beta.droidcam.app/go/droidCam.client.setup.deb" "$HOME/install/deb/droidcam_client_amd64.deb"
|
||||
mkdir -p "$HOME/install/deb/"
|
||||
|
||||
dpkg_install "$HOME/install/deb/droidcam_client_amd64.deb"
|
||||
apt_install v4l2loopback-dkms
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
wget -q --show-progress "https://beta.droidcam.app/go/droidCam.client.setup.deb" -O "$HOME/install/deb/droidcam_client_amd64.deb"
|
||||
else
|
||||
curl -fsSL "https://beta.droidcam.app/go/droidCam.client.setup.deb" -o "$HOME/install/deb/droidcam_client_amd64.deb"
|
||||
fi
|
||||
|
||||
success "droidcam installed!"
|
||||
info "Don't forget to install the android app:"
|
||||
info "https://play.google.com/store/apps/developer?id=Dev47Apps"
|
||||
sudo dpkg -i "$HOME/install/deb/droidcam_client_amd64.deb"
|
||||
sudo apt install -y v4l2loopback-dkms
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo "Don't forget to install the android app:"
|
||||
echo "https://play.google.com/store/apps/developer?id=Dev47Apps"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+35
-29
@@ -1,43 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install droidcam-obs plugin v1.5.1
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
#TODO
|
||||
# ffmpeg -version | head -n 1 | awk '{print $3}'
|
||||
# https://github.com/dev47apps/droidcam-obs-plugin/releases
|
||||
|
||||
exit
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: droidcam-obs plugin is not supported on macOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing droidcam-obs"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
# https://www.dev47apps.com/droidcam/linux/
|
||||
# https://www.dev47apps.com/obs/
|
||||
# https://www.dev47apps.com/obs/usage.html
|
||||
# https://obsproject.com/forum/threads/how-to-start-virtual-camera-without-sudo-privileges.139783/
|
||||
# https://www.dev47apps.com/droidcam/linux/
|
||||
# https://www.dev47apps.com/obs/
|
||||
|
||||
command -v "obs-studio" >/dev/null 2>&1 || echo "WARNING: You need obs-studio first!"
|
||||
|
||||
mkdir -p "$HOME/install/droidcam-obs"
|
||||
wget -O /tmp/droidcam-obs.zip https://files.dev47apps.net/obs/droidcam_obs_1.5.1_linux.zip
|
||||
unzip -oq /tmp/droidcam-obs.zip -d "$HOME/install/droidcam-obs"
|
||||
rm -rf /tmp/droidcam-obs.zip
|
||||
cd "$HOME/install/droidcam-obs"
|
||||
./install.sh
|
||||
sudo modprobe v4l2loopback video_nr=2 card_label="OBS Virtual Camera"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo "Don't forget to:"
|
||||
echo "1) restart OBS if it is running right now OR install (if not) and start it"
|
||||
echo "2) install android app: https://play.google.com/store/apps/developer?id=Dev47Apps"
|
||||
echo "3) if virtual camera not starting then execute:"
|
||||
echo -e "\tsudo modprobe v4l2loopback video_nr=2 card_label=\"OBS Virtual Camera\""
|
||||
echo
|
||||
}
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing droidcam-obs..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
# command -v "obs" >/dev/null 2>&1 || echo 'You need to install obs first!'
|
||||
command -v "obs-studio" >/dev/null 2>&1 || echo 'You need to install obs-studio first!'
|
||||
|
||||
mkdir -p $HOMEinstall/droidcam-obs
|
||||
wget -O /tmp/droidcam-obs.zip https://files.dev47apps.net/obs/droidcam_obs_1.5.1_linux.zip
|
||||
unzip -oq /tmp/droidcam-obs.zip -d $HOMEinstall/droidcam-obs
|
||||
rm -rf /tmp/droidcam-obs.zip
|
||||
cd $HOMEinstall/droidcam-obs && ./install.sh
|
||||
sudo modprobe v4l2loopback video_nr=2 card_label="OBS Virtual Camera"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo "Don't forget to:"
|
||||
echo "1) restart OBS if it is running right now OR install (if not) and start it"
|
||||
echo "2) install android app: https://play.google.com/store/apps/developer?id=Dev47Apps"
|
||||
echo "3) if virtual camera not starting then execute:"
|
||||
echo -e "\tsudo modprobe v4l2loopback video_nr=2 card_label=\"OBS Virtual Camera\""
|
||||
echo
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+55
-38
@@ -1,54 +1,71 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install flameshot (latest)
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
title
|
||||
set -eo pipefail
|
||||
|
||||
# https://github.com/flameshot-org/flameshot?tab=readme-ov-file#compilation
|
||||
# sudo apt install -y --autoremove flameshot && \
|
||||
# sudo systemctl restart flameshot
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
dir="$HOME/install"
|
||||
clone_dir="$dir/flameshot"
|
||||
mkdir -p "$dir"
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install --cask flameshot
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
sudo apt install -y \
|
||||
g++ \
|
||||
cmake \
|
||||
build-essential \
|
||||
qtbase5-dev \
|
||||
qttools5-dev-tools \
|
||||
libqt5svg5-dev \
|
||||
qttools5-dev \
|
||||
libqt5dbus5 \
|
||||
libqt5network5 \
|
||||
libqt5core5a \
|
||||
libqt5widgets5 \
|
||||
libqt5gui5 \
|
||||
libqt5svg5
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing flameshot"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
if [ ! -d "$clone_dir" ]; then
|
||||
git clone --depth=1 --single-branch https://github.com/flameshot-org/flameshot.git "$clone_dir"
|
||||
fi
|
||||
# https://github.com/flameshot-org/flameshot?tab=readme-ov-file#compilation
|
||||
# sudo apt install -y --autoremove flameshot
|
||||
# sudo systemctl restart flameshot
|
||||
|
||||
# Directory where build files will be placed, may be relative
|
||||
export BUILD_DIR=build
|
||||
dir="$HOME/install"
|
||||
clone_dir="$dir/flameshot"
|
||||
mkdir -p "$dir"
|
||||
|
||||
# Directory prefix where flameshot will be installed. If you are just building and don't want to
|
||||
# install, comment this environment variable.
|
||||
# This excludes the bin/flameshot part of the install,
|
||||
# e.g. in /opt/flameshot/bin/flameshot, the CMAKE_INSTALL_PREFIX is /opt/flameshot
|
||||
# This must be an absolute path. Requires CMAKE 3.29.
|
||||
export CMAKE_INSTALL_PREFIX=/opt/flameshot
|
||||
sudo apt install -y \
|
||||
g++ \
|
||||
cmake \
|
||||
build-essential \
|
||||
qtbase5-dev \
|
||||
qttools5-dev-tools \
|
||||
libqt5svg5-dev \
|
||||
qttools5-dev \
|
||||
libqt5dbus5 \
|
||||
libqt5network5 \
|
||||
libqt5core5a \
|
||||
libqt5widgets5 \
|
||||
libqt5gui5 \
|
||||
libqt5svg5
|
||||
|
||||
cd "$clone_dir" && \
|
||||
git pull && \
|
||||
cmake -S . -B "$BUILD_DIR" && \
|
||||
if [ ! -d "$clone_dir" ]; then
|
||||
git clone --depth=1 --single-branch https://github.com/flameshot-org/flameshot.git "$clone_dir"
|
||||
fi
|
||||
|
||||
# Directory where build files will be placed, may be relative
|
||||
export BUILD_DIR=build
|
||||
|
||||
# Directory prefix where flameshot will be installed.
|
||||
export CMAKE_INSTALL_PREFIX=/opt/flameshot
|
||||
|
||||
cd "$clone_dir"
|
||||
git pull
|
||||
cmake -S . -B "$BUILD_DIR"
|
||||
cmake --build "$BUILD_DIR"
|
||||
|
||||
[ $? = 0 ] && {
|
||||
echo
|
||||
success "flameshot installed!"
|
||||
echo "Finish!"
|
||||
# /opt/flameshot/flameshot -v
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+69
-27
@@ -1,38 +1,80 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install git (latest)
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
title
|
||||
set -eo pipefail
|
||||
|
||||
require make
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
if installed git; then
|
||||
if [ -d "$HOME/install/git" ]; then
|
||||
cd "$HOME/install/git" && \
|
||||
git pull
|
||||
else
|
||||
clone "https://github.com/git/git.git" "$HOME/install/git" --depth=1 --single-branch && \
|
||||
cd "$HOME/install/git"
|
||||
require() {
|
||||
local missing=()
|
||||
for pkg in "$@"; do
|
||||
installed "$pkg" || missing+=("$pkg")
|
||||
done
|
||||
if [ ${#missing[@]} -gt 0 ]; then
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install "${missing[@]}"
|
||||
else
|
||||
echo "ERROR: Missing: ${missing[*]}. Install manually or use brew." >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
sudo apt install -y "${missing[@]}"
|
||||
fi
|
||||
fi
|
||||
sudo make prefix=/usr/local all && \
|
||||
sudo make prefix=/usr/local install
|
||||
else
|
||||
require wget
|
||||
mkdir -p "$HOME/install/git"
|
||||
download "https://github.com/git/git/archive/master.zip" "/tmp/git.zip" && \
|
||||
unzip -oq "/tmp/git.zip" -d "$HOME/install/git" && \
|
||||
rm /tmp/git.zip && \
|
||||
cd "$HOME/install/git/git-master" && \
|
||||
sudo make prefix=/usr/local all && \
|
||||
sudo make prefix=/usr/local install && \
|
||||
cd - && \
|
||||
rm -rf git && \
|
||||
clone "https://github.com/git/git.git" "$HOME/install/git" --depth=1 --single-branch
|
||||
fi
|
||||
}
|
||||
|
||||
[ $? = 0 ] && {
|
||||
download() {
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$1" -O "$2"
|
||||
else
|
||||
curl -fsSL "$1" -o "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
clone_quick() {
|
||||
git clone --depth=1 --single-branch "$@"
|
||||
}
|
||||
|
||||
install() {
|
||||
echo
|
||||
success "git installed!"
|
||||
echo "==============================================="
|
||||
echo "Installing git"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
require make
|
||||
|
||||
if installed git; then
|
||||
if [ -d "$HOME/install/git" ]; then
|
||||
cd "$HOME/install/git"
|
||||
git pull
|
||||
else
|
||||
clone_quick "https://github.com/git/git.git" "$HOME/install/git"
|
||||
cd "$HOME/install/git"
|
||||
fi
|
||||
sudo make prefix=/usr/local all
|
||||
sudo make prefix=/usr/local install
|
||||
else
|
||||
require wget unzip
|
||||
mkdir -p "$HOME/install/git"
|
||||
download "https://github.com/git/git/archive/master.zip" "/tmp/git.zip"
|
||||
unzip -oq "/tmp/git.zip" -d "$HOME/install/git"
|
||||
rm /tmp/git.zip
|
||||
cd "$HOME/install/git/git-master"
|
||||
sudo make prefix=/usr/local all
|
||||
sudo make prefix=/usr/local install
|
||||
cd -
|
||||
rm -rf git
|
||||
clone_quick "https://github.com/git/git.git" "$HOME/install/git"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
git --version
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+31
-6
@@ -7,6 +7,8 @@
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
doRemove() {
|
||||
[ -d "/usr/local/go" ] && sudo rm -rf "/usr/local/go"
|
||||
}
|
||||
@@ -20,22 +22,42 @@ install() {
|
||||
echo "Installing golang v$version"
|
||||
echo "==============================================="
|
||||
echo
|
||||
latestJson=$(echo "$json" | jq -r '.[0].files.[] | select (.kind == "archive" and .os == "linux" and .arch == "amd64")')
|
||||
|
||||
local os="linux"
|
||||
[ "$(uname -s)" = "Darwin" ] && os="darwin"
|
||||
|
||||
latestJson=$(echo "$json" | jq -r ".[0].files.[] | select (.kind == \"archive\" and .os == \"$os\" and .arch == \"amd64\")")
|
||||
fileName=$(echo "$latestJson" | jq -r '.filename')
|
||||
fileUrl="$dlUrl/$fileName"
|
||||
downloadPath="$HOME/install"
|
||||
archivePath="$downloadPath/$fileName"
|
||||
doRemove
|
||||
[ -f "$archivePath" ] || wget "$fileUrl" -O "$archivePath"
|
||||
[ -f "$archivePath" ] && sudo tar -xzf "$archivePath" -C /usr/local
|
||||
if [ ! -f "$archivePath" ]; then
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$fileUrl" -O "$archivePath"
|
||||
else
|
||||
curl -fsSL "$fileUrl" -o "$archivePath"
|
||||
fi
|
||||
fi
|
||||
sudo tar -xzf "$archivePath" -C /usr/local
|
||||
sudo chown "$USER": -R /usr/local/go
|
||||
echo 'export PATH="/usr/local/go/bin:$PATH"' >> "$HOME/.profile"
|
||||
echo "export GOPATH=\"\$HOME/.go\"" >> "$HOME/.profile"
|
||||
if ! grep -q '/usr/local/go/bin' "$HOME/.profile" 2>/dev/null; then
|
||||
echo 'export PATH="/usr/local/go/bin:$PATH"' >> "$HOME/.profile"
|
||||
echo "export GOPATH=\"\$HOME/.go\"" >> "$HOME/.profile"
|
||||
fi
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
source "$HOME/.profile"
|
||||
|
||||
echo
|
||||
go version
|
||||
go install github.com/go-delve/delve/cmd/dlv@latest
|
||||
go install
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
upgrade() {
|
||||
install
|
||||
}
|
||||
|
||||
remove() {
|
||||
@@ -45,12 +67,15 @@ remove() {
|
||||
echo "==============================================="
|
||||
echo
|
||||
doRemove
|
||||
sed -i '/\/usr\/local\/go\/bin/d' "$HOME/.profile"
|
||||
sed -i '/GOPATH/d' "$HOME/.profile"
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
u|upgrade|update) upgrade ;;
|
||||
r|remove|d|delete|p|purge) remove ;;
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+39
-5
@@ -1,15 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install grub-customizer (latest + ppa)
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
title
|
||||
set -eo pipefail
|
||||
|
||||
sudo add-apt-repository -y ppa:danielrichter2007/grub-customizer && \
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: grub-customizer is not supported on macOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing grub-customizer"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo add-apt-repository -y ppa:danielrichter2007/grub-customizer
|
||||
sudo apt install -y --autoremove grub-customizer
|
||||
|
||||
[ $? = 0 ] && {
|
||||
echo
|
||||
success "grub-customizer installed!"
|
||||
echo "Finish!"
|
||||
grub-customizer -v
|
||||
echo
|
||||
}
|
||||
|
||||
remove() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Removing grub-customizer"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
source_file="/etc/apt/sources.list.d/$(ls -1 /etc/apt/sources.list.d/ | grep danielrichter2007)"
|
||||
sudo apt remove -y --autoremove grub-customizer
|
||||
if [ -f "$source_file" ]; then
|
||||
sudo rm "$source_file"
|
||||
sudo apt update
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
r|remove|d|delete|p|purge) remove ;;
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+54
-38
@@ -1,43 +1,59 @@
|
||||
#!/usr/bin/env bash (latest)
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install KDE Window AppMenu Applet
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing KDE Window AppMenu Applet..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
# https://github.com/psifidotos/applet-window-appmenu/blob/master/INSTALLATION.md
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
sudo apt install -y --autoremove \
|
||||
make \
|
||||
cmake \
|
||||
extra-cmake-modules \
|
||||
qtdeclarative5-dev \
|
||||
libkf5plasma-dev \
|
||||
libqt5x11extras5-dev \
|
||||
g++ \
|
||||
libsm-dev \
|
||||
libkf5configwidgets-dev \
|
||||
libkdecorations2-dev \
|
||||
libxcb-randr0-dev \
|
||||
libkf5wayland-dev \
|
||||
plasma-workspace-dev
|
||||
|
||||
if installed 'git'; then
|
||||
sudo rm -rf /usr/src/appmenu-applet
|
||||
sudo git clone https://github.com/psifidotos/applet-window-appmenu.git --depth=1 /usr/src/appmenu-applet
|
||||
else
|
||||
sudo wget https://github.com/psifidotos/applet-window-appmenu/archive/master.zip -O /tmp/appmenu-applet.zip
|
||||
sudo unzip -oq /tmp/appmenu-applet.zip -d /usr/src/appmenu-applet
|
||||
sudo mv /usr/src/appmenu-applet/applet-window-appmenu-master/* /usr/src/appmenu-applet/
|
||||
sudo mv /usr/src/appmenu-applet/applet-window-appmenu-master/.* /usr/src/appmenu-applet/
|
||||
sudo rm -rf /usr/src/appmenu-applet/applet-window-appmenu-master
|
||||
sudo rm -f /usr/src/appmenu-applet.zip
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: KDE Window AppMenu Applet is not supported on macOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
sudo chown -R $USER: /usr/src/appmenu-applet
|
||||
cd /usr/src/appmenu-applet/
|
||||
sh ./install.sh
|
||||
echo
|
||||
echo 'Success! Now you can add "Window AppMenu Applet" on desktop or panel'
|
||||
echo
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing KDE Window AppMenu Applet"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
# https://github.com/psifidotos/applet-window-appmenu/blob/master/INSTALLATION.md
|
||||
|
||||
sudo apt install -y --autoremove \
|
||||
make \
|
||||
cmake \
|
||||
extra-cmake-modules \
|
||||
qtdeclarative5-dev \
|
||||
libkf5plasma-dev \
|
||||
libqt5x11extras5-dev \
|
||||
g++ \
|
||||
libsm-dev \
|
||||
libkf5configwidgets-dev \
|
||||
libkdecorations2-dev \
|
||||
libxcb-randr0-dev \
|
||||
libkf5wayland-dev \
|
||||
plasma-workspace-dev
|
||||
|
||||
if installed git; then
|
||||
sudo rm -rf /usr/src/appmenu-applet
|
||||
sudo git clone https://github.com/psifidotos/applet-window-appmenu.git --depth=1 /usr/src/appmenu-applet
|
||||
else
|
||||
sudo wget https://github.com/psifidotos/applet-window-appmenu/archive/master.zip -O /tmp/appmenu-applet.zip
|
||||
sudo unzip -oq /tmp/appmenu-applet.zip -d /usr/src/appmenu-applet
|
||||
sudo mv /usr/src/appmenu-applet/applet-window-appmenu-master/* /usr/src/appmenu-applet/
|
||||
sudo mv /usr/src/appmenu-applet/applet-window-appmenu-master/.* /usr/src/appmenu-applet/
|
||||
sudo rm -rf /usr/src/appmenu-applet/applet-window-appmenu-master
|
||||
sudo rm -f /usr/src/appmenu-applet.zip
|
||||
fi
|
||||
sudo chown -R "$USER": /usr/src/appmenu-applet
|
||||
cd /usr/src/appmenu-applet/
|
||||
sh ./install.sh
|
||||
|
||||
echo
|
||||
echo "Finish! Now you can add 'Window AppMenu Applet' on desktop or panel"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+24
-4
@@ -1,9 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install KDE Backports
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
title
|
||||
set -eo pipefail
|
||||
|
||||
sudo add-apt-repository -y ppa:kubuntu-ppa/backports && \
|
||||
sudo apt update && \
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: KDE Backports are not supported on macOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing KDE Backports"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo add-apt-repository -y ppa:kubuntu-ppa/backports
|
||||
sudo apt update
|
||||
sudo apt full-upgrade
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+40
-31
@@ -1,24 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install file templates (KDE)
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing file templates (KDE)..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
TPL_DIR="$HOME/.local/share/templates"
|
||||
TPL_SRC="$TPL_DIR/.source"
|
||||
[ ! -d "$TPL_SRC" ] && mkdir -p "$TPL_SRC"
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "WARNING: KDE file templates are not applicable on macOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "- Markdown" ####################################################
|
||||
cat <<EOF > "$TPL_SRC/template.md"
|
||||
install() {
|
||||
echo "==============================================="
|
||||
echo "Installing file templates (KDE)..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
TPL_DIR="$HOME/.local/share/templates"
|
||||
TPL_SRC="$TPL_DIR/.source"
|
||||
[ ! -d "$TPL_SRC" ] && mkdir -p "$TPL_SRC"
|
||||
|
||||
echo "- Markdown" ####################################################
|
||||
cat <<EOF > "$TPL_SRC/template.md"
|
||||
# Title
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
cat << EOF > "$TPL_DIR/md.desktop"
|
||||
cat << EOF > "$TPL_DIR/md.desktop"
|
||||
[Desktop Entry]
|
||||
Name=Документ Markdown
|
||||
Icon=text-markdown
|
||||
@@ -26,8 +33,8 @@ Type=Link
|
||||
URL=.source/template.md
|
||||
EOF
|
||||
|
||||
echo "- PHP" ####################################################
|
||||
cat <<EOF > "$TPL_SRC/template.php"
|
||||
echo "- PHP" ####################################################
|
||||
cat <<EOF > "$TPL_SRC/template.php"
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
ini_set('error_reporting', E_ALL);
|
||||
@@ -38,7 +45,7 @@ ini_set('log_errors', 1);
|
||||
|
||||
EOF
|
||||
|
||||
cat << EOF > "$TPL_DIR/php.desktop"
|
||||
cat << EOF > "$TPL_DIR/php.desktop"
|
||||
[Desktop Entry]
|
||||
Name=PHP-скрипт
|
||||
Icon=application-x-php
|
||||
@@ -46,8 +53,8 @@ Type=Link
|
||||
URL=.source/template.php
|
||||
EOF
|
||||
|
||||
echo "- Shell" ####################################################
|
||||
cat <<EOF > "$TPL_SRC/template.sh"
|
||||
echo "- Shell" ####################################################
|
||||
cat <<EOF > "$TPL_SRC/template.sh"
|
||||
#!/usr/bin/env bash
|
||||
EOF
|
||||
|
||||
@@ -59,8 +66,8 @@ Type=Link
|
||||
URL=.source/template.sh
|
||||
EOF
|
||||
|
||||
echo "- Go" ####################################################
|
||||
cat <<EOF > "$TPL_SRC/template.go"
|
||||
echo "- Go" ####################################################
|
||||
cat <<EOF > "$TPL_SRC/template.go"
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
@@ -70,14 +77,14 @@ func main() {
|
||||
}
|
||||
EOF
|
||||
|
||||
cat << EOF > "$TPL_DIR/go.desktop"
|
||||
cat << EOF > "$TPL_DIR/go.desktop"
|
||||
[Desktop Entry]
|
||||
Name=Golang файл
|
||||
Type=Link
|
||||
URL=.source/template.go
|
||||
EOF
|
||||
|
||||
echo "- Dockerfile" ####################################################
|
||||
echo "- Dockerfile" ####################################################
|
||||
cat <<EOF > "$TPL_SRC/Dockerfile"
|
||||
# https://habr.com/ru/company/ruvds/blog/439980/
|
||||
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
|
||||
@@ -86,33 +93,35 @@ FROM ubuntu:latest
|
||||
|
||||
EOF
|
||||
|
||||
cat << EOF > "$TPL_DIR/dockerfile.desktop"
|
||||
cat << EOF > "$TPL_DIR/dockerfile.desktop"
|
||||
[Desktop Entry]
|
||||
Name=Dockerfile
|
||||
Type=Link
|
||||
URL=.source/Dockerfile.go
|
||||
EOF
|
||||
|
||||
echo "- docker-compose" ####################################################
|
||||
cat <<EOF > "$TPL_SRC/docker-compose.yml"
|
||||
echo "- docker-compose" ####################################################
|
||||
cat <<EOF > "$TPL_SRC/docker-compose.yml"
|
||||
# https://docs.docker.com/compose/gettingstarted/
|
||||
# https://docs.docker.com/compose/compose-file/compose-file-v3/
|
||||
version: "3.9"
|
||||
services:
|
||||
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
cat << EOF > "$TPL_DIR/docker-compose.desktop"
|
||||
cat << EOF > "$TPL_DIR/docker-compose.desktop"
|
||||
[Desktop Entry]
|
||||
Name=docker-compose
|
||||
Type=Link
|
||||
URL=.source/docker-compose.yml
|
||||
EOF
|
||||
|
||||
echo
|
||||
echo "Finish! You can find them here:"
|
||||
echo -e "\t$TPL_DIR"
|
||||
echo
|
||||
echo
|
||||
echo "Finish! You can find them here:"
|
||||
echo -e "\t$TPL_DIR"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
|
||||
+27
-13
@@ -1,19 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install KDE portal
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing KDE portal..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
sudo apt install -y \
|
||||
xdg-desktop-portal \
|
||||
xdg-desktop-portal-kde \
|
||||
xdg-desktop-portal-gtk && \
|
||||
echo "GTK_USE_PORTAL=1" | sudo tee -a /etc/environment && \
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: KDE portal is not supported on macOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing KDE portal"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo apt install -y \
|
||||
xdg-desktop-portal \
|
||||
xdg-desktop-portal-kde \
|
||||
xdg-desktop-portal-gtk
|
||||
|
||||
echo "GTK_USE_PORTAL=1" | sudo tee -a /etc/environment
|
||||
echo "XDG_CURRENT_DESKTOP=KDE" | sudo tee -a /etc/environment
|
||||
|
||||
echo
|
||||
echo "Finish! Now you need to relogin"
|
||||
echo
|
||||
echo
|
||||
echo "Finish! Now you need to relogin"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+19
-4
@@ -5,6 +5,13 @@
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: keyd is not supported on macOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
mkdir -p "$HOME/install"
|
||||
|
||||
install() {
|
||||
@@ -13,14 +20,18 @@ install() {
|
||||
echo "Installing keyd (latest)"
|
||||
echo "==============================================="
|
||||
echo
|
||||
hash git || { echo "ERROR: git not installed" ; exit 1; }
|
||||
|
||||
installed git || { echo "ERROR: git not installed" ; exit 1; }
|
||||
cd "$HOME/install"
|
||||
git clone --depth=1 --single-branch https://github.com/rvaiya/keyd.git "$HOME/install/keyd"
|
||||
cd "$HOME/install/keyd"
|
||||
make && sudo make install
|
||||
make
|
||||
sudo make install
|
||||
sudo systemctl enable --now keyd
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
upgrade() {
|
||||
@@ -29,14 +40,18 @@ upgrade() {
|
||||
echo "Upgrading keyd"
|
||||
echo "==============================================="
|
||||
echo
|
||||
hash git || { echo "ERROR: git not installed" ; exit 1; }
|
||||
|
||||
installed git || { echo "ERROR: git not installed" ; exit 1; }
|
||||
[ -d "$HOME/install/keyd" ] || { echo "ERROR: repo not found: $HOME/install/keyd" ; exit 1; }
|
||||
cd "$HOME/install/keyd"
|
||||
make && sudo make install
|
||||
make
|
||||
sudo make install
|
||||
sudo systemctl enable --now keyd
|
||||
sudo usermod -aG keyd "$(whoami)"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
restart() {
|
||||
|
||||
+23
-6
@@ -1,11 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install libreoffice
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing libreoffice..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
sudo apt update && \
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: This script is for Debian/Ubuntu only. Install LibreOffice manually on macOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing libreoffice"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y --autoremove libreoffice
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+91
-33
@@ -1,40 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install lite-xl v2.1.7
|
||||
|
||||
# https://github.com/lite-xl/lite-xl/releases
|
||||
# https://lite-xl.com/setup/getting-started/
|
||||
set -eo pipefail
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing lite-xl v2.1.7..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: lite-xl portable install is not supported on macOS. Use brew install --cask lite-xl or build from source." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tar_url="https://github.com/lite-xl/lite-xl/releases/download/v2.1.7/lite-xl-v2.1.7-addons-linux-x86_64-portable.tar.gz"
|
||||
lpm_url="https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/latest/lpm.x86_64-linux"
|
||||
tar_filepath="$HOME/install/lite-xl-v2.1.7.tar.gz"
|
||||
untar_dir="$HOME/install"
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
rm -rf \
|
||||
"$HOME/.local/bin/lpm" \
|
||||
"$HOME/install/lite-xl" \
|
||||
"$HOME/.local/bin/lite-xl" \
|
||||
"$HOME/.local/share/lite-xl"
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing lite-xl v2.1.7"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
mkdir -vp \
|
||||
"$untar_dir" \
|
||||
"$HOME/.local/bin" \
|
||||
"$HOME/.local/share/lite-xl"
|
||||
# https://github.com/lite-xl/lite-xl/releases
|
||||
# https://lite-xl.com/setup/getting-started/
|
||||
|
||||
wget "$tar_url" -O "$tar_filepath" && \
|
||||
wget "$lpm_url" -O "$HOME/.local/bin/lpm" && \
|
||||
chmod +x "$HOME/.local/bin/lpm" && \
|
||||
tar -xzf "$tar_filepath" -C "$untar_dir" && \
|
||||
cp -vf "$untar_dir/lite-xl/lite-xl" "$HOME/.local/bin/" && \
|
||||
cp -vfr "$untar_dir"/lite-xl/data/* "$HOME/.local/share/lite-xl/"
|
||||
tar_url="https://github.com/lite-xl/lite-xl/releases/download/v2.1.7/lite-xl-v2.1.7-addons-linux-x86_64-portable.tar.gz"
|
||||
lpm_url="https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/latest/lpm.x86_64-linux"
|
||||
tar_filepath="$HOME/install/lite-xl-v2.1.7.tar.gz"
|
||||
untar_dir="$HOME/install"
|
||||
|
||||
# echo -e "\nexport LITE_SCALE=1 # https://github.com/lite-xl/lite-xl/issues/1173\n" >> $HOME/.profile
|
||||
cat << EOF > "$HOME/.local/share/applications/org.lite_xl.lite_xl.desktop"
|
||||
rm -rf \
|
||||
"$HOME/.local/bin/lpm" \
|
||||
"$HOME/install/lite-xl" \
|
||||
"$HOME/.local/bin/lite-xl" \
|
||||
"$HOME/.local/share/lite-xl"
|
||||
|
||||
mkdir -p \
|
||||
"$untar_dir" \
|
||||
"$HOME/.local/bin" \
|
||||
"$HOME/.local/share/lite-xl"
|
||||
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$tar_url" -O "$tar_filepath"
|
||||
wget -q --show-progress "$lpm_url" -O "$HOME/.local/bin/lpm"
|
||||
else
|
||||
curl -fsSL "$tar_url" -o "$tar_filepath"
|
||||
curl -fsSL "$lpm_url" -o "$HOME/.local/bin/lpm"
|
||||
fi
|
||||
|
||||
chmod +x "$HOME/.local/bin/lpm"
|
||||
tar -xzf "$tar_filepath" -C "$untar_dir"
|
||||
cp -f "$untar_dir/lite-xl/lite-xl" "$HOME/.local/bin/"
|
||||
cp -fr "$untar_dir"/lite-xl/data/* "$HOME/.local/share/lite-xl/"
|
||||
|
||||
cat << EOF > "$HOME/.local/share/applications/org.lite_xl.lite_xl.desktop"
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Lite XL
|
||||
@@ -47,9 +62,52 @@ Categories=Development;IDE;
|
||||
MimeType=text/plain;
|
||||
EOF
|
||||
|
||||
sudo update-desktop-database && \
|
||||
xdg-desktop-menu forceupdate
|
||||
if command -v update-desktop-database >/dev/null 2>&1; then
|
||||
sudo update-desktop-database
|
||||
fi
|
||||
if command -v xdg-desktop-menu >/dev/null 2>&1; then
|
||||
xdg-desktop-menu forceupdate
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
remove() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew uninstall --cask lite-xl 2>/dev/null || true
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Removing lite-xl"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
rm -rf \
|
||||
"$HOME/.local/bin/lite-xl" \
|
||||
"$HOME/.local/bin/lpm" \
|
||||
"$HOME/.local/share/applications/org.lite_xl.lite_xl.desktop" \
|
||||
"$HOME/.local/share/lite-xl" \
|
||||
"$HOME/.config/lite-xl"
|
||||
|
||||
if command -v update-desktop-database >/dev/null 2>&1; then
|
||||
sudo update-desktop-database
|
||||
fi
|
||||
if command -v xdg-desktop-menu >/dev/null 2>&1; then
|
||||
xdg-desktop-menu forceupdate
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
r|remove|d|delete|p|purge) remove ;;
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+33
-10
@@ -1,16 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install mariadb (latest) and php-mysql + phpMyAdmin (if php is installed)
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing mariadb (latest)..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
installed() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install mariadb
|
||||
brew services start mariadb
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing mariadb"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo apt install -y --autoremove mariadb-server mariadb-client
|
||||
sudo mysql_secure_installation
|
||||
if installed php; then
|
||||
sudo apt install -y --autoremove php-mysql phpmyadmin
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
sudo apt install -y --autoremove mariadb-server mariadb-client
|
||||
sudo mysql_secure_installation
|
||||
installed "php" && sudo apt install -y --autoremove php-mysql phpmyadmin
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+9
-3
@@ -5,8 +5,10 @@ set -eo pipefail
|
||||
|
||||
#TODO nokia-sans
|
||||
|
||||
isMac() { uname -s | grep -q "Darwin"; }
|
||||
isLinux() { uname -s | grep -q "Linux"; }
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
isMac() { [ "$(uname -s)" = "Darwin" ]; }
|
||||
isLinux() { [ "$(uname -s)" = "Linux" ]; }
|
||||
|
||||
url="https://github.com/ryanoasis/nerd-fonts/releases/latest/download"
|
||||
downloadPath="$HOME/install/nerd-fonts"
|
||||
@@ -41,7 +43,11 @@ install() {
|
||||
[[ -d "$downloadPath" ]] || mkdir -p "$downloadPath"
|
||||
for fontname in "${fontsNames[@]}"; do
|
||||
fontDir="$installPath/Nerd-$fontname"
|
||||
wget "$url/$fontname.tar.xz" -O "$downloadPath/$fontname.tar.xz"
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$url/$fontname.tar.xz" -O "$downloadPath/$fontname.tar.xz"
|
||||
else
|
||||
curl -fsSL "$url/$fontname.tar.xz" -o "$downloadPath/$fontname.tar.xz"
|
||||
fi
|
||||
[[ -d "$installPath/$fontname" ]] || mkdir -p "$fontDir"
|
||||
tar -xJf "$downloadPath/$fontname.tar.xz" -C "$fontDir"
|
||||
done
|
||||
|
||||
+38
-21
@@ -1,59 +1,76 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install nodejs + npm via nvm
|
||||
|
||||
isMac() { uname -s | grep -q "Darwin"; }
|
||||
isLinux() { uname -s | grep -q "Linux"; }
|
||||
set -eo pipefail
|
||||
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
isMac() { [ "$(uname -s)" = "Darwin" ]; }
|
||||
isLinux() { [ "$(uname -s)" = "Linux" ]; }
|
||||
|
||||
NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing nodejs + nvm..."
|
||||
echo "Installing nodejs + nvm"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
if isMac; then
|
||||
brew install nvm
|
||||
if installed brew; then
|
||||
brew install nvm
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
elif isLinux; then
|
||||
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
|
||||
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
|
||||
else
|
||||
echo "This OS is not supported yet!"
|
||||
exit
|
||||
echo "ERROR: This OS is not supported yet!" >&2
|
||||
exit 1
|
||||
fi
|
||||
nvm install-latest-npm
|
||||
nvm install node
|
||||
nvm use node
|
||||
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
|
||||
[ -s "$NVM_DIR/bash_completion" ] && source "$NVM_DIR/bash_completion"
|
||||
|
||||
cat << EOF >> "$HOME/.profile"
|
||||
nvm install-latest-npm
|
||||
nvm install node
|
||||
nvm use node
|
||||
|
||||
if ! grep -q 'NVM_DIR' "$HOME/.profile" 2>/dev/null; then
|
||||
cat << EOF >> "$HOME/.profile"
|
||||
|
||||
# nvm (not nvim!)
|
||||
export NVM_DIR="\$HOME/.nvm" # nvim_autoinstalled
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && source "\$NVM_DIR/nvm.sh" # nvim_autoinstalled
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && source "\$NVM_DIR/bash_completion" # nvim_autoinstalled
|
||||
export NVM_DIR="\$HOME/.nvm"
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && source "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && source "\$NVM_DIR/bash_completion"
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
|
||||
nvm current
|
||||
nvm ls
|
||||
echo
|
||||
}
|
||||
|
||||
remove() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Removing nodejs + nvm..."
|
||||
echo "Removing nodejs + nvm"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
nvm unload
|
||||
if command -v nvm >/dev/null 2>&1; then
|
||||
nvm unload 2>/dev/null || true
|
||||
fi
|
||||
rm -rf "$NVM_DIR"
|
||||
# sed -i "/NVM_DIR[=\].+/d" "$HOME/.profile"
|
||||
brew uninstall nvm
|
||||
sed -i '/NVM_DIR/d' "$HOME/.profile" 2>/dev/null || true
|
||||
if isMac && installed brew; then
|
||||
brew uninstall nvm 2>/dev/null || true
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
|
||||
+32
-18
@@ -1,25 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install ntfy (latest) + ppa
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing ntfy (latest) + ppa..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
# https://ntfy.sh/docs/install/#general-steps
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
installed() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: ntfy apt/ppa install is not supported on macOS. Use 'brew install ntfy' instead." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing ntfy"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
# https://ntfy.sh/docs/install/#general-steps
|
||||
|
||||
installed curl || sudo apt install -y curl
|
||||
|
||||
curl -sSL https://archive.heckel.io/apt/pubkey.txt | sudo apt-key add -
|
||||
sudo apt install -y apt-transport-https
|
||||
sudo sh -c "echo 'deb [arch=amd64] https://archive.heckel.io/apt debian main' > /etc/apt/sources.list.d/archive.heckel.io.list"
|
||||
sudo apt update
|
||||
sudo apt install -y ntfy
|
||||
sudo systemctl enable ntfy
|
||||
sudo systemctl start ntfy
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
! installed curl && sudo apt install -y curl
|
||||
|
||||
curl -sSL https://archive.heckel.io/apt/pubkey.txt | sudo apt-key add - && \
|
||||
sudo apt install apt-transport-https && \
|
||||
sudo sh -c "echo 'deb [arch=amd64] https://archive.heckel.io/apt debian main' \
|
||||
> /etc/apt/sources.list.d/archive.heckel.io.list" && \
|
||||
sudo apt update && \
|
||||
sudo apt install ntfy -y && \
|
||||
sudo systemctl enable ntfy && \
|
||||
sudo systemctl start ntfy
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+40
-14
@@ -1,30 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install nvim + lazyvim
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
# https://www.lazyvim.org/installation
|
||||
# https://www.devas.life/effective-neovim-setup-for-web-development-towards-2024/
|
||||
|
||||
# TODO https://github.com/rockerBOO/awesome-neovim
|
||||
# TODO https://docs.astronvim.com
|
||||
|
||||
url="https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz"
|
||||
isMac() { [ "$(uname -s)" = "Darwin" ]; }
|
||||
isLinux() { [ "$(uname -s)" = "Linux" ]; }
|
||||
|
||||
if isLinux; then
|
||||
url="https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz"
|
||||
nvimDirName="nvim-linux-x86_64"
|
||||
elif isMac; then
|
||||
url="https://github.com/neovim/neovim/releases/latest/download/nvim-macos-x86_64.tar.gz"
|
||||
nvimDirName="nvim-macos-x86_64"
|
||||
fi
|
||||
|
||||
downloadPath="$HOME/install"
|
||||
downloadTarGz="$downloadPath/nvim.tar.gz"
|
||||
installPath="/opt/nvim"
|
||||
cfgPath="$HOME/.config/nvim"
|
||||
nvimDataPaths=(
|
||||
"$cfgPath"
|
||||
"$HOME"/.local/share/nvim
|
||||
"$HOME"/.local/state/nvim
|
||||
"$HOME"/.cache/nvim
|
||||
"$HOME/.local/share/nvim"
|
||||
"$HOME/.local/state/nvim"
|
||||
"$HOME/.cache/nvim"
|
||||
)
|
||||
|
||||
backup() {
|
||||
echo "Backup configuration files..."
|
||||
t=$(date +'%s')
|
||||
for path in "${nvimDataPaths[@]}"; do
|
||||
[[ -d "$path" ]] && cp -v "$path" "$path-$t.bak"
|
||||
[[ -d "$path" ]] && cp -rv "$path" "$path-$t.bak"
|
||||
done
|
||||
echo "Done"
|
||||
}
|
||||
@@ -37,17 +50,28 @@ install() {
|
||||
echo
|
||||
|
||||
backup
|
||||
wget "$url" -O "$downloadTarGz"
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$url" -O "$downloadTarGz"
|
||||
else
|
||||
curl -fsSL "$url" -o "$downloadTarGz"
|
||||
fi
|
||||
tar -xzf "$downloadTarGz" -C "$downloadPath"
|
||||
|
||||
sudo rm -rf "$installPath"
|
||||
sudo mv "$downloadPath/nvim-linux-x86_64" "$installPath"
|
||||
sudo mv "$downloadPath/$nvimDirName" "$installPath"
|
||||
|
||||
if [ -d "$cfgPath" ]; then
|
||||
rm -rf "$cfgPath"
|
||||
fi
|
||||
git clone --depth=1 --single-branch https://github.com/LazyVim/starter "$cfgPath"
|
||||
rm -rf "$cfgPath/.git"
|
||||
|
||||
sudo update-desktop-database
|
||||
xdg-desktop-menu forceupdate
|
||||
if command -v update-desktop-database >/dev/null 2>&1; then
|
||||
sudo update-desktop-database
|
||||
fi
|
||||
if command -v xdg-desktop-menu >/dev/null 2>&1; then
|
||||
xdg-desktop-menu forceupdate
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
@@ -58,12 +82,16 @@ install() {
|
||||
remove() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Removing nerd-fonts"
|
||||
echo "Removing neovim"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
find "$downloadPath" -type d -name "Nerd-*" -exec rm -rf {} +
|
||||
fc-cache -vf "$downloadPath"
|
||||
sudo rm -rf "$installPath"
|
||||
for path in "${nvimDataPaths[@]}"; do
|
||||
rm -rf "$path"
|
||||
done
|
||||
find "$HOME/.config" -type f -path "*/nvim*" -exec rm -rfv {} + 2>/dev/null || true
|
||||
find "$HOME/.local" -type f -path "*/nvim*" -exec rm -rfv {} + 2>/dev/null || true
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
@@ -76,5 +104,3 @@ case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
|
||||
# export PATH="$PATH:/opt/nvim-linux-x86_64/bin"
|
||||
|
||||
+30
-6
@@ -1,10 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install obs-studio (latest snap)
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing obs-studio (latest snap)..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
sudo snap install obs-studio
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install --cask obs
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing obs-studio"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo snap install obs-studio
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+25
-28
@@ -3,58 +3,55 @@
|
||||
|
||||
# https://github.com/ollama/ollama
|
||||
|
||||
set -o pipefail
|
||||
|
||||
mkdir -p "$HOME/install"
|
||||
set -eo pipefail
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing ollama (latest)"
|
||||
echo "Installing ollama"
|
||||
echo "==============================================="
|
||||
echo
|
||||
curl -fsSL https://ollama.com/install.sh | sh
|
||||
echo
|
||||
echo "Finish!"
|
||||
}
|
||||
|
||||
upgrade() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Upgrading ollama"
|
||||
echo "==============================================="
|
||||
echo
|
||||
curl -fsSL https://ollama.com/install.sh | sh
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
remove() {
|
||||
# https://docs.ollama.com/linux#uninstall
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Removing ollama"
|
||||
echo "==============================================="
|
||||
echo
|
||||
sudo systemctl stop ollama
|
||||
sudo systemctl disable ollama
|
||||
sudo rm /etc/systemd/system/ollama.service
|
||||
sudo rm -r "$(which ollama | tr 'bin' 'lib')"
|
||||
sudo rm "$(which ollama)"
|
||||
sudo userdel ollama
|
||||
sudo groupdel ollama
|
||||
sudo rm -rf \
|
||||
/usr/bin/ollama \
|
||||
/usr/share/ollama \
|
||||
/usr/local/lib/ollama \
|
||||
/usr/local/bin/ollama
|
||||
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
sudo rm -rf /usr/local/bin/ollama /usr/local/lib/ollama ~/.ollama
|
||||
else
|
||||
# https://docs.ollama.com/linux#uninstall
|
||||
sudo systemctl stop ollama 2>/dev/null || true
|
||||
sudo systemctl disable ollama 2>/dev/null || true
|
||||
sudo rm -f /etc/systemd/system/ollama.service 2>/dev/null || true
|
||||
if command -v ollama >/dev/null 2>&1; then
|
||||
sudo rm -rf "$(dirname "$(dirname "$(which ollama)")")/lib/ollama" 2>/dev/null || true
|
||||
sudo rm -f "$(which ollama)"
|
||||
fi
|
||||
sudo userdel ollama 2>/dev/null || true
|
||||
sudo groupdel ollama 2>/dev/null || true
|
||||
sudo rm -rf \
|
||||
/usr/bin/ollama \
|
||||
/usr/share/ollama \
|
||||
/usr/local/lib/ollama \
|
||||
/usr/local/bin/ollama
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
u|upgrade) upgrade ;;
|
||||
r|remove|d|delete|p|purge) remove ;;
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+62
-12
@@ -1,19 +1,69 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install omz (latest)
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing omz (latest)..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
installed() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing omz"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
if ! installed zsh || ! installed git || ! installed curl; then
|
||||
echo "ERROR: you need git, zsh and curl to be installed!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
if ! installed zsh || ! installed git || ! installed curl; then
|
||||
echo "ERROR: you need git, zsh and curl to be installed!"
|
||||
exit 1
|
||||
fi
|
||||
upgrade() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Upgrading omz"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
if [ -d "$ZSH" ]; then
|
||||
bash "$ZSH/tools/upgrade.sh"
|
||||
else
|
||||
echo "ERROR: OMZ not found." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
remove() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Removing omz"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
if [ -d "$ZSH" ]; then
|
||||
bash "$ZSH/tools/uninstall.sh"
|
||||
else
|
||||
echo "WARNING: OMZ not found, cleaning up." >&2
|
||||
fi
|
||||
rm -rf "$HOME/.oh-my-zsh"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
u|upgrade|update) upgrade ;;
|
||||
r|remove|d|delete|p|purge) remove ;;
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+60
-52
@@ -1,60 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install omz fancy (powerline10k + MesloLGS font)
|
||||
|
||||
# https://gist.github.com/anthonyaxenov/b8460935d06b9f0da72def03d0f26515
|
||||
set -eo pipefail
|
||||
|
||||
# Based on:
|
||||
# https://github.com/Powerlevel9k/powerlevel9k/wiki/Install-Instructions
|
||||
# https://github.com/ohmyzsh/ohmyzsh
|
||||
# https://powerline.readthedocs.io/en/latest/installation/linux.html#fonts-installation
|
||||
# https://gist.github.com/dogrocker/1efb8fd9427779c827058f873b94df95
|
||||
# https://linuxhint.com/install_zsh_shell_ubuntu_1804/
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing omz fancy: powerline10k + MesloLGS font..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
isMac() { [ "$(uname -s)" = "Darwin" ]; }
|
||||
|
||||
installed() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing omz fancy: powerline10k + MesloLGS font"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
if ! installed zsh || ! installed git; then
|
||||
echo "ERROR: you need git and zsh to be installed!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "$HOME/.oh-my-zsh" ]]; then
|
||||
echo "ERROR: you need omz to be installed!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "1/3 Installing MesloLGS fonts..."
|
||||
mkdir -p "$HOME/.local/share/fonts/"
|
||||
FONTS_URL="https://github.com/romkatv/powerlevel10k-media/raw/master"
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$FONTS_URL/MesloLGS%20NF%20Regular.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Regular.ttf"
|
||||
wget -q --show-progress "$FONTS_URL/MesloLGS%20NF%20Bold.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Bold.ttf"
|
||||
wget -q --show-progress "$FONTS_URL/MesloLGS%20NF%20Italic.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Italic.ttf"
|
||||
wget -q --show-progress "$FONTS_URL/MesloLGS%20NF%20Bold%20Italic.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Bold Italic.ttf"
|
||||
else
|
||||
curl -fsSL "$FONTS_URL/MesloLGS%20NF%20Regular.ttf" -o "$HOME/.local/share/fonts/MesloLGS NF Regular.ttf"
|
||||
curl -fsSL "$FONTS_URL/MesloLGS%20NF%20Bold.ttf" -o "$HOME/.local/share/fonts/MesloLGS NF Bold.ttf"
|
||||
curl -fsSL "$FONTS_URL/MesloLGS%20NF%20Italic.ttf" -o "$HOME/.local/share/fonts/MesloLGS NF Italic.ttf"
|
||||
curl -fsSL "$FONTS_URL/MesloLGS%20NF%20Bold%20Italic.ttf" -o "$HOME/.local/share/fonts/MesloLGS NF Bold Italic.ttf"
|
||||
fi
|
||||
if command -v fc-cache >/dev/null 2>&1; then
|
||||
fc-cache -vf "$HOME/.local/share/fonts/"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "2/3 Installing powerlevel10k theme..."
|
||||
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
|
||||
sed -i.bak 's#^ZSH_THEME=.*$#ZSH_THEME="powerlevel10k/powerlevel10k"#g' "$HOME/.zshrc"
|
||||
|
||||
echo
|
||||
echo "3/3 Installing plugins..."
|
||||
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions"
|
||||
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting"
|
||||
sed -i.bak 's/^plugins=/plugins=(git laravel docker docker-compose composer zsh-autosuggestions zsh-syntax-highlighting)/g' "$HOME/.zshrc"
|
||||
p10k configure
|
||||
|
||||
echo
|
||||
echo "Finish! You need to:"
|
||||
echo "- review your plugins in $HOME/.zshrc"
|
||||
echo "- restart terminal windows to reload fonts and set 'MesloLGS NF Regular' as default font"
|
||||
echo "- log out of your session and login again"
|
||||
echo
|
||||
}
|
||||
|
||||
if ! installed zsh || ! installed git || ! installed wget; then
|
||||
echo "ERROR: you need git, zsh and wget to be installed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "$HOME/.oh-my-zsh" ]]; then
|
||||
echo "ERROR: you need omz to be installed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "1/3 Installing MesloLGS fonts..."
|
||||
mkdir -p "$HOME/.local/share/fonts/"
|
||||
FONTS_URL="https://github.com/romkatv/powerlevel10k-media/raw/master"
|
||||
wget "$FONTS_URL/MesloLGS%20NF%20Regular.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Regular.ttf"
|
||||
wget "$FONTS_URL/MesloLGS%20NF%20Bold.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Bold.ttf"
|
||||
wget "$FONTS_URL/MesloLGS%20NF%20Italic.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Italic.ttf"
|
||||
wget "$FONTS_URL/MesloLGS%20NF%20Bold%20Italic.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Bold Italic.ttf"
|
||||
fc-cache -vf "$HOME/.local/share/fonts/"
|
||||
|
||||
echo
|
||||
echo "2/3 Installing powerlevel10k theme..."
|
||||
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
|
||||
sed -i 's#^ZSH_THEME=.*$#ZSH_THEME="powerlevel10k/powerlevel10k"#g' "$HOME/.zshrc"
|
||||
|
||||
echo
|
||||
echo "3/3 Installing plugins..."
|
||||
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
|
||||
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
|
||||
sed -i 's/^plugins=/plugins=(git laravel docker docker-compose composer zsh-autosuggestions zsh-syntax-highlighting)/g' $HOME/.zshrc
|
||||
p10k configure
|
||||
|
||||
echo
|
||||
echo "Finish! You need to:"
|
||||
echo "- review your plugins in $HOME/.zshrc"
|
||||
echo "- restart terminal windows to reload fonts and set 'MesloLGS NF Regular' as default font"
|
||||
echo "- log out of your session and login again"
|
||||
echo
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+68
-19
@@ -1,31 +1,80 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install openvpn v2.6.3 (src)
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
# https://openvpn.net/community-downloads/
|
||||
# https://openvpn.net/community-resources/installing-openvpn/
|
||||
set -eo pipefail
|
||||
|
||||
[ "$1" ] && OVPNVER="$1" || OVPNVER='2.6.3'
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
title "Installing openvpn v${OVPNVER} (src)..."
|
||||
require() {
|
||||
local missing=()
|
||||
for pkg in "$@"; do
|
||||
installed "$pkg" || missing+=("$pkg")
|
||||
done
|
||||
if [ ${#missing[@]} -gt 0 ]; then
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install "${missing[@]}"
|
||||
else
|
||||
echo "ERROR: Missing: ${missing[*]}. Install manually or use brew." >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
sudo apt install -y "${missing[@]}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
require libssl-dev \
|
||||
liblzo2-dev \
|
||||
libpam0g-dev
|
||||
download() {
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$1" -O "$2"
|
||||
else
|
||||
curl -fsSL "$1" -o "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
mkdir -p "$HOME/install/"
|
||||
download "https://swupdate.openvpn.org/community/releases/openvpn-${OVPNVER}.tar.gz" "$HOME/install/openvpn-${OVPNVER}.tar.gz" && \
|
||||
unpack_targz "$HOME/install/openvpn-${OVPNVER}.tar.gz" "$HOME/install/" && \
|
||||
cd "$HOME/install/openvpn-${OVPNVER}" && \
|
||||
sudo ./configure && \
|
||||
sudo make && \
|
||||
sudo make install &&
|
||||
apt_install network-manager-openvpn \
|
||||
network-manager-openvpn-gnome
|
||||
unpack_targz() {
|
||||
tar -xzvf "$1" -C "$2"
|
||||
}
|
||||
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install openvpn
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
[ $? = 0 ] && {
|
||||
echo
|
||||
success "openvpn installed!"
|
||||
echo "==============================================="
|
||||
echo "Installing openvpn"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
# https://openvpn.net/community-downloads/
|
||||
# https://openvpn.net/community-resources/installing-openvpn/
|
||||
|
||||
OVPNVER='2.6.3'
|
||||
|
||||
require libssl-dev liblzo2-dev libpam0g-dev
|
||||
|
||||
mkdir -p "$HOME/install/"
|
||||
download "https://swupdate.openvpn.org/community/releases/openvpn-${OVPNVER}.tar.gz" "$HOME/install/openvpn-${OVPNVER}.tar.gz"
|
||||
unpack_targz "$HOME/install/openvpn-${OVPNVER}.tar.gz" "$HOME/install/"
|
||||
cd "$HOME/install/openvpn-${OVPNVER}"
|
||||
sudo ./configure
|
||||
sudo make
|
||||
sudo make install
|
||||
sudo apt install -y network-manager-openvpn network-manager-openvpn-gnome
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
openvpn --version
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+39
-15
@@ -1,27 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install papirus-icon-theme (latest)
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
title
|
||||
set -eo pipefail
|
||||
|
||||
mkdir -p "$HOME/install/papirus-icon-theme" "$HOME/.local/share/icons/"
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
if installed git; then
|
||||
clone_quick https://github.com/PapirusDevelopmentTeam/papirus-icon-theme.git "$HOME/install/"
|
||||
else
|
||||
download https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/archive/refs/heads/master.zip -O "$HOME/install/papirus-icon-theme.zip" && \
|
||||
unzip -oq "$HOME/install/papirus-icon-theme.zip" -d "$HOME/install/papirus-icon-theme" && \
|
||||
rm -f "$HOME/install/papirus-icon-theme.zip"
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: Papirus icon theme is not supported on macOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
symlink "$HOME/install/papirus-icon-theme/Papirus" "$HOME/.local/share/icons/Papirus" && \
|
||||
symlink "$HOME/install/papirus-icon-theme/Papirus-Dark" "$HOME/.local/share/icons/Papirus-Dark" && \
|
||||
symlink "$HOME/install/papirus-icon-theme/Papirus-Light" "$HOME/.local/share/icons/Papirus-Light"
|
||||
download() {
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$1" -O "$2"
|
||||
else
|
||||
curl -fsSL "$1" -o "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
[ $? = 0 ] && {
|
||||
install() {
|
||||
echo
|
||||
success "Papirus icons installed!"
|
||||
info "You can find them in $HOME/.local/share/icons/"
|
||||
echo "==============================================="
|
||||
echo "Installing papirus-icon-theme"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
mkdir -p "$HOME/install/papirus-icon-theme" "$HOME/.local/share/icons/"
|
||||
|
||||
if installed git; then
|
||||
git clone --depth=1 --single-branch https://github.com/PapirusDevelopmentTeam/papirus-icon-theme.git "$HOME/install/papirus-icon-theme"
|
||||
else
|
||||
download https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/archive/refs/heads/master.zip "$HOME/install/papirus-icon-theme.zip"
|
||||
unzip -oq "$HOME/install/papirus-icon-theme.zip" -d "$HOME/install/papirus-icon-theme"
|
||||
rm -f "$HOME/install/papirus-icon-theme.zip"
|
||||
fi
|
||||
|
||||
ln -sf "$HOME/install/papirus-icon-theme/Papirus" "$HOME/.local/share/icons/Papirus"
|
||||
ln -sf "$HOME/install/papirus-icon-theme/Papirus-Dark" "$HOME/.local/share/icons/Papirus-Dark"
|
||||
ln -sf "$HOME/install/papirus-icon-theme/Papirus-Light" "$HOME/.local/share/icons/Papirus-Light"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo "You can find icons in $HOME/.local/share/icons/"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
|
||||
+56
-10
@@ -1,14 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install postgresql (latest) and php-pgsql (if php is installed)
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
title
|
||||
set -eo pipefail
|
||||
|
||||
require postgresql postgresql-contrib && \
|
||||
sudo service postgresql restart && \
|
||||
{
|
||||
echo
|
||||
success "openvpn installed!"
|
||||
postgres --version
|
||||
echo
|
||||
}
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
require() {
|
||||
local missing=()
|
||||
for pkg in "$@"; do
|
||||
installed "$pkg" || missing+=("$pkg")
|
||||
done
|
||||
if [ ${#missing[@]} -gt 0 ]; then
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install "${missing[@]}"
|
||||
else
|
||||
echo "ERROR: Missing: ${missing[*]}. Install manually or use brew." >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
sudo apt install -y "${missing[@]}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install postgresql
|
||||
brew services start postgresql
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing postgresql"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
require postgresql postgresql-contrib
|
||||
sudo service postgresql restart
|
||||
|
||||
if installed php; then
|
||||
sudo apt install -y --autoremove php-pgsql phpmyadmin
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
postgres --version
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+52
-36
@@ -1,42 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install php v8.4
|
||||
|
||||
[ "$1" ] && PHPVER="$1" || PHPVER="8.4"
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing php${PHPVER}..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
sudo apt install -y --autoremove \
|
||||
php${PHPVER}-fpm \
|
||||
php${PHPVER}-dev \
|
||||
php${PHPVER}-apcu \
|
||||
php${PHPVER}-bcmath \
|
||||
php${PHPVER}-cli \
|
||||
php${PHPVER}-common \
|
||||
php${PHPVER}-curl \
|
||||
php${PHPVER}-dev \
|
||||
php${PHPVER}-dom \
|
||||
php${PHPVER}-gd \
|
||||
php${PHPVER}-intl \
|
||||
php${PHPVER}-mbstring \
|
||||
php${PHPVER}-mysql \
|
||||
php${PHPVER}-opcache \
|
||||
php${PHPVER}-pgsql \
|
||||
php${PHPVER}-simplexml \
|
||||
php${PHPVER}-soap \
|
||||
php${PHPVER}-sqlite3 \
|
||||
php${PHPVER}-xdebug \
|
||||
php${PHPVER}-xml \
|
||||
php${PHPVER}-xmlrpc \
|
||||
php${PHPVER}-zip
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
# php${PHPVER}-ldap \
|
||||
# php${PHPVER}-dba \
|
||||
# php${PHPVER}-xsl \
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install php
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
php -v
|
||||
echo
|
||||
PHPVER="8.4"
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing php ${PHPVER}"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo apt install -y --autoremove \
|
||||
php${PHPVER}-fpm \
|
||||
php${PHPVER}-dev \
|
||||
php${PHPVER}-apcu \
|
||||
php${PHPVER}-bcmath \
|
||||
php${PHPVER}-cli \
|
||||
php${PHPVER}-common \
|
||||
php${PHPVER}-curl \
|
||||
php${PHPVER}-dom \
|
||||
php${PHPVER}-gd \
|
||||
php${PHPVER}-intl \
|
||||
php${PHPVER}-mbstring \
|
||||
php${PHPVER}-mysql \
|
||||
php${PHPVER}-opcache \
|
||||
php${PHPVER}-pgsql \
|
||||
php${PHPVER}-simplexml \
|
||||
php${PHPVER}-soap \
|
||||
php${PHPVER}-sqlite3 \
|
||||
php${PHPVER}-xdebug \
|
||||
php${PHPVER}-xml \
|
||||
php${PHPVER}-xmlrpc \
|
||||
php${PHPVER}-zip
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
php -v
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+37
-24
@@ -1,30 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install psalm
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing psalm..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
installed() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing psalm"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
if ! installed php; then
|
||||
echo "ERROR: You need php to be installed" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! installed composer; then
|
||||
echo "ERROR: You need composer to be installed" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
COMPOSER_GLOBAL_HOME="$(composer config -g home)"
|
||||
NEWPATH="export PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
|
||||
if ! grep -qoh "$NEWPATH" "$HOME/.profile" 2>/dev/null; then
|
||||
echo "$NEWPATH" >> "$HOME/.profile"
|
||||
fi
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
source "$HOME/.profile"
|
||||
|
||||
composer global require vimeo/psalm --dev
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
psalm --version
|
||||
echo
|
||||
}
|
||||
|
||||
! installed 'php' && echo 'ERROR: You need php to be installed' && exit 1
|
||||
! installed "composer" && echo "ERROR: You need composer to be installed" && exit 2
|
||||
|
||||
COMPOSER_GLOBAL_HOME="$(composer config -g home)"
|
||||
NEWPATH="export PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
|
||||
cat "$HOME/.profile" | grep -qoh "$NEWPATH" || {
|
||||
$NEWPATH
|
||||
echo "$NEWPATH" >> "$HOME/.profile"
|
||||
}
|
||||
source "$HOME/.profile"
|
||||
|
||||
composer global require vimeo/psalm --dev
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
psalm --version
|
||||
echo
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+49
-27
@@ -1,33 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install php-spx
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing php-spx..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
installed() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
! installed 'php' && echo 'ERROR: You need php to be installed' && exit 1
|
||||
! installed 'phpize' && echo 'ERROR: You need php-dev to be installed' && exit 2
|
||||
! installed 'make' && sudo apt install -y make
|
||||
! installed 'wget' && sudo apt install -y wget
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: php-spx is not supported on macOS (requires Linux PHP extension build)." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -d "$HOME/install/php-spx" ] || mkdir -p "$HOME/install/php-spx"
|
||||
wget https://github.com/NoiseByNorthwest/php-spx/archive/refs/heads/release/latest.zip -O /tmp/php-spx.zip \
|
||||
&& unzip -oq /tmp/php-spx.zip -d "$HOME/install/php-spx" \
|
||||
&& rm /tmp/php-spx.zip \
|
||||
&& cd "$HOME/install/php-spx/php-spx-release-latest" \
|
||||
&& phpize \
|
||||
&& ./configure \
|
||||
&& make \
|
||||
&& sudo make install
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing php-spx"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
PHPVER=`php -r 'echo ($v=explode(".",PHP_VERSION))[0].".".$v[1];'`
|
||||
cat << EOF | sudo tee -a "/etc/php/${PHPVER}/mods-available/spx.ini"
|
||||
if ! installed php; then
|
||||
echo "ERROR: You need php to be installed" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! installed phpize; then
|
||||
echo "ERROR: You need php-dev to be installed" >&2
|
||||
exit 2
|
||||
fi
|
||||
if ! installed make; then
|
||||
sudo apt install -y make
|
||||
fi
|
||||
|
||||
mkdir -p "$HOME/install/php-spx"
|
||||
if installed wget; then
|
||||
wget -q --show-progress https://github.com/NoiseByNorthwest/php-spx/archive/refs/heads/release/latest.zip -O /tmp/php-spx.zip
|
||||
else
|
||||
curl -fsSL https://github.com/NoiseByNorthwest/php-spx/archive/refs/heads/release/latest.zip -o /tmp/php-spx.zip
|
||||
fi
|
||||
unzip -oq /tmp/php-spx.zip -d "$HOME/install/php-spx"
|
||||
rm /tmp/php-spx.zip
|
||||
cd "$HOME/install/php-spx/php-spx-release-latest"
|
||||
phpize
|
||||
./configure
|
||||
make
|
||||
sudo make install
|
||||
|
||||
PHPVER=$(php -r 'echo ($v=explode(".",PHP_VERSION))[0].".".$v[1];')
|
||||
cat << EOF | sudo tee -a "/etc/php/${PHPVER}/mods-available/spx.ini"
|
||||
; https://github.com/NoiseByNorthwest/php-spx/tree/release/latest#configuration
|
||||
; https://habr.com/ru/post/505192/
|
||||
|
||||
@@ -39,8 +56,13 @@ spx.http_key = 'spx'
|
||||
|
||||
EOF
|
||||
|
||||
sudo ln -sf "/etc/php/${PHPVER}/mods-available/spx.ini" "/etc/php/${PHPVER}/cli/conf.d/99-spx.ini"
|
||||
sudo ln -sf "/etc/php/${PHPVER}/mods-available/spx.ini" "/etc/php/${PHPVER}/cli/conf.d/99-spx.ini"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+39
-26
@@ -1,32 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install phpcs + php-cs-fixer
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing phpcs + php-cs-fixer..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
installed() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing phpcs + php-cs-fixer"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
if ! installed php; then
|
||||
echo "ERROR: You need php to be installed" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! installed composer; then
|
||||
echo "ERROR: You need composer to be installed" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
COMPOSER_GLOBAL_HOME="$(composer config -g home)"
|
||||
NEWPATH="export PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
|
||||
if ! grep -qoh "$NEWPATH" "$HOME/.profile" 2>/dev/null; then
|
||||
echo "$NEWPATH" >> "$HOME/.profile"
|
||||
fi
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
source "$HOME/.profile"
|
||||
|
||||
composer global require squizlabs/php_codesniffer --dev
|
||||
composer global require friendsofphp/php-cs-fixer --dev
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
phpcs --version
|
||||
php-cs-fixer --version
|
||||
echo
|
||||
}
|
||||
|
||||
! installed 'php' && echo 'ERROR: You need php to be installed' && exit 1
|
||||
! installed "composer" && echo "ERROR: You need composer to be installed" && exit 2
|
||||
|
||||
COMPOSER_GLOBAL_HOME="$(composer config -g home)"
|
||||
NEWPATH="export PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
|
||||
cat "$HOME/.profile" | grep -qoh "$NEWPATH" || {
|
||||
$NEWPATH
|
||||
echo "$NEWPATH" >> "$HOME/.profile"
|
||||
}
|
||||
source "$HOME/.profile"
|
||||
|
||||
composer global require squizlabs/php_codesniffer --dev
|
||||
composer global require friendsofphp/php-cs-fixer --dev
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
phpcs --version # phpcbf --version
|
||||
php-cs-fixer --version
|
||||
echo
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+37
-24
@@ -1,30 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install phpmd
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing phpmd..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
installed() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing phpmd"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
if ! installed php; then
|
||||
echo "ERROR: You need php to be installed" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! installed composer; then
|
||||
echo "ERROR: You need composer to be installed" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
COMPOSER_GLOBAL_HOME="$(composer config -g home)"
|
||||
NEWPATH="export PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
|
||||
if ! grep -qoh "$NEWPATH" "$HOME/.profile" 2>/dev/null; then
|
||||
echo "$NEWPATH" >> "$HOME/.profile"
|
||||
fi
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
source "$HOME/.profile"
|
||||
|
||||
composer global require phpmd/phpmd --dev
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
phpmd --version
|
||||
echo
|
||||
}
|
||||
|
||||
! installed 'php' && echo 'ERROR: You need php to be installed' && exit 1
|
||||
! installed "composer" && echo "ERROR: You need composer to be installed" && exit 2
|
||||
|
||||
COMPOSER_GLOBAL_HOME="$(composer config -g home)"
|
||||
NEWPATH="export PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
|
||||
cat "$HOME/.profile" | grep -qoh "$NEWPATH" || {
|
||||
$NEWPATH
|
||||
echo "$NEWPATH" >> "$HOME/.profile"
|
||||
}
|
||||
source "$HOME/.profile"
|
||||
|
||||
composer global require phpmd/phpmd --dev
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
phpmd --version
|
||||
echo
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+37
-24
@@ -1,31 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install phpstan
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing phpstan..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
installed() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing phpstan"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
if ! installed php; then
|
||||
echo "ERROR: You need php to be installed" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! installed composer; then
|
||||
echo "ERROR: You need composer to be installed" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
COMPOSER_GLOBAL_HOME="$(composer config -g home)"
|
||||
NEWPATH="export PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
|
||||
if ! grep -qoh "$NEWPATH" "$HOME/.profile" 2>/dev/null; then
|
||||
echo "$NEWPATH" >> "$HOME/.profile"
|
||||
fi
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
source "$HOME/.profile"
|
||||
|
||||
composer global require phpstan/phpstan --dev
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
phpstan --version
|
||||
echo
|
||||
}
|
||||
|
||||
! installed 'php' && echo 'ERROR: You need php to be installed' && exit 1
|
||||
! installed "composer" && echo "ERROR: You need composer to be installed" && exit 2
|
||||
|
||||
COMPOSER_GLOBAL_HOME="$(composer config -g home)"
|
||||
NEWPATH="export PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
|
||||
cat "$HOME/.profile" | grep -qoh "$NEWPATH" || {
|
||||
$NEWPATH
|
||||
echo "$NEWPATH" >> "$HOME/.profile"
|
||||
}
|
||||
source "$HOME/.profile"
|
||||
|
||||
composer global require phpstan/phpstan --dev
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
phpstan --version
|
||||
echo
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
|
||||
+37
-24
@@ -1,31 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install phpunit
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing phpunit..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
installed() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing phpunit"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
if ! installed php; then
|
||||
echo "ERROR: You need php to be installed" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! installed composer; then
|
||||
echo "ERROR: You need composer to be installed" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
COMPOSER_GLOBAL_HOME="$(composer config -g home)"
|
||||
NEWPATH="export PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
|
||||
if ! grep -qoh "$NEWPATH" "$HOME/.profile" 2>/dev/null; then
|
||||
echo "$NEWPATH" >> "$HOME/.profile"
|
||||
fi
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
source "$HOME/.profile"
|
||||
|
||||
composer global require phpunit/phpunit --dev
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
phpunit --version
|
||||
echo
|
||||
}
|
||||
|
||||
! installed 'php' && echo 'ERROR: You need php to be installed' && exit 1
|
||||
! installed "composer" && echo "ERROR: You need composer to be installed" && exit 2
|
||||
|
||||
COMPOSER_GLOBAL_HOME="$(composer config -g home)"
|
||||
NEWPATH="export PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
|
||||
cat "$HOME/.profile" | grep -qoh "$NEWPATH" || {
|
||||
$NEWPATH
|
||||
echo "$NEWPATH" >> "$HOME/.profile"
|
||||
}
|
||||
source "$HOME/.profile"
|
||||
|
||||
composer global require phpunit/phpunit --dev
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
phpunit --version
|
||||
echo
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
|
||||
+47
-13
@@ -1,21 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install postman (latest)
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
# https://learning.postman.com/docs/getting-started/installation-and-updates/#installing-postman-on-linux
|
||||
set -eo pipefail
|
||||
|
||||
# set -ex
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
title
|
||||
download() {
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$1" -O "$2"
|
||||
else
|
||||
curl -fsSL "$1" -o "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
mkdir -p "$HOME/install" && \
|
||||
"$HOME/.local/bin" && \
|
||||
"$HOME/.local/share/applications"
|
||||
unpack_targz() {
|
||||
tar -xzvf "$1" -C "$2"
|
||||
}
|
||||
|
||||
download "https://dl.pstmn.io/download/latest/linux64" "$HOME/install/postman.tar.gz" && \
|
||||
unpack_targz "$HOME/install/postman.tar.gz" "$HOME/install" && \
|
||||
symlink "$HOME/install/Postman/Postman" "$HOME/.local/bin/postman" && \
|
||||
cat << EOF > "$HOME/.local/share/applications/Postman.desktop" && sudo update-desktop-database
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install --cask postman
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing postman"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
# https://learning.postman.com/docs/getting-started/installation-and-updates/#installing-postman-on-linux
|
||||
|
||||
mkdir -p "$HOME/install" "$HOME/.local/bin" "$HOME/.local/share/applications"
|
||||
|
||||
download "https://dl.pstmn.io/download/latest/linux64" "$HOME/install/postman.tar.gz"
|
||||
unpack_targz "$HOME/install/postman.tar.gz" "$HOME/install"
|
||||
ln -sf "$HOME/install/Postman/Postman" "$HOME/.local/bin/postman"
|
||||
|
||||
cat << EOF > "$HOME/.local/share/applications/Postman.desktop"
|
||||
[Desktop Entry]
|
||||
Name=Postman
|
||||
Exec=$HOME/.local/bin/postman %U
|
||||
@@ -26,8 +53,15 @@ Type=Application
|
||||
Encoding=UTF-8
|
||||
EOF
|
||||
|
||||
[ $? = 0 ] && {
|
||||
if command -v update-desktop-database >/dev/null 2>&1; then
|
||||
sudo update-desktop-database
|
||||
fi
|
||||
|
||||
echo
|
||||
success "Postman installed!"
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+43
-21
@@ -1,25 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install qt5
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing qt5..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
sudo apt install -y --autoremove \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
g++ \
|
||||
libqt5core5a \
|
||||
libqt5dbus5 \
|
||||
libqt5gui5 \
|
||||
libqt5network5 \
|
||||
libqt5svg5 \
|
||||
libqt5svg5-dev \
|
||||
libqt5widgets5 \
|
||||
openssl \
|
||||
qtbase5-dev \
|
||||
qttools5-dev \
|
||||
qttools5-dev-tools
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if command -v brew >/dev/null 2>&1; then
|
||||
brew install qt@5
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing qt5"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo apt install -y --autoremove \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
g++ \
|
||||
libqt5core5a \
|
||||
libqt5dbus5 \
|
||||
libqt5gui5 \
|
||||
libqt5network5 \
|
||||
libqt5svg5 \
|
||||
libqt5svg5-dev \
|
||||
libqt5widgets5 \
|
||||
openssl \
|
||||
qtbase5-dev \
|
||||
qttools5-dev \
|
||||
qttools5-dev-tools
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+64
-17
@@ -1,24 +1,71 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install rustdesk client v1.4.2 (deb)
|
||||
|
||||
[ "$1" ] && RDVER="$1" || RDVER="1.4.2"
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing rustdesk v$RDVER..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
# https://github.com/rustdesk/rustdesk
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
deb_path="$HOME/install"
|
||||
deb_name="rustdesk-$RDVER.deb"
|
||||
mkdir -p "$deb_path"
|
||||
deb="$deb_path/$deb_name"
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install --cask rustdesk
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
sudo apt install -y libxdo3 python3-pip
|
||||
wget "https://github.com/rustdesk/rustdesk/releases/download/$RDVER/$deb_name" -O "$deb"
|
||||
sudo dpkg -i "$deb"
|
||||
RDVER="1.4.9"
|
||||
|
||||
# flatpak install -y com.rustdesk.RustDesk
|
||||
# https://develop.kde.org/docs/administration/portal-permissions/
|
||||
# flatpak permission-set kde-authorized remote-desktop com.rustdesk.RustDesk yes
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing rustdesk v${RDVER}"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
# https://github.com/rustdesk/rustdesk
|
||||
|
||||
deb_path="$HOME/install"
|
||||
deb_name="rustdesk-${RDVER}.deb"
|
||||
mkdir -p "$deb_path"
|
||||
deb="$deb_path/$deb_name"
|
||||
|
||||
sudo apt install -y libxdo3 python3-pip
|
||||
if installed wget; then
|
||||
wget -q --show-progress "https://github.com/rustdesk/rustdesk/releases/download/${RDVER}/${deb_name}" -O "$deb"
|
||||
else
|
||||
curl -fsSL "https://github.com/rustdesk/rustdesk/releases/download/${RDVER}/${deb_name}" -o "$deb"
|
||||
fi
|
||||
sudo dpkg -i "$deb"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
remove() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew uninstall --cask rustdesk
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Removing rustdesk"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo dpkg -r rustdesk 2>/dev/null || true
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
r|remove|d|delete|p|purge) remove ;;
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+32
-34
@@ -1,43 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install bunch of software from snap
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing software from snap..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
installed() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
snapi() {
|
||||
snap install $1 2>/dev/null
|
||||
[[ $? -ne 0 ]] && snap install $1 --classic
|
||||
}
|
||||
|
||||
if ! installed snapd; then
|
||||
sudo apt update
|
||||
sudo apt install -y --autoremove snapd #gnome-software-plugin-snap
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: snap is not supported on macOS. Use brew instead." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# snapi snap-store
|
||||
# snapi gtk-common-themes
|
||||
# snapi gtk2-common-themes
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
snapi peek
|
||||
# snapi telegram-desktop #todo
|
||||
# snapi code # deb https://github.com/microsoft/vscode/issues/221836
|
||||
snapi skype
|
||||
snapi dbeaver-ce
|
||||
# snapi mysql-workbench-community
|
||||
# snapi discord
|
||||
# snapi phpstorm
|
||||
# snapi audacity
|
||||
# snapi flameshot # deb
|
||||
# snapi zoom-client # deb
|
||||
snapi() {
|
||||
snap install "$1" 2>/dev/null || snap install "$1" --classic
|
||||
}
|
||||
|
||||
# https://certbot.eff.org/
|
||||
# snapi certbot
|
||||
# sudo ln -sf /snap/bin/certbot /usr/bin/certbot
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing software from snap"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
if ! installed snapd; then
|
||||
sudo apt update
|
||||
sudo apt install -y --autoremove snapd
|
||||
fi
|
||||
|
||||
snapi peek
|
||||
snapi skype
|
||||
snapi dbeaver-ce
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
|
||||
+67
-34
@@ -1,45 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install Sublime Merge
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
# https://www.sublimemerge.com/download
|
||||
# https://gist.github.com/lugrus2000/1fc55158b87f94d799392a6dd1ac0ce2
|
||||
# https://gist.github.com/maboloshi/feaa63c35f4c2baab24c9aaf9b3f4e47
|
||||
set -eo pipefail
|
||||
|
||||
[ "$1" ] && SMVER="$1" || SMVER='2102'
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
title
|
||||
download() {
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$1" -O "$2"
|
||||
else
|
||||
curl -fsSL "$1" -o "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
mkdir -p "$HOME/install"
|
||||
DEB_PATH="$HOME/install/sublime-merge_build-${SMVER}_amd64.deb"
|
||||
BIN_PATH="/opt/sublime_merge/sublime_merge"
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install --cask sublime-merge
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ ! -f "$DEB_PATH" ]]; then
|
||||
download https://download.sublimetext.com/sublime-merge_build-${SMVER}_amd64.deb "$DEB_PATH"
|
||||
fi
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing Sublime Merge"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo dpkg -i "$DEB_PATH"
|
||||
# sudo cp -f $BIN_PATH $BIN_PATH.old
|
||||
# https://www.sublimemerge.com/download
|
||||
|
||||
# if [[ $SMVER = 2102 ]]; then
|
||||
#TODO not working
|
||||
# printf '\x48\xC7\xC0\x19\x01\x00\x00\xC3' | sudo dd of=$BIN_PATH bs=1 seek=$((0x003A5400)) conv=notrunc
|
||||
# printf '\x90\x90\x90\x90\x90' | sudo dd of=$BIN_PATH bs=1 seek=$((0x003A7EC9)) conv=notrunc
|
||||
# printf '\x90\x90\x90\x90\x90' | sudo dd of=$BIN_PATH bs=1 seek=$((0x003A7EE4)) conv=notrunc
|
||||
# printf '\x48\x31\xC0\x48\xFF\xC0\xC3' | sudo dd of=$BIN_PATH bs=1 seek=$((0x003A67FE)) conv=notrunc
|
||||
# printf '\xC3' | sudo dd of=$BIN_PATH bs=1 seek=$((0x003A514E)) conv=notrunc
|
||||
# printf '\xC3' | sudo dd of=$BIN_PATH bs=1 seek=$((0x003A40D2)) conv=notrunc
|
||||
SMVER='2102'
|
||||
|
||||
#TODO segfault
|
||||
# echo 0045a360: 48 C7 C0 19 01 00 00 C3 | sudo xxd -r - $BIN_PATH
|
||||
# echo 0045d21d: 90 90 90 90 90 | sudo xxd -r - $BIN_PATH
|
||||
# echo 0045d23a: 90 90 90 90 90 | sudo xxd -r - $BIN_PATH
|
||||
# echo 0045b990: C3 | sudo xxd -r - $BIN_PATH
|
||||
# echo 0045a05a: C3 | sudo xxd -r - $BIN_PATH
|
||||
# echo 00459aba: C3 | sudo xxd -r - $BIN_PATH
|
||||
# fi
|
||||
mkdir -p "$HOME/install"
|
||||
DEB_PATH="$HOME/install/sublime-merge_build-${SMVER}_amd64.deb"
|
||||
BIN_PATH="/opt/sublime_merge/sublime_merge"
|
||||
|
||||
echo
|
||||
success "Sublime Merge installed!"
|
||||
$BIN_PATH --version
|
||||
echo
|
||||
if [[ ! -f "$DEB_PATH" ]]; then
|
||||
download "https://download.sublimetext.com/sublime-merge_build-${SMVER}_amd64.deb" "$DEB_PATH"
|
||||
fi
|
||||
|
||||
sudo dpkg -i "$DEB_PATH"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
$BIN_PATH --version
|
||||
echo
|
||||
}
|
||||
|
||||
remove() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew uninstall --cask sublime-merge
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Removing Sublime Merge"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo dpkg -r sublime-merge 2>/dev/null || true
|
||||
sudo rm -rf /opt/sublime_merge
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
r|remove|d|delete|p|purge) remove ;;
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+77
-27
@@ -1,37 +1,87 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install Sublime Text
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
# https://www.sublimetext.com/download
|
||||
# https://gist.axenov.dev/anthony/sublime
|
||||
# https://gist.axenov.dev/anthony/sublime2
|
||||
# https://gist.github.com/lugrus2000/1fc55158b87f94d799392a6dd1ac0ce2
|
||||
# https://gist.github.com/maboloshi/feaa63c35f4c2baab24c9aaf9b3f4e47
|
||||
set -eo pipefail
|
||||
|
||||
[ "$1" ] && STVER="$1" || STVER='4200'
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
title
|
||||
download() {
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$1" -O "$2"
|
||||
else
|
||||
curl -fsSL "$1" -o "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
mkdir -p "$HOME/install"
|
||||
DEB_PATH="$HOME/install/sublime-text_build-${STVER}_amd64.deb"
|
||||
BIN_PATH="/opt/sublime_text/sublime_text"
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install --cask sublime-text
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ ! -f "$DEB_PATH" ]]; then
|
||||
download "https://download.sublimetext.com/sublime-text_build-${STVER}_amd64.deb" "$DEB_PATH"
|
||||
fi
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing Sublime Text"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo dpkg -i "$DEB_PATH"
|
||||
sudo cp -f "$BIN_PATH" "$BIN_PATH.old"
|
||||
# https://www.sublimetext.com/download
|
||||
|
||||
if [[ $STVER = 4169 ]]; then
|
||||
echo "00489f39: c640 0501 4885 c9" | sudo xxd -r - "$BIN_PATH"
|
||||
elif [[ $STVER = 4200 ]]; then
|
||||
sudo sed -i 's#\x0F\xB6\x51\x05\x83\xF2\x01#\xC6\x41\x05\x01\xB2\x00\x90#' "$BIN_PATH"
|
||||
else
|
||||
sudo sed -i 's#\x80\x79\x05\x00\x0F\x94\xC2#\xC6\x41\x05\x01\xB2\x00\x90#' "$BIN_PATH"
|
||||
fi
|
||||
STVER='4200'
|
||||
|
||||
echo
|
||||
success "Sublime Text installed!"
|
||||
$BIN_PATH --version
|
||||
echo
|
||||
mkdir -p "$HOME/install"
|
||||
DEB_PATH="$HOME/install/sublime-text_build-${STVER}_amd64.deb"
|
||||
BIN_PATH="/opt/sublime_text/sublime_text"
|
||||
|
||||
if [[ ! -f "$DEB_PATH" ]]; then
|
||||
download "https://download.sublimetext.com/sublime-text_build-${STVER}_amd64.deb" "$DEB_PATH"
|
||||
fi
|
||||
|
||||
sudo dpkg -i "$DEB_PATH"
|
||||
sudo cp -f "$BIN_PATH" "$BIN_PATH.old"
|
||||
|
||||
if [[ $STVER = 4169 ]]; then
|
||||
echo "00489f39: c640 0501 4885 c9" | sudo xxd -r - "$BIN_PATH"
|
||||
elif [[ $STVER = 4200 ]]; then
|
||||
sudo sed -i 's#\x0F\xB6\x51\x05\x83\xF2\x01#\xC6\x41\x05\x01\xB2\x00\x90#' "$BIN_PATH"
|
||||
else
|
||||
sudo sed -i 's#\x80\x79\x05\x00\x0F\x94\xC2#\xC6\x41\x05\x01\xB2\x00\x90#' "$BIN_PATH"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
$BIN_PATH --version
|
||||
echo
|
||||
}
|
||||
|
||||
remove() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew uninstall --cask sublime-text
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Removing Sublime Text"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo dpkg -r sublime-text 2>/dev/null || true
|
||||
sudo rm -rf /opt/sublime_text
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
r|remove|d|delete|p|purge) remove ;;
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+42
-14
@@ -1,20 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Samsung Unified Linux Driver repo
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
# https://www.bchemnet.com/suldr/
|
||||
# https://www.bchemnet.com/suldr/supported.html
|
||||
set -eo pipefail
|
||||
|
||||
title
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
mkdir -vp "$HOME/install"
|
||||
sudo bash -c 'echo "deb https://www.bchemnet.com/suldr/ debian extra" >> /etc/apt/sources.list.d/samsung.list'
|
||||
download \
|
||||
https://www.bchemnet.com/suldr/pool/debian/extra/su/suldr-keyring_3_all.deb \
|
||||
"$HOME/install/suldr-keyring_3_all.deb"
|
||||
sudo dpkg -i "$HOME/install/suldr-keyring_3_all.deb"
|
||||
apt_install suld-driver2-1.00.39
|
||||
download() {
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$1" -O "$2"
|
||||
else
|
||||
curl -fsSL "$1" -o "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
success "Samsung Unified Linux Driver installed!"
|
||||
info "Don't forget to connect your Samsung printer"
|
||||
info "See more info here: https://www.bchemnet.com/suldr/"
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: Samsung Unified Linux Driver is not supported on macOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing Samsung Unified Linux Driver"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
# https://www.bchemnet.com/suldr/
|
||||
# https://www.bchemnet.com/suldr/supported.html
|
||||
|
||||
mkdir -p "$HOME/install"
|
||||
sudo bash -c 'echo "deb https://www.bchemnet.com/suldr/ debian extra" >> /etc/apt/sources.list.d/samsung.list'
|
||||
download \
|
||||
https://www.bchemnet.com/suldr/pool/debian/extra/su/suldr-keyring_3_all.deb \
|
||||
"$HOME/install/suldr-keyring_3_all.deb"
|
||||
sudo dpkg -i "$HOME/install/suldr-keyring_3_all.deb"
|
||||
sudo apt install -y suld-driver2-1.00.39
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo "Don't forget to connect your Samsung printer"
|
||||
echo "See more info here: https://www.bchemnet.com/suldr/"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+49
-19
@@ -1,28 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install syncthing (latest) + ppa
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing syncthing (latest) + ppa..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
# https://apt.syncthing.net/
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
# Add the release PGP keys:
|
||||
sudo curl -s -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg
|
||||
download() {
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$1" -O "$2"
|
||||
else
|
||||
curl -fsSL "$1" -o "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
# Add the "stable" channel to your APT sources:
|
||||
echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install syncthing
|
||||
brew services start syncthing
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
# Add the "candidate" channel to your APT sources:
|
||||
echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing candidate" | sudo tee /etc/apt/sources.list.d/syncthing.list
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing syncthing"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
# Update and install syncthing:
|
||||
sudo apt update
|
||||
sudo apt install -y --autoremove syncthing
|
||||
# https://apt.syncthing.net/
|
||||
|
||||
wget "https://raw.githubusercontent.com/syncthing/syncthing/main/etc/linux-desktop/syncthing-start.desktop" -O $HOME/.local/share/applications/syncthing-start.desktop
|
||||
wget "https://raw.githubusercontent.com/syncthing/syncthing/main/etc/linux-desktop/syncthing-ui.desktop" -O $HOME/.local/share/applications/syncthing-ui.desktop
|
||||
ln -sf $HOME/.local/share/applications/syncthing-start.desktop $HOME/.config/autostart/syncthing-start.desktop
|
||||
# или демоном: https://habr.com/ru/post/350892/
|
||||
# Add the release PGP keys:
|
||||
sudo curl -s -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg
|
||||
|
||||
# Add the channels to APT sources:
|
||||
echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
|
||||
echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing candidate" | sudo tee /etc/apt/sources.list.d/syncthing.list
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y --autoremove syncthing
|
||||
|
||||
mkdir -p "$HOME/.local/share/applications" "$HOME/.config/autostart"
|
||||
download "https://raw.githubusercontent.com/syncthing/syncthing/main/etc/linux-desktop/syncthing-start.desktop" "$HOME/.local/share/applications/syncthing-start.desktop"
|
||||
download "https://raw.githubusercontent.com/syncthing/syncthing/main/etc/linux-desktop/syncthing-ui.desktop" "$HOME/.local/share/applications/syncthing-ui.desktop"
|
||||
ln -sf "$HOME/.local/share/applications/syncthing-start.desktop" "$HOME/.config/autostart/syncthing-start.desktop"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+18
-13
@@ -1,18 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install telebit (latest)
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing telebit (latest)..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
# https://git.coolaj86.com/coolaj86/telebit.js#install
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing telebit"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
# export NODEJS_VER=v10.2 # v10.2 is tested working, but we can test other versions
|
||||
# export TELEBIT_VERSION=master # git tag or branch to install from
|
||||
# export TELEBIT_USERSPACE=no # install as a system service (launchd, systemd only)
|
||||
# export TELEBIT_PATH=/opt/telebit
|
||||
# export TELEBIT_USER=telebit
|
||||
# export TELEBIT_GROUP=telebit
|
||||
curl https://get.telebit.io/ | bash
|
||||
# https://git.coolaj86.com/coolaj86/telebit.js#install
|
||||
curl -fsSL https://get.telebit.io/ | bash
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+36
-9
@@ -1,13 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install telegram (latest)
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing telegram (latest)..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
mkdir -p "$HOME/install" "$HOME/.local/bin"
|
||||
wget "https://telegram.org/dl/desktop/linux" -O $HOME/install/telegram.tar.gz && \
|
||||
tar -xJf $HOME/install/telegram.tar.gz -C $HOME/.local/bin
|
||||
$HOME/.local/bin/Telegram/Telegram & disown > /dev/null
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install --cask telegram
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing telegram"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
mkdir -p "$HOME/install" "$HOME/.local/bin"
|
||||
if installed wget; then
|
||||
wget -q --show-progress "https://telegram.org/dl/desktop/linux" -O "$HOME/install/telegram.tar.gz"
|
||||
else
|
||||
curl -fsSL "https://telegram.org/dl/desktop/linux" -o "$HOME/install/telegram.tar.gz"
|
||||
fi
|
||||
tar -xJf "$HOME/install/telegram.tar.gz" -C "$HOME/.local/bin"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+47
-24
@@ -1,33 +1,56 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install tilt (k8s dev env)
|
||||
|
||||
mkdir -p ~/install/tilt ~/.local/bin
|
||||
cd ~/install/tilt
|
||||
set -eo pipefail
|
||||
|
||||
KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
|
||||
curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl"
|
||||
curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl.sha256"
|
||||
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
|
||||
chmod +x kubectl
|
||||
cp ./kubectl ~/.local/bin/kubectl
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
################################################################################
|
||||
isMac() { [ "$(uname -s)" = "Darwin" ]; }
|
||||
|
||||
CTLPTL_URL=$(curl -s "https://api.github.com/repos/tilt-dev/ctlptl/releases/latest" \
|
||||
| jq -r '.assets.[] | select(.name | test("linux.x86_64.tar.gz")).browser_download_url')
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing tilt"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
curl -fsSL "$CTLPTL_URL" | tar -xz -C ~/.local/bin ctlptl
|
||||
# chmod +x ~/.local/bin/ctlptl
|
||||
mkdir -p ~/install/tilt ~/.local/bin
|
||||
|
||||
################################################################################
|
||||
if isMac; then
|
||||
if installed brew; then
|
||||
brew install kubectl tilt-dev/tap/ctlptl tilt-dev/tap/tilt
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
cd ~/install/tilt
|
||||
|
||||
TILT_URL=$(curl -s "https://api.github.com/repos/tilt-dev/tilt/releases/latest" \
|
||||
| jq -r '.assets.[] | select(.name | test("linux.x86_64.tar.gz")).browser_download_url')
|
||||
KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
|
||||
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
|
||||
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256"
|
||||
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
|
||||
chmod +x kubectl
|
||||
cp ./kubectl ~/.local/bin/kubectl
|
||||
|
||||
curl -fsSL "$TILT_URL" | tar -xz -C ~/.local/bin tilt
|
||||
# chmod +x ~/.local/bin/tilt
|
||||
cd -
|
||||
CTLPTL_URL=$(curl -s "https://api.github.com/repos/tilt-dev/ctlptl/releases/latest" \
|
||||
| jq -r '.assets.[] | select(.name | test("linux.x86_64.tar.gz")).browser_download_url')
|
||||
curl -fsSL "$CTLPTL_URL" | tar -xz -C ~/.local/bin ctlptl
|
||||
|
||||
echo "Version of ctlptl = $(ctlptl version)"
|
||||
echo "Version of tilt = $(tilt version)"
|
||||
echo "Version of kubectl:"
|
||||
kubectl version
|
||||
TILT_URL=$(curl -s "https://api.github.com/repos/tilt-dev/tilt/releases/latest" \
|
||||
| jq -r '.assets.[] | select(.name | test("linux.x86_64.tar.gz")).browser_download_url')
|
||||
curl -fsSL "$TILT_URL" | tar -xz -C ~/.local/bin tilt
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo "ctlptl version = $(ctlptl version)"
|
||||
echo "tilt version = $(tilt version)"
|
||||
echo "kubectl version:"
|
||||
kubectl version
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+26
-9
@@ -1,13 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install ulauncher (latest) + ppa
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing ulauncher (latest) + ppa..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
sudo add-apt-repository universe -y
|
||||
sudo add-apt-repository ppa:agornostal/ulauncher -y
|
||||
sudo apt update
|
||||
sudo apt install ulauncher
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: ulauncher is not supported on macOS. Use Alfred or Raycast instead." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing ulauncher"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo add-apt-repository universe -y
|
||||
sudo add-apt-repository ppa:agornostal/ulauncher -y
|
||||
sudo apt update
|
||||
sudo apt install -y ulauncher
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+68
-13
@@ -1,19 +1,74 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install Vivaldi + ppa
|
||||
|
||||
# https://repo.vivaldi.com
|
||||
# https://help.vivaldi.com/desktop/#install-update
|
||||
# https://help.vivaldi.com/desktop/install-update/manual-setup-vivaldi-linux-repositories/
|
||||
set -eo pipefail
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing Vivaldi + ppa..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
wget -qO- https://repo.vivaldi.com/archive/linux_signing_key.pub | gpg --dearmor > packages.vivaldi.gpg
|
||||
sudo install -o root -g root -m 644 packages.vivaldi.gpg /etc/apt/trusted.gpg.d
|
||||
sudo sh -c 'echo "deb [arch=amd64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.vivaldi.gpg] https://repo.vivaldi.com/archive/deb stable main" > /etc/apt/sources.list.d/vivaldi.list'
|
||||
rm -f packages.vivaldi.gpg
|
||||
doInstall() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install --cask vivaldi
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
sudo apt update && sudo apt install vivaldi-stable
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing Vivaldi"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
# https://repo.vivaldi.com
|
||||
# https://help.vivaldi.com/desktop/#install-update
|
||||
|
||||
if installed wget; then
|
||||
wget -qO- https://repo.vivaldi.com/archive/linux_signing_key.pub | gpg --dearmor > packages.vivaldi.gpg
|
||||
else
|
||||
curl -fsSL https://repo.vivaldi.com/archive/linux_signing_key.pub | gpg --dearmor > packages.vivaldi.gpg
|
||||
fi
|
||||
sudo install -o root -g root -m 644 packages.vivaldi.gpg /etc/apt/trusted.gpg.d
|
||||
sudo sh -c 'echo "deb [arch=amd64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.vivaldi.gpg] https://repo.vivaldi.com/archive/deb stable main" > /etc/apt/sources.list.d/vivaldi.list'
|
||||
rm -f packages.vivaldi.gpg
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y vivaldi-stable
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
remove() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew uninstall --cask vivaldi
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Removing Vivaldi"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo apt remove -y vivaldi-stable
|
||||
sudo rm -rf \
|
||||
/usr/share/keyrings/vivaldi-browser.gpg \
|
||||
/etc/apt/sources.list.d/vivaldi-archive.list \
|
||||
/etc/apt/sources.list.d/vivaldi.list
|
||||
sudo apt update
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
r|remove|d|delete|p|purge) remove ;;
|
||||
*) doInstall ;;
|
||||
esac
|
||||
|
||||
+36
-7
@@ -1,18 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: VSCode deb-package
|
||||
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
|
||||
|
||||
title
|
||||
set -eo pipefail
|
||||
|
||||
mkdir -p "$HOME/install"
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
download "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64" \
|
||||
"$HOME/install/vscode.deb" && \
|
||||
download() {
|
||||
if installed wget; then
|
||||
wget -q --show-progress "$1" -O "$2"
|
||||
else
|
||||
curl -fsSL "$1" -o "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install --cask visual-studio-code
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing VSCode"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
mkdir -p "$HOME/install"
|
||||
|
||||
download "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64" \
|
||||
"$HOME/install/vscode.deb"
|
||||
sudo dpkg -i "$HOME/install/vscode.deb"
|
||||
|
||||
[ $? = 0 ] && {
|
||||
echo
|
||||
success "VSCode installed"
|
||||
echo "Finish!"
|
||||
code --version
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+53
-10
@@ -1,14 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install wine (latest) + ppa
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing wine (latest)..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
sudo dpkg --add-architecture i386
|
||||
wget -qO- https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
|
||||
sudo add-apt-repository -y "deb https://dl.winehq.org/wine-builds/ubuntu/ $(lsb_release -cs 2>/dev/null) main"
|
||||
sudo apt install -y --autoremove winehq-stable
|
||||
wine --version
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: wine on macOS requires Wine Skin, CrossOver, or manual setup" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing wine"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo dpkg --add-architecture i386
|
||||
if installed wget; then
|
||||
wget -qO- https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
|
||||
else
|
||||
curl -fsSL https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
|
||||
fi
|
||||
sudo add-apt-repository -y "deb https://dl.winehq.org/wine-builds/ubuntu/ $(lsb_release -cs 2>/dev/null) main"
|
||||
sudo apt install -y --autoremove winehq-stable
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
wine --version
|
||||
echo
|
||||
}
|
||||
|
||||
remove() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Removing wine"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo apt remove --purge -y "wine*"
|
||||
rm -rf "$HOME/.wine"
|
||||
rm -f "$HOME/.config/menus/applications-merged/"*wine*
|
||||
rm -rf "$HOME/.local/share/applications/wine"
|
||||
rm -f "$HOME/.local/share/desktop-directories/"*wine*
|
||||
rm -f "$HOME/.local/share/icons/"*wine*
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
r|remove|d|delete|p|purge) remove ;;
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+50
-36
@@ -1,45 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install youtube-dl (src)
|
||||
|
||||
# https://github.com/ytdl-org/youtube-dl#installation
|
||||
set -eo pipefail
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing youtube-dl (src)..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
# 11.04.23: release 2021.12.17 in snap/apt/github is broken (Unable to extract uploader id)
|
||||
# and still no fix officially released, so we just build it from actual sources
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing youtube-dl"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
# curl -L https://yt-dl.org/downloads/latest/youtube-dl -o "$HOME/.local/bin/youtube-dl" && \
|
||||
# sudo chmod +rx "$HOME/.local/bin/youtube-dl"
|
||||
# https://github.com/ytdl-org/youtube-dl#installation
|
||||
|
||||
installed() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
if ! installed make; then
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: Install Xcode Command Line Tools first." >&2
|
||||
exit 1
|
||||
else
|
||||
sudo apt install -y make
|
||||
fi
|
||||
fi
|
||||
mkdir -p "$HOME/install/youtube-dl" "$HOME/.local/bin"
|
||||
|
||||
if installed git; then
|
||||
if [ -d "$HOME/install/youtube-dl" ]; then
|
||||
cd "$HOME/install/youtube-dl"
|
||||
git pull
|
||||
else
|
||||
git clone https://github.com/ytdl-org/youtube-dl.git "$HOME/install/youtube-dl" --depth=1 --single-branch
|
||||
fi
|
||||
else
|
||||
if ! installed wget; then
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "ERROR: Install wget or use git." >&2
|
||||
exit 1
|
||||
else
|
||||
sudo apt install -y wget
|
||||
fi
|
||||
fi
|
||||
wget -q --show-progress https://github.com/ytdl-org/youtube-dl/archive/refs/heads/master.zip -O "$HOME/install/youtube-dl.zip"
|
||||
unzip -oq "$HOME/install/youtube-dl.zip" -d "$HOME/install/youtube-dl"
|
||||
fi
|
||||
|
||||
cd "$HOME/install/youtube-dl"
|
||||
make youtube-dl
|
||||
mv youtube-dl "$HOME/.local/bin/"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
youtube-dl --version
|
||||
echo
|
||||
}
|
||||
|
||||
! installed make && sudo apt install -y make
|
||||
mkdir -p "$HOME/install/youtube-dl" "$HOME/.local/bin"
|
||||
|
||||
if installed git; then
|
||||
if [[ -d "$HOME/install/youtube-dl" ]]; then
|
||||
cd "$HOME/install/youtube-dl"
|
||||
git pull
|
||||
else
|
||||
git clone https://github.com/ytdl-org/youtube-dl.git "$HOME/install/youtube-dl" --depth=1 --single-branch
|
||||
fi
|
||||
else
|
||||
! installed wget && sudo apt install -y wget
|
||||
wget https://github.com/ytdl-org/youtube-dl/archive/refs/heads/master.zip -O "$HOME/install/youtube-dl.zip" && \
|
||||
unzip -oq "$HOME/install/youtube-dl.zip" -d "$HOME/install/youtube-dl"
|
||||
fi
|
||||
|
||||
cd "$HOME/install/youtube-dl" && \
|
||||
make youtube-dl && \
|
||||
mv youtube-dl "$HOME/.local/bin"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
youtube-dl --version
|
||||
echo
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+22
-10
@@ -1,15 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install ytdlcue
|
||||
|
||||
# https://gist.github.com/anthonyaxenov/8e11f18493c8419ee7abc94a8ea0cfaf
|
||||
set -eo pipefail
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing ytdlcue..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing ytdlcue"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
install_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
tools_dir="`dirname $install_dir`/tools"
|
||||
cp "${tools_dir}/ytdlcue.sh" "$HOME/.local/bin/ytdlcue"
|
||||
sudo chmod +rx "$HOME/.local/bin/ytdlcue"
|
||||
# https://gist.github.com/anthonyaxenov/8e11f18493c8419ee7abc94a8ea0cfaf
|
||||
|
||||
install_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
tools_dir="$(dirname "$install_dir")/tools"
|
||||
cp "${tools_dir}/ytdlcue.sh" "$HOME/.local/bin/ytdlcue"
|
||||
chmod +rx "$HOME/.local/bin/ytdlcue"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+46
-32
@@ -1,37 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install zint (latest)
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing zint (latest)..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
sudo apt install -y --autoremove \
|
||||
g++ \
|
||||
cmake \
|
||||
qtbase5-dev \
|
||||
qttools5-dev \
|
||||
libpng-dev
|
||||
installed() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
if installed git; then
|
||||
# 2.9.* ===============================================================================
|
||||
sudo git clone git@github.com:zint/zint.git /usr/src/zint
|
||||
cd /usr/src/zint
|
||||
sudo cmake .
|
||||
sudo make
|
||||
sudo make install
|
||||
else
|
||||
echo "You need git to be installed!"
|
||||
# 2.4.2 ===============================================================================
|
||||
# https://wayneoutthere.com/2021/02/17/how-to-install-zint-on-ubuntu/
|
||||
# sudo wget https://github.com/downloads/zint/zint/zint-2.4.2.tar.gz -O /usr/src/zint.tar.gz
|
||||
# sudo tar -C /usr/src/ -xzf /usr/src/zint.tar.gz
|
||||
# sudo rm -rf /usr/src/zint.tar.gz
|
||||
# cd /usr/src/zint-2.4.2/build
|
||||
# sudo cmake ..
|
||||
# sudo make
|
||||
# sudo make install
|
||||
# sudo rm -rf /usr/src/zint*
|
||||
# cd -
|
||||
fi
|
||||
install() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if installed brew; then
|
||||
brew install zint
|
||||
else
|
||||
echo "ERROR: Install Homebrew first." >&2
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing zint"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo apt install -y --autoremove \
|
||||
g++ \
|
||||
cmake \
|
||||
qtbase5-dev \
|
||||
qttools5-dev \
|
||||
libpng-dev
|
||||
|
||||
if installed git; then
|
||||
sudo rm -rf /usr/src/zint
|
||||
sudo git clone https://github.com/zint/zint.git /usr/src/zint
|
||||
cd /usr/src/zint
|
||||
sudo cmake .
|
||||
sudo make
|
||||
sudo make install
|
||||
else
|
||||
echo "ERROR: You need git to be installed!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
+19
-7
@@ -1,11 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
##makedesc: Install vanilla zsh
|
||||
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing vanilla zsh..."
|
||||
echo "==============================================="
|
||||
echo
|
||||
set -eo pipefail
|
||||
|
||||
sudo apt install -y --autoremove zsh
|
||||
echo "source ~/.profile" >> "$HOME/.zshrc"
|
||||
install() {
|
||||
echo
|
||||
echo "==============================================="
|
||||
echo "Installing vanilla zsh"
|
||||
echo "==============================================="
|
||||
echo
|
||||
|
||||
sudo apt install -y --autoremove zsh
|
||||
echo "source ~/.profile" >> "$HOME/.zshrc"
|
||||
|
||||
echo
|
||||
echo "Finish!"
|
||||
echo
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*) install ;;
|
||||
esac
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# Shell-скрипты
|
||||
|
||||
Эти скрипты я писал в разное время для решения разных задач.
|
||||
Чтобы они не растерялись по репозиториям и носителям, я решил собрать их здесь в одну кучу.
|
||||
|
||||
Я всегда использую Ubuntu в качестве своих настольных и серверных ОС, поэтому все эти скрипты писались и использовались в этих средах с версий 18.*.
|
||||
@@ -1 +0,0 @@
|
||||
AFRAID_TOKEN=6qfkK3VmHf7t4PwvTUJtxNEQ
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC1091
|
||||
thisdir="$( dirname "$(readlink -e -- "${BASH_SOURCE[0]}")")"
|
||||
|
||||
log() {
|
||||
timestamp="$(date +'%Y-%m-%d %H:%M:%S')"
|
||||
datestamp="$(date +'%Y-%m-%d')"
|
||||
[ ! -d "$thisdir/log" ] && mkdir "$thisdir/log"
|
||||
echo "[$timestamp] $*" >> "$thisdir/log/$datestamp.log"
|
||||
}
|
||||
|
||||
[ ! -f "$thisdir/.env" ] && {
|
||||
log "ERROR: .env not exists"
|
||||
exit 1
|
||||
}
|
||||
|
||||
source "$thisdir/.env"
|
||||
|
||||
[ -z "$AFRAID_TOKEN" ] && {
|
||||
log "ERROR: env var AFRAID_TOKEN not specified"
|
||||
exit 1
|
||||
}
|
||||
|
||||
result=$(curl -s "http://sync.afraid.org/u/${AFRAID_TOKEN}/")
|
||||
log "$result"
|
||||
@@ -1,3 +0,0 @@
|
||||
DUCK_TOKEN=
|
||||
DUCK_DOMAINS=
|
||||
DUCK_IP=
|
||||
@@ -1,2 +0,0 @@
|
||||
.env
|
||||
*.log
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
thisdir="$( dirname "$(readlink -e -- "${BASH_SOURCE[0]}")")"
|
||||
|
||||
# https://www.duckdns.org/install.jsp
|
||||
|
||||
croncmd="$thisdir/update.sh"
|
||||
cronjob="*/30 * * * * $croncmd" # every 30 min
|
||||
( crontab -l | grep -v -F "$croncmd" ; echo "$cronjob" ) | crontab -
|
||||
cp -f "$thisdir/.env.example" "$thisdir/.env"
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
( crontab -l | grep -v -F "duckdns" ) | crontab -
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC1091
|
||||
thisdir="$( dirname "$(readlink -e -- "${BASH_SOURCE[0]}")")"
|
||||
|
||||
log() {
|
||||
timestamp="$(date +'%Y-%m-%d %H:%M:%S')"
|
||||
datestamp="$(date +'%Y-%m-%d')"
|
||||
[ ! -d "$thisdir/log" ] && mkdir "$thisdir/log"
|
||||
echo "[$timestamp] $*" >> "$thisdir/log/$datestamp.log"
|
||||
}
|
||||
|
||||
[ ! -f "$thisdir/.env" ] && {
|
||||
log "ERROR: .env not exists"
|
||||
exit 1
|
||||
}
|
||||
|
||||
source "$thisdir/.env"
|
||||
|
||||
[ -z "$DUCK_TOKEN" ] && {
|
||||
log "ERROR: env var DUCK_TOKEN not specified"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -z "$DUCK_DOMAINS" ] && {
|
||||
log "ERROR: env var DUCK_DOMAINS not specified"
|
||||
exit 1
|
||||
}
|
||||
|
||||
result=$(curl -s "https://www.duckdns.org/update?domains=${DUCK_DOMAINS}&token=${DUCK_TOKEN}&ip=${DUCK_IP}")
|
||||
log "$result"
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
sudo sysctl -w net.ipv6.conf.all.disable_ipv6="$1"
|
||||
sudo sysctl -w net.ipv6.conf.default.disable_ipv6="$1"
|
||||
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6="$1"
|
||||
@@ -1,55 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# https://gist.github.com/anthonyaxenov/c16e1181d4b8a8644c57ec8a1f6cf21c
|
||||
#########################################################################
|
||||
# #
|
||||
# Set output resolution #
|
||||
# #
|
||||
# Author: Anthony Axenov (Антон Аксенов) #
|
||||
# Version: 1.0 #
|
||||
# License: WTFPLv2 #
|
||||
# #
|
||||
#########################################################################
|
||||
# #
|
||||
# Using this script you can change your output resolution #
|
||||
# to any one you need. Just adjust some vars below and run script #
|
||||
# (chmod +x needed). #
|
||||
# #
|
||||
#########################################################################
|
||||
|
||||
# Set output name to work with. You can get it via 'xrandr --listactivemonitors'
|
||||
output="HDMI-3"
|
||||
# Set width of this output in px
|
||||
width=1920
|
||||
# Set height of this output in px
|
||||
height=1080
|
||||
# Set refresh rate in Hz of this output in px
|
||||
refresh=120
|
||||
|
||||
# Sometimes cvt and gtf generates different modelines.
|
||||
# You can play around and look which of them gives best result:
|
||||
modeline=$(cvt ${width} ${height} ${refresh} | grep "Modeline")
|
||||
# modeline=$(gtf ${width} ${height} ${refresh} | grep "Modeline")
|
||||
|
||||
# Some important data needed to xrandr:
|
||||
modename="${width}x${height}@${refresh}_my"
|
||||
params=$(echo "$modeline" | sed "s|^\s*Modeline\s*\"[0-9x_.]*\"\s*||")
|
||||
|
||||
echo "Set resolution ${width}x${height}@${refresh} on output $output:"
|
||||
echo "$modename $params"
|
||||
|
||||
# Simple logic:
|
||||
# 1. Switch output to safe mode which always exists (I believe) to avoid errors
|
||||
xrandr --output $output --mode 640x480 --verbose
|
||||
# 2. If output aready have our mode -- we must delete it to avoid errors
|
||||
if $(xrandr | grep -q "$modename"); then
|
||||
# 2.1. Detach mode from output
|
||||
xrandr --delmode $output $modename
|
||||
# 2.2. Remove mode itself
|
||||
xrandr --rmmode $modename
|
||||
fi
|
||||
# 3. Create new mode with freshly generated parameters
|
||||
xrandr --newmode $modename $params --verbose
|
||||
# 4. Attach mode to our output
|
||||
xrandr --addmode $output $modename --verbose
|
||||
# 5. Switch output to this mode immidiately
|
||||
xrandr --output $output --mode $modename --refresh $refresh --verbose
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Original filename: docker-volume-snapshot
|
||||
# Author: Juned Khatri
|
||||
# License: MIT
|
||||
# Repo: https://github.com/junedkhatri31/docker-volume-snapshot
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
programname=`basename "$0"`
|
||||
|
||||
display_usage() {
|
||||
echo "usage: $programname (create|restore) source destination"
|
||||
echo " create create snapshot file from docker volume"
|
||||
echo " restore restore snapshot file to docker volume"
|
||||
echo " source source path"
|
||||
echo " destination destination path"
|
||||
echo
|
||||
echo "Tip: Supports tar's compression algorithms automatically"
|
||||
echo " based on the file extention, for example .tar.gz"
|
||||
echo
|
||||
echo "Examples:"
|
||||
echo "docker-volume-snapshot create xyz_volume xyz_volume.tar"
|
||||
echo "docker-volume-snapshot create xyz_volume xyz_volume.tar.gz"
|
||||
echo "docker-volume-snapshot restore xyz_volume.tar xyz_volume"
|
||||
echo "docker-volume-snapshot restore xyz_volume.tar.gz xyz_volume"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"create")
|
||||
if [[ -z "$2" || -z "$3" ]]; then display_usage; exit 1; fi
|
||||
directory=`dirname "$3"`
|
||||
if [ "$directory" == "." ]; then directory=$(pwd); fi
|
||||
filename=`basename "$3"`
|
||||
docker run --rm -v "$2:/source" -v "$directory:/dest" busybox tar cvaf "/dest/$filename" -C /source .
|
||||
;;
|
||||
"restore")
|
||||
if [[ -z "$2" || -z "$3" ]]; then display_usage; exit 1; fi
|
||||
directory=`dirname "$2"`
|
||||
if [ "$directory" == "." ]; then directory=$(pwd); fi
|
||||
filename=`basename "$2"`
|
||||
docker run --rm -v "$3:/dest" -v "$directory:/source" busybox tar xvf "/source/$filename" -C /dest
|
||||
;;
|
||||
*)
|
||||
display_usage
|
||||
exit 1 # Command to come out of the program with status 1
|
||||
;;
|
||||
esac
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# https://obsproject.com/kb/virtual-camera-troubleshooting
|
||||
# https://obsproject.com/forum/threads/how-to-start-virtual-camera-without-sudo-privileges.139783/
|
||||
# https://blog.csdn.net/qq_43008667/article/details/128041455
|
||||
# https://blog.jbrains.ca/permalink/using-obs-studio-as-a-virtual-cam-on-linux
|
||||
# https://github.com/obsproject/obs-studio/issues/4808
|
||||
|
||||
# v4l2loopback-dkms
|
||||
|
||||
# obs_start()
|
||||
# {
|
||||
# #This function is intended to prevent blank cameras in OBS upon OBS restart / exit
|
||||
# #1. load/refresh uvcvideo before starting obs
|
||||
# if lsmod | grep -q 'uvcvideo'; then
|
||||
# sudo rmmod uvcvideo
|
||||
# fi
|
||||
# sudo modprobe uvcvideo
|
||||
# #2. since no environment with a keyring to prompt for allowing virtual webcams prior is a must
|
||||
# sudo modprobe v4l2loopback video_nr=10 card_label='OBS Virtual Camera'
|
||||
# sleep 1
|
||||
# sh -c "$obs_cmd --startvirtualcam || sleep 3; sudo rmmod uvcvideo"
|
||||
# }
|
||||
|
||||
installed () {
|
||||
command -v $1 > /dev/null
|
||||
}
|
||||
|
||||
installed 'obs' && obs_cmd='obs'
|
||||
installed 'obs-studio' && obs_cmd='obs-studio'
|
||||
|
||||
# obs executes this command when you start virtual camera
|
||||
# sudo modprobe v4l2loopback exclusive_caps=1 card_label="OBS Virtual Camera"
|
||||
|
||||
# another version from one of links below
|
||||
# sudo modprobe v4l2loopback video_nr=2 devices=1 card_label="OBS Virtual Camera"
|
||||
|
||||
sudo modprobe -r v4l2loopback || sudo rmmod v4l2loopback
|
||||
if [[ $? == 0 ]]; then
|
||||
sudo modprobe v4l2loopback video_nr=2 devices=1 card_label="OBS Virtual Camera"
|
||||
if [[ $? == 0 ]]; then
|
||||
$obs_cmd --startvirtualcam & disown
|
||||
else
|
||||
echo "Cannot run modprobe. Ensure v4l2loopback-dkms is installed and try again"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Cannot remove v4l2loopback device"
|
||||
exit 2
|
||||
fi
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# https://gist.github.com/pkorpine/16fcdbe070222cf1d99e67cf542e60c2
|
||||
|
||||
sudo rm -rf /etc/apt/sources.list.d/vivaldi*
|
||||
cd /tmp
|
||||
wget -qO- https://repo.vivaldi.com/archive/linux_signing_key.pub | gpg --dearmor > packages.vivaldi.gpg
|
||||
sudo install -o root -g root -m 644 packages.vivaldi.gpg /etc/apt/trusted.gpg.d
|
||||
sudo sh -c 'echo "deb [arch=amd64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.vivaldi.gpg] https://repo.vivaldi.com/archive/deb stable main" > /etc/apt/sources.list.d/vivaldi.list'
|
||||
rm -f packages.vivaldi.gpg
|
||||
sudo apt update
|
||||
@@ -1,111 +0,0 @@
|
||||
# Argument parser for bash scripts v1.6
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
# 1. add these lines after shebang:
|
||||
|
||||
__RAW_ARGS__=("$@")
|
||||
source args.sh
|
||||
|
||||
# 2. read arguments as flags:
|
||||
|
||||
arg a 1 flag_a
|
||||
echo "Flag -a has value '$flag_a'"
|
||||
echo "Flag -a has value '$(arg a 1)'"
|
||||
|
||||
arg b 1 flag_b
|
||||
echo "Flag -b has value '$flag_b'"
|
||||
echo "Flag -b has value '$(arg b 1)'"
|
||||
|
||||
arg c 1 flag_c
|
||||
echo "Flag -c has value '$flag_c'"
|
||||
echo "Flag -c has value '$(arg c 1)'"
|
||||
|
||||
arg d 1 flag_d
|
||||
echo "Flag -d has value '$flag_d'"
|
||||
echo "Flag -d has value '$(arg d 1)'"
|
||||
|
||||
argl flag1 1 flag_1
|
||||
echo "Flag --flag1 has value '$flag_1'"
|
||||
echo "Flag --flag1 has value '$(argl flag1 1)'"
|
||||
|
||||
argl flag2 1 flag_2
|
||||
echo "Flag --flag2 has value '$flag_2'"
|
||||
echo "Flag --flag2 has value '$(argl flag2 1)'"
|
||||
|
||||
# 3. and/or read arguments' values:
|
||||
|
||||
arg a 0 arg_a
|
||||
echo "Arg -a has value '$arg_a'"
|
||||
echo "Arg -a has value '$(arg a 0)'"
|
||||
|
||||
arg b 0 arg_b
|
||||
echo "Arg -b has value '$arg_b'"
|
||||
echo "Arg -b has value '$(arg b 0)'"
|
||||
|
||||
argl arg1 0 arg_1
|
||||
echo "Arg --arg1 has value '$arg_1'"
|
||||
echo "Arg --arg1 has value '$(argl arg1 0)'"
|
||||
|
||||
argl arg2 0 arg_2
|
||||
echo "Arg --arg2 has value '$arg_2'"
|
||||
echo "Arg --arg2 has value '$(argl arg2 0)'"
|
||||
```
|
||||
|
||||
## How it works
|
||||
|
||||
1. Short arguments can be specified contiguously or separately
|
||||
and their order does not matter, but before each of them
|
||||
(or the first of them) one leading dash must be specified.
|
||||
|
||||
> Valid combinations: `-a -b -c`, `-cba`, `-b -azc "value of z"`
|
||||
|
||||
2. Short arguments can have values and if are - value must go
|
||||
next to argument itself.
|
||||
|
||||
> Valid combinations: `-ab avalue`, `-ba avalue`, `-a avalue -b`
|
||||
|
||||
3. Long arguments cannot be combined like short ones and each
|
||||
of them must be specified separately with two leading dashes.
|
||||
|
||||
> Valid combinations: `--foo --bar`, `--bar --foo`
|
||||
|
||||
4. Long arguments can have a value which must be specified after `=`.
|
||||
|
||||
> Valid combinations: `--foo value --bar`, `--bar --foo=value`
|
||||
|
||||
5. If arg value may contain space then value must be "double-quoted".
|
||||
|
||||
6. You can use arg() or argl() to check presence of any arg, no matter
|
||||
if it has value or not.
|
||||
|
||||
More info:
|
||||
* 🇷🇺 [axenov.dev/bash-args](https://axenov.dev/bash-args/)
|
||||
* 🇺🇸 [axenov.dev/en/bash-processing-arguments-in-a-script-when-called-from-the-shell/](https://axenov.dev/en/bash-processing-arguments-in-a-script-when-called-from-the-shell)
|
||||
|
||||
Tested in Ubuntu 20.04.2 LTS in:
|
||||
|
||||
```
|
||||
bash 5.0.17(1)-release (x86_64-pc-linux-gnu) and later
|
||||
zsh 5.8 (x86_64-ubuntu-linux-gnu) and later
|
||||
```
|
||||
|
||||
## Version history
|
||||
|
||||
```
|
||||
v1.0 - initial
|
||||
v1.1 - arg(): improved skipping uninteresting args
|
||||
- arg(): check next arg to be valid value
|
||||
v1.2 - removed all 'return' statements
|
||||
- arg(): error message corrected
|
||||
- new examples
|
||||
v1.3 - argl(): improved flag check
|
||||
- some text corrections
|
||||
v1.4 - new function argn()
|
||||
- some text corrections
|
||||
v1.5 - arg(), grep_match(): fixed searching for -e argument
|
||||
- grep_match(): redirect output into /dev/null
|
||||
v1.6 - removed useless argn()
|
||||
- arg() and argl() refactored and now support values with whitespaces
|
||||
```
|
||||
@@ -1,158 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Argument parser for bash scripts
|
||||
#
|
||||
# Author: Anthony Axenov (Антон Аксенов)
|
||||
# Version: 1.6
|
||||
# License: MIT
|
||||
# Description: https://git.axenov.dev/anthony/shell/src/branch/master/helpers/arg-parser
|
||||
|
||||
#purpose Little helper to check if string matches PCRE
|
||||
#argument $1 - some string
|
||||
#argument $2 - regex
|
||||
#exitcode 0 - string valid
|
||||
#exitcode 1 - string is not valid
|
||||
grep_match() {
|
||||
printf "%s" "$1" | grep -qE "$2" >/dev/null
|
||||
}
|
||||
|
||||
#purpose Find short argument or its value
|
||||
#argument $1 - (string) argument (without leading dashes; only first letter will be processed)
|
||||
#argument $2 - (number) is it flag? 1 if is, otherwise 0 or nothing
|
||||
#argument $3 - (string) variable to return value into
|
||||
# (if not specified then it will be echo'ed in stdout)
|
||||
#returns (string) 1 (if $2 == 1), value (if correct and if $2 != 1) or nothing
|
||||
#usage To get value into var: arg v 0 myvar or myvalue=$(arg 'v')
|
||||
#usage To find flag into var: arg f 1 myvar or flag=$(arg 'f')
|
||||
#usage To echo value: arg v
|
||||
#usage To echo 1 if flag exists: arg f
|
||||
arg() {
|
||||
[ "$1" ] || { echo "Argument name is not specified!" >&2 && exit 1; }
|
||||
local arg_name="${1:0:1}" # first character of argument name to find
|
||||
local is_flag="$2" || 0 # 1 if we need just find a flag, 0 to get a value
|
||||
local var_name="$3" || 0 # variable name to return value into or 0 to echo it in stdout
|
||||
local value= # initialize empty value to check if we found one later
|
||||
local arg_found=0 # marker of found argument
|
||||
|
||||
for idx in "${!__RAW_ARGS__[@]}"; do # going through all args
|
||||
local arg_search=${__RAW_ARGS__[idx]} # get current argument
|
||||
|
||||
# skip $arg_search if it starts with '--' or letter
|
||||
grep_match "$arg_search" "^(\w|--)" && continue
|
||||
|
||||
# clear $arg_search from special and duplicate characters, e.g. 'fas-)dfs' will become 'fasd'
|
||||
local arg_chars="$(printf "%s" "$arg_search" \
|
||||
| tr -s "[$arg_search]" 2>/dev/null \
|
||||
| tr -d "[:punct:][:blank:]" 2>/dev/null)"
|
||||
|
||||
# if $arg_name is not one of $arg_chars the skip it
|
||||
grep_match "-$arg_name" "^-[$arg_chars]$" || continue
|
||||
arg_found=1
|
||||
|
||||
# then return '1'|'0' back into $value if we need flag or next arg value otherwise
|
||||
[ "$is_flag" = 1 ] && value=1 || value="${__RAW_ARGS__[idx+1]}"
|
||||
break
|
||||
done
|
||||
|
||||
[ "$is_flag" = 1 ] && [ -z "$value" ] && value=0;
|
||||
|
||||
# if value we found is empty or looks like another argument then exit with error message
|
||||
if [ "$arg_found" = 1 ] && ! grep_match "$value" "^[[:graph:]]+$" || grep_match "$value" "^--?\w+$"; then
|
||||
echo "ERROR: Argument '-$arg_name' must have correct value!" >&2 && exit 1
|
||||
fi
|
||||
|
||||
# return '$value' back into $var_name (if exists) or echo in stdout
|
||||
[ "$var_name" ] && eval "$var_name='$value'" || echo "$value"
|
||||
}
|
||||
|
||||
#purpose Find long argument or its value
|
||||
#argument $1 - argument (without leading dashes)
|
||||
#argument $2 - (number) is it flag? 1 if is, otherwise 0 or nothing
|
||||
#argument $3 - (string) variable to return value into
|
||||
# (if not specified then it will be echo'ed in stdout)
|
||||
#returns (string) 1 (if $2 == 1), value (if correct and if $2 != 1) or nothing
|
||||
#usage To get value into var: arg v 0 myvar or myvalue=$(arg 'v')
|
||||
#usage To find flag into var: arg f 1 myvar or flag=$(arg 'f')
|
||||
#usage To echo value: arg v
|
||||
#usage To echo 1 if flag exists: arg f
|
||||
argl() {
|
||||
[ "$1" ] || { echo "Argument name is not specified!" >&2 && exit 1; }
|
||||
local arg_name="$1" # argument name to find
|
||||
local is_flag="$2" || 0 # 1 if we need just find a flag, 0 to get a value
|
||||
local var_name="$3" || 0 # variable name to return value into or 0 to echo it in stdout
|
||||
local value= # initialize empty value to check if we found one later
|
||||
local arg_found=0 # marker of found argument
|
||||
|
||||
for idx in "${!__RAW_ARGS__[@]}"; do # going through all args
|
||||
local arg_search="${__RAW_ARGS__[idx]}" # get current argument
|
||||
|
||||
if [ "$arg_search" = "--$arg_name" ]; then # if current arg begins with two dashes
|
||||
# then return '1' back into $value if we need flag or next arg value otherwise
|
||||
[ "$is_flag" = 1 ] && value=1 || value="${__RAW_ARGS__[idx+1]}"
|
||||
break # stop the loop
|
||||
elif grep_match "$arg_search" "^--$arg_name=.+$"; then # check if $arg like '--foo=bar'
|
||||
# then return '1' back into $value if we need flag or part from '=' to arg's end as value otherwise
|
||||
[ "$is_flag" = 1 ] && value=1 || value="${arg_search#*=}"
|
||||
break # stop the loop
|
||||
fi
|
||||
done
|
||||
|
||||
[ "$is_flag" = 1 ] && [ -z "$value" ] && value=0;
|
||||
|
||||
# if value we found is empty or looks like another argument then exit with error message
|
||||
if [ "$arg_found" = 1 ] && ! grep_match "$value" "^[[:graph:]]+$" || grep_match "$value" "^--?\w+$"; then
|
||||
echo "ERROR: Argument '--$arg_name' must have correct value!" >&2 && exit 1;
|
||||
fi
|
||||
|
||||
# return '$value' back into $var_name (if exists) or echo in stdout
|
||||
[ "$var_name" ] && eval "$var_name='$value'" || echo "$value"
|
||||
}
|
||||
|
||||
################################
|
||||
|
||||
# This is simple examples which you can play around with.
|
||||
# 1. uncomment code below
|
||||
# 2. call thi sscript to see what happens:
|
||||
# /args.sh -abcd --flag1 --flag2 -e evalue -f fvalue --arg1=value1 --arg2 value2
|
||||
|
||||
# __RAW_ARGS__=("$@")
|
||||
|
||||
# arg a 1 flag_a
|
||||
# echo "Flag -a has value '$flag_a'"
|
||||
# echo "Flag -a has value '$(arg a 1)'"
|
||||
|
||||
# arg b 1 flag_b
|
||||
# echo "Flag -b has value '$flag_b'"
|
||||
# echo "Flag -b has value '$(arg b 1)'"
|
||||
|
||||
# arg c 1 flag_c
|
||||
# echo "Flag -c has value '$flag_c'"
|
||||
# echo "Flag -c has value '$(arg c 1)'"
|
||||
|
||||
# arg d 1 flag_d
|
||||
# echo "Flag -d has value '$flag_d'"
|
||||
# echo "Flag -d has value '$(arg d 1)'"
|
||||
|
||||
# argl flag1 1 flag_1
|
||||
# echo "Flag --flag1 has value '$flag_1'"
|
||||
# echo "Flag --flag1 has value '$(argl flag1 1)'"
|
||||
|
||||
# argl flag2 1 flag_2
|
||||
# echo "Flag --flag2 has value '$flag_2'"
|
||||
# echo "Flag --flag2 has value '$(argl flag2 1)'"
|
||||
|
||||
# arg e 0 arg_e
|
||||
# echo "Arg -e has value '$arg_e'"
|
||||
# echo "Arg -e has value '$(arg e 0)'"
|
||||
|
||||
# arg f 0 arg_f
|
||||
# echo "Arg -f has value '$arg_f'"
|
||||
# echo "Arg -f has value '$(arg f 0)'"
|
||||
|
||||
# argl arg1 0 arg_1
|
||||
# echo "Arg --arg1 has value '$arg_1'"
|
||||
# echo "Arg --arg1 has value '$(argl arg1 0)'"
|
||||
|
||||
# argl arg2 0 arg_2
|
||||
# echo "Arg --arg2 has value '$arg_2'"
|
||||
# echo "Arg --arg2 has value '$(argl arg2 0)'"
|
||||
@@ -1,127 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source $( dirname $(readlink -e -- "${BASH_SOURCE}"))/io.sh || exit 255
|
||||
|
||||
########################################################
|
||||
# Little handy helpers for scripting
|
||||
########################################################
|
||||
|
||||
is_bash() {
|
||||
[[ "$(basename "$SHELL")" != "bash" ]]
|
||||
}
|
||||
|
||||
is_sourced() {
|
||||
[[ "${BASH_SOURCE[0]}" != "$0" ]]
|
||||
}
|
||||
|
||||
is_root() {
|
||||
[[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]
|
||||
}
|
||||
|
||||
get_os() {
|
||||
case "$(uname -s)" in
|
||||
Linux*) echo Linux ;;
|
||||
Darwin*) echo Macos ;;
|
||||
CYGWIN*) echo Cygwin ;;
|
||||
MINGW*) echo MinGw ;;
|
||||
MSYS_NT*) echo Git ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_os_id() {
|
||||
[ -f /etc/os-release ] && source /etc/os-release
|
||||
echo "$ID"
|
||||
}
|
||||
|
||||
# convert relative path $1 to full one
|
||||
abspath() {
|
||||
echo $(realpath -q "${1/#\~/$HOME}")
|
||||
}
|
||||
|
||||
# check if path $1 is writable
|
||||
is_writable() {
|
||||
[ -w "$(abspath $1)" ]
|
||||
}
|
||||
|
||||
# check if path $1 is a directory
|
||||
is_dir() {
|
||||
[ -d "$(abspath $1)" ]
|
||||
}
|
||||
|
||||
# check if path $1 is a file
|
||||
is_file() {
|
||||
[ -f "$(abspath $1)" ]
|
||||
}
|
||||
|
||||
# check if an argument is a shell function
|
||||
is_function() {
|
||||
declare -F "$1" > /dev/null
|
||||
}
|
||||
|
||||
# check if string $1 matches regex $2
|
||||
regex_match() {
|
||||
printf "%s" "$1" | grep -qP "$2"
|
||||
}
|
||||
|
||||
# check if array $2 contains string $1
|
||||
in_array() {
|
||||
local find=$1
|
||||
shift
|
||||
for e in "$@"; do
|
||||
[[ "$e" == "$find" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# join all elements of array $2 with delimiter $1
|
||||
implode() {
|
||||
local d=${1-}
|
||||
local f=${2-}
|
||||
if shift 2; then
|
||||
printf %s "$f" "${@/#/$d}"
|
||||
fi
|
||||
}
|
||||
|
||||
# open url $1 in system web-browser
|
||||
open_url() {
|
||||
if which xdg-open > /dev/null; then
|
||||
xdg-open "$1" </dev/null >/dev/null 2>&1 & disown
|
||||
elif which gnome-open > /dev/null; then
|
||||
gnome-open "$1" </dev/null >/dev/null 2>&1 & disown
|
||||
fi
|
||||
}
|
||||
|
||||
# unpack .tar.gz file $1 into path $2
|
||||
unpack_targz() {
|
||||
require tar
|
||||
tar -xzvf "$1" -C "$2"
|
||||
}
|
||||
|
||||
# make soft symbolic link of path $1 to path $2
|
||||
symlink() {
|
||||
ln -sf "$1" "$2"
|
||||
}
|
||||
|
||||
# download file $1 into path $2 using wget
|
||||
download() {
|
||||
require wget
|
||||
wget "$1" -O "$2"
|
||||
}
|
||||
|
||||
# download file $1 into path $2 using curl
|
||||
cdownload() {
|
||||
require curl
|
||||
curl -fsSL "$1" -o "$2"
|
||||
}
|
||||
|
||||
is_int() {
|
||||
[[ "$1" =~ ^[0-9]+$ ]]
|
||||
}
|
||||
|
||||
is_number() {
|
||||
[[ "$1" =~ ^[0-9]+([.,][0-9]+)?$ ]]
|
||||
}
|
||||
|
||||
trim() {
|
||||
echo "$1" | xargs
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source $( dirname $(readlink -e -- "${BASH_SOURCE}"))/io.sh || exit 255
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
########################################################
|
||||
# Docker wrappers
|
||||
########################################################
|
||||
|
||||
# Вызывает корректную команду docker compose
|
||||
docker.compose() {
|
||||
require docker
|
||||
|
||||
argl profiles 0 profiles
|
||||
args=${*/--profiles=[a-zA-Z_,0-9]*/}
|
||||
|
||||
if $(docker compose &>/dev/null); then
|
||||
local cmd="docker compose $args"
|
||||
elif installed_pkg "docker-compose"; then
|
||||
local cmd="docker-compose $args"
|
||||
warn
|
||||
warn "docker-compose v1 устарел и не поддерживается, его поведение непредсказуемо."
|
||||
warn "Обнови docker согласно документации: https://docs.docker.com/engine/install/"
|
||||
warn
|
||||
else
|
||||
error "Должен быть установлен docker-compose-plugin!"
|
||||
die "Установи docker согласно документации: https://docs.docker.com/engine/install/" 2
|
||||
fi
|
||||
|
||||
if [[ "$profiles" ]]; then
|
||||
export COMPOSE_PROFILES=$profiles
|
||||
debug "Выполнено: export COMPOSE_PROFILES=$profiles"
|
||||
fi
|
||||
|
||||
debug "Команда: $cmd"
|
||||
$cmd
|
||||
}
|
||||
|
||||
# Выводит информацию о контейнере
|
||||
docker.inspect() {
|
||||
cmd="docker inspect $*"
|
||||
debug "Команда: $cmd"
|
||||
$cmd 2>/dev/null
|
||||
}
|
||||
|
||||
# Выполняет команду в контейнере от имени root
|
||||
docker.exec() {
|
||||
cmd="docker exec -u root -it $*"
|
||||
debug "Команда: $cmd"
|
||||
$cmd
|
||||
}
|
||||
|
||||
# Выводит информацию о контейнере
|
||||
docker.inspect() {
|
||||
cmd="docker inspect $*"
|
||||
debug "Команда: $cmd"
|
||||
$cmd 2>/dev/null
|
||||
}
|
||||
|
||||
docker.ip() { # not finished
|
||||
if [ "$1" ]; then
|
||||
if [ "$1" = "-a" ]; then
|
||||
docker ps -aq \
|
||||
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
|
||||
| sed -e 's#^/##' \
|
||||
| column -t
|
||||
elif [ "$1" = "-c" ]; then
|
||||
docker-compose ps -q \
|
||||
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
|
||||
| sed -e 's#^/##' \
|
||||
| column -t
|
||||
else
|
||||
docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$1"
|
||||
docker port "$1"
|
||||
fi
|
||||
else
|
||||
docker ps -q \
|
||||
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
|
||||
| sed -e 's#^/##' \
|
||||
| column -t
|
||||
fi
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
_dir=$( dirname $(readlink -e -- "${BASH_SOURCE}"))
|
||||
source "$_dir/io.sh" || exit 255
|
||||
source "$_dir/basic.sh" || exit 255
|
||||
source "$_dir/packages.sh" || exit 255
|
||||
|
||||
########################################################
|
||||
# Shorthands for git
|
||||
########################################################
|
||||
|
||||
git.clone_quick() {
|
||||
require git
|
||||
git clone --depth=1 --single-branch "$@"
|
||||
}
|
||||
|
||||
git.is_repo() {
|
||||
require git
|
||||
[ "$1" ] || die "Path is not specified" 101
|
||||
require_dir "$1/"
|
||||
check_dir "$1/.git"
|
||||
}
|
||||
|
||||
git.require_repo() {
|
||||
require git
|
||||
git.is_repo "$1" || die "'$1' is not git repository!" 10
|
||||
}
|
||||
|
||||
git.cfg() {
|
||||
require git
|
||||
[ "$1" ] || die "Key is not specified" 101
|
||||
if [[ "$2" ]]; then
|
||||
git config --global --replace-all "$1" "$2"
|
||||
else
|
||||
echo $(git config --global --get-all "$1")
|
||||
fi
|
||||
}
|
||||
|
||||
git.set_user() {
|
||||
require git
|
||||
[ "$1" ] || die "git.set_user: Repo is not specified" 100
|
||||
git.cfg "$1" "user.name" "$2"
|
||||
git.cfg "$1" "user.email" "$3"
|
||||
success "User set to '$name <$email>' in ${FWHITE}$1"
|
||||
}
|
||||
|
||||
git.fetch() {
|
||||
require git
|
||||
if [ "$1" ]; then
|
||||
if git.remote_branch_exists "origin/$1"; then
|
||||
git fetch origin "refs/heads/$1:refs/remotes/origin/$1" --progress --prune --quiet 2>&1 || die "Could not fetch $1 from origin" 12
|
||||
else
|
||||
warn "Tried to fetch branch 'origin/$1' but it does not exist."
|
||||
fi
|
||||
else
|
||||
git fetch origin --progress --prune --quiet 2>&1 || exit 12
|
||||
fi
|
||||
}
|
||||
|
||||
git.reset() {
|
||||
require git
|
||||
git reset --hard HEAD
|
||||
git clean -fd
|
||||
}
|
||||
|
||||
git.clone() {
|
||||
require git
|
||||
git clone "$*" 2>&1
|
||||
}
|
||||
|
||||
git.co() {
|
||||
require git
|
||||
git checkout "$*" 2>&1
|
||||
}
|
||||
|
||||
git.is_it_current_branch() {
|
||||
require git
|
||||
[ "$1" ] || die "git.is_it_current_branch: Branch is not specified" 19
|
||||
[[ "$(git.current_branch)" = "$1" ]]
|
||||
}
|
||||
|
||||
git.pull() {
|
||||
require git
|
||||
[ "$1" ] && BRANCH=$1 || BRANCH=$(git.current_branch)
|
||||
# note "Updating branch $BRANCH..."
|
||||
git pull origin "refs/heads/$BRANCH:refs/remotes/origin/$BRANCH" --prune --force --quiet 2>&1 || exit 13
|
||||
git pull origin --tags --force --quiet 2>&1 || exit 13
|
||||
# [ "$1" ] || die "git.pull: Branch is not specified" 19
|
||||
# if [ "$1" ]; then
|
||||
# note "Updating branch $1..."
|
||||
# git pull origin "refs/heads/$1:refs/remotes/origin/$1" --prune --force --quiet 2>&1 || exit 13
|
||||
# else
|
||||
# note "Updating current branch..."
|
||||
# git pull
|
||||
# fi
|
||||
}
|
||||
|
||||
git.current_branch() {
|
||||
require git
|
||||
git branch --show-current || exit 18
|
||||
}
|
||||
|
||||
git.local_branch_exists() {
|
||||
require git
|
||||
[ -n "$(git for-each-ref --format='%(refname:short)' refs/heads/$1)" ]
|
||||
}
|
||||
|
||||
git.update_refs() {
|
||||
require git
|
||||
info "Updating local refs..."
|
||||
git remote update origin --prune 1>/dev/null 2>&1 || exit 18
|
||||
}
|
||||
|
||||
git.delete_remote_branch() {
|
||||
require git
|
||||
[ "$1" ] || die "git.remote_branch_exists: Branch is not specified" 19
|
||||
if git.remote_branch_exists "origin/$1"; then
|
||||
git push origin :"$1" # || die "Could not delete the remote $1 in $ORIGIN"
|
||||
return 0
|
||||
else
|
||||
warn "Trying to delete the remote branch $1, but it does not exists in origin"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
git.is_clean_worktree() {
|
||||
require git
|
||||
git rev-parse --verify HEAD >/dev/null || exit 18
|
||||
git update-index -q --ignore-submodules --refresh
|
||||
git diff-files --quiet --ignore-submodules || return 1
|
||||
git diff-index --quiet --ignore-submodules --cached HEAD -- || return 2
|
||||
return 0
|
||||
}
|
||||
|
||||
git.is_branch_merged_into() {
|
||||
require git
|
||||
[ "$1" ] || die "git.remote_branch_exists: Branch1 is not specified" 19
|
||||
[ "$2" ] || die "git.remote_branch_exists: Branch2 is not specified" 19
|
||||
git.update_refs
|
||||
local merge_hash=$(git merge-base "$1"^{} "$2"^{})
|
||||
local base_hash=$(git rev-parse "$1"^{})
|
||||
[ "$merge_hash" = "$base_hash" ]
|
||||
}
|
||||
|
||||
git.remote_branch_exists() {
|
||||
require git
|
||||
[ "$1" ] || die "git.remote_branch_exists: Branch is not specified" 19
|
||||
git.update_refs
|
||||
[ -n "$(git for-each-ref --format='%(refname:short)' refs/remotes/$1)" ]
|
||||
}
|
||||
|
||||
git.new_branch() {
|
||||
require git
|
||||
[ "$1" ] || die "git.new_branch: Branch is not specified" 19
|
||||
if [ "$2" ] && ! git.local_branch_exists "$2" && git.remote_branch_exists "origin/$2"; then
|
||||
git.co -b "$1" origin/"$2"
|
||||
else
|
||||
git.co -b "$1" "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
git.require_clean_worktree() {
|
||||
require git
|
||||
if ! git.is_clean_worktree; then
|
||||
warn "Your working tree is dirty! Look at this:"
|
||||
git status -bs
|
||||
_T="What should you do now?\n"
|
||||
_T="${_T}\t${BOLD}${FWHITE}0.${RESET} try to continue as is\t- errors may occur!\n"
|
||||
_T="${_T}\t${BOLD}${FWHITE}1.${RESET} hard reset\t\t\t- clear current changes and new files\n"
|
||||
_T="${_T}\t${BOLD}${FWHITE}2.${RESET} stash changes (default)\t- save all changes in safe to apply them later via 'git stash pop'\n"
|
||||
_T="${_T}\t${BOLD}${FWHITE}3.${RESET} cancel\n"
|
||||
ask "${_T}${BOLD}${FWHITE}Your choice [0-3]" reset_answer
|
||||
case $reset_answer in
|
||||
1 ) warn "Clearing your work..." && git.reset ;;
|
||||
3 ) exit ;;
|
||||
* ) git stash -a -u -m "WIP before switch to $branch_task" ;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#TODO source basic.sh
|
||||
#TODO source args-parser/args.sh
|
||||
|
||||
########################################################
|
||||
# Help functions
|
||||
########################################################
|
||||
|
||||
process_help_arg() {
|
||||
command="${FUNCNAME[1]}"
|
||||
need_help=$(arg help 1)
|
||||
[[ "$need_help" -eq 0 ]] && need_help=$(argl help 1)
|
||||
[[ "$need_help" -eq 1 ]] && help "$command"
|
||||
}
|
||||
|
||||
help() {
|
||||
is_function "help.$1" && help."$1" && exit
|
||||
echo "Main help message"
|
||||
}
|
||||
|
||||
help.example() {
|
||||
echo "Example help message"
|
||||
}
|
||||
|
||||
example() {
|
||||
process_help_arg
|
||||
echo "Example command"
|
||||
}
|
||||
@@ -1,393 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
########################################################
|
||||
# Simple and fancy input & output
|
||||
########################################################
|
||||
|
||||
which tput > /dev/null 2>&1 && [[ $(tput -T$TERM colors) -gt 8 ]] && CAN_USE_COLORS=1 || CAN_USE_COLORS=0
|
||||
USE_COLORS=${USE_COLORS:-$CAN_USE_COLORS}
|
||||
|
||||
# Icons (message prefixes)
|
||||
[[ "$USE_COLORS" == 1 ]] && IINFO="( i )" || IINFO=''
|
||||
[[ "$USE_COLORS" == 1 ]] && INOTE="( * )" || INOTE=''
|
||||
[[ "$USE_COLORS" == 1 ]] && IWARN="( # )" || IWARN=''
|
||||
[[ "$USE_COLORS" == 1 ]] && IERROR="( ! )" || IERROR=''
|
||||
[[ "$USE_COLORS" == 1 ]] && IFATAL="( @ )" || IFATAL=''
|
||||
[[ "$USE_COLORS" == 1 ]] && ISUCCESS="( ! )" || ISUCCESS=''
|
||||
[[ "$USE_COLORS" == 1 ]] && IASK="( ? )" || IASK=''
|
||||
[[ "$USE_COLORS" == 1 ]] && IDEBUG="(DBG)" || IDEBUG=''
|
||||
[[ "$USE_COLORS" == 1 ]] && IVRB="( + )" || IVRB=''
|
||||
|
||||
# Text attributes
|
||||
[[ "$USE_COLORS" == 1 ]] && FRESET="$(tput sgr0)" || FRESET='' # Normal
|
||||
[[ "$USE_COLORS" == 1 ]] && FBOLD="$(tput bold)" || FBOLD='' # Bold
|
||||
[[ "$USE_COLORS" == 1 ]] && FDIM="$(tput dim)" || FDIM='' # Dimmed
|
||||
[[ "$USE_COLORS" == 1 ]] && FLINE="$(tput smul)" || FLINE='' # Underlined
|
||||
[[ "$USE_COLORS" == 1 ]] && FENDLINE="$(tput rmul)" || FENDLINE='' # End of underlined
|
||||
[[ "$USE_COLORS" == 1 ]] && FBLINK="$(tput blink)" || FBLINK='' # Blink
|
||||
[[ "$USE_COLORS" == 1 ]] && FREV="$(tput rev)" || FREV='' # Reversed
|
||||
|
||||
# Text colors - normal
|
||||
[[ "$USE_COLORS" == 1 ]] && FBLACK="$(tput setaf 0)" || FBLACK='' # Black
|
||||
[[ "$USE_COLORS" == 1 ]] && FRED="$(tput setaf 1)" || FRED='' # Red
|
||||
[[ "$USE_COLORS" == 1 ]] && FGREEN="$(tput setaf 2)" || FGREEN='' # Green
|
||||
[[ "$USE_COLORS" == 1 ]] && FYELLOW="$(tput setaf 3)" || FYELLOW='' # Yellow
|
||||
[[ "$USE_COLORS" == 1 ]] && FBLUE="$(tput setaf 4)" || FBLUE='' # Blue
|
||||
[[ "$USE_COLORS" == 1 ]] && FPURPLE="$(tput setaf 5)" || FPURPLE='' # Purple
|
||||
[[ "$USE_COLORS" == 1 ]] && FCYAN="$(tput setaf 6)" || FCYAN='' # Cyan
|
||||
[[ "$USE_COLORS" == 1 ]] && FWHITE="$(tput setaf 7)" || FWHITE='' # White
|
||||
|
||||
# Text colors - bright
|
||||
[[ "$USE_COLORS" == 1 ]] && FLBLACK="$(tput setaf 8)" || FLBLACK='' # Black
|
||||
[[ "$USE_COLORS" == 1 ]] && FLRED="$(tput setaf 9)" || FLRED='' # Red
|
||||
[[ "$USE_COLORS" == 1 ]] && FLGREEN="$(tput setaf 10)" || FLGREEN='' # Green
|
||||
[[ "$USE_COLORS" == 1 ]] && FLYELLOW="$(tput setaf 11)" || FLYELLOW='' # Yellow
|
||||
[[ "$USE_COLORS" == 1 ]] && FLBLUE="$(tput setaf 12)" || FLBLUE='' # Blue
|
||||
[[ "$USE_COLORS" == 1 ]] && FLPURPLE="$(tput setaf 13)" || FLPURPLE='' # Purple
|
||||
[[ "$USE_COLORS" == 1 ]] && FLCYAN="$(tput setaf 14)" || FLCYAN='' # Cyan
|
||||
[[ "$USE_COLORS" == 1 ]] && FLWHITE="$(tput setaf 15)" || FLWHITE='' # White
|
||||
|
||||
# Background colors - normal
|
||||
[[ "$USE_COLORS" == 1 ]] && FBBLACK="$(tput setab 0)" || FBBLACK='' # Black
|
||||
[[ "$USE_COLORS" == 1 ]] && FBRED="$(tput setab 1)" || FBRED='' # Red
|
||||
[[ "$USE_COLORS" == 1 ]] && FBGREEN="$(tput setab 2)" || FBGREEN='' # Green
|
||||
[[ "$USE_COLORS" == 1 ]] && FBYELLOW="$(tput setab 3)" || FBYELLOW='' # Yellow
|
||||
[[ "$USE_COLORS" == 1 ]] && FBBLUE="$(tput setab 4)" || FBBLUE='' # Blue
|
||||
[[ "$USE_COLORS" == 1 ]] && FBPURPLE="$(tput setab 5)" || FBPURPLE='' # Purple
|
||||
[[ "$USE_COLORS" == 1 ]] && FBCYAN="$(tput setab 6)" || FBCYAN='' # Cyan
|
||||
[[ "$USE_COLORS" == 1 ]] && FBWHITE="$(tput setab 7)" || FBWHITE='' # White
|
||||
|
||||
# Background colors - bright
|
||||
[[ "$USE_COLORS" == 1 ]] && FBLBLACK="$(tput setab 8)" || FBLBLACK='' # Black
|
||||
[[ "$USE_COLORS" == 1 ]] && FBLRED="$(tput setab 9)" || FBLRED='' # Red
|
||||
[[ "$USE_COLORS" == 1 ]] && FBLGREEN="$(tput setab 10)" || FBLGREEN='' # Green
|
||||
[[ "$USE_COLORS" == 1 ]] && FBLYELLOW="$(tput setab 11)" || FBLYELLOW='' # Yellow
|
||||
[[ "$USE_COLORS" == 1 ]] && FBLBLUE="$(tput setab 12)" || FBLBLUE='' # Blue
|
||||
[[ "$USE_COLORS" == 1 ]] && FBLPURPLE="$(tput setab 13)" || FBLPURPLE='' # Purple
|
||||
[[ "$USE_COLORS" == 1 ]] && FBLCYAN="$(tput setab 14)" || FBLCYAN='' # Cyan
|
||||
[[ "$USE_COLORS" == 1 ]] && FBLWHITE="$(tput setab 15)" || FBLWHITE='' # White
|
||||
|
||||
now() {
|
||||
echo "[$(date +'%H:%M:%S')] "
|
||||
}
|
||||
|
||||
ask() {
|
||||
IFS= read -rp "$(print ${FBOLD}${FBBLUE}${FWHITE}${IASK}${FRESET}\ ${FBOLD}$1 ): " $2
|
||||
}
|
||||
|
||||
print() {
|
||||
# if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi
|
||||
echo -e "$*${FRESET}"
|
||||
}
|
||||
|
||||
link() {
|
||||
echo -e "\e]8;;$2\a$1\e]8;;\a"
|
||||
}
|
||||
|
||||
debug() {
|
||||
if [ "$2" ]; then
|
||||
print "${FDIM}${FBOLD}${FRESET}${FDIM}$(now)${IDEBUG} ${FUNCNAME[1]:-?}():${BASH_LINENO:-?}\t$1 " >&2
|
||||
else
|
||||
print "${FDIM}${FBOLD}${FRESET}${FDIM}$(now)${IDEBUG} $1 " >&2
|
||||
fi
|
||||
}
|
||||
|
||||
var_dump() {
|
||||
debug "$1 = ${!1}"
|
||||
}
|
||||
|
||||
print_stacktrace() {
|
||||
STACK=""
|
||||
local i
|
||||
local stack_size=${#FUNCNAME[@]}
|
||||
debug "Callstack:"
|
||||
# for (( i=$stack_size-1; i>=1; i-- )); do
|
||||
for (( i=1; i<$stack_size; i++ )); do
|
||||
local func="${FUNCNAME[$i]}"
|
||||
[ x$func = x ] && func=MAIN
|
||||
local linen="${BASH_LINENO[$(( i - 1 ))]}"
|
||||
local src="${BASH_SOURCE[$i]}"
|
||||
[ x"$src" = x ] && src=non_file_source
|
||||
debug " at $func $src:$linen"
|
||||
done
|
||||
}
|
||||
|
||||
verbose() {
|
||||
print "${FBOLD}$(now)${IVRB}${FRESET}${FYELLOW} $1 "
|
||||
}
|
||||
|
||||
info() {
|
||||
print "${FBOLD}$(now)${FWHITE}${FBLBLUE}${IINFO}${FRESET}${FWHITE} $1 "
|
||||
}
|
||||
|
||||
note() {
|
||||
print "${FBOLD}$(now)${FDIM}${FWHITE}${INOTE}${FRESET} $1 "
|
||||
}
|
||||
|
||||
success() {
|
||||
print "${FBOLD}$(now)${FBGREEN}${FWHITE}${ISUCCESS}${FRESET}$FGREEN $1 "
|
||||
}
|
||||
|
||||
warn() {
|
||||
print "${FBOLD}$(now)${FBYELLOW}${FBLACK}${IWARN}${FRESET}${FYELLOW} Warning:${FRESET} $1 "
|
||||
}
|
||||
|
||||
error() {
|
||||
print "${FBOLD}$(now)${FBLRED}${FWHITE}${IERROR} Error: ${FRESET}${FLRED} $1 " >&2
|
||||
}
|
||||
|
||||
fatal() {
|
||||
print "${FBOLD}$(now)${FBRED}${FWHITE}${IFATAL} FATAL: $1 " >&2
|
||||
print_stacktrace
|
||||
}
|
||||
|
||||
die() {
|
||||
error "${1:-halted}"
|
||||
exit ${2:-255}
|
||||
}
|
||||
|
||||
# var='test var_dump'
|
||||
# var_dump var
|
||||
# debug 'test debug'
|
||||
# verbose 'test verbose'
|
||||
# info 'test info'
|
||||
# note 'test note'
|
||||
# success 'test success'
|
||||
# warn 'test warn'
|
||||
# error 'test error'
|
||||
# fatal 'test fatal'
|
||||
# die 'test die'
|
||||
|
||||
# experiments ==============================================================================
|
||||
|
||||
# spinner() {
|
||||
# local frames=('⠋' '⠙' '⠹' '⠸' '⠼' '⠴' '⠦' '⠧' '⠇' '⠏')
|
||||
# local spin_i=0
|
||||
# local interval=0.1
|
||||
# printf "\e[?25l"
|
||||
|
||||
# local color="${FGREEN}"
|
||||
|
||||
# while true; do
|
||||
# printf "\r ${color}%s${CL}" "${frames[spin_i]}"
|
||||
# spin_i=$(( (spin_i + 1) % ${#frames[@]} ))
|
||||
# sleep "$interval"
|
||||
# done
|
||||
# }
|
||||
|
||||
# echo "lorem ipsum dolor sit amet"
|
||||
# spinner &
|
||||
# SPINNER_PID=$!
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# ===========
|
||||
|
||||
|
||||
# https://unix.stackexchange.com/a/269085
|
||||
# https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
|
||||
# https://linuxcommand.org/lc3_adv_tput.php
|
||||
# https://gist.github.com/nowmilano/4055d6df5b6e4ea87c5a72dc2d604193
|
||||
# https://gist.github.com/nick3499/402a6d7dccd474f2bdb679f4311b1238
|
||||
# https://gist.github.com/connorjan/2b02126868157c2b69f9aa0a052cdc86
|
||||
|
||||
# tput setaf 0
|
||||
# echo "BLACK FOREGROUND"
|
||||
# tput setaf 1
|
||||
# echo "RED FOREGROUND"
|
||||
# tput setaf 2
|
||||
# echo "GREEN FOREGROUND"
|
||||
# tput setaf 3
|
||||
# echo "YELLOW FOREGROUND"
|
||||
# tput setaf 4
|
||||
# echo "BLUE FOREGROUND"
|
||||
# tput setaf 5
|
||||
# echo "MAGENTA FOREGROUND"
|
||||
# tput setaf 6
|
||||
# echo "CYAN FOREGROUND"
|
||||
# tput setaf 7
|
||||
# echo "WHITE FOREGROUND"
|
||||
# tput reset
|
||||
|
||||
# ===========
|
||||
|
||||
|
||||
# ===========
|
||||
|
||||
# tohex(){
|
||||
# dec=$(($1%256)) ### input must be a number in range 0-255.
|
||||
# if [ "$dec" -lt "16" ]; then
|
||||
# bas=$(( dec%16 ))
|
||||
# mul=128
|
||||
# [ "$bas" -eq "7" ] && mul=192
|
||||
# [ "$bas" -eq "8" ] && bas=7
|
||||
# [ "$bas" -gt "8" ] && mul=255
|
||||
# a="$(( (bas&1) *mul ))"
|
||||
# b="$(( ((bas&2)>>1)*mul ))"
|
||||
# c="$(( ((bas&4)>>2)*mul ))"
|
||||
# printf 'dec= %3s basic= #%02x%02x%02x\n' "$dec" "$a" "$b" "$c"
|
||||
# elif [ "$dec" -gt 15 ] && [ "$dec" -lt 232 ]; then
|
||||
# b=$(( (dec-16)%6 )); b=$(( b==0?0: b*40 + 55 ))
|
||||
# g=$(( (dec-16)/6%6)); g=$(( g==0?0: g*40 + 55 ))
|
||||
# r=$(( (dec-16)/36 )); r=$(( r==0?0: r*40 + 55 ))
|
||||
# printf 'dec= %3s color= #%02x%02x%02x\n' "$dec" "$r" "$g" "$b"
|
||||
# else
|
||||
# gray=$(( (dec-232)*10+8 ))
|
||||
# printf 'dec= %3s gray= #%02x%02x%02x\n' "$dec" "$gray" "$gray" "$gray"
|
||||
# fi
|
||||
# }
|
||||
|
||||
# for i in $(seq 0 255); do
|
||||
# tohex ${i}
|
||||
# done
|
||||
|
||||
# ===========
|
||||
|
||||
# fromhex(){
|
||||
# hex=${1#"#"}
|
||||
# r=$(printf '0x%0.2s' "$hex")
|
||||
# g=$(printf '0x%0.2s' ${hex#??})
|
||||
# b=$(printf '0x%0.2s' ${hex#????})
|
||||
# printf '%03d' "$(( (r<75?0:(r-35)/40)*6*6 +
|
||||
# (g<75?0:(g-35)/40)*6 +
|
||||
# (b<75?0:(b-35)/40) + 16 ))"
|
||||
# }
|
||||
|
||||
# fromhex 00fc7b
|
||||
|
||||
# ===========
|
||||
|
||||
# mode2header(){
|
||||
# #### For 16 Million colors use \e[0;38;2;R;G;Bm each RGB is {0..255}
|
||||
# printf '\e[mR\n' # reset the colors.
|
||||
# printf '\n\e[m%59s\n' "Some samples of colors for r;g;b. Each one may be 000..255"
|
||||
# printf '\e[m%59s\n' "for the ansi option: \e[0;38;2;r;g;bm or \e[0;48;2;r;g;bm :"
|
||||
# }
|
||||
|
||||
# mode2colors(){
|
||||
# # foreground or background (only 3 or 4 are accepted)
|
||||
# local fb="$1"
|
||||
# [[ $fb != 3 ]] && fb=4
|
||||
# local samples=(0 63 127 191 255)
|
||||
# for r in "${samples[@]}"; do
|
||||
# for g in "${samples[@]}"; do
|
||||
# for b in "${samples[@]}"; do
|
||||
# printf '\e[0;%s8;2;%s;%s;%sm%03d;%03d;%03d ' "$fb" "$r" "$g" "$b" "$r" "$g" "$b"
|
||||
# done; printf '\e[m\n'
|
||||
# done; printf '\e[m'
|
||||
# done; printf '\e[mReset\n'
|
||||
# }
|
||||
# mode2header
|
||||
# mode2colors 3
|
||||
# mode2colors 4
|
||||
|
||||
# ===========
|
||||
|
||||
# printf '\e[48;5;%dm ' {0..255}; printf '\e[0m \n'
|
||||
# for r in {200..255..5}; do
|
||||
# fb=4
|
||||
# g=1
|
||||
# b=1
|
||||
# printf '\e[0;%s8;2;%s;%s;%sm ' "$fb" "$r" "$g" "$b"
|
||||
# done
|
||||
# echo
|
||||
|
||||
# ===========
|
||||
|
||||
# color(){
|
||||
# for c; do
|
||||
# printf '\e[48;5;%dm%03d' $c $c
|
||||
# done
|
||||
# printf '\e[0m \n'
|
||||
# }
|
||||
|
||||
# IFS=$' \t\n'
|
||||
# color {0..15}
|
||||
# for ((i=0;i<6;i++)); do
|
||||
# color $(seq $((i*36+16)) $((i*36+51)))
|
||||
# done
|
||||
# color {232..255}
|
||||
|
||||
# ===========
|
||||
|
||||
# for ((i=0; i<256; i++)) ;do
|
||||
# echo -n ' '
|
||||
# tput setab $i
|
||||
# tput setaf $(( ( (i>231&&i<244 ) || ( (i<17)&& (i%8<2)) ||
|
||||
# (i>16&&i<232)&& ((i-16)%6 <(i<100?3:2) ) && ((i-16)%36<15) )?7:16))
|
||||
# printf " C %03d " $i
|
||||
# tput op
|
||||
# (( ((i<16||i>231) && ((i+1)%8==0)) || ((i>16&&i<232)&& ((i-15)%6==0)) )) &&
|
||||
# printf "\n" ''
|
||||
# done
|
||||
|
||||
# ===========
|
||||
|
||||
# echo "tput character test"
|
||||
# echo "==================="
|
||||
# echo
|
||||
|
||||
# tput bold; echo "This text has the bold attribute."; tput sgr0
|
||||
|
||||
# tput smul; echo "This text is underlined (smul)."; tput rmul
|
||||
|
||||
# # Most terminal emulators do not support blinking text (though xterm
|
||||
# # does) because blinking text is considered to be in bad taste ;-)
|
||||
# tput blink; echo "This text is blinking (blink)."; tput sgr0
|
||||
|
||||
# tput rev; echo "This text has the reverse attribute"; tput sgr0
|
||||
|
||||
# # Standout mode is reverse on many terminals, bold on others.
|
||||
# tput smso; echo "This text is in standout mode (smso)."; tput rmso
|
||||
|
||||
# tput sgr0
|
||||
# echo
|
||||
|
||||
|
||||
# experiments ==============================================================================
|
||||
|
||||
# function delay_spinner(){
|
||||
# ##
|
||||
# ## Usage:
|
||||
# ##
|
||||
# ## $ long-running-command &
|
||||
# ## $ delay_spinner " Please wait msg..."
|
||||
# ##
|
||||
# ## Spinner exists when long-running-command completes
|
||||
# ##
|
||||
# local PROGRESSTXT
|
||||
# if [ ! "$1" ]; then
|
||||
# PROGRESSTXT=" Please wait..."
|
||||
# else
|
||||
# PROGRESSTXT="$1"
|
||||
# fi
|
||||
# # visual progress marker function
|
||||
# # http://stackoverflow.com/users/2869509/wizurd
|
||||
# # vars
|
||||
# local pid=$!
|
||||
# local delay=0.1
|
||||
# local spinstr='|/-\'
|
||||
# echo -e "\n\n"
|
||||
# while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
|
||||
# local temp=${spinstr#?}
|
||||
# printf "\r$PROGRESSTXT[%c] " "$spinstr"
|
||||
# local spinstr=$temp${spinstr%"$temp"}
|
||||
# sleep $delay
|
||||
# printf "\b\b\b\b\b\b"
|
||||
# done
|
||||
# printf -- '\n\n'
|
||||
# #
|
||||
# # <-- end function ec2cli_spinner -->
|
||||
# #
|
||||
# }
|
||||
# sleep 10 && echo 'test' &
|
||||
# delay_spinner "Please wait msg..."
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
########################################################
|
||||
# Logging functions
|
||||
########################################################
|
||||
|
||||
# write some message $1 in log file and stdout with timestamp
|
||||
log_path="/home/$USER/logs"
|
||||
log() {
|
||||
[ ! -d "$log_path" ] && log_path="./log"
|
||||
[ ! -d "$log_path" ] && mkdir -p "$log_path"
|
||||
echo -e "[$(date '+%H:%M:%S')] $*" | tee -a "$log_path/$(date '+%Y%m%d').log"
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
########################################################
|
||||
# Misc
|
||||
########################################################
|
||||
|
||||
# https://askubuntu.com/a/30414
|
||||
is_full_screen() {
|
||||
local WINDOW=$(xwininfo -id "$(xdotool getactivewindow)" -stats \
|
||||
| grep -E '(Width|Height):' \
|
||||
| awk '{print $NF}' \
|
||||
| sed -e 's/ /x/')
|
||||
local SCREEN=$(xdpyinfo | grep -m1 dimensions | awk '{print $2}')
|
||||
if [ "$WINDOW" = "$SCREEN" ]; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
ytm() {
|
||||
youtube-dl \
|
||||
--extract-audio \
|
||||
--audio-format flac \
|
||||
--audio-quality 0 \
|
||||
--format bestaudio \
|
||||
--write-info-json \
|
||||
--output "$HOME/Downloads/ytm/%(playlist_title)s/%(channel)s - %(title)s.%(ext)s" \
|
||||
"$@"
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
########################################################
|
||||
# Networking functions
|
||||
########################################################
|
||||
|
||||
get_current_ip() {
|
||||
local CURRENT_IP
|
||||
[ -f /etc/os-release ] && source /etc/os-release
|
||||
case "$ID" in
|
||||
debian|ubuntu) CURRENT_IP=$(hostname -I | awk '{print $1}') ;;
|
||||
alpine) CURRENT_IP=$(ip -4 addr show eth0 | awk '/inet / {print $2}' | cut -d/ -f1 | head -n 1) ;;
|
||||
*) CURRENT_IP="Unknown" ;;
|
||||
esac
|
||||
echo "$CURRENT_IP"
|
||||
}
|
||||
|
||||
get_external_ip() {
|
||||
local ip="$(curl -s https://api.myip.com | jq .ip)"
|
||||
echo "$ip" | tr -d '"'
|
||||
}
|
||||
|
||||
is_valid_ipv4() {
|
||||
local ip="$1"
|
||||
local regex="^([0-9]{1,3}\.){3}[0-9]{1,3}$"
|
||||
|
||||
if [[ $ip =~ $regex ]]; then
|
||||
IFS='.' read -r -a parts <<< "$ip"
|
||||
for part in "${parts[@]}"; do
|
||||
if ! [[ $part =~ ^[0-9]+$ ]] || ((part < 0 || part > 255)); then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
curltime() {
|
||||
curl -w @- -o /dev/null -s "$@" <<'EOF'
|
||||
time_namelookup: %{time_namelookup} sec\n
|
||||
time_connect: %{time_connect} sec\n
|
||||
time_appconnect: %{time_appconnect} sec\n
|
||||
time_pretransfer: %{time_pretransfer} sec\n
|
||||
time_redirect: %{time_redirect} sec\n
|
||||
time_starttransfer: %{time_starttransfer} sec\n
|
||||
---------------\n
|
||||
time_total: %{time_total} sec\n
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
########################################################
|
||||
# Notifications
|
||||
########################################################
|
||||
|
||||
TITLE="$0"
|
||||
NTFY_CHANNEL="example"
|
||||
|
||||
# отправляет простую нотификацию
|
||||
ntfy_info() {
|
||||
require ntfy
|
||||
ntfy send \
|
||||
--title "$TITLE" \
|
||||
--message "$1" \
|
||||
--priority 1 \
|
||||
"$NTFY_CHANNEL"
|
||||
}
|
||||
|
||||
# отправляет нотификацию с предупреждением
|
||||
ntfy_warn() {
|
||||
require ntfy
|
||||
ntfy send \
|
||||
--title "$TITLE" \
|
||||
--tags "warning" \
|
||||
--message "$1" \
|
||||
--priority 5 \
|
||||
"$NTFY_CHANNEL"
|
||||
}
|
||||
|
||||
|
||||
notify () {
|
||||
if ! installed "notify-send"; then
|
||||
warning "Notifications toggled on, but 'notify-send' is not installed!"
|
||||
return 1
|
||||
fi
|
||||
[ -n "$1" ] && local title="$1"
|
||||
local text="$2"
|
||||
local level="$3"
|
||||
local icon="$4"
|
||||
case "$level" in
|
||||
critical) local timeout=0 ;;
|
||||
low) local timeout=5000 ;;
|
||||
*) local timeout=10000 ;;
|
||||
esac
|
||||
debug "$title / $text / $level / $icon / $timeout"
|
||||
notify-send "$title" "$text" -a "$0" -u "$level" -i "$icon" -t $timeout
|
||||
}
|
||||
|
||||
# TODO: docblock
|
||||
notify_error() {
|
||||
notify "Error" "$1" "critical" "dialog-error"
|
||||
}
|
||||
|
||||
# TODO: docblock
|
||||
notify_warning() {
|
||||
notify "Warning" "$1" "normal" "dialog-warning"
|
||||
}
|
||||
|
||||
# TODO: docblock
|
||||
notify_info() {
|
||||
notify "" "$1" "low" "dialog-information"
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source $( dirname $(readlink -e -- "${BASH_SOURCE}"))/packages.sh || exit 255
|
||||
|
||||
########################################################
|
||||
# Desktop notifications
|
||||
########################################################
|
||||
|
||||
notify () {
|
||||
require "notify-send"
|
||||
[ -n "$1" ] && local title="$1" || local title="My notification"
|
||||
local text="$2"
|
||||
local level="$3"
|
||||
local icon="$4"
|
||||
case $level in
|
||||
"critical") local timeout=0 ;;
|
||||
"low") local timeout=5000 ;;
|
||||
*) local timeout=10000 ;;
|
||||
esac
|
||||
notify-send "$title" "$text" -a "MyScript" -u "$level" -i "$icon" -t $timeout
|
||||
}
|
||||
|
||||
notify_error() {
|
||||
notify "Error" "$1" "critical" "dialog-error"
|
||||
}
|
||||
|
||||
notify_warning() {
|
||||
notify "Warning" "$1" "normal" "dialog-warning"
|
||||
}
|
||||
|
||||
notify_info() {
|
||||
notify "" "$1" "low" "dialog-information"
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source $( dirname $(readlink -e -- "${BASH_SOURCE}"))/io.sh || exit 255
|
||||
|
||||
########################################################
|
||||
# Functions to control system packages
|
||||
########################################################
|
||||
|
||||
installed() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
installed_pkg() {
|
||||
dpkg --list | grep -qw "ii $1"
|
||||
}
|
||||
|
||||
apt_ppa_add() {
|
||||
sudo add-apt-repository -y $*
|
||||
}
|
||||
|
||||
apt_ppa_remove() {
|
||||
sudo add-apt-repository -ry $*
|
||||
}
|
||||
|
||||
apt_update() {
|
||||
sudo apt update $*
|
||||
}
|
||||
|
||||
apt_install() {
|
||||
sudo apt install -y $*
|
||||
}
|
||||
|
||||
apt_remove() {
|
||||
sudo apt purge -y $*
|
||||
}
|
||||
|
||||
dpkg_install() {
|
||||
sudo dpkg -i $*
|
||||
}
|
||||
|
||||
dpkg_remove() {
|
||||
sudo dpkg -r $*
|
||||
}
|
||||
|
||||
dpkg_arch() {
|
||||
dpkg --print-architecture
|
||||
}
|
||||
|
||||
require() {
|
||||
sw=()
|
||||
for package in "$@"; do
|
||||
if ! installed "$package" && ! installed_pkg "$package"; then
|
||||
sw+=("$package")
|
||||
fi
|
||||
done
|
||||
if [ ${#sw[@]} -gt 0 ]; then
|
||||
info "These packages will be installed in your system:\n${sw[*]}"
|
||||
apt_install ${sw[*]}
|
||||
[ $? -gt 0 ] && die "installation cancelled" 201
|
||||
fi
|
||||
}
|
||||
|
||||
require_pkg() {
|
||||
sw=()
|
||||
for package in "$@"; do
|
||||
if ! installed "$package" && ! installed_pkg "$package"; then
|
||||
sw+=("$package")
|
||||
fi
|
||||
done
|
||||
if [ ${#sw[@]} -gt 0 ]; then
|
||||
die "These packages must be installed in your system:\n${sw[*]}" 200
|
||||
fi
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source $( dirname $(readlink -e -- "${BASH_SOURCE}"))/io.sh || exit 255
|
||||
|
||||
########################################################
|
||||
# Testing functions
|
||||
########################################################
|
||||
|
||||
# $1 - command to exec
|
||||
assert_exec() {
|
||||
[ "$1" ] || exit 1
|
||||
local prefix="$(dt)${BOLD}${FWHITE}[TEST EXEC]"
|
||||
if $($1 1>/dev/null 2>&1); then
|
||||
local text="${BGREEN} PASSED"
|
||||
else
|
||||
local text="${BLRED} FAILED"
|
||||
fi
|
||||
print "${prefix} ${text} ${BRESET} ($?):${RESET} $1"
|
||||
}
|
||||
# usage:
|
||||
|
||||
# func1() {
|
||||
# return 0
|
||||
# }
|
||||
# func2() {
|
||||
# return 1
|
||||
# }
|
||||
# assert_exec "func1" # PASSED
|
||||
# assert_exec "func2" # FAILED
|
||||
# assert_exec "whoami" # PASSED
|
||||
|
||||
|
||||
# $1 - command to exec
|
||||
# $2 - expected output
|
||||
assert_output() {
|
||||
[ "$1" ] || exit 1
|
||||
[ "$2" ] && local expected="$2" || local expected=''
|
||||
local prefix="$(dt)${BOLD}${FWHITE}[TEST OUTP]"
|
||||
local output=$($1 2>&1)
|
||||
local code=$?
|
||||
if [[ "$output" == *"$expected"* ]]; then
|
||||
local text="${BGREEN} PASSED"
|
||||
else
|
||||
local text="${BLRED} FAILED"
|
||||
fi
|
||||
print "${prefix} ${text} ${BRESET} (${code}|${expected}):${RESET} $1"
|
||||
# print "\tOutput > $output"
|
||||
}
|
||||
# usage:
|
||||
|
||||
# func1() {
|
||||
# echo "some string"
|
||||
# }
|
||||
# func2() {
|
||||
# echo "another string"
|
||||
# }
|
||||
# expect_output "func1" "string" # PASSED
|
||||
# expect_output "func2" "some" # FAILED
|
||||
# expect_output "func2" "string" # PASSED
|
||||
|
||||
|
||||
# $1 - command to exec
|
||||
# $2 - expected exit-code
|
||||
assert_code() {
|
||||
[ "$1" ] || exit 1
|
||||
[ "$2" ] && local expected=$2 || local expected=0
|
||||
local prefix="$(dt)${BOLD}${FWHITE}[TEST CODE]"
|
||||
$($1 1>/dev/null 2>&1)
|
||||
local code=$?
|
||||
if [[ $code -eq $expected ]]; then
|
||||
local text="${BGREEN} PASSED"
|
||||
else
|
||||
local text="${BLRED} FAILED"
|
||||
fi
|
||||
print "${prefix} ${text} ${BRESET} (${code}|${expected}):${RESET} $1"
|
||||
}
|
||||
# usage:
|
||||
|
||||
# func1() {
|
||||
# # exit 0
|
||||
# return 0
|
||||
# }
|
||||
# func2() {
|
||||
# # exit 1
|
||||
# return 1
|
||||
# }
|
||||
# expect_code "func1" 0 # PASSED
|
||||
# expect_code "func1" 1 # FAILED
|
||||
# expect_code "func2" 0 # FAILED
|
||||
# expect_code "func2" 1 # PASSED
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#TODO source basic.sh
|
||||
#TODO source args-parser/args.sh
|
||||
|
||||
########################################################
|
||||
# Trap usage examples
|
||||
########################################################
|
||||
|
||||
# for sig in SIGHUP SIGINT SIGQUIT SIGABRT SIGKILL SIGTERM SIGTSTP; do
|
||||
# # shellcheck disable=SC2064
|
||||
# trap "set +x && echo && echo && echo '*** Прервано сигналом $sig, остановка ***' && exit" $sig
|
||||
# done
|
||||
|
||||
for sig in SIGHUP SIGINT SIGQUIT SIGABRT SIGKILL SIGTERM SIGTSTP; do
|
||||
trap "myfunc" $sig
|
||||
done
|
||||
|
||||
myfunc() {
|
||||
echo "trapped!"
|
||||
exit
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# https://forums.opensuse.org/t/networkmanager-shows-connection-to-lo/164441/13
|
||||
# https://man.archlinux.org/man/NetworkManager.conf.5.en#Device_List_Format
|
||||
# https://access.redhat.com/documentation/ru-ru/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/configuring-networkmanager-to-ignore-certain-devices_configuring-and-managing-networking
|
||||
|
||||
sudo touch /etc/NetworkManager/conf.d/10-ignore-veth.conf
|
||||
sudo tee <<EOF /etc/NetworkManager/conf.d/10-ignore-veth.conf > /dev/null
|
||||
# Disable virtual interfaces to be managed via NetworkManager
|
||||
[keyfile]
|
||||
unmanaged-devices=interface-name:veth*
|
||||
|
||||
EOF
|
||||
sudo systemctl reload NetworkManager
|
||||
@@ -1,57 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# My use case:
|
||||
# syncthing synchronizes ALL changes in DCIM directory on my android to PC.
|
||||
# I wanted files to be copied somewhere else on my PC to stay forever, so I
|
||||
# could sort them later and safely free some space on mobile without loss.
|
||||
# Also I wish to have some stupid log with history of such events.
|
||||
|
||||
# inotify-tools package must be installed!
|
||||
|
||||
# CHANGE THIS PARAMETERS to ones you needed
|
||||
dir_src="$HOME/Syncthing/Mobile/Camera"
|
||||
dir_dest="$HOME/some/safe/place"
|
||||
dir_logs="$HOME/inotifywait-cp-logs"
|
||||
regexp="[0-9]{8}_[0-9]{6}.*\.(jpg|mp4|gif)"
|
||||
mkdir -p "$dir_dest" "$dir_logs"
|
||||
|
||||
print() {
|
||||
echo -e "[`date '+%H:%M:%S'`] $*" \
|
||||
| tee -a "$dir_logs/`date '+%Y%m%d'`.log"
|
||||
}
|
||||
|
||||
copy () {
|
||||
if [ -f "$dir_dest/$1" ]; then
|
||||
print "SKIPPED:\t$dir_dest/$1"
|
||||
else
|
||||
cp "$dir_src/$1" "$dir_dest/$1"
|
||||
print "COPIED:\t$dir_src/$1 => $dir_dest/$1"
|
||||
fi
|
||||
}
|
||||
|
||||
print "START\t========================="
|
||||
|
||||
# First, try to backup files synced since last exec of this script
|
||||
ls -1 "$dir_src" \
|
||||
| grep -E "^${regexp}$" \
|
||||
| while read filename; do copy "$filename"; done
|
||||
|
||||
# Next, run inotifywait against source directory with args:
|
||||
# --quiet -- print less (only print events)
|
||||
# --monitor -- don't stop after first event (like infinite loop)
|
||||
# --event -- first syncthing creates hidden file to write data into
|
||||
# then renames it according to source file name, so here
|
||||
# we listen to MOVED_TO event to catch final filename
|
||||
# --format %f -- print only filename
|
||||
# --include -- filename regexp to catch event from, ensure your $regexp
|
||||
# is correct or remove line 53 to catch synced ALL files
|
||||
|
||||
inotifywait \
|
||||
--quiet \
|
||||
--monitor \
|
||||
--event moved_to \
|
||||
--format %f \
|
||||
--include "$regexp" \
|
||||
"$dir_src" \
|
||||
| while read filename; do copy "$filename"; done
|
||||
|
||||
print "FINISH\t========================="
|
||||
@@ -1,5 +0,0 @@
|
||||
# Backing up photos from Syncthing
|
||||
|
||||
More info:
|
||||
* 🇷🇺 [axenov.dev/резервное-копирование-фотографий-со](https://axenov.dev/резервное-копирование-фотографий-со/)
|
||||
* 🇺🇸 (planned to translate)
|
||||
@@ -1,19 +0,0 @@
|
||||
# Daemon file
|
||||
# Place or symlink it to /etc/systemd/system/inotifywait-cp.service
|
||||
# Enable and start: sudo systemctl enable --now inotifywait-cp
|
||||
# Check it: sudo systemctl status inotifywait-cp
|
||||
|
||||
[Unit]
|
||||
Description=Photosync from android
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
# correct these parameters as needed:
|
||||
User=user
|
||||
WorkingDirectory=/home/user
|
||||
ExecStart=bash /home/user/.local/bin/photosync-a53.sh
|
||||
|
||||
|
||||
[Install]
|
||||
WantedBy=network.target
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# My use case:
|
||||
# syncthing synchronizes ALL changes in DCIM directory on my android to PC.
|
||||
# I wanted files to be copied somewhere else on my PC to stay forever, so I
|
||||
# could sort them later and safely free some space on mobile without loss.
|
||||
# Also I wish to have some stupid log with history of such events.
|
||||
|
||||
# inotify-tools package must be installed!
|
||||
|
||||
# CHANGE THIS PARAMETERS to ones you needed
|
||||
dir_src="$HOME/Syncthing/Mobile/Camera"
|
||||
dir_dest="$HOME/some/safe/place"
|
||||
dir_logs="$HOME/inotifywait-cp-logs"
|
||||
regexp="[0-9]{8}_[0-9]{6}.*\.(jpg|mp4|gif)"
|
||||
|
||||
print() {
|
||||
echo -e "[`date '+%H:%M:%S'`] $*" \
|
||||
| tee -a "$dir_logs/`date '+%Y%m%d'`.log"
|
||||
}
|
||||
|
||||
copy () {
|
||||
mkdir -p "$dir_src" "$dir_dest" "$dir_logs"
|
||||
if [ -f "$dir_dest/$1" ]; then
|
||||
print "SKIPPED:\t$dir_dest/$1"
|
||||
else
|
||||
cp "$dir_src/$1" "$dir_dest/$1"
|
||||
print "COPIED:\t$dir_src/$1 => $dir_dest/$1"
|
||||
fi
|
||||
}
|
||||
|
||||
mkdir -p "$dir_src" "$dir_dest" "$dir_logs"
|
||||
|
||||
print "START\t========================="
|
||||
|
||||
# First, try to backup files synced since last exec of this script
|
||||
ls -1 "$dir_src" \
|
||||
| grep -E "^$regexp$" \
|
||||
| while read filename; do copy "$filename"; done
|
||||
|
||||
# Next, run inotifywait against source directory with args:
|
||||
# --quiet -- print less (only print events)
|
||||
# --monitor -- don't stop after first event (like infinite loop)
|
||||
# --event -- first syncthing creates hidden file to write data into
|
||||
# then renames it according to source file name, so here
|
||||
# we listen to MOVED_TO event to catch final filename
|
||||
# --format %f -- print only filename
|
||||
# --include -- filename regexp to catch event from, ensure your $regexp
|
||||
# is correct or remove line 56 to catch synced ALL files
|
||||
|
||||
inotifywait \
|
||||
--quiet \
|
||||
--monitor \
|
||||
--event moved_to \
|
||||
--format %f \
|
||||
--include "$regexp" \
|
||||
"$dir_src" \
|
||||
| while read filename; do copy "$filename"; done
|
||||
|
||||
print "FINISH\t========================="
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -exo pipefail
|
||||
|
||||
# https://www.linode.com/docs/guides/how-to-increase-swap-space-in-ubuntu/
|
||||
# https://help.ubuntu.com/community/SwapFaq
|
||||
|
||||
sudo swapon --show
|
||||
free -h
|
||||
df -h
|
||||
|
||||
if [ -f /swapfile ]; then
|
||||
set +x
|
||||
echo "Already exists"
|
||||
exit 1
|
||||
fi;
|
||||
|
||||
sudo fallocate -l 1G /swapfile
|
||||
sudo chmod 600 /swapfile
|
||||
sudo mkswap /swapfile
|
||||
sudo swapon /swapfile
|
||||
|
||||
sudo swapon --show
|
||||
free -h
|
||||
df -h
|
||||
|
||||
sudo cp /etc/fstab /etc/fstab.bak
|
||||
echo "/swapfile swap swap defaults 0 0" | sudo tee -a /etc/fstab
|
||||
sudo sysctl vm.swappiness=50
|
||||
echo "vm.swappiness=50" | sudo tee -a /etc/fstab
|
||||
|
||||
sudo swapon --show
|
||||
@@ -1,157 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Welcome to amusement park!
|
||||
|
||||
[[ "$1" = '--help' ]] || [[ "$1" = '-h' ]] && cat <<EOF && exit
|
||||
NetBeans docker wrapper for php
|
||||
===============================
|
||||
Anthony Axenov (c) 2023, The MIT License
|
||||
https://axenov.dev
|
||||
https://opensource.org/license/mit
|
||||
Replacement host php interpreter with dockerized one to run & debug cli php scripts.
|
||||
Usage:
|
||||
./$(basename $0) --container=<NAME> [--map=<PATH1>:<PATH2>] [PHP_ARGS] <SCRIPT> [SCRIPT_ARGS]
|
||||
Arguments:
|
||||
--container : docker container where your SCRIPT is located. Required.
|
||||
--map : sources path mapped from the host to container. Not required.
|
||||
PATH1 is an absolute path to php sources directory on the host.
|
||||
PATH2 is an absolute path of the same directory inside of container.
|
||||
Delimiter ':' is required. If PATH1, PATH2 or delimiter is missed
|
||||
or value is empty then error will be thrown.
|
||||
PHP_ARGS : arguments you can pass to real php interpreter according to its --help.
|
||||
Not required.
|
||||
SCRIPT : a path to script file (.php) to be executed in container. Required.
|
||||
Note that this file must exist inside or be available from that container.
|
||||
SCRIPT_ARGS : arguments to call your script with. They will be passed to script as is.
|
||||
Not required.
|
||||
Read this article to know how to set this helper as interpreter for NetBeans:
|
||||
ru: https://axenov.dev/netbeans-php-docker-xdebug-cli
|
||||
en: https://axenov.dev/en/netbeans-php-docker-xdebug-cli-en
|
||||
EOF
|
||||
|
||||
pwd=$(pwd) # current working directory
|
||||
cmdline=($@) # copy currently called command line to array
|
||||
collect_php_args=1 # should we collect php args or script ones?
|
||||
quiet=0 # should we print some useful data before executing?
|
||||
|
||||
# find a path where this wrapper is located
|
||||
wrapper_dir="$(dirname $0)"
|
||||
|
||||
# find a path where project is probably located
|
||||
project_dir="$(dirname $wrapper_dir)"
|
||||
|
||||
# here we check if this wrapper is global or local
|
||||
# but if it is set as global from nbproject dir of
|
||||
# current project then it is not detected as global
|
||||
# anyway behavior will be correct
|
||||
nbproject="$(basename $wrapper_dir)"
|
||||
[ "$nbproject" = 'nbproject' ] && is_global=0 || is_global=1
|
||||
|
||||
# prepare new array to collect php args
|
||||
declare -a php_cmd=("docker" "exec")
|
||||
|
||||
# and another one for script args
|
||||
declare -a script_args=()
|
||||
|
||||
# and one more for directory mapping
|
||||
declare -a map_arr=()
|
||||
|
||||
# iterate over arguments we received from netbeans
|
||||
for arg in "${cmdline[@]}"; do
|
||||
|
||||
# if this is a container name
|
||||
if [ "${arg::11}" = '--container' ]; then
|
||||
container="${arg:12}" # save it
|
||||
php_cmd+=("$container" 'php') # add php itself
|
||||
continue # jump to next iteration
|
||||
fi
|
||||
|
||||
# if this is a path map
|
||||
if [ "${arg::5}" = '--map' ]; then
|
||||
map="${arg:6}" # save it
|
||||
map_arr=(${map//:/ }) # split it and check if it is correct
|
||||
if [ -z "${map_arr[0]}" ] || [ -z "${map_arr[1]}" ]; then
|
||||
echo "ERROR: directory map is incorrect!"
|
||||
echo "Use $0 --help to get info about how to use this wrapper."
|
||||
echo "Exit code 3."
|
||||
exit 3
|
||||
fi
|
||||
continue # jump to next iteration
|
||||
fi
|
||||
|
||||
# if this is a container name
|
||||
if [ "${arg::7}" = '--quiet' ]; then
|
||||
quiet=1
|
||||
continue # jump to next iteration
|
||||
fi
|
||||
|
||||
# if this is an absolute path to a script file
|
||||
if [ -f "$arg" ]; then
|
||||
# make its path correct for container
|
||||
if [ "$map" ]; then # when paths are mapped
|
||||
# remove first part of map from an absolute filepath and append result to second map part
|
||||
filepath="${map_arr[1]}${arg##${map_arr[0]}}"
|
||||
else # when paths are NOT mapped
|
||||
# remove project path from absolute filepath
|
||||
filepath="${arg##$project_dir/}"
|
||||
fi
|
||||
php_cmd+=("$filepath") # append php args with filepath
|
||||
collect_php_args=0 # now we need to collect script args
|
||||
continue # jump to next iteration
|
||||
fi
|
||||
|
||||
if [ "$collect_php_args" = 1 ]; then # if we collect php args
|
||||
php_cmd+=("$arg") # add current arg to php args as is
|
||||
continue # jump to next iteration
|
||||
fi
|
||||
|
||||
script_args+=("$arg") # otherwise add current arg to script args as is
|
||||
done
|
||||
|
||||
# docker container name is required so we must halt here if there is no one
|
||||
if [ -z "$container" ]; then
|
||||
echo "ERROR: no docker container is specified!" >&2
|
||||
echo "Use $0 --help to get info about how to use this wrapper." >&2
|
||||
echo "Exit code 1." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# path to php script is also required so we must halt here too if there is no one
|
||||
if [ -z "$filepath" ]; then
|
||||
echo "ERROR: no script filepath is specified!" >&2
|
||||
echo "Use $0 --help to get info about how to use this wrapper." >&2
|
||||
echo "Exit code 2." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
cmdline="${php_cmd[*]} ${script_args[*]}" # make a command to execute
|
||||
|
||||
# print some important data collected above
|
||||
if [ "$quiet" = 0 ]; then
|
||||
echo "NetBeans docker wrapper for php"
|
||||
echo "==============================="
|
||||
echo -e "Container name: $container"
|
||||
echo -e "Script path: $filepath"
|
||||
echo -e "Directory mapping: ${map:-(none)}"
|
||||
echo -e "Command line:\n$cmdline\n"
|
||||
fi
|
||||
|
||||
# some debug output
|
||||
# echo "=== some debug output ========="
|
||||
# cat <<EOF | column -t
|
||||
# is_global $is_global
|
||||
# container $container
|
||||
# pwd $pwd
|
||||
# wrapper_dir $wrapper_dir
|
||||
# nbproject $nbproject
|
||||
# project_dir $project_dir
|
||||
# map $map
|
||||
# map_arr[0] ${map_arr[0]}
|
||||
# map_arr[1] ${map_arr[1]}
|
||||
# filepath $filepath
|
||||
# EOF
|
||||
# echo "==============================="
|
||||
|
||||
$cmdline # execute
|
||||
|
||||
# that's folks!
|
||||
@@ -1,107 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# https://gist.github.com/anthonyaxenov/b8336a2bc9e6a742b5a050fa2588d71e
|
||||
#####################################################################
|
||||
# #
|
||||
# Stupidly simple backup script for own projects #
|
||||
# #
|
||||
# Author: Anthony Axenov (Антон Аксенов) #
|
||||
# Version: 1.0 #
|
||||
# License: WTFPLv2 More info: https://axenov.dev/?p=1423 #
|
||||
# #
|
||||
#####################################################################
|
||||
|
||||
# database credentials ==============================================
|
||||
|
||||
DBUSER=
|
||||
DBPASS=
|
||||
DBNAME=
|
||||
DBCHARSET="utf8"
|
||||
|
||||
# date formats ======================================================
|
||||
|
||||
FMT_DT_DIR="%Y.%m.%d" # 2021.03.19
|
||||
FMT_DT_FILE="%H.%M" # 08.24
|
||||
FMT_DT_LOG="%H:%M:%S" # 08:24:15.168149413
|
||||
|
||||
# local storage =====================================================
|
||||
|
||||
LOCAL_BAK_DIR="/backup/$(date +$FMT_DT_DIR)"
|
||||
|
||||
# database backup file
|
||||
LOCAL_SQL_FILE="$(date +$FMT_DT_FILE)-db.sql.gz"
|
||||
LOCAL_SQL_PATH="$LOCAL_BAK_DIR/$LOCAL_SQL_FILE"
|
||||
|
||||
# project path and backup file
|
||||
LOCAL_SRC_DIR="/var/www/"
|
||||
LOCAL_SRC_FILE="$(date +$FMT_DT_FILE)-src.tar.gz"
|
||||
LOCAL_SRC_PATH="$LOCAL_BAK_DIR/$LOCAL_SRC_FILE"
|
||||
|
||||
# log file
|
||||
LOG_FILE="$(date +$FMT_DT_FILE).log"
|
||||
LOG_PATH="$LOCAL_BAK_DIR/$LOG_FILE"
|
||||
|
||||
log() {
|
||||
echo -e "[$(date +$FMT_DT_LOG)] $*" | tee -a "$LOG_PATH"
|
||||
}
|
||||
|
||||
# remote storage ====================================================
|
||||
|
||||
REMOTE_HOST="user@example.com"
|
||||
REMOTE_BAK_DIR="/backup/$(date +$FMT_DT_DIR)"
|
||||
REMOTE_SQL_PATH="$REMOTE_BAK_DIR/$LOCAL_SQL_FILE"
|
||||
REMOTE_SRC_PATH="$REMOTE_BAK_DIR/$LOCAL_SRC_FILE"
|
||||
REMOTE_LOG_PATH="$REMOTE_BAK_DIR/$LOG_FILE"
|
||||
|
||||
# start =============================================================
|
||||
|
||||
echo
|
||||
log "Start ----------------------------------------------------------------"
|
||||
log "Initialized parameters:"
|
||||
log "\tDB_USER\t\t= $DB_USER"
|
||||
log "\tDB_NAME\t\t= $DB_NAME"
|
||||
log "\tDB_CHARSET\t= $DB_CHARSET"
|
||||
log "\tLOCAL_SRC_DIR\t= $LOCAL_SRC_DIR"
|
||||
log "\tLOCAL_SRC_PATH\t= $LOCAL_SRC_PATH"
|
||||
log "\tLOCAL_SQL_PATH\t= $LOCAL_SQL_PATH"
|
||||
log "\tLOG_PATH\t= $LOG_PATH"
|
||||
log "\tREMOTE_HOST\t= $REMOTE_HOST"
|
||||
log "\tREMOTE_SQL_PATH\t= $REMOTE_SQL_PATH"
|
||||
log "\tREMOTE_SRC_PATH\t= $REMOTE_SRC_PATH"
|
||||
log "\tREMOTE_LOG_PATH\t= $REMOTE_LOG_PATH"
|
||||
|
||||
mkdir -p $LOCAL_BAK_DIR
|
||||
log "Created local dir: $LOCAL_BAK_DIR"
|
||||
|
||||
ssh $REMOTE_HOST mkdir -p $REMOTE_BAK_DIR
|
||||
log "Created remote dir: $REMOTE_BAK_DIR"
|
||||
|
||||
log "1/4 Dumping DB: $DBNAME..."
|
||||
mysqldump \
|
||||
--user="$DBUSER" \
|
||||
--password="$DBPASS" \
|
||||
--default-character-set="$DBCHARSET" \
|
||||
--opt \
|
||||
--quick \
|
||||
"$DBNAME" | gzip > "$LOCAL_SQL_PATH"
|
||||
# --opt Same as --add-drop-table, --add-locks, --create-options,
|
||||
# --quick, --extended-insert, --lock-tables, --set-charset,
|
||||
# and --disable-keys
|
||||
[ $? -gt 0 ] && log "ERROR: failed to create dump. Exit-code: $?" || log "\t- OK"
|
||||
|
||||
log "2/4 Sending database backup to $REMOTE_HOST..."
|
||||
rsync --progress "$LOCAL_SQL_PATH" "$REMOTE_HOST:$REMOTE_SQL_PATH"
|
||||
[ $? -gt 0 ] && log "ERROR: failed to send database backup. Exit-code: $?" || log "\t- OK"
|
||||
|
||||
log "3/4 Compressing project dir: $LOCAL_SRC_DIR..."
|
||||
tar -zcf "$LOCAL_SRC_PATH" "$LOCAL_SRC_DIR"
|
||||
[ $? -gt 0 ] && log "ERROR: failed to compress project. Exit-code: $?" || log "\t- OK"
|
||||
|
||||
log "4/4 Sending project backup to ${REMOTE_HOST}..."
|
||||
rsync --progress "$LOCAL_SRC_PATH" "$REMOTE_HOST:$REMOTE_SRC_PATH"
|
||||
[ $? -gt 0 ] && log "ERROR: failed to send project backup. Exit-code: $?" || log "\t- OK"
|
||||
|
||||
rsync --progress "$LOG_PATH" "$REMOTE_HOST:$REMOTE_LOG_PATH"
|
||||
|
||||
log "Finish!"
|
||||
log "Used space: $(du -h "$LOCAL_BAK_DIR" | tail -n1)"
|
||||
log "Free space: $(df -h | tail -n1 | awk '{print $4}')"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user