1 Commits

Author SHA1 Message Date
5970e9b968 Moved from ./install/todo 2022-07-04 22:13:41 +08:00
163 changed files with 849 additions and 5890 deletions

View File

@@ -1,13 +0,0 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
[{install/*, uninstall/*, upgrade/*}]
indent_style = space
indent_size = 4
[{packs/*, Makefile*}]
indent_style = tab
indent_size = 4

1
.gitignore vendored
View File

@@ -1,2 +1 @@
*.bak
*.log

13
LICENSE
View File

@@ -1,13 +0,0 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2022 Антон Аксенов <anthonyaxenov@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

331
Makefile
View File

@@ -1,347 +1,114 @@
# Autogenerated at 10.07.2025 23:45 using ./gen-makefile
.DEFAULT_GOAL := help
# Autogenerated at 04.07.2022 22:11 using ./gen-makefile.sh
#===============================================
# Scripts listed in ./install
#===============================================
##lamp: Apache + php + mariadb
lamp: apache php mariadb
##apache: Install apache2 (latest)
apache:
./install/apache
##apache2: Install apache2 (latest)
apache2:
@./install/apache2
##apt: Install software from apt
##apt: Install bunch of software from apt
apt:
@./install/apt
##canon-mg2500: Install Canon Pixma MG2500 + ppa
canon-mg2500:
@./install/canon-mg2500
./install/apt
##chrome: Install google chrome (latest)
chrome:
@./install/chrome
##clamav: ClamAV (WIP)
clamav:
@./install/clamav
./install/chrome
##composer: Install composer (latest)
composer:
@./install/composer
./install/composer
##docker: Install docker (latest) + ppa
##docker: Install docker (latest) + docker-compose (latest) + ppa
docker:
@./install/docker
./install/docker
##dots: Install dotfiles
dots:
@./install/dots
##droidcam: Install droidcam v1.9.0
##droidcam: Install droidcam v1.8.2
droidcam:
@./install/droidcam
./install/droidcam
##droidcam-obs: Install droidcam-obs plugin v1.5.1
droidcam-obs:
@./install/droidcam-obs
##flameshot: Install flameshot (latest)
flameshot:
@./install/flameshot
##frkn.deprecated: Install Wireguard + FRKN
frkn.deprecated:
@./install/frkn.deprecated
./install/droidcam-obs
##git: Install git (latest)
git:
@./install/git
./install/git
##golang: Install golang v1.21.0
##golang: Install golang v1.18.3
golang:
@./install/golang
./install/golang
##grub-customizer: Install grub-customizer (latest + ppa)
grub-customizer:
@./install/grub-customizer
##jbmono: Install JetBrains Mono fonts
jbmono:
@./install/jbmono
##grubc: Install grub-customizer (latest) + ppa
grubc:
./install/grubc
##kde-appmenu: Install KDE Window AppMenu Applet
kde-appmenu:
@./install/kde-appmenu
./install/kde-appmenu
##kde-backports: Install KDE Backports
kde-backports:
@./install/kde-backports
##kde-file-templates: Install file templates (KDE)
kde-file-templates:
@./install/kde-file-templates
##kde-portal: Install KDE portal
kde-portal:
@./install/kde-portal
##libreoffice: Install libreoffice
libreoffice:
@./install/libreoffice
##lite-xl: Install lite-xl v2.1.7
##lite-xl: Install lite-xl v2.0.5 (draft)
lite-xl:
@./install/lite-xl
./install/lite-xl
##mariadb: Install mariadb (latest) and php-mysql + phpMyAdmin (if php is installed)
mariadb:
@./install/mariadb
./install/mariadb
##nodejs: Install nodejs + npm via nvm
nodejs:
@./install/nodejs
##ntfy: Install ntfy (latest) + ppa
ntfy:
@./install/ntfy
##nvim: Install nvim + lazyvim
nvim:
@./install/nvim
##obs-studio: Install obs-studio (latest snap)
obs-studio:
@./install/obs-studio
##omz-clean: Install omz (latest)
omz-clean:
@./install/omz-clean
##omz-fancy: Install omz fancy (powerline10k + MesloLGS font)
omz-fancy:
@./install/omz-fancy
##openvpn: Install openvpn v2.6.3 (src)
openvpn:
@./install/openvpn
##papirus: Install papirus-icon-theme (latest)
papirus:
@./install/papirus
./install/nodejs
##pgsql: Install postgresql (latest) and php-pgsql (if php is installed)
pgsql:
@./install/pgsql
./install/pgsql
##php: Install php v8.4
##php: Install php v8.1 + ppa
php:
@./install/php
##phpcs: Install phpcs + php-cs-fixer
phpcs:
@./install/phpcs
##phpmd: Install phpmd
phpmd:
@./install/phpmd
##php-psalm: Install psalm
php-psalm:
@./install/php-psalm
##php-spx: Install php-spx
php-spx:
@./install/php-spx
##phpstan: Install phpstan
phpstan:
@./install/phpstan
##phpunit: Install phpunit
phpunit:
@./install/phpunit
./install/php
##postman: Install postman (latest)
postman:
@./install/postman
./install/postman
##qt5: Install qt5
qt5:
@./install/qt5
##rustdesk: Install rustdesk client (flatpak)
##rustdesk: Install rustdesk v1.1.8 (deb)
rustdesk:
@./install/rustdesk
##rustdesk-deb: Install rustdesk client v1.4.0 (deb)
rustdesk-deb:
@./install/rustdesk-deb
./install/rustdesk
##snap: Install bunch of software from snap
snap:
@./install/snap
##sublimemerge: Install Sublime Merge
sublimemerge:
@./install/sublimemerge
##sublimetext: Install Sublime Text
sublimetext:
@./install/sublimetext
##suld: Samsung Unified Linux Driver repo
suld:
@./install/suld
./install/snap
##syncthing: Install syncthing (latest) + ppa
syncthing:
@./install/syncthing
./install/syncthing
##telebit: Install telebit (latest)
telebit:
@./install/telebit
##telegram: Install telegram (latest)
telegram:
@./install/telegram
./install/telebit
##ulauncher: Install ulauncher (latest) + ppa
ulauncher:
@./install/ulauncher
./install/ulauncher
##vivaldi: Install Vivaldi + ppa
vivaldi:
@./install/vivaldi
##vscode: VSCode deb-package
vscode:
@./install/vscode
##wine: Install wine (latest) + ppa
##wine: Install wine (latest) + ppa (focal)
wine:
@./install/wine
##youtube-dl: Install youtube-dl (src)
youtube-dl:
@./install/youtube-dl
##ytdlcue: Install ytdlcue
ytdlcue:
@./install/ytdlcue
./install/wine
##zint: Install zint (latest)
zint:
@./install/zint
./install/zint
##zsh: Install vanilla zsh
##zsh: Install zsh + omz (latest)
zsh:
@./install/zsh
./install/zsh
#===============================================
# Scripts listed in ./packs
#===============================================
##lamp: [PACK] Apache + php + mariadb
lamp: apache phpstack mariadb
##obs: [PACK] Install OBS Studio + droidcam-obs
obs: obs-studio droidcam-obs
##omz: [PACK] zsh + omz + powerline10k + MesloLGS font
omz: zsh omz-clean omz-fancy
chsh -s /usr/bin/zsh
@exec zsh
##phptools: [PACK] Install only php tooling (composer, phpunit, psalm, phpcs, php-cs-fixer, phpmd)
phptools: composer php-psalm phpcs phpmd phpstan phpunit
##phpstack: [PACK] Install full php stack with tooling
phpstack: php phptools
#===============================================
# Scripts listed in ./upgrade
#===============================================
##^omz: Upgrade omz
^omz:
@./upgrade/omz
#===============================================
# Scripts listed in ./uninstall
#===============================================
##/apache2: Uninstall apache2
/apache2:
@./uninstall/apache2
##/canon-mg2500: Uninstall Canon Pixma MG2500 + ppa
/canon-mg2500:
@./uninstall/canon-mg2500
##/chrome: Uninstall google chrome
/chrome:
@./uninstall/chrome
##/composer: Uninstall composer
/composer:
@./uninstall/composer
##/docker: Uninstall docker + ppa
/docker:
@./uninstall/docker
##/grub-customizer: Uninstall grub-customizer with ppa
/grub-customizer:
@./uninstall/grub-customizer
##/lazynvim: <no description>
/lazynvim:
@./uninstall/lazynvim
##/lite-xl: Uninstall lite-xl
/lite-xl:
@./uninstall/lite-xl
##/omz: Uninstall omz
/omz:
@./uninstall/omz
##/sublimemerge: Uninstall Sublime Merge
/sublimemerge:
@./uninstall/sublimemerge
##/sublimetext: Uninstall Sublime Text
/sublimetext:
@./uninstall/sublimetext
##/vivaldi: Uninstall vivaldi + ppa
/vivaldi:
@./uninstall/vivaldi
##/wine: Uninstall wine
/wine:
@./uninstall/wine
#===============================================
# Service goals
#===============================================
self:
@./gen-makefile
##help: Show this help message
help: Makefile
@echo "Ubuntu software installator"
@echo
@echo "Usage:"
@echo "\tmake help\t - show this help"
@echo "\tmake self\t - regenerate Makefile (alias of ./gen-makefile)"
@echo "\tmake GOAL\t - install software"
@echo "\tmake ^GOAL\t - upgrade software"
@echo "\tmake /GOAL\t - uninstall software"
@echo "\nYou can combine GOALs, here are some examples:"
@echo "\tmake /docker docker"
@echo "\tmake php /docker ^omz"
@echo "\nAvailable GOALs:"
@sed -n 's/^##//p' $< | column -ts ':' | sed -e "s/^/\t/"
+%:
@make
@echo "\tmake <goal>\n"
@echo "Available goals:"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e "s/^/\t/"
##<goal>_: Same as 'cat ./install/<goal>.sh'
%_:
@cat ./install/$*.sh

View File

@@ -1,51 +1,61 @@
# My shell environment
# My Ubuntu environment
`make`-ready bunch of scripts for easily (de)installation of different software and bunch of useful handy functions for custom scripting.
`make`-ready bunch of scripts for easily installation of different software.
## Requirements
* Ubuntu >= 20.04 (not tested with version < 20)
* `bash`, `zsh` or other `sh`-compatible shell
* `make` (optional but recommended)
* `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.
* `wget` (necessary for some scripts)
* `git` (necessary for some scripts)
## Usage
```shell
# with git
git clone git@git.axenov.dev:anthony/shell.git --depth=1 --single-branch
### Clone this repo (recommended)
# without git
wget -qO - https://git.axenov.dev/anthony/shell/archive/master.tar.gz | tar -zxf -
```shell
# if git is installed
git clone git@git.axenov.dev:anthony/my-env.git --depth=1
# if git is not installed
wget -qO - https://git.axenov.dev/anthony/my-env/archive/master.tar.gz | tar -zxf -
# switch to repo dir
cd my-env
# get full list of `make` goals
cd shell && make
make help
# generate new ./Makefile and get full list of `make` goals
./gen-makefile.sh
```
## How to add my script?
### Selective straightforward installation
1. Create a new shell script in `./install`, `./upgrade` or `./uninstall` directory.
```shell
# from remote file
wget -qO - https://git.axenov.dev/anthony/my-env/raw/branch/master/install/apt.sh | bash
# from locally cloned repo
./install/apt.sh
```
## How to add a new software script?
1. Create new `./install/*.sh` script.
At the beggining of a file you must write these two lines:
```shell
#!/usr/bin/env bash
#!/bin/bash
##makedesc: Your description for Makefile
```
2. Make this script executable, e.g.:
```shell
sudo chmod a+x ./install/myscript
```
3. Test your script
4. Run `make self` to generate new `./Makefile`
2. Test your script
3. Run `./gen-makefile.sh` to generate new `./Makefile`
## How to create a pack?
## How to create packs?
You can create new file inside `./packs` dir.
Syntax is same as classic makefile.
It is important to add a comment with short description:
Syntax is same as classic makefile with one important and necessary addition -- a comment started with `##`:
```makefile
##mypack1: Pack description
@@ -53,42 +63,12 @@ mypack1: goal1 goal2 goalX ...
...
##mypackX: Pack description
mypackX: goalA goalB
mypackY: goalA goalB
@cp file1 file2
...
...
```
where:
* `mypack*` is the pack name of your choice
* `mypack*` is the pack name
* `goal*` are script names in `./install`
## Useful links and sources used
* https://gist.github.com/anthonyaxenov/d53c4385b7d1466e0affeb56388b1005
* https://gist.github.com/anthonyaxenov/89c99e09ddb195985707e2b24a57257d
* ...and other my [gists](https://gist.github.com/anthonyaxenov/) with [SHELL] prefix
* https://github.com/nvie/gitflow/blob/develop/gitflow-common (BSD License)
* https://github.com/petervanderdoes/gitflow-avh/blob/develop/gitflow-common (FreeBSD License)
* https://github.com/vaniacer/bash_color/blob/master/color
* https://misc.flogisoft.com/bash/tip_colors_and_formatting
* https://www-users.york.ac.uk/~mijp1/teaching/2nd_year_Comp_Lab/guides/grep_awk_sed.pdf
* https://www.galago-project.org/specs/notification/
* https://laurvas.ru/bash-trap/
* https://stackoverflow.com/a/52674277
* https://rtfm.co.ua/bash-funkciya-getopts-ispolzuem-opcii-v-skriptax/
* https://gist.github.com/jacknlliu/7c51e0ee8b51881dc8fb2183c481992e
* https://gist.github.com/anthonyaxenov/d53c4385b7d1466e0affeb56388b1005
* https://github.com/nvie/gitflow/blob/develop/gitflow-common
* https://github.com/petervanderdoes/gitflow-avh/blob/develop/gitflow-common
* https://gitlab.com/kyb/autorsync/-/blob/master/
* https://lug.fh-swf.de/vim/vim-bash/StyleGuideShell.en.pdf
* https://www.thegeekstuff.com/2010/06/bash-array-tutorial/
* https://www.distributednetworks.com/linux-network-admin/module4/ephemeral-reserved-portNumbers.php
* https://github.com/community-scripts/ProxmoxVE/tree/main/install
* https://github.com/community-scripts/ProxmoxVE/tree/main/misc
* https://faculty.cs.niu.edu/~hutchins/csci480/signals.htm
## License
[WTFPLv2](LICENSE) but other licences are also possible.

11
TODO.md
View File

@@ -1,11 +0,0 @@
# Todo list
* tdesktop (https://desktop.telegram.org)
* spoofdpi (https://git.axenov.dev/mirrors/SpoofDPI/tags)
* lazynvim (https://www.lazyvim.org)
* build: [flameshot](https://github.com/flameshot-org/flameshot#compilation)
* build: [rustdesk](https://github.com/rustdesk/rustdesk#build)
* update scripts (when possible)
* uninstall scripts (when possible)
* ...

12
experimental/flatpak Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
echo
echo "==============================================="
echo "Installing flatpak and its software..."
echo "==============================================="
echo
sudo apt install -y --autoremove \
flatpak \
gnome-software-plugin-flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

49
experimental/oci8 Normal file
View File

@@ -0,0 +1,49 @@
#!/bin/bash
echo
echo "==============================================="
echo "Installing oci8..."
echo "==============================================="
echo
# https://www.oracle.com/cis/database/technologies/instant-client/downloads.html
#check for
# wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip
# wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip -- only libociicus.so
# wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-sqlplus-linuxx64.zip
# wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-tools-linuxx64.zip
# wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxx64.zip
#unzip
sudo mkdir /opt/oracle/
sudo mv ~/Downloads/instant_client/ /opt/oracle/
sudo sh -c "echo /opt/oracle/instant_client > /etc/ld.so.conf.d/oracle-instantclient.conf"
sudo ldconfig
sudo apt install -y --autoremove \
php-dev \
php-pear \
build-essential \
libaio1 \
default-jdk
sudo pecl channel-update pecl.php.net
sudo pecl install oci8 # php8
#sudo pecl install oci8-2.2.0 # php7
#sh -c "echo '; priority=10' > /etc/php/7.4/mods-available/oci8.ini"
# sudo sh -c "echo 'extension=oci8.so' >> /etc/php/7.4/mods-available/oci8.ini"
# sudo chmod 0644 /etc/php/7.4/mods-available/oci8.ini
sudo phpenmod oci8
php -i | grep oci8
# instantclient,/opt/oracle/instant_client
# https://pecl.php.net/package/oci8
#sudo pecl install oci8-2.2.0

View File

@@ -0,0 +1,42 @@
#!/bin/bash
echo
echo "==============================================="
echo "Installing phpstorm-url-handler..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
# https://github.com/rozwell/phpstorm-url-handler/
# https://askubuntu.com/a/1023143
# https://askubuntu.com/a/919825
# https://medium.com/swlh/custom-protocol-handling-how-to-8ac41ff651eb
# https://www.linuxquestions.org/questions/linux-desktop-74/xdg-open-doesn%27t-recognize-custom-protocol-4175433062/#post4809984
sudo rm -rf /usr/bin/phpstorm-url-handler >/dev/null
sudo rm -rf ~/.local/share/applications/phpstorm-url-handler.desktop >/dev/null
sudo rm -rf /usr/share/applications/phpstorm-url-handler.desktop >/dev/null
if installed "git"; then
sudo git clone https://github.com/rozwell/phpstorm-url-handler.git /usr/src/phpstorm-url-handler
else
sudo wget https://github.com/rozwell/phpstorm-url-handler/archive/master.zip -O /tmp/phpstorm-url-handler.zip
sudo unzip /tmp/phpstorm-url-handler.zip -d /usr/src/phpstorm-url-handler
sudo rm -f /tmp/phpstorm-url-handler.zip
fi
info "Copy .desktop"
sudo cp /usr/src/phpstorm-url-handler/phpstorm-url-handler.desktop /usr/share/local/applications/phpstorm-url-handler.desktop
info "Symlink bin"
sudo cp /usr/src/phpstorm-url-handler/phpstorm-url-handler /usr/bin/phpstorm-url-handler
info "desktop-file-install"
sudo desktop-file-install phpstorm-url-handler.desktop
info "update-desktop-database"
sudo update-desktop-database -v 2>&1 | grep -E "^(.+)\/phpstorm-url-handler.desktop(.+)$"
info "xdg-mime"
xdg-mime default phpstorm-url-handler.desktop x-scheme-handler/phpstorm

46
experimental/samp-server Normal file
View File

@@ -0,0 +1,46 @@
#!/bin/bash
echo
echo "==============================================="
echo "Installing samp-server v03svr_R2-1..."
echo "==============================================="
echo
# https://sampwiki.blast.hk/wiki/Linux_Server
# https://team.sa-mp.com/wiki/Server.cfg_RU.html
cd $HOME
wget -qO - https://files.sa-mp.com/samp03svr_R2-1.tar.gz | tar -zxf -
# sudo dpkg --add-architecture i386
# sudo apt update
# sudo apt install -y libc6:i386
apt-get install ia32-libs
echo "echo Executing Server Config...
lanmode 0
rcon 1
language Russian
rcon_password bootsector
maxplayers 50
port 7777
hostname My Server
gamemode0 bare 1
filterscripts base gl_actions gl_property gl_realtime
announce 1
query 1
weburl
maxnpc 0
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 800.0
stream_rate 1000
timestamp 1
output 0
" > $HOME/samp03/server.cfg
ln -s $HOME/samp03/samp03svr /usr/local/bin/samp
echo
echo "Success! Now run via 'samp &'"
echo

12
experimental/wkhtmltopdf Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
echo
echo "==============================================="
echo "Installing wkhtmltopdf..."
echo "==============================================="
echo
# не тестировалось
wget "https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb" -O /tmp/wkhtmltopdf.deb
sudo dpkg -i /tmp/wkhtmltopdf.deb
rm /tmp/wkhtmltopdf.deb

View File

@@ -1,95 +0,0 @@
#!/usr/bin/env bash
[ -f Makefile ] && mv Makefile Makefile.bak
CHR_UPGRADE='^'
CHR_UNINSTALL='/'
cat << EOF > Makefile
# Autogenerated at $(date +'%d.%m.%Y %H:%M') using ${BASH_SOURCE[0]}
.DEFAULT_GOAL := help
#===============================================
# Scripts listed in ./install
#===============================================
EOF
for file in ./install/*; do
name=${file##*/}
name=${name%.sh}
desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
[ -z "$desc" ] && desc='<no description>'
echo -e "##${name}: ${desc}\n${name}:\n\t@${file}\n" >> Makefile
done;
cat << EOF >> Makefile
#===============================================
# Scripts listed in ./packs
#===============================================
EOF
for file in ./packs/*; do
cat "$file" >> Makefile
echo >> Makefile
done;
cat << EOF >> Makefile
#===============================================
# Scripts listed in ./upgrade
#===============================================
EOF
for file in ./upgrade/*; do
name=${file##*/}
name=${name%.sh}
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}\n" >> Makefile
done;
cat << EOF >> Makefile
#===============================================
# Scripts listed in ./uninstall
#===============================================
EOF
for file in ./uninstall/*; do
name=${file##*/}
name=${name%.sh}
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}\n" >> Makefile
done;
cat << EOF >> Makefile
#===============================================
# Service goals
#===============================================
self:
@./gen-makefile
help: Makefile
@echo "Ubuntu software installator"
@echo
@echo "Usage:"
@echo "\tmake help\t - show this help"
@echo "\tmake self\t - regenerate Makefile (alias of ./gen-makefile)"
@echo "\tmake GOAL\t - install software"
@echo "\tmake ${CHR_UPGRADE}GOAL\t - upgrade software"
@echo "\tmake ${CHR_UNINSTALL}GOAL\t - uninstall software"
@echo "\nYou can combine GOALs, here are some examples:"
@echo "\tmake ${CHR_UNINSTALL}docker docker"
@echo "\tmake php ${CHR_UNINSTALL}docker ${CHR_UPGRADE}omz"
@echo "\nAvailable GOALs:"
@sed -n 's/^##//p' $< | column -ts ':' | sed -e "s/^/\t/"
+%:
@make $*
EOF
echo "New ./Makefile has been generated!"
echo "Old one has been saved as ./Makefile.bak"
echo "Now run 'make' to get help"

