Update KARBS

This commit is contained in:
Kristofers Solo 2022-11-28 00:48:32 +02:00
parent e32f9c9561
commit e41a60963c
16 changed files with 158 additions and 123 deletions

View File

@ -2,5 +2,5 @@ from django.apps import AppConfig
class KarbsConfig(AppConfig): class KarbsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField' default_auto_field = "django.db.models.BigAutoField"
name = 'karbs' name = "karbs"

View File

@ -2,6 +2,6 @@ from django.urls import path
from . import views from . import views
urlpatterns = [ urlpatterns = [
path('', views.karbs, name='karbs'), path("", views.karbs, name="karbs"),
path('instructions', views.instructions, name='instructions'), path("instructions", views.instructions, name="instructions"),
] ]

View File

@ -3,9 +3,9 @@ from django.shortcuts import render, redirect
def instructions(request): def instructions(request):
"""Karbs Instruction""" """Karbs Instruction"""
return render(request, 'karbs/instructions.html', {'title': 'Karbs Instructions'}) return render(request, "karbs/instructions.html", {"title": "Karbs Instructions"})
def karbs(request): def karbs(request):
"""Karbs install script""" """Karbs install script"""
return render(request, 'karbs/karbs.sh', {'title': 'KARBS'}) return render(request, "karbs/karbs", {"title": "KARBS"})

View File

@ -11,6 +11,6 @@ import os
from django.core.asgi import get_asgi_application from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'kristofersxyz.settings') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kristofersxyz.settings")
application = get_asgi_application() application = get_asgi_application()

View File

@ -1,7 +1,7 @@
""" """
Django settings for kristofersxyz project. Django settings for kristofersxyz project.
Generated by 'django-admin startproject' using Django 4.0.5. Generated by "django-admin startproject" using Django 4.0.5.
For more information on this file, see For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/ https://docs.djangoproject.com/en/4.0/topics/settings/
@ -14,81 +14,77 @@ import json
from pathlib import Path from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / "subdir".
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
if Path(BASE_DIR, 'debug').is_file(): # if `debug` files exists # SECURITY WARNING: don"t run with debug turned on in production!
# SECURITY WARNING: don't run with debug turned on in production! DEBUG = Path(BASE_DIR, "debug").is_file()
DEBUG = True
with open(Path(BASE_DIR, 'config.json'), 'r', encoding='UTF-8') as config_file:
config = json.load(config_file)
else:
DEBUG = False
with open('/etc/config.json', 'r', encoding='UTF-8') as config_file:
config = json.load(config_file)
with open(Path(BASE_DIR, "config.json"), "r", encoding="UTF-8") as config_file:
config = json.load(config_file)
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config['SECRET_KEY'] SECRET_KEY = config["SECRET_KEY"]
ALLOWED_HOSTS = config['ALLOWED_HOSTS'] ALLOWED_HOSTS = config["ALLOWED_HOSTS"]
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'django.contrib.admin', "django.contrib.admin",
'django.contrib.auth', "django.contrib.auth",
'django.contrib.contenttypes', "django.contrib.contenttypes",
'django.contrib.sessions', "django.contrib.sessions",
'django.contrib.messages', "django.contrib.messages",
'django.contrib.staticfiles', "django.contrib.staticfiles",
'main', "main",
'karbs', "karbs",
] ]
MIDDLEWARE = [ MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware', "django.middleware.security.SecurityMiddleware",
'django.contrib.sessions.middleware.SessionMiddleware', "django.contrib.sessions.middleware.SessionMiddleware",
'django.middleware.common.CommonMiddleware', "django.middleware.common.CommonMiddleware",
'django.middleware.csrf.CsrfViewMiddleware', "django.middleware.csrf.CsrfViewMiddleware",
'django.contrib.auth.middleware.AuthenticationMiddleware', "django.contrib.auth.middleware.AuthenticationMiddleware",
'django.contrib.messages.middleware.MessageMiddleware', "django.contrib.messages.middleware.MessageMiddleware",
'django.middleware.clickjacking.XFrameOptionsMiddleware', "django.middleware.clickjacking.XFrameOptionsMiddleware",
] ]
ROOT_URLCONF = 'kristofersxyz.urls' ROOT_URLCONF = "kristofersxyz.urls"
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', "BACKEND": "django.template.backends.django.DjangoTemplates",
'DIRS': [Path.joinpath(BASE_DIR, 'templates')], "DIRS": [Path.joinpath(BASE_DIR, "templates")],
'APP_DIRS': True, "APP_DIRS": True,
'OPTIONS': { "OPTIONS": {
'context_processors': [ "context_processors": [
'django.template.context_processors.debug', "django.template.context_processors.debug",
'django.template.context_processors.request', "django.template.context_processors.request",
'django.contrib.auth.context_processors.auth', "django.contrib.auth.context_processors.auth",
'django.contrib.messages.context_processors.messages', "django.contrib.messages.context_processors.messages",
], ],
}, },
}, },
] ]
WSGI_APPLICATION = 'kristofersxyz.wsgi.application' WSGI_APPLICATION = "kristofersxyz.wsgi.application"
# Database # Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases # https://docs.djangoproject.com/en/4.0/ref/settings/#databases
DATABASES = { DATABASES = {
'default': { "default": {
'ENGINE': 'django.db.backends.sqlite3', "ENGINE": "django.db.backends.sqlite3",
'NAME': BASE_DIR / 'db.sqlite3', "NAME": BASE_DIR / "db.sqlite3",
} }
} }
@ -98,16 +94,16 @@ DATABASES = {
AUTH_PASSWORD_VALIDATORS = [ AUTH_PASSWORD_VALIDATORS = [
{ {
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
}, },
{ {
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
}, },
{ {
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
}, },
{ {
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
}, },
] ]
@ -115,9 +111,9 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/4.0/topics/i18n/ # https://docs.djangoproject.com/en/4.0/topics/i18n/
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = "en-us"
TIME_ZONE = 'Europe/Riga' TIME_ZONE = "Europe/Riga"
USE_I18N = True USE_I18N = True
@ -127,11 +123,13 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/ # https://docs.djangoproject.com/en/4.0/howto/static-files/
STATIC_URL = '/static/' # STATIC_URL = Path.joinpath(BASE_DIR, "static")
STATIC_ROOT = Path.joinpath(BASE_DIR, 'static') STATIC_URL = "/static/"
STATIC_ROOT = Path.joinpath(BASE_DIR, "static")
MEDIA_ROOT = Path.joinpath(BASE_DIR, "media")
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

View File

@ -5,13 +5,13 @@ The `urlpatterns` list routes URLs to views. For more information please see:
Examples: Examples:
Function views Function views
1. Add an import: from my_app import views 1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home') 2. Add a URL to urlpatterns: path("", views.home, name="home")
Class-based views Class-based views
1. Add an import: from other_app.views import Home 1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 2. Add a URL to urlpatterns: path("", Home.as_view(), name="home")
Including another URLconf Including another URLconf
1. Import the include() function: from django.urls import include, path 1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path("blog/", include("blog.urls"))
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import path, include from django.urls import path, include
@ -19,9 +19,9 @@ from django.conf import settings
from django.conf.urls.static import static from django.conf.urls.static import static
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path("admin/", admin.site.urls),
path('', include('main.urls')), path("", include("main.urls")),
path('karbs.sh/', include('karbs.urls')), path("karbs/", include("karbs.urls")),
] ]
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

View File

@ -11,6 +11,6 @@ import os
from django.core.wsgi import get_wsgi_application from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'kristofersxyz.settings') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kristofersxyz.settings")
application = get_wsgi_application() application = get_wsgi_application()

View File

@ -2,5 +2,5 @@ from django.apps import AppConfig
class MainConfig(AppConfig): class MainConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField' default_auto_field = "django.db.models.BigAutoField"
name = 'main' name = "main"

View File

@ -2,6 +2,6 @@ from django.urls import path
from . import views from . import views
urlpatterns = [ urlpatterns = [
path('', views.index, name='home'), path("", views.index, name="home"),
path('lightsaber', views.lightsaber, name='lightsaber'), path("lightsaber", views.lightsaber, name="lightsaber"),
] ]

View File

@ -3,9 +3,9 @@ from django.shortcuts import render
def index(request): def index(request):
"""Homepage""" """Homepage"""
return render(request, 'main/index.html', {'title': 'Kristofers Solo Webpage'}) return render(request, "main/index.html", {"title": "Kristofers Solo Webpage"})
def lightsaber(request): def lightsaber(request):
"""Lightsaber page""" """Lightsaber page"""
return render(request, 'main/lightsaber.html', {'title': 'Lightsaber'}) return render(request, "main/lightsaber.html", {"title": "Lightsaber"})

