From fcdfc8d1b06b13ca2f1c61e92252cfa8c4e36932 Mon Sep 17 00:00:00 2001 From: Retro Sapphire <29125087+retro-sapphire@users.noreply.github.com> Date: Sun, 13 Feb 2022 18:36:53 +0530 Subject: [PATCH] unlicense --- LICENSE.txt | 24 ++++++++++++++++++++++++ README.md | 24 ++++++++++++++++++++++++ snap-nuke.sh | 44 ++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 LICENSE.txt create mode 100644 README.md diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..fdddb29 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/README.md b/README.md new file mode 100644 index 0000000..f7e7d5a --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Snap Nuke +This script nukes the snap package manager from Ubuntu. + +**Note**: This has only been tested on Ubuntu 20.04 LTS, and may not work +as intended on other versions. I will not be responsible for any damage if this +script breaks your pc. + +If you really want a snap-less Ubuntu that is guaranteed to not break, +you may want to try [Pop!_OS](https://pop.system76.com/) or [Linux Mint](https://linuxmint.com/) + +If you are a server administrator, I highly advise against running this script, since it hasn't +been tested on Ubuntu Server. Please use Debian Testing instead. It's basically normal Debian but +the packages are more up to date. This is also what Ubuntu uses as a baseline to build on top of. + +## Run the script +```bash +git clone https://github.com/grobo021/snap-nuke/ +cd snap-nuke +./snap-nuke.sh +``` + +## Legal +This repository is under the [unlicense](LICENSE.txt) license. You are free to use this however you want, +but we are NOT providing any warranty that the script wont break the system. You have been warned. diff --git a/snap-nuke.sh b/snap-nuke.sh index ccf5376..83743b9 100755 --- a/snap-nuke.sh +++ b/snap-nuke.sh @@ -1,12 +1,43 @@ #!/bin/bash +if [[ "$EUID" == 0 ]] +then +cat << EOF +┌──────────────────────────────────────────────────────────────────────┐ +│Please don't run this script as root as it may break you system. │ +│We will ask you for the password if we need root access. │ +└──────────────────────────────────────────────────────────────────────┘ +┬─┬ ノ( ゜-゜ノ) +EOF +exit +fi + +cat << EOF +┌──────────────────────────────────────────────────────────────────────┐ +│This Bash Script is made by u/Techno021 to nuke snaps from Ubuntu. │ +│ │ +│Note: This has only been tested on Ubuntu 20.04 LTS, and may not work │ +│as intended on other versions. I will not be responsible for any │ +│damage if this script breaks your pc │ +└──────────────────────────────────────────────────────────────────────┘ +EOF + +while true; do + read -p "Do you wish to run the script? " yn + case $yn in + [Yy]* ) break;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; + esac +done + sudo snap remove $(snap list | awk '!/^Name|^core|^bare|^snapd/ {print $1}') sudo snap remove $(snap list | awk '/^bare/ {print $1}') sudo snap remove $(snap list | awk '/^core/ {print $1}') sudo snap remove $(snap list | awk '/^snapd/ {print $1}') -for VARIABLE in $(df -h | awk '/snap/ {print $6}') +for I in $(df -h | awk '/snap/ {print $6}') do - sudo umount $VARIABLE + sudo umount $I done sudo cp nosnap.pref /etc/apt/preferences.d/nosnap.pref @@ -16,3 +47,12 @@ rm -rf ~/snap sudo rm -rf /snap sudo rm -rf /var/snap sudo rm -rf /var/lib/snapd + +cat << EOF +┌─────────────────────────────────────────────────────────────────────┐ +│All Done! This script has succesfully completed, please reboot so │ +│that changes take effect. │ +└─────────────────────────────────────────────────────────────────────┘ +(╯°□°)╯︵ ┴─┴ +EOF +echo