mirror of
https://github.com/kristoferssolo/kristofersxyz.git
synced 2025-10-21 18:30:34 +00:00
Update KARBS
This commit is contained in:
parent
e32f9c9561
commit
e41a60963c
@ -2,5 +2,5 @@ from django.apps import AppConfig
|
||||
|
||||
|
||||
class KarbsConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'karbs'
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "karbs"
|
||||
|
||||
@ -2,6 +2,6 @@ from django.urls import path
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.karbs, name='karbs'),
|
||||
path('instructions', views.instructions, name='instructions'),
|
||||
path("", views.karbs, name="karbs"),
|
||||
path("instructions", views.instructions, name="instructions"),
|
||||
]
|
||||
|
||||
@ -3,9 +3,9 @@ from django.shortcuts import render, redirect
|
||||
|
||||
def instructions(request):
|
||||
"""Karbs Instruction"""
|
||||
return render(request, 'karbs/instructions.html', {'title': 'Karbs Instructions'})
|
||||
return render(request, "karbs/instructions.html", {"title": "Karbs Instructions"})
|
||||
|
||||
|
||||
def karbs(request):
|
||||
"""Karbs install script"""
|
||||
return render(request, 'karbs/karbs.sh', {'title': 'KARBS'})
|
||||
return render(request, "karbs/karbs", {"title": "KARBS"})
|
||||
|
||||
@ -11,6 +11,6 @@ import os
|
||||
|
||||
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()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
"""
|
||||
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
|
||||
https://docs.djangoproject.com/en/4.0/topics/settings/
|
||||
@ -14,81 +14,77 @@ import json
|
||||
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
|
||||
|
||||
if Path(BASE_DIR, 'debug').is_file(): # if `debug` files exists
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
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)
|
||||
# SECURITY WARNING: don"t run with debug turned on in production!
|
||||
DEBUG = Path(BASE_DIR, "debug").is_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
|
||||
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
||||
|
||||
# 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
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'main',
|
||||
'karbs',
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
"django.contrib.sessions",
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"main",
|
||||
"karbs",
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'kristofersxyz.urls'
|
||||
ROOT_URLCONF = "kristofersxyz.urls"
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [Path.joinpath(BASE_DIR, 'templates')],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [Path.joinpath(BASE_DIR, "templates")],
|
||||
"APP_DIRS": True,
|
||||
"OPTIONS": {
|
||||
"context_processors": [
|
||||
"django.template.context_processors.debug",
|
||||
"django.template.context_processors.request",
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'kristofersxyz.wsgi.application'
|
||||
WSGI_APPLICATION = "kristofersxyz.wsgi.application"
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / 'db.sqlite3',
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": BASE_DIR / "db.sqlite3",
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,16 +94,16 @@ DATABASES = {
|
||||
|
||||
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
|
||||
# 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
|
||||
|
||||
@ -127,11 +123,13 @@ USE_TZ = True
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = Path.joinpath(BASE_DIR, 'static')
|
||||
# STATIC_URL = 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
|
||||
# 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"
|
||||
|
||||
@ -5,13 +5,13 @@ The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
Examples:
|
||||
Function 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
|
||||
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
|
||||
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.urls import path, include
|
||||
@ -19,9 +19,9 @@ from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('', include('main.urls')),
|
||||
path('karbs.sh/', include('karbs.urls')),
|
||||
path("admin/", admin.site.urls),
|
||||
path("", include("main.urls")),
|
||||
path("karbs/", include("karbs.urls")),
|
||||
]
|
||||
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
|
||||
@ -11,6 +11,6 @@ import os
|
||||
|
||||
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()
|
||||
|
||||
@ -2,5 +2,5 @@ from django.apps import AppConfig
|
||||
|
||||
|
||||
class MainConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'main'
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "main"
|
||||
|
||||
@ -2,6 +2,6 @@ from django.urls import path
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.index, name='home'),
|
||||
path('lightsaber', views.lightsaber, name='lightsaber'),
|
||||
path("", views.index, name="home"),
|
||||
path("lightsaber", views.lightsaber, name="lightsaber"),
|
||||
]
|
||||
|
||||
@ -3,9 +3,9 @@ from django.shortcuts import render
|
||||
|
||||
def index(request):
|
||||
"""Homepage"""
|
||||
return render(request, 'main/index.html', {'title': 'Kristofers Solo Webpage'})
|
||||
return render(request, "main/index.html", {"title": "Kristofers Solo Webpage"})
|
||||
|
||||
|
||||
def lightsaber(request):
|
||||
"""Lightsaber page"""
|
||||
return render(request, 'main/lightsaber.html', {'title': 'Lightsaber'})
|
||||
return render(request, "main/lightsaber.html", {"title": "Lightsaber"})
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env python
|
||||
"""Django's command-line utility for administrative tasks."""
|
||||
#!/usr/bin/env python3
|
||||
"""Django"s command-line utility for administrative tasks."""
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
"""Run administrative tasks."""
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'kristofersxyz.settings')
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kristofersxyz.settings")
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
@ -18,5 +18,5 @@ def main():
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@ -12,10 +12,14 @@ hr {
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: 32px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 40px 0 0 0;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
p {
|
||||
@ -57,3 +61,11 @@ aside {
|
||||
.list {
|
||||
margin: 10px 40px;
|
||||
}
|
||||
|
||||
.upper {
|
||||
list-style-type: circle;
|
||||
}
|
||||
|
||||
.sub {
|
||||
list-style-type: disc;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% extends 'layout.html' %}
|
||||
{% extends "layout.html" %}
|
||||
{% load static %}
|
||||
{% block title %}{{ title }}{% endblock %}
|
||||
{% block meta %}
|
||||
@ -27,28 +27,28 @@
|
||||
<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:
|
||||
</p>
|
||||
<pre><code>curl -LO krisrofers.xyz/karbs.sh
|
||||
sh karbs.sh</code></pre>
|
||||
<pre><code>curl -LO krisrofers.xyz/karbs
|
||||
sh karbs</code></pre>
|
||||
<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.
|
||||
</p>
|
||||
<h2>What does KARBS install?</h2>
|
||||
<hr>
|
||||
<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>!
|
||||
</p>
|
||||
<p>Here is some idea of the programs installed:</p>
|
||||
<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.
|
||||
</aside>
|
||||
<ul class="list">
|
||||
<ul class="list upper">
|
||||
<li>
|
||||
<a href="https://awesomewm.org/" target="_blank">awesome</a> - a highly configurable, next generation framework window manager for X
|
||||
</li>
|
||||
<li>
|
||||
Minimalist and keyboard-centric programs for
|
||||
<ul class="list">
|
||||
Minimalist and keyboard-centric programs for:
|
||||
<ul class="list sub">
|
||||
<li>
|
||||
file management (<a href="https://github.com/gokcehan/lf" target="_blank">lf</a>),
|
||||
</li>
|
||||
|
||||
65
templates/karbs/karbs
Executable file
65
templates/karbs/karbs
Executable 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
|
||||
@ -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'
|
||||
@ -1,4 +1,4 @@
|
||||
{% extends 'layout.html' %}
|
||||
{% extends "layout.html" %}
|
||||
{% load static %}
|
||||
{% block title %}{{ title }}{% endblock %}
|
||||
{% block meta %}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user