mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
pack scripts into s9pk
This commit is contained in:
@@ -162,6 +162,15 @@ pub fn asset_dir<P: AsRef<Path>>(datadir: P, pkg_id: &PackageId, version: &Versi
|
||||
.join(version.as_str())
|
||||
}
|
||||
|
||||
pub fn script_dir<P: AsRef<Path>>(datadir: P, pkg_id: &PackageId, version: &Version) -> PathBuf {
|
||||
datadir
|
||||
.as_ref()
|
||||
.join(PKG_VOLUME_DIR)
|
||||
.join(pkg_id)
|
||||
.join("scripts")
|
||||
.join(version.as_str())
|
||||
}
|
||||
|
||||
pub fn backup_dir(pkg_id: &PackageId) -> PathBuf {
|
||||
Path::new(BACKUP_DIR).join(pkg_id).join("data")
|
||||
}
|
||||
@@ -178,6 +187,8 @@ pub enum Volume {
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
Assets {},
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
Scripts {},
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
Pointer {
|
||||
package_id: PackageId,
|
||||
volume_id: VolumeId,
|
||||
@@ -228,6 +239,7 @@ impl Volume {
|
||||
match self {
|
||||
Volume::Data { .. } => data_dir(&ctx.datadir, pkg_id, volume_id),
|
||||
Volume::Assets {} => asset_dir(&ctx.datadir, pkg_id, version).join(volume_id),
|
||||
Volume::Scripts {} => script_dir(&ctx.datadir, pkg_id, version).join(volume_id),
|
||||
Volume::Pointer {
|
||||
package_id,
|
||||
volume_id,
|
||||
@@ -260,6 +272,7 @@ impl Volume {
|
||||
match self {
|
||||
Volume::Data { readonly } => *readonly,
|
||||
Volume::Assets {} => true,
|
||||
Volume::Scripts {} => true,
|
||||
Volume::Pointer { readonly, .. } => *readonly,
|
||||
Volume::Certificate { .. } => true,
|
||||
Volume::Backup { readonly } => *readonly,
|
||||
|
||||
Reference in New Issue
Block a user