View File

@ -1,12 +1,12 @@
#!/usr/bin/env python #!/usr/bin/env python3
"""Django's command-line utility for administrative tasks.""" """Django"s command-line utility for administrative tasks."""
import os import os
import sys import sys
def main(): def main():
"""Run administrative tasks.""" """Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'kristofersxyz.settings') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kristofersxyz.settings")
try: try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
except ImportError as exc: except ImportError as exc:
@ -18,5 +18,5 @@ def main():
execute_from_command_line(sys.argv) execute_from_command_line(sys.argv)
if __name__ == '__main__': if __name__ == "__main__":
main() main()

View File

@ -12,10 +12,14 @@ hr {
h1 { h1 {
text-align: center; text-align: center;
font-size: 32px;
font-weight: bold;
} }
h2 { h2 {
margin: 40px 0 0 0; margin: 40px 0 0 0;
font-size: 24px;
font-weight: bold;
} }
p { p {
@ -57,3 +61,11 @@ aside {
.list { .list {
margin: 10px 40px; margin: 10px 40px;
} }
.upper {
list-style-type: circle;
}
.sub {
list-style-type: disc;
}

View File

@ -1,4 +1,4 @@
{% extends 'layout.html' %} {% extends "layout.html" %}
{% load static %} {% load static %}
{% block title %}{{ title }}{% endblock %} {% block title %}{{ title }}{% endblock %}
{% block meta %} {% block meta %}
@ -27,28 +27,28 @@
<a href="https://artixlinux.org/" target="_blank">Artix</a> <a href="https://artixlinux.org/" target="_blank">Artix</a>
Linux, make sure <code>curl</code> is installed and just run the following as the root user: Linux, make sure <code>curl</code> is installed and just run the following as the root user:
</p> </p>
<pre><code>curl -LO krisrofers.xyz/karbs.sh <pre><code>curl -LO krisrofers.xyz/karbs
sh karbs.sh</code></pre> sh karbs</code></pre>
<p> <p>
Note that the KARBS scripts will not partition any drives or wipe anything, <strong>but</strong> when it deploys the dotfiles, it will overwrite any preexisting files: e.g. the KARBS .zshrc will replace your old .zshrc, etc. Note that the KARBS scripts will not partition any drives or wipe anything, <strong>but</strong> when it deploys the dotfiles, it will overwrite any preexisting files: e.g. the KARBS .zshrc will replace your old .zshrc, etc.
</p> </p>
<h2>What does KARBS install?</h2> <h2>What does KARBS install?</h2>
<hr> <hr>
<p> <p>
You can check out the programs list that KARBS parses for installation <a href="https://github.com/kristoferssolo/karbs/blob/main/pkg-files/minimal-pkgs" You can check out the programs list that KARBS parses for installation <a href="https://github.com/kristoferssolo/karbs/blob/main/pkg-files/X11-pkgs"
target="_blank">right here</a>! target="_blank">right here</a>!
</p> </p>
<p>Here is some idea of the programs installed:</p> <p>Here is some idea of the programs installed:</p>
<aside> <aside>
If you don't know any of these programs and this is all Greek to you, don't worry because it's all done automatically for you and you will learn as you use the system. If you don't know any of these programs and this is all Greek to you, don't worry because it's all done automatically for you and you will learn as you use the system.
</aside> </aside>
<ul class="list"> <ul class="list upper">
<li> <li>
<a href="https://awesomewm.org/" target="_blank">awesome</a> - a highly configurable, next generation framework window manager for X <a href="https://awesomewm.org/" target="_blank">awesome</a> - a highly configurable, next generation framework window manager for X
</li> </li>
<li> <li>
Minimalist and keyboard-centric programs for Minimalist and keyboard-centric programs for:
<ul class="list"> <ul class="list sub">
<li> <li>
file management (<a href="https://github.com/gokcehan/lf" target="_blank">lf</a>), file management (<a href="https://github.com/gokcehan/lf" target="_blank">lf</a>),
</li> </li>

65
templates/karbs/karbs Executable file
View File

@ -0,0 +1,65 @@
#!/bin/sh
# Kristofers Auto Rice Boostrapping Script (KARBS)
# by Kristofers Solo
# License: GNU GPLv3
echo "Choose display server (X11 / Wayland)[1/2]: "
read -r USER_INPUT
# Get display server type from user
if [ "$USER_INPUT" = 1 ]; then
DISPLAY_SERVER="X11"
elif [ "$USER_INPUT" = 2 ]; then
DISPLAY_SERVER="wayland"
else
echo "Wrong input. Please try again."
exit
fi
# Install paru
if pacman -Q paru; then
:
else
sudo pacman -S --noconfirm rust-src git wget
git clone https://aur.archlinux.org/paru-bin
cd paru-bin || exit
makepkg -si
cd ..
rm -rf paru-bin
fi
FILE="pkg-files/$DISPLAY_SERVER-pkgs"
if [ -f "$FILE" ]; then
paru -Syu --noconfirm --needed - < $FILE
else
curl -LO https://raw.githubusercontent.com/kristoferssolo/karbs/main/$FILE
paru -Syu --noconfirm --needed - < $DISPLAY_SERVER-pkgs
rm -f $DISPLAY_SERVER-pkgs
fi
git clone https://github.com/kristoferssolo/solorice "$HOME"
git clone https://github.com/kristoferssolo/SoloVim "$HOME"/.config/nvim
rm -rf "$HOME"/{LICENSE,readme.md,.gitignore}
mkdir -p "$HOME"/{Downloads,Documents,Videos,Music,Pictures/screenshots}
if [ $DISPLAY_SERVER = "wayland" ]; then
rm -rf "$HOME"/.config/{awesome,picom,sx,zsh/.zprofile-X11}
mv "$HOME"/.config/zsh/zprofile-wayland "$HOME"/.config/zsh/.zprofile
chsh -s /bin/zsh
zsh
Hyprland
else
rm -rf "$HOME"/.config/{hypr,waybar,zsh/.zprofile-wayland}
mv "$HOME"/.config/zsh/zprofile-X11 "$HOME"/.config/zsh/.zprofile
git clone https://github.com/streetturtle/awesome-wm-widgets "$HOME"/.config/awesome/awesome-wm-widgets
chsh -s /bin/zsh
zsh
echo -e "\n\n\033[1;31mFor weather widget to work, enter API-key from https://openweathermap.org, latitude and longitude in '~/.config/awesome/weather' file, each on seperate line.\033[0m"
echo "API-key"
echo "latitude"
echo "longitude"
echo -e "\nEverything else is ready to go. You can run 'sx' or reboot."
fi

View File

@ -1,40 +0,0 @@
#!/bin/sh
echo 'Choose installation size: minimal or full'
read size
if pacman -Q paru; then
echo
else
sudo pacman -S --noconfirm rust
git clone 'https://aur.archlinux.org/paru-bin'
cd paru-bin
makepkg -si
cd ..
rm -rf paru-bin
fi
FILE = "pkg-files/$size-pkgs.txt"
if [[ -f "$FILE" ]]; then
paru -Syu --noconfirm --needed - < "pkg-files/$size-pkgs"
else
curl -LO "https://raw.githubusercontent.com/kristoferssolo/karbs/main/pkg-files/$size-pkgs"
paru -Syu --noconfirm --needed - < "$size-pkgs"
rm "$size"-pkgs
fi
mkdir -p "$HOME"/{repos,Downloads,Documents,Videos,Music,Pictures/screenshots}
git clone 'https://github.com/kristoferssolo/solorice' "$HOME/repos/solorice"
cp -rf "$HOME/repos/solorice/.config" "$HOME"
rm -rf "$HOME/.config/awesome/desktop"
touch "$HOME/.config/awesome/weather"
cp -rf "$HOME/repos/solorice/.local" "$HOME"
ln -sf "$HOME/.config/zsh/.zshenv" "$HOME"
git clone 'https://github.com/streetturtle/awesome-wm-widgets' "$HOME/.config/awesome/awesome-wm-widgets"
chsh -s /bin/zsh
echo
echo
echo -e '\033[1;31m For weather widget to work, enter API-key from https://openweathermap.org, latitude and logitude in `~/.config/awesome/weather` file, each on seperate line. \033[0m'

View File

@ -1,4 +1,4 @@
{% extends 'layout.html' %} {% extends "layout.html" %}
{% load static %} {% load static %}
{% block title %}{{ title }}{% endblock %} {% block title %}{{ title }}{% endblock %}
{% block meta %} {% block meta %}