Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/captainkyds_scripz/info.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: captainkyds_scripz
description: This script builds a command to clean unneeded apt files and upgrade your debian based system (Ubuntu, Debian or Kali).
version: 1.0.0
version: 1.0.1
author: captainkyds
license: MIT
git: https://github.com/captainkyds/captainkyds_scripts4wsl.git
Expand Down
41 changes: 26 additions & 15 deletions scripts/captainkyds_scripz/script.noshell
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
echo "color='tput setaf 5; tput bold" >> /usr/local/bin/upgrade
echo "reset=tput sgr0" >> /usr/local/bin/upgrade
echo '$(color); echo "time to clean out old apt files and upgrade. Here we go."; $(reset)' >> /usr/local/bin/upgrade
echo '$(color) echo "Starting the cleaning cycle."; $(reset)' >> /usr/local/bin/upgrade
echo 'apt clean -y' >> /usr/local/bin/upgrade
echo 'apt autoremove -y' >> /usr/local/bin/upgrade
echo '$(color); echo "All done cleaning now updating sources and upgrading your distro"; $(reset)' >> /usr/local/bin/upgrade
echo 'apt update' >> /usr/local/bin/upgrade
echo 'apt upgrade -y' >> /usr/local/bin/upgrade
echo 'apt dist-upgrade -y' >> /usr/local/bin/upgrade
echo '$(color); echo "the upgrade has been completed. Enjoy"; $(reset)' >> /usr/local/bin/upgrade
cat <<- "EOF" > /usr/local/bin/upgrade
#!/bin/bash

color="tput setaf 5; tput bold"
reset="tput sgr0"

if [ "$EUID" -ne 0 ]
then eval "$color"; echo "Please run as root"; eval "$reset"
exit
fi

eval "$color"; echo "time to clean out old apt files and upgrade. Here we go."; eval "$reset"
eval "$color"; echo "Starting the cleaning cycle."; eval "$reset"
apt clean -y
apt autoremove -y
eval "$color"; echo "All done cleaning now updating sources and upgrading your distro"; eval "$reset"
apt update
apt upgrade -y
apt dist-upgrade -y
eval "$color"; echo "the upgrade has been completed. Enjoy"; eval "$reset"
EOF

chmod +x /usr/local/bin/upgrade
upgrade

Expand All @@ -20,7 +31,7 @@ upgrade
# personally I do every 12 hours cause I don't wanna get caught with an exploitable system
# To have this script build the cron entry for you delete the # at the start of the next 4 lines

crontab -l
echo "* */12 * * * /usr/local/bin/upgrade > /dev/null 2>&1" >> crontab_new
crontab crontab_new
rm crontab_new
crontab -l
echo "* */12 * * * /usr/local/bin/upgrade > /dev/null 2>&1" >> crontab_new
crontab crontab_new
rm crontab_new