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
|
||||
|
||||
|
||||
############# Packages to install ########################################
|
||||
|
||||
macos_homebrew_essentials="python3 vim-nox tmux nano zsh git autossh mosh sshuttle lynx npm tidy mcfly ack ncdu shfmt"
|
||||
|
|
@ -9,10 +8,8 @@ raspberrypi_essentials="python3 python3-pip vim-nox python3-venv tmux nano zsh g
|
|||
raspberrypi_printer="cups printer-driver-gutenprint"
|
||||
raspberrypi_camera="python3-opencv"
|
||||
|
||||
|
||||
############# Packages install functions #################################
|
||||
|
||||
|
||||
install_python_linters() {
|
||||
pip3 install requests bs4 prospector black isort --break-system-packages
|
||||
}
|
||||
|
|
@ -31,9 +28,10 @@ if [ "$system_type" = "Darwin" ]; then
|
|||
|
||||
# install homebrew if it's missing
|
||||
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
|
||||
if [ $install_homebrew = "y" ]; then
|
||||
install_homebrew=${install_homebrew:-y}
|
||||
if echo "$install_homebrew" | grep -qi '^[yj]$'; then
|
||||
echo "Installing homebrew"
|
||||
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
|
||||
fi
|
||||
|
|
@ -45,72 +43,69 @@ fi
|
|||
if [ "$system_type" = "Linux" ]; then
|
||||
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
|
||||
if [ $install_raspberrypi_essentials = "y" ]; then
|
||||
install_raspberrypi_essentials=${install_raspberrypi_essentials:-y}
|
||||
if echo "$install_raspberrypi_essentials" | grep -qi '^[yj]$'; then
|
||||
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
|
||||
if [ $install_raspberrypi_printer = "y" ]; then
|
||||
install_raspberrypi_printer=${install_raspberrypi_printer:-y}
|
||||
if echo "$install_raspberrypi_printer" | grep -qi '^[yj]$'; then
|
||||
install_this_now="$install_this_now $raspberrypi_printer"
|
||||
fi
|
||||
|
||||
|
||||
echo "Install the packages for the camera? (y/n)"
|
||||
echo "Install the packages for the camera? (y/n, default=y)"
|
||||
read -r install_raspberrypi_camera
|
||||
if [ $install_raspberrypi_camera = "y" ]; then
|
||||
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
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
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
|
||||
if [ $enable_ufw = "y" ]; then
|
||||
enable_ufw=${enable_ufw:-y}
|
||||
if echo "$enable_ufw" | grep -qi '^[yj]$'; then
|
||||
ufw allow ssh
|
||||
ufw enable
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
############# Commands for both ##########################################
|
||||
|
||||
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
|
||||
if [ $set_default_shell = "y" ]; then
|
||||
set_default_shell=${set_default_shell:-y}
|
||||
if echo "$set_default_shell" | grep -qi '^[yj]$'; then
|
||||
chsh -s /bin/zsh
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Install all linters for vim? (y/n)"
|
||||
echo "Install all linters for vim? (y/n, default=y)"
|
||||
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_python_linters
|
||||
fi
|
||||
|
||||
|
||||
echo "Install the vim plugins now? (y/n)"
|
||||
echo "Install the vim plugins now? (y/n, default=y)"
|
||||
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
|
||||
echo "Done!"
|
||||
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
|
||||
41
bin/venv-new
41
bin/venv-new
|
|
@ -1,20 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
||||
# Warn if still in a venv
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
|
||||
python_versions=""
|
||||
for dir in $(echo "$PATH" | tr ':' ' '); 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
|
||||
# Überprüfe, ob die Datei existiert und ausführbar ist
|
||||
# Check if executable
|
||||
if [ -x "$version" ] && "$version" --version >/dev/null 2>&1; then
|
||||
python_versions="$python_versions $version"
|
||||
fi
|
||||
|
|
@ -27,27 +23,31 @@ if [ -z "$python_versions" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Entferne Duplikate und sortiere die Python-Versionen
|
||||
python_versions=$(echo "$python_versions" | tr ' ' '\n' | sort -u -r | tr '\n' ' ')
|
||||
# Remove duplicates
|
||||
python_versions=$(echo "$python_versions" | tr ' ' '\n' | sort -u -rV | tr '\n' ' ')
|
||||
|
||||
# Nummerierte Liste der Python-Versionen anzeigen
|
||||
echo "Installed Python3 versions:"
|
||||
i=1
|
||||
highest_version=""
|
||||
for version in $python_versions; do
|
||||
if [ $i -eq 1 ]; then
|
||||
highest_version=$(basename "$version")
|
||||
echo "$i) $(basename "$version") (default)"
|
||||
else
|
||||
echo "$i) $(basename "$version")"
|
||||
fi
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
# Benutzer nach der Auswahl fragen
|
||||
echo "Select the number of the Python version you want to use:"
|
||||
read user_choice
|
||||
|
||||
# Enter -> default
|
||||
if [ -z "$user_choice" ]; then
|
||||
user_choice=1
|
||||
fi
|
||||
|
||||
|
||||
# Überprüfen, ob die Eingabe eine Zahl ist
|
||||
# Check if int
|
||||
if echo "$user_choice" | grep -qE '^[0-9]+$'; then
|
||||
i=1
|
||||
for version in $python_versions; do
|
||||
|
|
@ -58,7 +58,7 @@ if echo "$user_choice" | grep -qE '^[0-9]+$'; then
|
|||
i=$((i + 1))
|
||||
done
|
||||
|
||||
# Überprüfen, ob eine gültige Auswahl getroffen wurde
|
||||
# Check if input is valid
|
||||
if [ -n "$python_version" ]; then
|
||||
echo "You selected: $version"
|
||||
else
|
||||
|
|
@ -73,19 +73,22 @@ fi
|
|||
# Additional parameter
|
||||
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
|
||||
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"
|
||||
fi
|
||||
|
||||
# Create venv
|
||||
echo "Creating venv..."
|
||||
$version -m venv venv $additional_parameters
|
||||
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
|
||||
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
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue