2024-08-19 03:21:46 +02:00
|
|
|
import ../model/config_type
|
2024-08-27 22:16:31 +02:00
|
|
|
import ../model/log_type
|
|
|
|
|
2024-08-19 03:21:46 +02:00
|
|
|
import execute
|
|
|
|
import strformat
|
|
|
|
|
|
|
|
proc mountArchive*(nc: NorgConfig, repo: Repository): int =
|
2024-08-23 15:08:14 +02:00
|
|
|
let archive = fmt"{repo.path}::{nc.args.archive}"
|
|
|
|
let further_args = nc.args.further_args
|
2024-08-23 13:04:27 +02:00
|
|
|
let ok = runDiscard genCommand(cmd = "mount", repo = archive, further_args = further_args)
|
2024-08-19 03:21:46 +02:00
|
|
|
if ok == 0:
|
2024-08-27 22:16:31 +02:00
|
|
|
info fmt"Mounted {archive} at {further_args[0]}"
|
2024-08-19 03:21:46 +02:00
|
|
|
else:
|
2024-08-27 22:16:31 +02:00
|
|
|
error "Failed to mount ", archive
|
2024-08-19 03:21:46 +02:00
|
|
|
|
|
|
|
proc unmountArchive*(nc: NorgConfig): int =
|
2024-08-23 13:04:27 +02:00
|
|
|
let ok = runDiscard genCommand(cmd = "umount", repo = "", further_args = nc.args.further_args)
|
2024-08-19 03:21:46 +02:00
|
|
|
if ok == 0:
|
2024-08-27 22:16:31 +02:00
|
|
|
info "Unmounted ", nc.args.further_args[0]
|
2024-08-19 03:21:46 +02:00
|
|
|
else:
|
2024-08-27 22:16:31 +02:00
|
|
|
error "Failed to unmount ", nc.args.further_args[0]
|