34
gen-makefile.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
mv Makefile Makefile.bak
echo -e "# Autogenerated at $(date +'%d.%m.%Y %H:%M') using ${BASH_SOURCE[0]}\n" > Makefile
for file in ./packs/*; do
cat ${file} >> Makefile
done;
for file in ./install/*; do
name=${file##*/}
name=${name%.sh}
desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
[ -z "$desc" ] && desc='<no description>'
echo -e "##${name}: ${desc}\n${name}:\n\t${file}\n" >> Makefile
done;
cat << EOF >> Makefile
##help: Show this help message
help: Makefile
@echo "Usage:"
@echo "\tmake <goal>\n"
@echo "Available goals:"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e "s/^/\t/"
##<goal>_: Same as 'cat ./install/<goal>.sh'
%_:
@cat ./install/\$*.sh
EOF
echo "New ./Makefile has been generated!"
echo "Old one has been saved as ./Makefile.bak"
echo
make help

View File

@@ -1,20 +0,0 @@
#!/usr/bin/env bash
set -oe pipefail
__root__=$( dirname $(readlink -e -- "${BASH_SOURCE}"))
source $__root__/helpers/io.sh || exit 255
source $__root__/helpers/git.sh || exit 255
source $__root__/helpers/basic.sh || exit 255
source $__root__/helpers/debug.sh || exit 255
source $__root__/helpers/packages.sh || exit 255
title() {
[[ $__AAA_NO_TITLE = 1 ]] || {
[ "$1" ] && title="$1" || title="$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${BASH_SOURCE[1]})"
info
info "==============================================="
info "$title"
info "==============================================="
info
}
}

