mirror of
https://github.com/derfenix/photocatalog.git
synced 2026-03-11 21:35:34 +03:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0cf9b85787 | |||
| a56c582068 | |||
| 3be92806b1 | |||
| 65baf34032 | |||
| 986d16addf | |||
| 57eb22615d | |||
| aa6ba0c07c |
13
flake.nix
13
flake.nix
@@ -6,7 +6,7 @@
|
|||||||
outputs = { self, nixpkgs }:
|
outputs = { self, nixpkgs }:
|
||||||
let
|
let
|
||||||
lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101";
|
lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101";
|
||||||
version = "2.0.0";
|
version = "2.0.4";
|
||||||
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
||||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||||
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
||||||
@@ -41,7 +41,6 @@
|
|||||||
|
|
||||||
};
|
};
|
||||||
type = types.attrsOf (types.submodule ({ name, ... }: {
|
type = types.attrsOf (types.submodule ({ name, ... }: {
|
||||||
# freeformType = settingsFormat.type;
|
|
||||||
options = {
|
options = {
|
||||||
source = mkOption {
|
source = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
@@ -78,7 +77,7 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
mode = mkOption {
|
mode = mkOption {
|
||||||
type = types.str;
|
type = types.enum [ "hardlink" "symlink" "move" "copy" ];
|
||||||
default = "hardlink";
|
default = "hardlink";
|
||||||
description = ''
|
description = ''
|
||||||
Organization mode, one of [ hardlink symlink move copy ].
|
Organization mode, one of [ hardlink symlink move copy ].
|
||||||
@@ -101,11 +100,11 @@
|
|||||||
wantedBy = [
|
wantedBy = [
|
||||||
"default.target"
|
"default.target"
|
||||||
];
|
];
|
||||||
preStart = if !sync.skipFullSync then ''
|
preStart = if !sync.skipFullSync then (''
|
||||||
mkdir -p ${sync.target}
|
mkdir -p ${sync.target}
|
||||||
photocatalog -source ${sync.source} -target ${sync.target} -mode ${sync.mode}
|
photocatalog -source ${sync.source} -target ${sync.target} -mode ${sync.mode} ${if sync.overwrite then "-overwrite" else ""}
|
||||||
'' else null;
|
'') else null;
|
||||||
script = "photocatalog -source ${sync.source} -target ${sync.target} -skip-full-sync -watch -mode ${sync.mode}";
|
script = "photocatalog -source ${sync.source} -target ${sync.target} -skip-full-sync -watch -mode ${sync.mode} ${if sync.overwrite then "-overwrite" else ""}";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type="simple";
|
Type="simple";
|
||||||
Restart="no";
|
Restart="no";
|
||||||
|
|||||||
@@ -302,9 +302,13 @@ func (o *Organizer) ensureTargetPath(targetPath string) error {
|
|||||||
for _, part := range strings.Split(relPath, string(filepath.Separator)) {
|
for _, part := range strings.Split(relPath, string(filepath.Separator)) {
|
||||||
dir = filepath.Join(dir, part)
|
dir = filepath.Join(dir, part)
|
||||||
|
|
||||||
if err := os.Mkdir(dir, o.dirMode); err != nil && !os.IsExist(err) {
|
if err := os.Mkdir(dir, os.ModePerm); err != nil && !os.IsExist(err) {
|
||||||
return fmt.Errorf("create target directory path at %s: %w", dir, err)
|
return fmt.Errorf("create target directory path at %s: %w", dir, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := os.Chmod(dir, os.ModePerm&o.dirMode); err != nil {
|
||||||
|
return fmt.Errorf("chmod directory %s: %w", dir, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user