Regenerated
This commit is contained in:
+45
-102
@@ -3670,92 +3670,53 @@ ShellRoot {
|
||||
** =generated/.config/quickshell/updater/shell.qml=
|
||||
Updates the system
|
||||
#+BEGIN_SRC qml :tangle generated/.config/quickshell/updater/shell.qml :noweb yes :mkdirp yes :eval never
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
Window {
|
||||
id: root
|
||||
width: 600
|
||||
height: 380
|
||||
width: 500
|
||||
height: 200
|
||||
visible: true
|
||||
title: "System Updater"
|
||||
|
||||
property int currentStep: 0
|
||||
property int totalSteps: 4
|
||||
property string status: "idle"
|
||||
property int progress: 0
|
||||
property string status: "Waiting..."
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 16
|
||||
spacing: 10
|
||||
Timer {
|
||||
interval: 300
|
||||
running: true
|
||||
repeat: true
|
||||
|
||||
Text {
|
||||
text: "System Updater"
|
||||
font.pixelSize: 20
|
||||
}
|
||||
onTriggered: {
|
||||
let file = "/tmp/nixos-updater-status"
|
||||
|
||||
ProgressBar {
|
||||
from: 0
|
||||
to: root.totalSteps
|
||||
value: root.currentStep
|
||||
width: parent.width
|
||||
}
|
||||
let xhr = new XMLHttpRequest()
|
||||
xhr.open("GET", "file://" + file)
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
let parts = xhr.responseText.trim().split("|")
|
||||
|
||||
Text {
|
||||
text: "Step " + root.currentStep + " / " + root.totalSteps
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 180
|
||||
|
||||
ListView {
|
||||
id: logView
|
||||
anchors.fill: parent
|
||||
model: logModel
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: logModel
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: 10
|
||||
|
||||
Button {
|
||||
text: "Run update"
|
||||
onClicked: updater.start()
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Close"
|
||||
onClicked: root.visible = false
|
||||
if (parts.length === 2) {
|
||||
progress = parseInt(parts[0])
|
||||
status = parts[1]
|
||||
}
|
||||
}
|
||||
}
|
||||
xhr.send()
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: updater
|
||||
command: ["bash", "/home/henrov/.config/scripts/update-engine.sh"]
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: 10
|
||||
|
||||
onOutput: function(data) {
|
||||
logModel.append({ text: data.trim() })
|
||||
Text { text: status }
|
||||
|
||||
if (data.startsWith("STEP:")) {
|
||||
let parts = data.split(":")
|
||||
root.currentStep = parseInt(parts[1])
|
||||
}
|
||||
|
||||
if (data.startsWith("DONE")) {
|
||||
root.status = "done"
|
||||
}
|
||||
|
||||
if (data.startsWith("FAIL")) {
|
||||
root.status = "error"
|
||||
}
|
||||
ProgressBar {
|
||||
from: 0
|
||||
to: 100
|
||||
value: progress
|
||||
width: 300
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4084,46 +4045,28 @@ main
|
||||
** =generated/.config/scripts/update-engine.sh=
|
||||
A file containing color variables
|
||||
#+BEGIN_SRC sh :tangle generated/.config/scripts/update-engine.sh :shebang "#!/usr/bin/env bash" :noweb yes :mkdirp yes :eval never
|
||||
set -uo pipefail
|
||||
|
||||
emit() { echo "$1"; }
|
||||
STATUS_FILE="/tmp/nixos-updater-status"
|
||||
|
||||
step() {
|
||||
echo "STEP:$1:$2"
|
||||
echo "0|Starting" > "$STATUS_FILE"
|
||||
|
||||
update_step() {
|
||||
echo "$1|$2" > "$STATUS_FILE"
|
||||
}
|
||||
|
||||
ok() {
|
||||
echo "OK:$1"
|
||||
}
|
||||
update_step 10 "Fixing ownership"
|
||||
sudo chown -R "$USER":"wheel" "$REPO"
|
||||
|
||||
fail() {
|
||||
echo "FAIL:$1"
|
||||
}
|
||||
update_step 30 "Updating flake"
|
||||
nix flake update
|
||||
|
||||
REPO="/home/$USER/Repos/nixos/Droidnix"
|
||||
HOSTNAME="$(hostname)"
|
||||
cd "$REPO" || exit 1
|
||||
update_step 60 "Rebuilding system"
|
||||
sudo nixos-rebuild switch --flake ".#$HOSTNAME"
|
||||
|
||||
step 1 "Fixing ownership"
|
||||
sudo chown -R "$USER":"wheel" "$REPO" || fail "ownership"
|
||||
ok 1
|
||||
update_step 90 "Updating Flatpaks"
|
||||
flatpak update -y
|
||||
|
||||
step 2 "Updating flake"
|
||||
nix flake update || fail "flake"
|
||||
ok 2
|
||||
|
||||
step 3 "Rebuilding system"
|
||||
sudo nixos-rebuild switch --flake ".#$HOSTNAME" || fail "rebuild"
|
||||
hyprctl reload
|
||||
ok 3
|
||||
|
||||
step 4 "Flatpak cleanup"
|
||||
flatpak uninstall --unused -y
|
||||
flatpak update --appstream -y
|
||||
flatpak update -y || fail "flatpak"
|
||||
ok 4
|
||||
|
||||
emit "DONE"
|
||||
update_step 100 "Done"
|
||||
#+END_SRC
|
||||
|
||||
** =generated/.config/wofi/scripts/wofi-launcher.sh=
|
||||
|
||||
Reference in New Issue
Block a user