View File

@@ -1,46 +0,0 @@
#!/usr/bin/env bash
##makedesc: Example script
set -eo pipefail
install() {
echo
echo "==============================================="
echo "Installing example"
echo "==============================================="
echo
sleep 3
echo
echo "Finish! example v1.2.3"
echo
}
upgrade() {
echo
echo "==============================================="
echo "Upgrading example"
echo "==============================================="
echo
sleep 3
echo
echo "Finish! example v1.2.3"
echo
}
remove() {
echo
echo "==============================================="
echo "Removing example"
echo "==============================================="
echo
sleep 3
echo
echo "Finish!"
echo
}
case "$1" in
u|upgrade|update) upgrade ;;
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac

View File

@@ -1,46 +0,0 @@
#!/usr/bin/env bash
##makedesc: Manage anytype (deb)
set -eo pipefail
installDir="$HOME/install/anytype"
install() {
release="$(curl -s 'https://api.github.com/repos/anyproto/anytype-ts/releases/latest')"
tag="$(echo "$release" | jq -r '.tag_name')"
asset="$(echo "$release" | jq -r '.assets.[] | select(.name | test("amd64.deb$"))')"
url="$(echo "$asset" | jq -r '.browser_download_url')"
echo -e "$tag $url"
echo
echo "==============================================="
echo "Installing anytype $tag"
echo "==============================================="
echo
mkdir -p "$installDir"
filepath="$installDir/anytype_${tag}_amd46.deb"
wget "$url" -O "$filepath"
sudo dpkg -i "$filepath"
echo
echo "Finish! $tag"
echo
}
remove() {
echo
echo "==============================================="
echo "Removing anytype"
echo "==============================================="
echo
sudo apt purge -y anytype*
echo
echo "Finish!"
echo
}
case "$1" in
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac

12
install/apache Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
##makedesc: Install apache2 (latest)
echo
echo "==============================================="
echo "Installing apache2..."
echo "==============================================="
echo
sudo apt install -y --autoremove apache2
sudo service apache2 restart
apache2 -v

View File

@@ -1,46 +0,0 @@
#!/usr/bin/env bash
##makedesc: Manage apache2 (apt)
install() {
echo
echo "==============================================="
echo "Installing apache2"
echo "==============================================="
echo
sudo apt install -y apache2
sudo systemctl restart apache2
echo
echo "Finish! $(apache2 -v)"
echo
}
upgrade() {
echo
echo "==============================================="
echo "Upgrading apache2"
echo "==============================================="
echo
sudo apt upgrade -y apache2 apache2-data apache2-utils
sudo systemctl restart apache2
echo
echo "Finish! $(apache2 -v)"
echo
}
remove() {
echo
echo "==============================================="
echo "Removing apache2"
echo "==============================================="
echo
sudo apt purge -y apache2*
echo
echo "Finish!"
echo
}
case "$1" in
u|upgrade|update) upgrade ;;
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac

View File

