backup restoring

trunk
nbsp 2025-01-08 05:46:32 +02:00
parent db53b21005
commit d9a71b1361
No known key found for this signature in database
GPG Key ID: 7184AC1C9835CE48
1 changed files with 5 additions and 0 deletions

View File

@ -3,6 +3,8 @@ package app
import ( import (
"io/fs" "io/fs"
"os" "os"
"os/exec"
"path"
"strconv" "strconv"
"time" "time"
@ -29,6 +31,7 @@ func NewBackups() *Backups {
if err != nil { if err != nil {
continue continue
} }
// XXX: for some reason this gets fucked up with timezones???
list = append(list, humanize.Time(timestamp.Local())) list = append(list, humanize.Time(timestamp.Local()))
} }
@ -71,6 +74,8 @@ func (backups *Backups) Event(state *ui.State, event vaxis.Event) (processed boo
} }
func (backups *Backups) Draw(state *ui.State) { func (backups *Backups) Draw(state *ui.State) {
exec.Command("tar", "-C", ttbp.PathUserEntries, "-xf", path.Join(ttbp.PathUserBackups, backups.backups[backups.list.Index()].Name()), "--strip-components=1", "--skip-old-files").Run()
win := state.Window() win := state.Window()
win.New(win.Width/2-10, win.Height/2-8, 20, 5).Print(vaxis.Segment{Text: backups.title}) win.New(win.Width/2-10, win.Height/2-8, 20, 5).Print(vaxis.Segment{Text: backups.title})
win.New(win.Width/2-13, win.Height/2-2, 26, 1).Print(vaxis.Segment{Text: backups.description}) win.New(win.Width/2-13, win.Height/2-2, 26, 1).Print(vaxis.Segment{Text: backups.description})