workan on pyenv
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# from https://askubuntu.com/questions/3299/how-to-run-cron-job-when-network-is-up
|
# from https://askubuntu.com/questions/3299/how-to-run-cron-job-when-network-is-up
|
||||||
# usage in root cron
|
# usage in root cron
|
||||||
## @reboot bash /usr/share/customscripts/ifnet "/usr/share/customscripts/webhook bootup" 2>> /var/log/cron.error.log
|
## @reboot bash /usr/share/customscripts/ifnet "/usr/share/customscripts/webhook bootup"
|
||||||
|
|
||||||
# Configurable values
|
# Configurable values
|
||||||
## How many times we should check if we're online - this prevents infinite looping
|
## How many times we should check if we're online - this prevents infinite looping
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# usage
|
||||||
|
## curl -s https://raw.githubusercontent.com/PrincessPi3/general-scripts-and-system-ssssssetup/refs/heads/main/customscripts/python_pyenv_setup.sh | sudo "$SHELL" && source ~/.zshrc && exec "$SHELL" && pyenv install 3:latest && pyenv global 3:latest
|
||||||
# set -e
|
# set -e
|
||||||
|
|
||||||
# set rcfile
|
# set rcfile
|
||||||
rcfile="$HOME/.zshrc" # zsh
|
rcfile="$HOME/.zshrc" # zsh
|
||||||
# rcfile="$USER/.bashrc" # bash
|
# rcfile="$USER/.bashrc" # bash
|
||||||
|
package_log="/home/princesspi/python_packages_removed.txt"
|
||||||
|
|
||||||
# check if a command exists, and if so, purge that package
|
# check if a command exists, and if so, purge that package
|
||||||
# usage: check_purge_package <package_name>
|
# usage: check_purge_package <package_name>
|
||||||
@@ -15,7 +18,7 @@ check_purge_package () {
|
|||||||
|
|
||||||
if [ $package_check -eq 0 ]; then # if package is found, purge it
|
if [ $package_check -eq 0 ]; then # if package is found, purge it
|
||||||
echo "purging $package_name"
|
echo "purging $package_name"
|
||||||
sudo apt purge $package_name -y
|
sudo apt purge $package_name -y 2>>"$package_log" 1>>"$package_log"
|
||||||
echo "finished purging $package_name"
|
echo "finished purging $package_name"
|
||||||
else # otherwise skip
|
else # otherwise skip
|
||||||
echo "no $package_name installation found, skipping uninstall"
|
echo "no $package_name installation found, skipping uninstall"
|
||||||
@@ -23,13 +26,20 @@ check_purge_package () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# cleanup previous python installs
|
# cleanup previous python installs
|
||||||
check_purge_package pyenv
|
check_purge_package pyenv*
|
||||||
check_purge_package python3
|
check_purge_package python3*
|
||||||
check_purge_package python2
|
check_purge_package python2*
|
||||||
check_purge_package python
|
check_purge_package python*
|
||||||
check_purge_package pip
|
check_purge_package pip*
|
||||||
check_purge_package pip3
|
check_purge_package pip3*
|
||||||
check_purge_package pip2
|
check_purge_package pip2*
|
||||||
|
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
echo "Autoremoving packages"
|
||||||
|
sudo apt autoremove -y 2>>"$package_log" 1>>"$package_log"
|
||||||
|
|
||||||
|
echo -e "DONE CLEARING OLD PACKAGES!\n\tRemoved packages logged to $package_log"
|
||||||
|
|
||||||
# remove any existing pyenv install
|
# remove any existing pyenv install
|
||||||
pyenv root 2>/dev/null 1>/dev/null # do it silently
|
pyenv root 2>/dev/null 1>/dev/null # do it silently
|
||||||
@@ -67,14 +77,14 @@ if [ $rc_pyalias_check -eq 0 ]; then # if aliases found
|
|||||||
echo "pyenv aliases already set up in $rcfile, skipping"
|
echo "pyenv aliases already set up in $rcfile, skipping"
|
||||||
else # if aliases not found, add python shit
|
else # if aliases not found, add python shit
|
||||||
echo "Setting up pyenv aliases in $rcfile"
|
echo "Setting up pyenv aliases in $rcfile"
|
||||||
echo "## python aliases" >> $rcfile
|
echo -e "\n## python aliases" >> $rcfile
|
||||||
echo 'alias py=python' >> $rcfile
|
echo 'alias py=python' >> $rcfile
|
||||||
echo 'alias py3=python' >> $rcfile
|
echo 'alias py3=python' >> $rcfile
|
||||||
echo 'alias py2=python' >> $rcfile
|
echo 'alias py2=python' >> $rcfile
|
||||||
echo 'alias python3=python' >> $rcfile
|
echo 'alias python3=python' >> $rcfile
|
||||||
echo 'alias python2=python' >> $rcfile
|
echo 'alias python2=python' >> $rcfile
|
||||||
echo 'alias pip3=pip' >> $rcfile
|
echo 'alias pip3=pip' >> $rcfile
|
||||||
echo 'alias pip2=pip' >> $rcfile
|
echo -e "alias pip2=pip\n" >> $rcfile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n\ndone~ :3~\n\treset shell with exec \"\$SHELL\"\n"
|
echo -e "\n\ndone~ :3~\n\treset shell with exec \"\$SHELL\"\n"
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "Setting up Github"
|
||||||
|
|
||||||
|
echo "Enter Github Classic Token (https://github.com/settings/tokens)"
|
||||||
|
read GITHUB_TOKEN
|
||||||
|
|
||||||
|
echo "Enter Email Address"
|
||||||
|
read EMAIL_ADDRESS
|
||||||
|
|
||||||
|
echo "Enter Github Username"
|
||||||
|
read GITHUB_USERNAME
|
||||||
|
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install git gh -y
|
||||||
|
|
||||||
|
echo "Saving Token to ~/.gh_token"
|
||||||
|
echo $GITHUB_TOKEN > ~/.gh_token
|
||||||
|
chmod 600 ~/.gh_token
|
||||||
|
|
||||||
|
echo "Logging into Github"
|
||||||
|
gh auth login --with-token < ~/.gh_token
|
||||||
|
gh auth setup-git
|
||||||
|
|
||||||
|
echo "Configuring Git"
|
||||||
|
git config --global user.email "$EMAIL_ADDRESS"
|
||||||
|
git config --global user.name "$GITHUB_USERNAME"
|
||||||
|
|
||||||
|
echo "DONE WOOO :3~"
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# usage in cron
|
# usage in cron
|
||||||
## @reboot bash /usr/share/customscripts/ifnet "/usr/share/customscripts/webhook bootup" 2>> /var/log/cron.error.log
|
## @reboot bash /usr/share/customscripts/ifnet "/usr/share/customscripts/webhook bootup"
|
||||||
# discord_webhook="https://discord.com/api/webhooks/yourwebhook"
|
# discord_webhook="https://discord.com/api/webhooks/yourwebhook"
|
||||||
discord_webhook=$(cat /usr/share/customscripts/webhook.txt)
|
discord_webhook=$(cat /usr/share/customscripts/webhook.txt)
|
||||||
ipaddr=$(hostname -I | grep -E -o "10.0.0.[0-9]{1,3}" | tr '\n' ' ')
|
ipaddr=$(hostname -I | grep -E -o "10.0.0.[0-9]{1,3}" | tr '\n' ' ')
|
||||||
|
|||||||
Reference in New Issue
Block a user