@@ -1,50 +1,60 @@
#!/usr/bin/env bash
##makedesc: Install basic software from apt
#!/bin/bash
##makedesc: Install bunch of software from apt
sudo apt update && \
sudo apt upgrade -y --autoremove && \
sudo apt install -y \
alien \
apt-transport-https \
build-essential \
ca-certificates \
cmake \
curl \
dconf-editor \
default-jdk \
dialog \
gettext \
gnupg \
gparted \
hardinfo \
htop \
libaio1 \
libcurl4-gnutls-dev \
libexpat1-dev \
libghc-zlib-dev \
libssl-dev \
lsb-release \
make \
mc \
meld \
nano \
neofetch \
net-tools \
nmap \
p7zip-full \
easyeffects \
software-properties-common \
ubuntu-restricted-extras \
unzip \
vlc \
ffmpeg \
inotify-tools \
notify-osd \
fonts-open-sans \
libnotify-bin \
tree \
earlyoom
# terminator
# xclip
# sqlitebrowser
# etckeeper
echo
echo "==============================================="
echo "Installing software from apt..."
echo "==============================================="
echo
sudo apt update && sudo apt upgrade -y --autoremove
sudo apt install -y --autoremove \
apt-transport-https \
ca-certificates \
curl \
make \
cmake \
dialog \
build-essential \
software-properties-common \
libaio1 \
libssl-dev \
libghc-zlib-dev \
libcurl4-gnutls-dev \
libexpat1-dev \
gettext \
gnupg \
ubuntu-restricted-extras \
unzip \
mc \
htop \
nano \
neofetch \
default-jdk \
terminator \
dconf-editor \
alien \
meld \
vlc \
gparted \
hardinfo \
libreoffice \
pulseeffects \
lsp-plugins \
lsb-release \
net-tools \
nmap \
p7zip-full \
sqlitebrowser
# gnome-software \
# minder \
# redshift \
# redshift-gtk \
# nodejs \
# compiz \
# compizconfig-settings-manager \
# earlyoom \
# etckeeper \
# deepin-screenshot \
# geoclue-2.0 \
# at

View File

@@ -1,52 +0,0 @@
#!/usr/bin/env bash
##makedesc: Canon Pixma MG2500 + ppa
install() {
echo
echo "==============================================="
echo "Installing Canon Pixma MG2500 + ppa"
echo "==============================================="
echo
sudo add-apt-repository -y ppa:thierry-f/fork-michael-gruz
sudo apt install -y cnijfilter-mg2500series scangearmp-mg2500series
echo
echo "Finish!"
echo "Drivers for Canon Pixma MG2500 installed!"
echo "Now you must reboot PC and connect your printer."
echo
}
upgrade() {
echo
echo "==============================================="
echo "Upgrading Canon Pixma MG2500 + ppa"
echo "==============================================="
echo
sudo apt upgrade -y cnijfilter-mg2500series scangearmp-mg2500series
echo
echo "Finish! Canon Pixma MG2500 + ppa"
echo
}
remove() {
echo
echo "==============================================="
echo "Removing Canon Pixma MG2500 + ppa"
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 add-apt-repository -ry ppa:thierry-f/fork-michael-gruz
echo
echo "Finish!"
echo
}
case "$1" in
u|upgrade|update) upgrade ;;
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac

View File

@@ -1,56 +1,15 @@
#!/usr/bin/env bash
##makedesc: Google Chrome (latest)
#!/bin/bash
##makedesc: Install google chrome (latest)
set -eo pipefail
echo
echo "==============================================="
echo "Installing google chrome (latest)..."
echo "==============================================="
echo
# https://t.me/axenov_blog/251
dest="$HOME/install/deb"
deb="$dest/google-chrome.deb"
url="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
install() {
echo
echo "==============================================="
echo "Installing Google Chrome"
echo "==============================================="
echo
mkdir -p "$dest"
wget "$url" -O "$deb"
sudo dpkg -i "$deb"
echo
echo "Finish! $(google-chrome --version)"
echo
}
upgrade() {
echo
echo "==============================================="
echo "Upgrading Google Chrome"
echo "==============================================="
echo
mkdir -p "$dest"
wget "$url" -O "$deb"
sudo dpkg -i "$deb"
echo
echo "Finish! $(google-chrome --version)"
echo
}
remove() {
echo
echo "==============================================="
echo "Removing Google Chrome"
echo "==============================================="
echo
sudo dpkg -r google-chrome
echo
echo "Finish!"
echo
}
case "$1" in
u|upgrade|update) upgrade ;;
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac
# sudo snap install chromium
wget "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" -O /tmp/google-chrome-stable_current_amd64.deb
sudo dpkg -i /tmp/google-chrome-stable_current_amd64.deb
rm /tmp/google-chrome-stable_current_amd64.deb

View File

@@ -1,56 +0,0 @@
#!/usr/bin/env bash
##makedesc: ClamAV
set -eo pipefail
install() {
echo
echo "==============================================="
echo "Installing clamav"
echo "==============================================="
echo
sudo apt install -y clamav
echo "DatabaseMirror packages.microsoft.com/clamav" \
| sudo tee -a /etc/clamav/freshclam.conf
sudo freshclam
echo
echo "Finish!"
echo
}
upgrade() {
echo
echo "==============================================="
echo "Upgrading clamav"
echo "==============================================="
echo
sudo apt upgrade -y clamav
sudo freshclam
echo
echo "Finish!"
echo
}
remove() {
echo
echo "==============================================="
echo "Removing clamav"
echo "==============================================="
echo
sudo apt purge -y clamav*
echo
echo "Finish!"
echo
}
case "$1" in
u|upgrade|update) upgrade ;;
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac

View File

@@ -1,38 +1,56 @@
#!/usr/bin/env bash
#!/bin/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
echo
echo "==============================================="
echo "Installing composer (latest)..."
echo "==============================================="
echo
title
require php
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"
installed() {
command -v "$1" >/dev/null 2>&1
}
source "$HOME/.profile"
success "composer installed!"
composer --version
if installed "php"; then
if installed "composer"; then
echo "WARNING: You already have composer installed - removing to install actual version"
sudo apt remove -y --autoremove composer
sudo rm -f /bin/composer
sudo rm -f /usr/bin/composer
sudo rm -f /usr/local/bin/composer
sudo rm -rf /usr/src/composer
fi
sudo mkdir -m 0777 -p /usr/src/composer
cd /usr/src/composer
# https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
sudo cp /usr/src/composer/composer.phar /usr/local/bin/composer
cd - >/dev/null
sudo rm -rf /usr/src/composer/
installed "composer" && composer --version
else
echo "WARNING: You need to have php installed"
fi
# title "Installing composer.phar in home dir..."
# cd ~
# EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)"
# php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
# ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
# if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
# then
# >&2 echo 'ERROR: Invalid installer signature'
# rm composer-setup.php
# exit 1
# fi
# php composer-setup.php --quiet
# RESULT=$?
# rm composer-setup.php

View File

@@ -1,78 +1,34 @@
#!/usr/bin/env bash
##makedesc: Docker + ppa
#!/bin/bash
##makedesc: Install docker (latest) + docker-compose (latest) + ppa
echo
echo "==============================================="
echo "Installing docker (latest)..."
echo "==============================================="
echo
# https://docs.docker.com/engine/install/ubuntu/
# https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user
set -eo pipefail
doRemove() {
sudo apt purge -y docker* podman-docker containerd runc
}
install_() {
echo
echo "==============================================="
echo "Installing Docker"
echo "==============================================="
echo
doRemove
sudo apt install -y ca-certificates lsb-release
source /etc/os-release
codename="$VERSION_CODENAME"
key="/etc/apt/keyrings/docker.asc"
arch=$(dpkg --print-architecture)
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" -o "$key"
sudo chmod a+r $key
echo "deb [arch=$arch signed-by=$key] https://download.docker.com/linux/ubuntu $codename stable" \
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin
sudo usermod -aG docker "$(whoami)"
newgrp docker
echo
echo "Finish! $(docker --version)"
echo "Probably, you need to relogin to apply 'docker' group permanently."
echo
}
upgrade() {
echo
echo "==============================================="
echo "Upgrading Docker"
echo "==============================================="
echo
sudo apt upgrade -y \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin
echo
echo "Finish!"
echo
}
remove() {
echo
echo "==============================================="
echo "Removing Docker"
echo "==============================================="
echo
doRemove
echo
echo "Finish!"
echo
}
case "$1" in
u|upgrade|update) upgrade ;;
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac
sudo apt remove -y docker docker-engine docker.io containerd runc
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.gpg
sudo apt update
sudo apt install -y --autoremove \
docker-ce \
docker-ce-cli \
containerd.io \
docker-compose-plugin \
docker-compose
sudo usermod -aG docker anthony
echo
echo "You need to logout and log in again to apply docker group"
echo

View File

@@ -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"

View File

@@ -1,21 +1,20 @@
#!/usr/bin/env bash
##makedesc: Install droidcam v1.9.0
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
#!/bin/bash
##makedesc: Install droidcam v1.8.2
#TODO
exit
# https://www.dev47apps.com/droidcam/linux/
# https://droidcam.app/linux/
echo
echo "==============================================="
echo "Installing droidcam v1.8.2..."
echo "==============================================="
echo
title
mkdir -p ~/install/droidcam
wget -O /tmp/droidcam.zip https://files.dev47apps.net/linux/droidcam_1.8.2.zip
unzip -o /tmp/droidcam.zip -d ~/install/droidcam
rm -rf /tmp/droidcam.zip
cd ~/install/droidcam && sudo ./install-client
mkdir -p "$HOME/install/deb/"
download "https://beta.droidcam.app/go/droidCam.client.setup.deb" "$HOME/install/deb/droidcam_client_amd64.deb"
dpkg_install "$HOME/install/deb/droidcam_client_amd64.deb"
apt_install v4l2loopback-dkms
success "droidcam installed!"
info "Don't forget to install the android app:"
info "https://play.google.com/store/apps/developer?id=Dev47Apps"
echo
echo "Don't forget to install android app: https://play.google.com/store/apps/developer?id=Dev47Apps"
echo

