Changes
This commit is contained in:
parent
bb48c563cc
commit
0a13950d78
5 changed files with 88 additions and 82 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
############# Packages to install ########################################
|
############# Packages to install ########################################
|
||||||
|
|
||||||
macos_homebrew_essentials="python3 vim-nox tmux nano zsh git autossh mosh sshuttle lynx npm tidy mcfly ack ncdu shfmt"
|
macos_homebrew_essentials="python3 vim-nox tmux nano zsh git autossh mosh sshuttle lynx npm tidy mcfly ack ncdu shfmt"
|
||||||
|
|
@ -9,17 +8,15 @@ raspberrypi_essentials="python3 python3-pip vim-nox python3-venv tmux nano zsh g
|
||||||
raspberrypi_printer="cups printer-driver-gutenprint"
|
raspberrypi_printer="cups printer-driver-gutenprint"
|
||||||
raspberrypi_camera="python3-opencv"
|
raspberrypi_camera="python3-opencv"
|
||||||
|
|
||||||
|
|
||||||
############# Packages install functions #################################
|
############# Packages install functions #################################
|
||||||
|
|
||||||
|
|
||||||
install_python_linters() {
|
install_python_linters() {
|
||||||
pip3 install requests bs4 prospector black isort --break-system-packages
|
pip3 install requests bs4 prospector black isort --break-system-packages
|
||||||
}
|
}
|
||||||
|
|
||||||
install_npm_linters() {
|
install_npm_linters() {
|
||||||
sudo npm install -g jsonlint
|
sudo npm install -g jsonlint
|
||||||
sudo npm install -g fixjson
|
sudo npm install -g fixjson
|
||||||
}
|
}
|
||||||
|
|
||||||
############# MacOS exclusive commands ###################################
|
############# MacOS exclusive commands ###################################
|
||||||
|
|
@ -29,88 +26,86 @@ system_type=$(uname -s)
|
||||||
|
|
||||||
if [ "$system_type" = "Darwin" ]; then
|
if [ "$system_type" = "Darwin" ]; then
|
||||||
|
|
||||||
# install homebrew if it's missing
|
# install homebrew if it's missing
|
||||||
if ! command -v brew >/dev/null 2>&1; then
|
if ! command -v brew >/dev/null 2>&1; then
|
||||||
echo "Install homebrew? (y/n)"
|
echo "Install homebrew? (y/n, default=y)"
|
||||||
read -r install_homebrew
|
read -r install_homebrew
|
||||||
if [ $install_homebrew = "y" ]; then
|
install_homebrew=${install_homebrew:-y}
|
||||||
echo "Installing homebrew"
|
if echo "$install_homebrew" | grep -qi '^[yj]$'; then
|
||||||
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
|
echo "Installing homebrew"
|
||||||
|
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
############# Raspberrypi exclusive commands #############################
|
############# Raspberrypi exclusive commands #############################
|
||||||
|
|
||||||
if [ "$system_type" = "Linux" ]; then
|
if [ "$system_type" = "Linux" ]; then
|
||||||
install_this_now=""
|
install_this_now=""
|
||||||
|
|
||||||
echo "Install the most important packages ($raspberrypi_essentials)? (y/n)"
|
echo "Install the most important packages ($raspberrypi_essentials)? (y/n, default=y)"
|
||||||
read -r install_raspberrypi_essentials
|
read -r install_raspberrypi_essentials
|
||||||
if [ $install_raspberrypi_essentials = "y" ]; then
|
install_raspberrypi_essentials=${install_raspberrypi_essentials:-y}
|
||||||
install_this_now="$install_this_now $raspberrypi_essentials"
|
if echo "$install_raspberrypi_essentials" | grep -qi '^[yj]$'; then
|
||||||
fi
|
install_this_now="$install_this_now $raspberrypi_essentials"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Install the packages for printing? (y/n)"
|
echo "Install the packages for printing? (y/n, default=y)"
|
||||||
read -r install_raspberrypi_printer
|
read -r install_raspberrypi_printer
|
||||||
if [ $install_raspberrypi_printer = "y" ]; then
|
install_raspberrypi_printer=${install_raspberrypi_printer:-y}
|
||||||
install_this_now="$install_this_now $raspberrypi_printer"
|
if echo "$install_raspberrypi_printer" | grep -qi '^[yj]$'; then
|
||||||
fi
|
install_this_now="$install_this_now $raspberrypi_printer"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Install the packages for the camera? (y/n, default=y)"
|
||||||
|
read -r install_raspberrypi_camera
|
||||||
|
install_raspberrypi_camera=${install_raspberrypi_camera:-y}
|
||||||
|
if echo "$install_raspberrypi_camera" | grep -qi '^[yj]$'; then
|
||||||
|
install_this_now="$install_this_now $raspberrypi_camera"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Install the packages for the camera? (y/n)"
|
if [ -n "$install_this_now" ]; then
|
||||||
read -r install_raspberrypi_camera
|
echo "Packages will be installed now!"
|
||||||
if [ $install_raspberrypi_camera = "y" ]; then
|
sudo apt update
|
||||||
install_this_now="$install_this_now $raspberrypi_camera"
|
for i in $install_this_now; do
|
||||||
fi
|
sudo apt-get install -y $i
|
||||||
|
done
|
||||||
|
fi
|
||||||
if [ -n "$install_this_now" ]; then
|
|
||||||
echo "Packages will be installed now!"
|
|
||||||
sudo apt update
|
|
||||||
for i in $install_this_now; do
|
|
||||||
sudo apt-get install -y $i
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if command -v ufw >/dev/null 2>&1; then
|
if command -v ufw >/dev/null 2>&1; then
|
||||||
echo "Enable the firewall (ufw with ssh allowed)? (y/n)"
|
echo "Enable the firewall (ufw with ssh allowed)? (y/n, default=y)"
|
||||||
read -r enable_ufw
|
read -r enable_ufw
|
||||||
if [ $enable_ufw = "y" ]; then
|
enable_ufw=${enable_ufw:-y}
|
||||||
ufw allow ssh
|
if echo "$enable_ufw" | grep -qi '^[yj]$'; then
|
||||||
ufw enable
|
ufw allow ssh
|
||||||
|
ufw enable
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
############# Commands for both ##########################################
|
############# Commands for both ##########################################
|
||||||
|
|
||||||
if command -v /bin/zsh >/dev/null 2>&1; then
|
if command -v /bin/zsh >/dev/null 2>&1; then
|
||||||
echo "Set zsh as default shell? (y/n)"
|
echo "Set zsh as default shell? (y/n, default=y)"
|
||||||
read -r set_default_shell
|
read -r set_default_shell
|
||||||
if [ $set_default_shell = "y" ]; then
|
set_default_shell=${set_default_shell:-y}
|
||||||
chsh -s /bin/zsh
|
if echo "$set_default_shell" | grep -qi '^[yj]$'; then
|
||||||
fi
|
chsh -s /bin/zsh
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Install all linters for vim? (y/n)"
|
echo "Install all linters for vim? (y/n, default=y)"
|
||||||
read -r install_linters
|
read -r install_linters
|
||||||
if [ $install_linters = "y" ]; then
|
install_linters=${install_linters:-y}
|
||||||
|
if echo "$install_linters" | grep -qi '^[yj]$'; then
|
||||||
install_npm_linters
|
install_npm_linters
|
||||||
install_python_linters
|
install_python_linters
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Install the vim plugins now? (y/n, default=y)"
|
||||||
echo "Install the vim plugins now? (y/n)"
|
|
||||||
read -r install_vim_plugins
|
read -r install_vim_plugins
|
||||||
if [ $install_vim_plugins = "y" ]; then
|
install_vim_plugins=${install_vim_plugins:-y}
|
||||||
|
if echo "$install_vim_plugins" | grep -qi '^[yj]$'; then
|
||||||
vim +'PlugInstall --sync' +qa
|
vim +'PlugInstall --sync' +qa
|
||||||
|
echo "Done!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
1
.config/yadm/encrypt
Normal file
1
.config/yadm/encrypt
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
important_git_repositories.txt
|
||||||
4
.config/yadm/hooks/post_pull
Executable file
4
.config/yadm/hooks/post_pull
Executable file
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
yadm alt
|
||||||
|
yadm perms
|
||||||
3
.local/share/yadm/archive
Normal file
3
.local/share/yadm/archive
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
Œ
ùÓИ;§ùŒäÒÀ0
|
||||||
|
?cÒóü‘¸ÙÊaä=Ë;=|¼ñë<C3B1>ò„$4y‡S;8÷<38> ¶»*ÇlQ,÷îþ“½ét?›Í¬ÀÅêxùìB«Ò¿‘—Z€=Ô;½©£¥þc6^Öò3É*ˆLÕ´Ë¢ˆ<C2A2>£HÇZ<ÇN<C387>L¢áb [<5B>™
|
||||||
|
eÏHô°9ç Yrþù&–*ÀM’Ml„£ê„Žoì4“úáÏbó¤ò*´êv&©¼tK3Ú#¥!À<>Ã!y¥“XþBÀ~jfÈàóÆy}F`Ê)•À^¶)g~`ež`…Ðæ<ìSJäÈ\ÓPû˜MAYæê€1µ,Ûen
|
||||||
43
bin/venv-new
43
bin/venv-new
|
|
@ -1,20 +1,16 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
# Warn if still in a venv
|
# Warn if still in a venv
|
||||||
|
|
||||||
if [ -n "$VIRTUAL_ENV" ]; then
|
if [ -n "$VIRTUAL_ENV" ]; then
|
||||||
echo "The current venv is still active! Run deactivate first!"
|
echo "The current venv is still active! Run 'deactivate' first!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
python_versions=""
|
python_versions=""
|
||||||
for dir in $(echo "$PATH" | tr ':' ' '); do
|
for dir in $(echo "$PATH" | tr ':' ' '); do
|
||||||
for version in "$dir"/python3.[0-9]*; do
|
for version in "$dir"/python3.[0-9]*; do
|
||||||
# Überprüfe, ob die Datei tatsächlich existiert (falls kein Treffer, wird $version auf "$dir/python3.[0-9]*" gesetzt)
|
|
||||||
if [ -e "$version" ]; then
|
if [ -e "$version" ]; then
|
||||||
# Überprüfe, ob die Datei existiert und ausführbar ist
|
# Check if executable
|
||||||
if [ -x "$version" ] && "$version" --version >/dev/null 2>&1; then
|
if [ -x "$version" ] && "$version" --version >/dev/null 2>&1; then
|
||||||
python_versions="$python_versions $version"
|
python_versions="$python_versions $version"
|
||||||
fi
|
fi
|
||||||
|
|
@ -27,27 +23,31 @@ if [ -z "$python_versions" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Entferne Duplikate und sortiere die Python-Versionen
|
# Remove duplicates
|
||||||
python_versions=$(echo "$python_versions" | tr ' ' '\n' | sort -u -r | tr '\n' ' ')
|
python_versions=$(echo "$python_versions" | tr ' ' '\n' | sort -u -rV | tr '\n' ' ')
|
||||||
|
|
||||||
# Nummerierte Liste der Python-Versionen anzeigen
|
|
||||||
echo "Installed Python3 versions:"
|
echo "Installed Python3 versions:"
|
||||||
i=1
|
i=1
|
||||||
|
highest_version=""
|
||||||
for version in $python_versions; do
|
for version in $python_versions; do
|
||||||
echo "$i) $(basename "$version")"
|
if [ $i -eq 1 ]; then
|
||||||
|
highest_version=$(basename "$version")
|
||||||
|
echo "$i) $(basename "$version") (default)"
|
||||||
|
else
|
||||||
|
echo "$i) $(basename "$version")"
|
||||||
|
fi
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
# Benutzer nach der Auswahl fragen
|
|
||||||
echo "Select the number of the Python version you want to use:"
|
echo "Select the number of the Python version you want to use:"
|
||||||
read user_choice
|
read user_choice
|
||||||
|
|
||||||
|
# Enter -> default
|
||||||
if [ -z "$user_choice" ]; then
|
if [ -z "$user_choice" ]; then
|
||||||
user_choice=1
|
user_choice=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if int
|
||||||
# Überprüfen, ob die Eingabe eine Zahl ist
|
|
||||||
if echo "$user_choice" | grep -qE '^[0-9]+$'; then
|
if echo "$user_choice" | grep -qE '^[0-9]+$'; then
|
||||||
i=1
|
i=1
|
||||||
for version in $python_versions; do
|
for version in $python_versions; do
|
||||||
|
|
@ -58,7 +58,7 @@ if echo "$user_choice" | grep -qE '^[0-9]+$'; then
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
# Überprüfen, ob eine gültige Auswahl getroffen wurde
|
# Check if input is valid
|
||||||
if [ -n "$python_version" ]; then
|
if [ -n "$python_version" ]; then
|
||||||
echo "You selected: $version"
|
echo "You selected: $version"
|
||||||
else
|
else
|
||||||
|
|
@ -73,19 +73,22 @@ fi
|
||||||
# Additional parameter
|
# Additional parameter
|
||||||
additional_parameters="--upgrade-deps --clear"
|
additional_parameters="--upgrade-deps --clear"
|
||||||
|
|
||||||
echo "Should the venv have access to the system packages? (y/n)"
|
echo "Should the venv have access to the system packages? (y/n, default=n)"
|
||||||
read -r add_system_packages
|
read -r add_system_packages
|
||||||
if [ "$add_system_packages" = "y" ]; then
|
add_system_packages=${add_system_packages:-n}
|
||||||
|
if echo "$add_system_packages" | grep -qi '^[yj]$'; then
|
||||||
additional_parameters="$additional_parameters --system-site-packages"
|
additional_parameters="$additional_parameters --system-site-packages"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create venv
|
echo "Creating venv..."
|
||||||
$version -m venv venv $additional_parameters
|
$version -m venv venv $additional_parameters
|
||||||
source ./venv/bin/activate
|
source ./venv/bin/activate
|
||||||
|
echo "Finished!\n"
|
||||||
|
|
||||||
# Install requirements.txt
|
|
||||||
echo "Install packages from requirements.txt? (y/n)"
|
echo "Install packages from requirements.txt? (y/n, default=y)"
|
||||||
read -r install_requirements_txt
|
read -r install_requirements_txt
|
||||||
if [ "$install_requirements_txt" = "y" ]; then
|
install_requirements_txt=${install_requirements_txt:-y}
|
||||||
|
if echo "$install_requirements_txt" | grep -qi '^[yj]$'; then
|
||||||
python3 -m pip install -r requirements.txt
|
python3 -m pip install -r requirements.txt
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue