From f3a2300c27e809a4a97c249ade03fe40ac6df77f Mon Sep 17 00:00:00 2001
From: tavo-wasd <gustavo@gustavocalvo.xyz>
Date: Tue, 28 May 2024 20:12:24 -0600
Subject: [PATCH] sudo is unnecessary

---
 awesome-software/debian-gnu-linux/README.md |  6 ++++--
 self_hosting/nextcloud/README.md            | 17 +++++++++--------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/awesome-software/debian-gnu-linux/README.md b/awesome-software/debian-gnu-linux/README.md
index 3915922..a7dee26 100644
--- a/awesome-software/debian-gnu-linux/README.md
+++ b/awesome-software/debian-gnu-linux/README.md
@@ -20,7 +20,7 @@ sudo apt-add-repository contrib non-free -y
 ### Non-free codecs & Microsoft Fonts
 
 ```shell
-sudo apt install vlc libavcodec-extra ttf-mscorefonts-installer
+sudo apt install vlc libavcodec-extra ttf-mscorefonts-installer -y
 ```
 
 #### (Extra) Nvidia drivers
@@ -34,7 +34,7 @@ sudo apt install nvidia-driver
 ```shell
 sudo dpkg --add-architecture i386 # Add 32bit packages
 sudo apt update                   # Apply changes
-sudo apt install steam-installer
+sudo apt install steam-installer -y
 ```
 
 Enable Proton under Settings > Compatibility > Enable Steam Play for all other titles
@@ -76,3 +76,5 @@ sudo locale-gen
 
 You should restart your computer after applying this changes,
 especially for flatpak and gpu drivers.
+
+## Recommended software
diff --git a/self_hosting/nextcloud/README.md b/self_hosting/nextcloud/README.md
index 7e52bfa..7858473 100644
--- a/self_hosting/nextcloud/README.md
+++ b/self_hosting/nextcloud/README.md
@@ -7,8 +7,7 @@ apt install -y curl nginx python3-certbot-nginx postgresql php php-{fpm,bcmath,b
 For some reason that installs apache2, remove it as we don't need it.
 
 ```shell
-apt purge apache2
-apt autoremove
+apt purge apache2 -y ; apt autoremove -y
 ```
 
 ### Check PHP version...
@@ -24,11 +23,13 @@ php -v | grep -o '[0-9].*(cli)' | cut -d '.' -f 1,2
 
 ```shell
 systemctl enable --now postgresql
-sudo -i -u postgres psql -c "CREATE USER nextcloud WITH PASSWORD 'DB_PASSWORD';"
-sudo -i -u postgres psql -c "CREATE DATABASE nextcloud TEMPLATE template0 ENCODING 'UTF8';"
-sudo -i -u postgres psql -c "ALTER DATABASE nextcloud OWNER TO nextcloud;"
-sudo -i -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE nextcloud TO nextcloud;"
-sudo -i -u postgres psql -c "GRANT ALL PRIVILEGES ON SCHEMA public TO nextcloud;"
+su -l postgres
+postgres$ psql -c "CREATE USER nextcloud WITH PASSWORD 'DB_PASSWORD';"
+postgres$ psql -c "CREATE DATABASE nextcloud TEMPLATE template0 ENCODING 'UTF8';"
+postgres$ psql -c "ALTER DATABASE nextcloud OWNER TO nextcloud;"
+postgres$ psql -c "GRANT ALL PRIVILEGES ON DATABASE nextcloud TO nextcloud;"
+postgres$ psql -c "GRANT ALL PRIVILEGES ON SCHEMA public TO nextcloud;"
+postgres$ exit
 ```
 
 # Nginx configuration & cert
@@ -36,10 +37,10 @@ I modified this config to be easily set up with SSL via certbot,
 but you can visit the following url for the official example:
 [Nextcloud's nginx example configuration](https://docs.nextcloud.com/server/19/admin_manual/installation/nginx.html).
 ```shell
+certbot certonly --nginx --register-unsafely-without-email --agree-tos -d YOURDOMAIN
 curl -L nextcloud-nginx.tavo.one | sed "s/cloud.example.com/YOURDOMAIN/g" | tee /etc/nginx/sites-available/nextcloud.conf 
 ln -s /etc/nginx/sites-available/nextcloud.conf /etc/nginx/sites-enabled/
 systemctl restart nginx
-certbot -d YOURDOMAIN --nginx --register-unsafely-without-email --agree-tos
 ```
 
 # Download & extract latest nextcloud