View File

@@ -1,21 +1,9 @@
#!/usr/bin/env bash
#!/bin/bash
##makedesc: Install droidcam-obs plugin v1.5.1
#TODO
# ffmpeg -version | head -n 1 | awk '{print $3}'
# https://github.com/dev47apps/droidcam-obs-plugin/releases
exit
# 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/
echo
echo "==============================================="
@@ -23,21 +11,16 @@ 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!'
command -v "obs" >/dev/null 2>&1 || echo 'You need to install obs first!'
mkdir -p $HOMEinstall/droidcam-obs
mkdir -p ~/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 $HOMEinstall/droidcam-obs
unzip -o /tmp/droidcam-obs.zip -d ~/install/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"
cd ~/install/droidcam-obs && ./install.sh
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 "1) restart OBS if it is running right now"
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

View File

@@ -1,54 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install flameshot (latest)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
title
# https://github.com/flameshot-org/flameshot?tab=readme-ov-file#compilation
# sudo apt install -y --autoremove flameshot && \
# sudo systemctl restart flameshot
dir="$HOME/install"
clone_dir="$dir/flameshot"
mkdir -p "$dir"
sudo apt install -y \
g++ \
cmake \
build-essential \
qtbase5-dev \
qttools5-dev-tools \
libqt5svg5-dev \
qttools5-dev \
libqt5dbus5 \
libqt5network5 \
libqt5core5a \
libqt5widgets5 \
libqt5gui5 \
libqt5svg5
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. 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
cd "$clone_dir" && \
git pull && \
cmake -S . -B "$BUILD_DIR" && \
cmake --build "$BUILD_DIR"
[ $? = 0 ] && {
echo
success "flameshot installed!"
# /opt/flameshot/flameshot -v
echo
}

View File

@@ -1,38 +1,38 @@
#!/usr/bin/env bash
#!/bin/bash
##makedesc: Install git (latest)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
title
echo
echo "==============================================="
echo "Installing git (latest)..."
echo "==============================================="
echo
require make
installed() {
command -v "$1" >/dev/null 2>&1
}
ENVDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
! installed make && sudo apt install -y make
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"
fi
sudo make prefix=/usr/local all && \
sudo make prefix=/usr/local install
sudo rm -rf /usr/src/git
sudo git clone https://github.com/git/git.git --depth=1 /usr/src/git
sudo chown -R $USER: /usr/src/git
cd /usr/src/git/
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
! installed wget && sudo apt install -y wget
wget https://github.com/git/git/archive/master.zip -O /tmp/git.zip
sudo unzip -q /tmp/git.zip -d /usr/src/git
rm /tmp/git.zip
cd /usr/src/git/git-master
sudo make prefix=/usr/local all
sudo make prefix=/usr/local install
cd /usr/src
sudo rm -rf git
sudo git clone https://github.com/git/git.git --depth=1 /usr/src/git
sudo chown -R $USER: /usr/src/git
fi
[ $? = 0 ] && {
echo
success "git installed!"
git --version
echo
}
git --version

View File

@@ -1,55 +1,27 @@
#!/usr/bin/env bash
##makedesc: Install golang
#!/bin/bash
##makedesc: Install golang v1.18.3
# https://go.dev/dl/
# https://golang.org/doc/install
# https://github.com/udhos/update-golang/blob/master/update-golang.sh
# https://www.vultr.com/docs/install-the-latest-version-of-golang-on-ubuntu
set -eo pipefail
doRemove() {
[ -d "/usr/local/go" ] && sudo rm -rf "/usr/local/go"
}
[ $1 ] && VERSION="$1" || VERSION="1.18.3"
FILE="go$VERSION.linux-amd64.tar.gz"
install() {
dlUrl="https://go.dev/dl"
json=$(curl -sSL "$dlUrl/?mode=json")
version=$(echo "$json" | jq -r '.[0].version')
echo
echo "==============================================="
echo "Installing golang v$version"
echo "==============================================="
echo
latestJson=$(echo "$json" | jq -r '.[0].files.[] | select (.kind == "archive" and .os == "linux" 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
sudo chown "$USER": -R /usr/local/go
echo 'export PATH="/usr/local/go/bin:$PATH"' >> "$HOME/.profile"
echo "export GOPATH=\"\$HOME/.go\"" >> "$HOME/.profile"
echo
echo "Finish!"
go version
}
remove() {
echo
echo "==============================================="
echo "Removing golang"
echo "==============================================="
echo
doRemove
echo
echo "Finish!"
echo
}
case "$1" in
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac
echo
echo "==============================================="
echo "Installing golang v$VERSION..."
echo "==============================================="
echo
sudo rm -rf /usr/local/go && \
wget "https://golang.org/dl/$FILE" -O /tmp/$FILE && \
sudo tar -xzf /tmp/$FILE -C /usr/local && \
rm -rf /tmp/$FILE && \
sudo chown $USER: -R /usr/local/go && \
echo 'export PATH="$PATH:/usr/local/go/bin\"' >> $HOME/.profile && \
echo 'export GOPATH="$HOME/.go"' >> $HOME/.profile && \
# source ~/.profile && \
go version && \
echo "NOTE: now run 'source ~/.profile' to apply new env vars"

View File

@@ -1,15 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install grub-customizer (latest + ppa)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
title
sudo add-apt-repository -y ppa:danielrichter2007/grub-customizer && \
sudo apt install -y --autoremove grub-customizer
[ $? = 0 ] && {
echo
success "grub-customizer installed!"
grub-customizer -v
echo
}

11
install/grubc Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
##makedesc: Install grub-customizer (latest) + ppa
echo
echo "==============================================="
echo "Installing grub-customizer (latest)..."
echo "==============================================="
echo
sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt install -y --autoremove grub-customizer

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash (latest)
#!/bin/bash (latest)
##makedesc: Install KDE Window AppMenu Applet
echo
@@ -29,7 +29,7 @@ if installed 'git'; then
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 unzip /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

View File

@@ -1,9 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install KDE Backports
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
title
sudo add-apt-repository -y ppa:kubuntu-ppa/backports && \
sudo apt update && \
sudo apt full-upgrade

View File

@@ -1,118 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install file templates (KDE)
echo
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"
[Desktop Entry]
Name=Документ Markdown
Icon=text-markdown
Type=Link
URL=.source/template.md
EOF
echo "- PHP" ####################################################
cat <<EOF > "$TPL_SRC/template.php"
<?php
declare(strict_types=1);
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('log_errors', 1);
EOF
cat << EOF > "$TPL_DIR/php.desktop"
[Desktop Entry]
Name=PHP-скрипт
Icon=application-x-php
Type=Link
URL=.source/template.php
EOF
echo "- Shell" ####################################################
cat <<EOF > "$TPL_SRC/template.sh"
#!/usr/bin/env bash
EOF
cat << EOF > "$TPL_DIR/sh.desktop"
[Desktop Entry]
Name=Bash-скрипт
Icon=terminal
Type=Link
URL=.source/template.sh
EOF
echo "- Go" ####################################################
cat <<EOF > "$TPL_SRC/template.go"
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
EOF
cat << EOF > "$TPL_DIR/go.desktop"
[Desktop Entry]
Name=Golang файл
Type=Link
URL=.source/template.go
EOF
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/
FROM ubuntu:latest
EOF
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"
# 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"
[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

View File

@@ -1,19 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install KDE portal
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

View File

@@ -1,11 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install libreoffice
echo
echo "==============================================="
echo "Installing libreoffice..."
echo "==============================================="
echo
sudo apt update && \
sudo apt install -y --autoremove libreoffice

View File

@@ -1,55 +1,34 @@
#!/usr/bin/env bash
##makedesc: Install lite-xl v2.1.7
#!/bin/bash
##makedesc: Install lite-xl v2.0.5 (draft)
# https://github.com/lite-xl/lite-xl/releases
# https://lite-xl.com/setup/getting-started/
# DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT
# DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT
# DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT
# DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT
# DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT
# https://github.com/lite-xl/lite-xl
[ $1 ] && LITEXLVER="$1" || LITEXLVER="2.0.5"
echo
echo "==============================================="
echo "Installing lite-xl v2.1.7..."
echo "Installing lite-xl v${LITEXLVER}..."
echo "==============================================="
echo
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"
wget "https://github.com/lite-xl/lite-xl/releases/download/v${LITEXLVER}/lite-xl-linux-x86_64.tar.gz" -O /tmp/lite-xl.tar.gz
sudo tar -xzf /tmp/lite-xl.tar.gz -C /tmp
mkdir -p $HOME/.local/bin && cp /tmp/lite-xl/bin/lite-xl $HOME/.local/bin
cp -r /tmp/lite-xl/share $HOME/.local
rm -rf /tmp/lite-xl*
echo -e 'export PATH="$PATH:$HOME/.local/bin"' >> $HOME/.bashrc
[ -f $HOME/.zshrc ] && echo -e 'export PATH="$PATH:$HOME/.local/bin"' >> $HOME/.zshrc
xdg-desktop-menu forceupdate
rm -rf \
"$HOME/.local/bin/lpm" \
"$HOME/install/lite-xl" \
"$HOME/.local/bin/lite-xl" \
"$HOME/.local/share/lite-xl"
mkdir -vp \
"$untar_dir" \
"$HOME/.local/bin" \
"$HOME/.local/share/lite-xl"
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/"
# 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"
[Desktop Entry]
Type=Application
Name=Lite XL
Comment=A lightweight text editor written in Lua
Exec=$HOME/.local/bin/lite-xl %F
Icon=lite-xl
Terminal=false
StartupWMClass=lite-xl
Categories=Development;IDE;
MimeType=text/plain;
EOF
sudo update-desktop-database && \
xdg-desktop-menu forceupdate
echo
echo "Finish!"
echo
### uninstall
# rm -f $HOME/.local/bin/lite-xl
# rm -rf $HOME/.local/share/icons/hicolor/scalable/apps/lite-xl.svg \
# $HOME/.local/share/applications/org.lite_xl.lite_xl.desktop \
# $HOME/.local/share/metainfo/org.lite_xl.lite_xl.appdata.xml \
# $HOME/.local/share/lite-xl

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash
##makedesc: Install mariadb (latest) and php-mysql + phpMyAdmin (if php is installed)
echo

View File

@@ -1,66 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install nerd-fonts
set -eo pipefail
#TODO nokia-sans
downloadPath="$HOME/install/nerd-fonts"
installPath="$HOME/.local/share/fonts/"
url="https://github.com/ryanoasis/nerd-fonts/releases/latest/download"
fonts=(
FiraCode
FiraMono
JetBrainsMono
Meslo
Noto
RobotoMono
Ubuntu
UbuntuMono
UbuntuSans
)
install() {
echo
echo "==============================================="
echo "Installing nerd-fonts"
echo "==============================================="
echo
[[ -d "$downloadPath" ]] || mkdir -p "$downloadPath"
for fontname in "${fonts[@]}"; do
fontdir="$installPath/Nerd-$fontname"
wget "$url/$fontname.tar.xz" -O "$downloadPath/$fontname.tar.xz"
[[ -d "$installPath/$fontname" ]] || mkdir -p "$fontdir"
tar -xJf "$downloadPath/$fontname.tar.xz" -C "$fontdir"
done
fc-cache -vf "$installPath"
echo
echo "Finish!"
echo
}
remove() {
echo
echo "==============================================="
echo "Removing nerd-fonts"
echo "==============================================="
echo
find "$installPath" -type d -name "Nerd-*" -exec rm -rf {} +
fc-cache -vf "$installPath"
echo
echo "Finish!"
echo
}
case "$1" in
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash
##makedesc: Install nodejs + npm via nvm
echo
@@ -11,17 +11,20 @@ installed() {
command -v "$1" >/dev/null 2>&1
}
installed "nvm" && sudo apt install -y --autoremove nodejs npm nvm
# sudo apt install -y --autoremove nodejs npm
! installed "nvm" && wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
if !installed "nvm"; then
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
fi
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
if [ $(nvm current) == 'system' ]; then
echo "WARNING: You already have node installed - removing to install actual version"
sudo apt remove -y --autoremove nodejs npm
else
nvm install-latest-npm
fi
nvm install-latest-npm
nvm install node
nvm use node
echo "Finish!"
nvm current
installed "node" && nvm current
nvm ls

View File

@@ -1,25 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install ntfy (latest) + ppa
echo
echo "==============================================="
echo "Installing ntfy (latest) + ppa..."
echo "==============================================="
echo
# https://ntfy.sh/docs/install/#general-steps
installed() {
command -v "$1" >/dev/null 2>&1
}
! 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

View File

@@ -1,80 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install nvim + lazyvim
set -eo pipefail
# 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"
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
)
backup() {
echo "Backup configuration files..."
t=$(date +'%s')
for path in "${nvimDataPaths[@]}"; do
[[ -d "$path" ]] && cp -v "$path" "$path-$t.bak"
done
echo "Done"
}
install() {
echo
echo "==============================================="
echo "Installing neovim"
echo "==============================================="
echo
backup
wget "$url" -O "$downloadTarGz"
tar -xzf "$downloadTarGz" -C "$downloadPath"
sudo rm -rf "$installPath"
sudo mv "$downloadPath/nvim-linux-x86_64" "$installPath"
git clone --depth=1 --single-branch https://github.com/LazyVim/starter "$cfgPath"
rm -rf "$cfgPath/.git"
sudo update-desktop-database
xdg-desktop-menu forceupdate
echo
echo "Finish!"
nvim -v
echo
}
remove() {
echo
echo "==============================================="
echo "Removing nerd-fonts"
echo "==============================================="
echo
find "$downloadPath" -type d -name "Nerd-*" -exec rm -rf {} +
fc-cache -vf "$downloadPath"
echo
echo "Finish!"
echo
}
case "$1" in
b|backup) backup ;;
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac
# export PATH="$PATH:/opt/nvim-linux-x86_64/bin"

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install obs-studio (latest snap)
echo
echo "==============================================="
echo "Installing obs-studio (latest snap)..."
echo "==============================================="
echo
sudo snap install obs-studio

View File

@@ -1,19 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install omz (latest)
echo
echo "==============================================="
echo "Installing omz (latest)..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
if ! installed zsh || ! installed git || ! installed curl; then
echo "ERROR: you need git, zsh and curl to be installed!"
exit 1
fi
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

View File

@@ -1,60 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install omz fancy (powerline10k + MesloLGS font)
# https://gist.github.com/anthonyaxenov/b8460935d06b9f0da72def03d0f26515
# 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/
echo
echo "==============================================="
echo "Installing omz fancy: powerline10k + MesloLGS font..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
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

View File

@@ -1,31 +0,0 @@
#!/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/
[ "$1" ] && OVPNVER="$1" || OVPNVER='2.6.3'
title "Installing openvpn v${OVPNVER} (src)..."
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 &&
apt_install network-manager-openvpn \
network-manager-openvpn-gnome
[ $? = 0 ] && {
echo
success "openvpn installed!"
openvpn --version
echo
}

View File

@@ -1,27 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install papirus-icon-theme (latest)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
title
mkdir -p "$HOME/install/papirus-icon-theme" "$HOME/.local/share/icons/"
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"
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"
[ $? = 0 ] && {
echo
success "Papirus icons installed!"
info "You can find them in $HOME/.local/share/icons/"
echo
}

View File

@@ -1,14 +1,16 @@
#!/usr/bin/env bash
#!/bin/bash
##makedesc: Install postgresql (latest) and php-pgsql (if php is installed)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
title
echo
echo "==============================================="
echo "Installing postgresql (latest)..."
echo "==============================================="
echo
require postgresql postgresql-contrib && \
sudo service postgresql restart && \
{
echo
success "openvpn installed!"
postgres --version
echo
}
installed() {
command -v "$1" >/dev/null 2>&1
}
sudo apt install -y --autoremove postgresql postgresql-contrib
sudo service postgresql restart
installed 'php' && sudo apt install -y --autoremove php-pgsql

View File

@@ -1,42 +1,34 @@
#!/usr/bin/env bash
##makedesc: Install php v8.4
#!/bin/bash
##makedesc: Install php v8.1 + ppa
[ "$1" ] && PHPVER="$1" || PHPVER="8.4"
[ $1 ] && PHPVER="$1" || PHPVER="8.1"
echo
echo "==============================================="
echo "Installing php${PHPVER}..."
echo "==============================================="
echo
sudo LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
sudo apt install -y --autoremove \
php${PHPVER}-fpm \
php${PHPVER}-dev \
php${PHPVER}-apcu \
php${PHPVER}-bcmath \
php${PHPVER} \
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
# php${PHPVER}-ldap \
# php${PHPVER}-dba \
# php${PHPVER}-bcmath \
# php${PHPVER}-bz2 \
# php${PHPVER}-curl \
# php${PHPVER}-gd \
# php${PHPVER}-json \
# php${PHPVER}-mbstring \
# php${PHPVER}-mysql \
# php${PHPVER}-opcache \
# php${PHPVER}-pgsql \
# php${PHPVER}-soap \
# php${PHPVER}-xml \
# php${PHPVER}-xmlrpc \
# php${PHPVER}-xsl \
echo
echo "Finish!"
# php${PHPVER}-sqlite3 \
# php${PHPVER}-zip
# php${PHPVER}-dba
# php${PHPVER}-ldap
php -v
echo

View File

@@ -1,30 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install psalm
echo
echo "==============================================="
echo "Installing psalm..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
! 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

View File

