Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # Colors
- bold="\e[1m"
- gray="\e[2m"
- underlined="\e[4m"
- red="\e[31m"
- green="\e[32m"
- normal="\e[0m"
- script_exe=$(basename "${0}")
- check_sudo() {
- if [ "$EUID" -ne 0 ]; then
- echo -e "${red}Run this script as root${normal}\n"
- if [ $(ls | grep -o "${script_exe}") ]; then
- echo -e "${gray}$ ./${script_exe} [clean|update]"
- else
- echo -e "${gray}$ ${script_exe} [clean|update]"
- fi
- exit 1
- fi
- }
- update() {
- check_sudo
- echo -e "${bold}Updating...${normal}\n"
- cd /root
- echo -en "Updating database... "
- apt -qq update
- echo -e "${green}OK!${normal}"
- echo -en "Updating youtube-dl... "
- pip3 install -q -U youtube-dl
- echo -e "${green}OK!${normal}"
- echo -en "Upgrading packages... "
- apt-fast upgrade -y
- echo -e "${green}OK!${normal}"
- }
- clean() {
- check_sudo
- echo -e "${bold}Cleaning...${normal}\n"
- echo -en "Cleaning the PC... "
- rm -rf /var/cache/apt/archives/*
- echo -e "${green}OK!${normal}"
- echo -en "Cleaning the dima's home "
- cd /home/dima
- rm -rf .wget-hsts
- rm -rf .viminfo
- rm -rf .bash_history
- rm -rf .thumbnails
- rm -rf .cache/thumbnails
- rm -rf .sudo_as_admin_successfull
- rm -rf .node_repl_history
- rm -rf .cache/vlc
- echo -e "${green}OK!${normal}"
- }
- case "$1" in
- update)
- update
- ;;
- clean)
- clean
- ;;
- *)
- update
- clean
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement