chore: 记录改造前基线
改造开始前的完整状态,作为可回退的基点。此提交之后:Pester 175 项、零依赖套件 101 项全绿;PowerShell 5.1 尚不可用(源文件无 BOM)。 包含此前未提交的在制品:安全描述符套件、Hyper-V 实验环境(tools/lab)、agent 约定(AGENTS.md 与 docs/agents)。 .gitignore 增加 *.key / *.pfx:BackupConfig.psd1 的 PasswordFile 此前默认指向仓库内的 baknret.key,一次 git add -A 就会把口令提交进版本库。默认值在后续提交中改为空。
This commit is contained in:
1 parent
7173e8ae10
commit
2937eb6652
32 files changed
+8775
-1691
No files matched your search
+215
-140
@@ -1,157 +1,232 @@
|
||||
<#
|
||||
软件名录:维护"软件名 -> 目录"的映射。
|
||||
.SYNOPSIS
|
||||
软件目录清单(SoftwareCatalog)。
|
||||
|
||||
有这个文件之后,BackupList.txt 里可以直接写软件名:
|
||||
.DESCRIPTION
|
||||
定义每个软件在归档内的槽位(Slot)结构,供备份与恢复共用。
|
||||
一个软件 = 一个归档(归档名就是软件名),包内的顶层目录就是这里定义的 Slot。
|
||||
|
||||
FooClolor
|
||||
Kazumi :: !*Cache
|
||||
Edge :: !*Cache,component_crx_cache
|
||||
.ssh @encrypt
|
||||
|
||||
归档包的名字也就是软件名(`FooClolor.7z`),不再是
|
||||
`FooClolor_from_C_+Programs.7z` 这种由路径拼出来的名字。
|
||||
|
||||
写法:
|
||||
|
||||
<软件名> = '<目录>'
|
||||
|
||||
软件名的限制:
|
||||
* 必须是合法的文件名(不能含 \ / : * ? " < > |),因为它就是归档名;
|
||||
* 不能含 `\` 或 `/` 或 `%`,否则会被当作字面路径而不是软件名;
|
||||
* **含 `-` 或 `.` 的名字必须写成带引号的键**,否则 PowerShell 会把
|
||||
`a-b` 解析成减法表达式并报 "Missing '=' operator":
|
||||
'scoop-config' = '...' # 正确
|
||||
scoop-config = '...' # 报错
|
||||
* 建议用英文/数字,但中文也可以。
|
||||
|
||||
目录可以写环境变量,例如 '%UserProfile%\.ssh'。
|
||||
|
||||
两个便利特性:
|
||||
|
||||
1. 目录不存在时会按前缀补全:写 'D:\Programs\legendary',实际目录是
|
||||
'D:\Programs\legendary_2.0.4',会自动匹配(只认 `<名>_*` 与 `<名>-*`,
|
||||
不会把 Legendary 误配成 LegendarySomething)。
|
||||
2. **一个软件包含多个目录**时,写成**对象数组**(每个目录带自己的说明),全部打进同一个归档:
|
||||
|
||||
scoop = @{ Dirs = @(
|
||||
'%UserProfile%\scoop\persist'
|
||||
'C:\Programs\ScoopApps\persist'
|
||||
'%UserProfile%\.config\scoop'
|
||||
) }
|
||||
|
||||
归档里每个目录仍是自己的名字与层级,恢复时会**只解出该目录自己那棵子树**,
|
||||
各自还原回原位,不会把兄弟目录也复制过去。
|
||||
纯字符串数组、以及旧的 `@{ Dirs = @(...) }` / `@{ Variants = @(...) }` 写法继续可用。
|
||||
|
||||
注意:归档内的顶层名就是目录自己的名字,所以**同一个软件里不能有两个同名目录**
|
||||
(典型例子是两个都叫 persist 的目录)。那种情况脚本会明确报错并让你拆成两个条目,
|
||||
而不是把两棵树悄悄混在一起。
|
||||
|
||||
分文件维护:用 Includes 引入其它名录文件(路径相对本文件):
|
||||
|
||||
@{
|
||||
Includes = @('SoftwareCatalog.games.psd1')
|
||||
...
|
||||
结构:
|
||||
SoftWareName = @{
|
||||
Slot = @{
|
||||
Path = 'Absolute\Path'
|
||||
Exclude = 'Relative\Path'
|
||||
Include = 'Relative\Path:Absolute\Path'
|
||||
Encrypt = $false
|
||||
Description = 'Some information about this slot.'
|
||||
}
|
||||
}
|
||||
|
||||
.NOTES
|
||||
字段说明:
|
||||
SoftWareName 软件名称。不含空格,遵循驼峰大小写。
|
||||
Slot 插槽。归档内的一层目录:内容进 `<Slot>\`;
|
||||
Path 是文件时,存成名为 `<Slot>` 的文件本身。
|
||||
同一软件里不能有两个同名 Slot。规则同 SoftWareName。
|
||||
Path 路径。需备份或恢复的来源路径,为宿主机上的绝对路径。
|
||||
Exclude 排除。不需备份的目录,为压缩包内的相对路径。
|
||||
多个以逗号分隔。相对于本 Slot 的根(即归档内的 `<Slot>\`)。
|
||||
以“!”打头即“任意层级匹配”(7z 的 -xr!,通配符 `*` / `?`);
|
||||
要按正则排除写成 `!re:<正则>`(脚本自己展开成精确路径)。
|
||||
Include 包含。需要追加的目录。
|
||||
语法:<压缩包内相对路径>:<宿主机绝对路径>。
|
||||
多个以逗号分隔。
|
||||
Encrypt 是否加密此归档。默认:$false。
|
||||
同一个条目里各 Slot 不一致时,整个归档按加密处理。
|
||||
Description 描述。
|
||||
#>
|
||||
|
||||
@{
|
||||
# 每个条目有两种写法:
|
||||
# 1. 只写一个目录字符串: legendary = '%UserProfile%\.config\legendary'
|
||||
# 2. 带目录介绍(推荐):
|
||||
# legendary = @{
|
||||
# Path = '%UserProfile%\.config\legendary'
|
||||
# Description = 'Legendary(Epic 的开源客户端)的配置与已安装记录'
|
||||
# }
|
||||
# 一个软件包含**多个目录**时,写成对象数组(见下面的 scoop)。
|
||||
# 运行时会把"这个条目打包哪些目录、每个目录是干什么的、排除了什么、为什么"
|
||||
# 逐条打印出来,说明就来自这里。
|
||||
|
||||
# ---- 用户配置 / 开发环境 ----
|
||||
# 含 `-` 或 `.` 的键必须加引号,否则会被当成减法表达式(见文件开头说明)
|
||||
legendary = @{
|
||||
Path = '%UserProfile%\.config\legendary'
|
||||
Description = 'Legendary(Epic 的开源客户端)的配置与已安装记录'
|
||||
}
|
||||
opencode = @{
|
||||
Path = '%UserProfile%\.config\opencode'
|
||||
Description = 'opencode 的配置'
|
||||
}
|
||||
|
||||
# 一个软件 = 一个归档;多个目录写成**对象数组**,每个目录各自带说明。
|
||||
# 注意:归档内的顶层名字就是**目录自己的名字**,所以同一个软件里不能有两个同名目录
|
||||
# (例如两个 persist)—— 那会在包里混成一棵树,脚本会明确报错让你拆成两个条目。
|
||||
scoop = @(
|
||||
@{
|
||||
Path = '%UserProfile%\scoop\persist'
|
||||
Description = 'scoop 里各应用的持久化数据(重装应用就会丢,必须备份)'
|
||||
AutoDarkMode = @{
|
||||
DefaultData = @{
|
||||
Path = '%AppData%\AutoDarkMode'
|
||||
Encrypt = $true
|
||||
Description = 'AutoDarkMode 数据。'
|
||||
}
|
||||
@{
|
||||
}
|
||||
|
||||
DeepSeekHarness = @{
|
||||
DefaultData = @{
|
||||
Path = '%UserProfile%\.dsh'
|
||||
Encrypt = $true
|
||||
Description = 'DSH(深度求索)数据。'
|
||||
}
|
||||
}
|
||||
|
||||
DSHDesktop = @{
|
||||
DefaultData = @{
|
||||
Path = '%AppData%\dsh-desktop'
|
||||
Encrypt = $true
|
||||
Description = 'DSH 桌面版数据。'
|
||||
}
|
||||
}
|
||||
|
||||
MicrosoftEdge = @{
|
||||
DefaultData = @{
|
||||
Path = '%LocalAppData%\Microsoft\Edge\User Data'
|
||||
Exclude = '!*Cache,!BrowserMetrics,!component_crx_cache,' +
|
||||
'!Crashpad,!optimization_guide,!ProvenanceData,' +
|
||||
'Default\ExtensionActivityEdge,Default\Extensions,Default\Service Worker,' +
|
||||
'Snapshots,Edge Sidebar,Edge Shopping'
|
||||
Encrypt = $true
|
||||
Description = '微软 Edge 浏览器用户数据。
|
||||
保留:书签/密码/偏好/历史,以及站点数据(IndexedDB / Local Storage)。
|
||||
排除:缓存、组件缓存、Service Worker、扩展本体(可从商店重装)、遥测与优化数据。
|
||||
可选排除:Default\IndexedDB、Default\Local Storage、Default\Session Storage、Default\blob_storage、Default\WebStorage。
|
||||
注意:Edge 常驻时打包会有上百个文件读不到(含 Login Data / Cookies),脚本检测到警告后不会用这份不完整的归档覆盖已有的完整归档。备份前建议先退出 Edge。'
|
||||
}
|
||||
}
|
||||
|
||||
FastNodeManager = @{
|
||||
DefaultData = @{
|
||||
Path = '%UserProfile%\fnm'
|
||||
Encrypt = $true
|
||||
Description = 'FNM(Node 版本管理器)数据。'
|
||||
}
|
||||
}
|
||||
|
||||
INZONEHub = @{
|
||||
DefaultData = @{
|
||||
Path = '%AppData%\Sony\INZONE Hub'
|
||||
Description = '索尼英纵数据。'
|
||||
}
|
||||
}
|
||||
|
||||
Kazumi = @{
|
||||
DefaultData = @{
|
||||
Path = '%AppData%\com.example\Kazumi'
|
||||
Encrypt = $true
|
||||
Description = 'Kazumi 数据。'
|
||||
}
|
||||
}
|
||||
|
||||
Legendary = @{
|
||||
DefaultConfig = @{
|
||||
Path = '%UserProfile%\.config\legendary'
|
||||
Encrypt = $true
|
||||
Description = 'Legendary(Epic 的开源客户端)的配置。'
|
||||
}
|
||||
}
|
||||
|
||||
Mnemon = @{
|
||||
DefaultData = @{
|
||||
Path = '%UserProfile%\.mnemon'
|
||||
Encrypt = $true
|
||||
Description = 'Mnemon(LLM 智能体的持久记忆系统)数据。'
|
||||
}
|
||||
}
|
||||
|
||||
Obsidian = @{
|
||||
DefaultData = @{
|
||||
Path = '%AppData%\obsidian'
|
||||
Encrypt = $true
|
||||
Description = 'Obsidian 数据。'
|
||||
}
|
||||
}
|
||||
|
||||
OpenCode = @{
|
||||
DefaultConfig = @{
|
||||
Path = '%UserProfile%\.config\opencode'
|
||||
Encrypt = $true
|
||||
Description = 'OpenCode 的配置。'
|
||||
}
|
||||
}
|
||||
|
||||
OpenSSH = @{
|
||||
DefaultData = @{
|
||||
Path = '%UserProfile%\.ssh'
|
||||
Encrypt = $true
|
||||
Description = 'SSH 私钥 / 公钥 / known_hosts 等文件。'
|
||||
}
|
||||
}
|
||||
|
||||
PiliPlus = @{
|
||||
DefaultData = @{
|
||||
Path = '%AppData%\com.example\piliplus'
|
||||
Encrypt = $true
|
||||
Description = 'PiliPlus 数据。'
|
||||
}
|
||||
}
|
||||
|
||||
PowerShell = @{
|
||||
DefaultData = @{
|
||||
Path = '%UserProfile%\Documents\PowerShell'
|
||||
Encrypt = $true
|
||||
Description = 'PowerShell 7 的用户配置与模块。'
|
||||
}
|
||||
}
|
||||
|
||||
PowerToys = @{
|
||||
DefaultBackup = @{
|
||||
Path = '%UserProfile%\Documents\PowerToys\Backup'
|
||||
Encrypt = $true
|
||||
Description = 'PowerToys 备份。'
|
||||
}
|
||||
}
|
||||
|
||||
Scoop = @{
|
||||
DefaultConfig = @{
|
||||
Path = '%UserProfile%\.config\scoop'
|
||||
Description = 'scoop 自身的配置(源、代理、已安装清单)'
|
||||
Encrypt = $true
|
||||
Description = 'Scoop 配置。'
|
||||
}
|
||||
)
|
||||
GlobalPersist = @{
|
||||
Path = '$(if ($env:SCOOP_GLOBAL) { $env:SCOOP_GLOBAL } else { Join-Path $env:ProgramData "scoop" })\persist'
|
||||
Encrypt = $true
|
||||
Description = 'Scoop 里各全局应用的持久化数据。'
|
||||
}
|
||||
UserPersist = @{
|
||||
Path = '$(if ($env:SCOOP) { $env:SCOOP } else { Join-Path $env:USERPROFILE "scoop" })\persist'
|
||||
Encrypt = $true
|
||||
Description = 'Scoop 里各用户应用的持久化数据。'
|
||||
}
|
||||
}
|
||||
|
||||
'.ssh' = @{
|
||||
Path = '%UserProfile%\.ssh'
|
||||
Description = 'SSH 私钥 / 公钥 / known_hosts(不可再生;要加密就给清单里那行加 @encrypt)'
|
||||
Startup = @{
|
||||
GlobalLink = @{
|
||||
Path = '%ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup'
|
||||
Description = '全局开机启动项(快捷方式)。'
|
||||
}
|
||||
UserLink = @{
|
||||
Path = '%AppData%\Microsoft\Windows\Start Menu\Programs\Startup'
|
||||
Description = '用户开机启动项(快捷方式)。'
|
||||
}
|
||||
}
|
||||
CodeSpace = @{
|
||||
Path = 'D:\UserData\Documents\CodeSpace'
|
||||
Description = '开发代码目录'
|
||||
|
||||
SteamRomManager = @{
|
||||
DefaultData = @{
|
||||
Path = '%AppData%\steam-rom-manager'
|
||||
Description = 'Steam Rom Manager 数据。'
|
||||
}
|
||||
}
|
||||
PowerShell = @{
|
||||
Path = '%UserProfile%\Documents\PowerShell'
|
||||
Description = 'PowerShell 7 的用户配置与模块'
|
||||
|
||||
TranslucentTB = @{
|
||||
ScoopData = @{
|
||||
Path = '$(scoop prefix translucenttb)\settings.json'
|
||||
Description = 'TranslucentTB 的设置文件(Scoop 安装)。'
|
||||
}
|
||||
}
|
||||
|
||||
TwinkleTray = @{
|
||||
DefaultData = @{
|
||||
Path = '%AppData%\twinkle-tray'
|
||||
Description = 'Twinkle Tray 数据。'
|
||||
}
|
||||
}
|
||||
|
||||
WindowsPowerShell = @{
|
||||
Path = '%UserProfile%\Documents\WindowsPowerShell'
|
||||
Description = 'Windows PowerShell 5.1 的用户配置与模块'
|
||||
DefaultData = @{
|
||||
Path = '%UserProfile%\Documents\WindowsPowerShell'
|
||||
Encrypt = $true
|
||||
Description = 'Windows PowerShell 5.1 的用户配置与模块。'
|
||||
}
|
||||
}
|
||||
|
||||
# ---- 应用数据 ----
|
||||
AutoDarkMode = @{ Path = '%AppData%\AutoDarkMode'; Description = 'AutoDarkMode 的主题/时间设置' }
|
||||
Kazumi = @{ Path = '%AppData%\com.example\Kazumi'; Description = 'Kazumi 的观看记录与设置' }
|
||||
piliplus = @{ Path = '%AppData%\com.example\piliplus'; Description = 'piliplus 的设置与账号数据' }
|
||||
fnm = @{ Path = '%AppData%\fnm'; Description = 'fnm(Node 版本管理器)的版本记录' }
|
||||
'twinkle-tray' = @{ Path = '%AppData%\twinkle-tray'; Description = 'Twinkle Tray 的显示器亮度设置' }
|
||||
|
||||
# ---- 浏览器与终端 ----
|
||||
# Edge 的缓存/扩展本体等可再生内容由 BackupList.txt 的 :- 排除规则挡掉
|
||||
Edge = @{
|
||||
Path = '%LocalAppData%\Microsoft\Edge\User Data'
|
||||
Description = 'Edge 用户数据:书签、密码、Cookies、历史、站点数据'
|
||||
WindowsTerminal = @{
|
||||
DefaultData = @{
|
||||
Path = '%LocalAppData%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json'
|
||||
Encrypt = $true
|
||||
Description = 'Windows Terminal 的设置文件。'
|
||||
}
|
||||
}
|
||||
WindowsTerminal = @{
|
||||
Path = '%LocalAppData%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json'
|
||||
Description = 'Windows Terminal 的设置文件'
|
||||
}
|
||||
|
||||
# ---- 系统 ----
|
||||
Startup = @{
|
||||
Path = '%ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup'
|
||||
Description = '全局开机启动项(快捷方式)'
|
||||
}
|
||||
|
||||
# ---- C:\Programs ----
|
||||
BaiduNetdisk = @{ Path = 'C:\Programs\BaiduNetdisk'; Description = '百度网盘客户端' }
|
||||
# FooClolor 的具体用途不明确,先不加介绍(没有 Description 也不会影响打包)
|
||||
FooClolor = 'C:\Programs\FooClolor'
|
||||
March7thAssistant = @{
|
||||
Path = 'C:\Programs\March7thAssistant'
|
||||
Description = '三月七助手(WebBrowser 用户目录里的缓存由 BackupList.txt 排除)'
|
||||
}
|
||||
MiFlash = @{ Path = 'C:\Programs\MiFlash'; Description = '小米刷机工具 MiFlash' }
|
||||
MiFlash_Unlock = @{ Path = 'C:\Programs\MiFlash_Unlock'; Description = '小米解锁工具' }
|
||||
QuarkCloudDrive = @{ Path = 'C:\Programs\QuarkCloudDrive'; Description = '夸克网盘客户端' }
|
||||
translucenttb = @{
|
||||
Path = 'C:\Programs\ScoopApps\apps\translucenttb\current\settings.json'
|
||||
Description = 'TranslucentTB 的设置文件'
|
||||
}
|
||||
'ScoopApps-persist' = @{
|
||||
Path = 'C:\Programs\ScoopApps\persist'
|
||||
Description = 'ScoopApps 安装位置上那份 persist。它和 scoop 数组里的 %UserProfile%\scoop\persist 是两个不同目录、末级名却同为 persist,所以不能并进同一个归档'
|
||||
}
|
||||
|
||||
# ---- 其它盘 ----
|
||||
Aria = @{ Path = 'D:\UserData\Documents\Aria'; Description = 'Aria 下载器的配置与任务' }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user