@@ -1,46 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install php-spx
echo
echo "==============================================="
echo "Installing php-spx..."
echo "==============================================="
echo
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
[ -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
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/
; extension=spx.so
; spx.data_dir = '/tmp/spx'
spx.http_enabled = 0
spx.http_key = 'spx'
; spx.http_ip_whitelist = "127.0.0.1"
EOF
sudo ln -sf "/etc/php/${PHPVER}/mods-available/spx.ini" "/etc/php/${PHPVER}/cli/conf.d/99-spx.ini"
echo
echo "Finish!"
echo

View File

@@ -1,32 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install phpcs + php-cs-fixer
echo
echo "==============================================="
echo "Installing phpcs + php-cs-fixer..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
! 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

View File

@@ -1,30 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install phpmd
echo
echo "==============================================="
echo "Installing phpmd..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
! 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

View File

@@ -1,31 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install phpstan
echo
echo "==============================================="
echo "Installing phpstan..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
! 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

View File

@@ -1,31 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install phpunit
echo
echo "==============================================="
echo "Installing phpunit..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
! 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

View File

@@ -1,33 +1,27 @@
#!/usr/bin/env bash
#!/bin/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
echo
echo "==============================================="
echo "Installing postman (latest)..."
echo "==============================================="
echo
# set -ex
wget "https://dl.pstmn.io/download/latest/linux64" -O /tmp/postman.tar.gz
# sudo tar -xvzf /tmp/postman.tar.gz -C /usr/local/bin
sudo tar -xzf /tmp/postman.tar.gz -C /usr/local
rm /tmp/postman.tar.gz
sudo ln -s /usr/local/Postman/Postman /usr/local/bin/postman
title
echo "#!/usr/bin/env xdg-open
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" && \
symlink "$HOME/install/Postman/Postman" "$HOME/.local/bin/postman" && \
cat << EOF > "$HOME/.local/share/applications/Postman.desktop" && sudo update-desktop-database
[Desktop Entry]
Name=Postman
Exec=$HOME/.local/bin/postman %U
Icon=$HOME/install/Postman/app/icons/icon_128x128.png
Categories=Development,Network
Exec=/usr/local/bin/postman
Icon=/usr/local/Postman/app/icons/icon_128x128.png
Categories=Utility,Network
Terminal=false
Type=Application
Encoding=UTF-8
EOF
[ $? = 0 ] && {
echo
success "Postman installed!"
echo
}
" > $HOME/.local/share/applications/Postman.desktop
sudo update-desktop-database

View File

@@ -1,25 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install qt5
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

View File

@@ -1,24 +1,16 @@
#!/usr/bin/env bash
##makedesc: Install rustdesk client v1.4.2 (deb)
#!/bin/bash
##makedesc: Install rustdesk v1.1.8 (deb)
[ "$1" ] && RDVER="$1" || RDVER="1.4.2"
[ $1 ] && RDVER="$1" || RDVER="1.1.8"
echo
echo "==============================================="
echo "Installing rustdesk v$RDVER..."
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
wget "https://github.com/rustdesk/rustdesk/releases/download/$RDVER/$deb_name" -O "$deb"
sudo dpkg -i "$deb"
# 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
sudo apt install libxdo3
wget "http://github.com/rustdesk/rustdesk/releases/download/${RDVER}/rustdesk-${RDVER}.deb" -qO /tmp/rustdesk.deb
sudo dpkg -i /tmp/rustdesk.deb
rm /tmp/rustdesk.deb

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash
##makedesc: Install bunch of software from snap
echo
@@ -18,26 +18,27 @@ snapi() {
if ! installed snapd; then
sudo apt update
sudo apt install -y --autoremove snapd #gnome-software-plugin-snap
sudo apt install -y --autoremove snapd gnome-software-plugin-snap
fi
# snapi snap-store
snapi telegram-desktop
snapi code
# snapi phpstorm
snapi skype
# snapi audacity
# snapi flameshot
# snapi gtk-common-themes
# snapi gtk2-common-themes
# snapi kde-frameworks-5-core18
snapi zoom-client
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
# https://certbot.eff.org/
# snapi certbot
# sudo ln -sf /snap/bin/certbot /usr/bin/certbot
# sudo ln -s /snap/bin/certbot /usr/bin/certbot
# snapi mysql-workbench-community
snapi dbeaver-ce
# snapi discord
# snapi obs-studio

View File

@@ -1,45 +0,0 @@
#!/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
[ "$1" ] && SMVER="$1" || SMVER='2102'
title
mkdir -p "$HOME/install"
DEB_PATH="$HOME/install/sublime-merge_build-${SMVER}_amd64.deb"
BIN_PATH="/opt/sublime_merge/sublime_merge"
if [[ ! -f "$DEB_PATH" ]]; then
download https://download.sublimetext.com/sublime-merge_build-${SMVER}_amd64.deb "$DEB_PATH"
fi
sudo dpkg -i "$DEB_PATH"
# sudo cp -f $BIN_PATH $BIN_PATH.old
# 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
#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
echo
success "Sublime Merge installed!"
$BIN_PATH --version
echo

View File

@@ -1,37 +0,0 @@
#!/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
[ "$1" ] && STVER="$1" || STVER='4200'
title
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
success "Sublime Text installed!"
$BIN_PATH --version
echo

View File

@@ -1,20 +0,0 @@
#!/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
title
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
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/"

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash
##makedesc: Install syncthing (latest) + ppa
echo
@@ -24,5 +24,5 @@ sudo apt install -y --autoremove syncthing
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
ln -s $HOME/.local/share/applications/syncthing-start.desktop $HOME/.config/autostart/syncthing-start.desktop
# или демоном: https://habr.com/ru/post/350892/

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash
##makedesc: Install telebit (latest)
echo

View File

@@ -1,13 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install telegram (latest)
echo
echo "==============================================="
echo "Installing telegram (latest)..."
echo "==============================================="
echo
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

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash
##makedesc: Install ulauncher (latest) + ppa
echo
@@ -7,7 +7,5 @@ echo "Installing ulauncher (latest) + ppa..."
echo "==============================================="
echo
sudo add-apt-repository universe -y
sudo add-apt-repository ppa:agornostal/ulauncher -y
sudo apt update
sudo apt install ulauncher
sudo add-apt-repository ppa:agornostal/ulauncher
sudo apt install -y --autoremove ulauncher

View File

@@ -1,19 +0,0 @@
#!/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/
echo
echo "==============================================="
echo "Installing Vivaldi + ppa..."
echo "==============================================="
echo
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 && sudo apt install vivaldi-stable

View File

@@ -1,18 +0,0 @@
#!/usr/bin/env bash
##makedesc: VSCode deb-package
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
title
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"
code --version
echo
}

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
##makedesc: Install wine (latest) + ppa
#!/bin/bash
##makedesc: Install wine (latest) + ppa (focal)
echo
echo "==============================================="
@@ -9,6 +9,6 @@ echo
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 add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'
sudo apt install -y --autoremove winehq-stable
wine --version

View File

@@ -1,45 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install youtube-dl (src)
# https://github.com/ytdl-org/youtube-dl#installation
echo
echo "==============================================="
echo "Installing youtube-dl (src)..."
echo "==============================================="
echo
# 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
# curl -L https://yt-dl.org/downloads/latest/youtube-dl -o "$HOME/.local/bin/youtube-dl" && \
# sudo chmod +rx "$HOME/.local/bin/youtube-dl"
installed() {
command -v "$1" >/dev/null 2>&1
}
! 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

View File

@@ -1,15 +0,0 @@
#!/usr/bin/env bash
##makedesc: Install ytdlcue
# https://gist.github.com/anthonyaxenov/8e11f18493c8419ee7abc94a8ea0cfaf
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"

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash
##makedesc: Install zint (latest)
echo

View File

@@ -1,11 +1,56 @@
#!/usr/bin/env bash
##makedesc: Install vanilla zsh
#!/bin/bash
##makedesc: Install zsh + omz (latest)
echo
echo "==============================================="
echo "Installing vanilla zsh..."
echo "Installing zsh + omz (latest)..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
if ! installed git || ! installed curl; then
echo "ERROR: you need git and curl to be installed!"
exit 1
fi
sudo apt install -y --autoremove zsh
echo "source ~/.profile" >> "$HOME/.zshrc"
# sudo chsh -s $(which zsh)
# 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/
echo
echo "1. Installing oh-my-zsh..."
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
echo
echo "2. Installing powerlevel9k theme (legacy)..."
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
sed -i 's@^ZSH_THEME=.*$@ZSH_THEME="powerlevel9k/powerlevel9k"@g' ~/.zshrc
echo
echo "3. Installing powerline fonts..."
wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf
mkdir -p ~/.local/share/fonts/
mv PowerlineSymbols.otf ~/.local/share/fonts/
fc-cache -vf ~/.local/share/fonts/
mkdir -p ~/.config/fontconfig/conf.d/
mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/
echo
echo "4. Installing autosuggestions and syntax highlighting..."
git clone https://github.com/zsh-users/zsh-autosuggestions.git .oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git .oh-my-zsh/custom/plugins/zsh-syntax-highlighting
sed -i 's@plugins=(git)@plugins=(git zsh-autosuggestions zsh-syntax-highlighting)@g' ~/.zshrc
echo
echo "Finish! Log out of your session and login again."
echo

View File

@@ -1,2 +0,0 @@
##lamp: [PACK] Apache + php + mariadb
lamp: apache phpstack mariadb

2
packs/lamp.makefile Normal file
View File

@@ -0,0 +1,2 @@
##lamp: Apache + php + mariadb
lamp: apache php mariadb

View File

@@ -1,2 +0,0 @@
##obs: [PACK] Install OBS Studio + droidcam-obs
obs: obs-studio droidcam-obs

View File

@@ -1,4 +0,0 @@
##omz: [PACK] zsh + omz + powerline10k + MesloLGS font
omz: zsh omz-clean omz-fancy
chsh -s /usr/bin/zsh
@exec zsh

View File

@@ -1,2 +0,0 @@
##phptools: [PACK] Install only php tooling (composer, phpunit, psalm, phpcs, php-cs-fixer, phpmd)
phptools: composer php-psalm phpcs phpmd phpstan phpunit

View File

@@ -1,2 +0,0 @@
##phpstack: [PACK] Install full php stack with tooling
phpstack: php phptools

View File

@@ -1,6 +0,0 @@
# Shell-скрипты
Эти скрипты я писал в разное время для решения разных задач.
Чтобы они не растерялись по репозиториям и носителям, я решил собрать их здесь в одну кучу.
Я всегда использую Ubuntu в качестве своих настольных и серверных ОС, поэтому все эти скрипты писались и использовались в этих средах с версий 18.*.

120
scripts/db_backup.sh Executable file
View File

@@ -0,0 +1,120 @@
##############################################################
# Скрипт для автоматического резервного копирования
# базы данных.
#
# Автор: Антон Аксенов
# URL: anthonyaxenov.ru
# Email: anthonyaxenov@gmail.com
#
# Подробности о скрипте, подготовка к работе:
# https://anthonyaxenov.blogspot.ru/2017/05/cron-1.html
#
##############################################################
#!/bin/bash
# Данные для работы с БД
DBHOST=
DBUSER=
DBPASS=
DBNAME=
DBCHARSET="utf8"
# Даты
FMT_DT_DIR="%d-%m-%Y" # формат даты для директорий | 19-03-2021
FMT_DT_FILE="%H%M%S-%d%m%y" # формат даты для файлов | 082456-190321
FMT_DT_LOG="%H:%M:%S" # формат даты для лога | 08:24:15.168149413
# Локальное хранилище
LOCALDIR=/backup # полный путь директории для бэкапов
LOCALPATH=$LOCALDIR/$(date +$FMT_DT_DIR) # полный путь директории за сегодня
LOCALFILE=$LOCALPATH/$DBNAME-$(date +$FMT_DT_FILE).sql # полный путь к файлу дампа
# Облачное хранилище
CLOUDUSE=1 # Копировать ли в облако? Закомментировать строку, если не надо
CLOUDMNT=/mnt/yadisk # Точка монтирования облака относительно корня
CLOUDDIR=db_backup # Папка в облаке, куда будут лететь файлы (внутри папки CLOUDMNT, т.е. без / в начале)
CLOUDPATH=$CLOUDMNT/$CLOUDDIR/$DATE # полный путь к папке текущей даты в облаке относительно корня
CLOUDFILE=$CLOUDPATH/$DBNAME-$DATETIME.sql # полный путь к файлу дампа в облаке
CLOUDFILEGZ=$CLOUDFILE.gz # полный путь к архиву в облаке
# Путь к бекапу на примонтированном хранилище будет выглядеть так:
# /mnt/yadisk/db_backup/2017-01-01/mybigdatabase-2017-01-01-12-23-34.sql.gz
log() {
echo "[$(date +$FMT_DT_LOG)] $*"
}
is_dir() {
[ -d "$1" ]
}
# Начало процесса
echo "[--------------------------------[$(date +$FMT_DT_LOG)]--------------------------------]"
log $LOCALPATH
if ! is_dir $LOCALPATH; then # Если нет папки за сегодня
sudo mkdir -p $LOCALPATH # создаём её, ошибки игнорируем
[ $? -eq 0 ] && log "New directory: $LOCALPATH"
fi
log "Generate a database dump: '$DBNAME'..."
mysqldump \
-q \
--user=$DBUSER \
--host=$DBHOST \
--password=$DBPASS \
--opt \
--default-character-set=$DBCHARSET $DBNAME \
> $LOCALFILE
exit
if [[ $? -gt 0 ]]; then
# если дамп сделать не удалось (код завершения предыдущей команды больше нуля) - прерываем весь скрипт
log "Dumping failed! Script aborted."
exit 1
else # иначе - упаковываем его
log "Dumping successfull! Packing in GZIP..."
gzip $LOCALFILE # Упаковка
if [[ $? -ne 0 ]]; then # Если не удалась
log "GZipping failed! SQL-file will be uploaded."
GZIP_FAILED=1 # Создаём флажок, что упаковка сорвалась
else
log "Result file: $LOCALFILEGZ"
fi
if [[ $CLOUDUSE -eq 1 ]]; then # Если задано копирование в облако - делаем всякое такое
mount | grep "$CLOUDMNT" > /dev/null # Проверяем примонтировано ли уже у нас облако (вывод не важен)
if [[ $? -ne 0 ]]; then # Если нет
mount $CLOUDMNT # значит монтируем
fi
if [[ $? -eq 0 ]]; then # если монтирование успешно - копируем туда файл
log "Cloud: successfully mounted at $CLOUDMNT"
log "Cloud: copying started => $CLOUDFILEGZ"
if ! [[ -d $CLOUDPATH ]]; then # Если в облаке нет папки за сегодня
mkdir $CLOUDPATH 2> /dev/null # создаём её, ошибки игнорируем
fi
if [[ -f $LOCALFILEGZ && GZIP_FAILED -ne 1 ]]; then # Если у нас архивирование выше не сорвалось
cp -R $LOCALFILEGZ $CLOUDFILEGZ # Копируем архив
else
cp -R $LOCALFILE $CLOUDFILE # Иначе - копируем большой тяжёлый дамп
fi
if [[ $? -gt 0 ]]; then # Если не скопировался - просто сообщаем
log "Cloud: copy failed."
else # Если скопировался - сообщаем и размонтируем
log "Cloud: file successfully uploaded!"
umount $CLOUDMNT # Размонтирование облака
if [[ $? -gt 0 ]]; then # Сообщаем результат размонтирования (если необходимо)
log "Cloud: umount - failed!"
fi # Конец проверки успешного РАЗмонтирования
fi # Конец проверки успешного копирования
else # если монтирование НЕуспешно - сообщаем
log "Cloud: failed to mount cloud at $CLOUDMNT"
fi # Конец проверки успешного монтирования
fi # Конец проверки необходимости выгрузки в облако
fi # Конец проверки успешного выполнения mysqldump
log "Stat datadir space (USED): `du -h $LOCALPATH | tail -n1`" # вывод размера папки с бэкапами за текущий день
log "Free HDD space: `df -h /home|tail -n1|awk '{print $4}'`" # вывод свободного места на локальном диске
log "All operations completed!"
exit 0 # Успешное завершение скрипта

View File

@@ -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"

View File

@@ -1,11 +0,0 @@
#!/usr/bin/env bash
# X11:
# xrandr --listactivemonitors
# xrandr --output $OUTPUT --rotate (left|right|normal|...)
# Wayland KDE: https://www.reddit.com/r/kde/comments/11vrbwc/how_do_i_rotate_the_screen_on_kde_with_wayland/
# kscreen-doctor --outputs
OUTPUT='HDMI-A-1'
[ "$1" ] && DIRECTION="$1" || DIRECTION="normal" # (left|right|normal|inverted)
kscreen-doctor "output.$OUTPUT.rotation.$DIRECTION"

View File

@@ -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

View File

@@ -1,3 +0,0 @@
DUCK_TOKEN=
DUCK_DOMAINS=
DUCK_IP=

View File

@@ -1,2 +0,0 @@
.env
*.log

View File

@@ -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"

View File

@@ -1,3 +0,0 @@
#!/bin/bash
( crontab -l | grep -v -F "duckdns" ) | crontab -

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -1,12 +0,0 @@
#!/usr/bin/env bash
# https://code.visualstudio.com/docs/setup/linux
sudo rm -rf /etc/apt/sources.list.d/vscode*
cd /tmp
sudo apt install wget gpg apt-transport-https
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" |sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null
rm -f packages.microsoft.gpg
sudo apt update

View File

@@ -1,57 +0,0 @@
#!/usr/bin/env bash
# Очистка места на диске
# https://gist.github.com/anthonyaxenov/02c00c965be4eb5bb163a153abdf4c2b
# https://itsfoss.com/free-up-space-ubuntu-linux/
echo
echo
df -hx tmpfs
echo
echo
echo "[1/5] Removing apt caches and unused packages"
echo
sudo apt autoremove --purge
sudo apt autoclean
sudo apt clean
echo
echo "[2/5] Removing old system logs"
echo
sudo journalctl --vacuum-time=1d
sudo rm -rf /var/log/journal/user-*@*
sudo rm -rf /var/log/journal/system*@*
sudo rm /var/log/{syslog,dmesg,btmp}.*
sudo rm /var/log/{auth,dpkg,kern,alternatives,dmesg}.log.*
echo
echo "[3/5] Cleaning user trash and thumbnails"
echo
rm -rf ~/.local/share/Trash/files/*
rm -rf ~/.cache/thumbnails/*
echo
echo "[4/5] Cleaning out dangling docker objects"
echo
docker system prune -f
# docker system prune -af
echo
echo "[5/5] Removing disabled unused snaps"
echo
sudo snap list --all \
| awk '/disabled/{print $1, $3}' \
| while read snapname revision; do
sudo snap remove "$snapname" --revision="$revision"
done
echo
echo
df -hx tmpfs
echo
echo

View File

@@ -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
```

View File

@@ -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)'"

View File

@@ -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
}

View File

@@ -1,3 +0,0 @@
#!/usr/bin/env bash
source $( dirname $(readlink -e -- "${BASH_SOURCE}"))/io.sh || exit 255

View File

@@ -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
}

View File

@@ -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
}

Some files were not shown because too many files have changed in this diff Show More