3 # The following lines create/update the HylaFAX spool directory:
4 # Subdirectories/files with persistent data are kept,
5 # other directories/files are removed/recreated,
6 # mostly from the template spool
7 # directory in the HylaFAX package.
9 # This block explains how the spool area is
10 # derived from the spool template in the HylaFAX package:
12 # + capital letter: directory; file otherwise
13 # + P/p: persistent directory
14 # + F/f: directory with symlinks per entry
15 # + T/t: temporary data
16 # + S/s: single symlink into package
18 # | + u: change ownership to uucp:uucp
19 # | + U: ..also change access mode to user-only
23 # client T u (client connection info)
26 # dev T u (maybe some FIFOs)
29 # etc F contains customized config files!
32 # info P u (database of called devices)
33 # log P u (communication logs)
37 # status T u (modem status info files)
41 shopt -s dotglob
# if bash sees "*", it also includes dot files
42 lnsym
() { ln --symbol "$@" ; }
43 lnsymfrc
() { ln --symbolic --force "$@" ; }
44 cprd
() { cp --remove-destination "$@" ; }
45 update
() { install --owner=@faxuser@
--group=@faxgroup@
"$@" ; }
48 ## create/update spooling area
50 update
--mode=0750 -d "@spoolAreaPath@"
53 persist
=(archive docq doneq info log pollq recvq sendq
)
55 # remove entries that don't belong here
56 touch dummy
# ensure "*" resolves to something
60 for j
in "${persist[@]}" xferfaxlog clientlog faxcron.lastrun
68 if test "$keep" == "0"
74 # create persistent data directories (unless they exist already)
75 update
--mode=0700 -d "${persist[@]}"
76 chmod 0755 info log recvq
78 # create ``xferfaxlog``, ``faxcron.lastrun``, ``clientlog``
79 touch clientlog faxcron.lastrun xferfaxlog
80 chown @faxuser@
:@faxgroup@ clientlog faxcron.lastrun xferfaxlog
82 # create symlinks for frozen directories/files
83 lnsym
--target-directory=.
"@hylafaxplus@"/spool
/{COPYRIGHT
,bin
,config
}
85 # create empty temporary directories
86 update
--mode=0700 -d client dev status
90 ## create and fill etc
92 install -d "@spoolAreaPath@/etc"
93 cd "@spoolAreaPath@/etc"
95 # create symlinks to all files in template's etc
96 lnsym
--target-directory=.
"@hylafaxplus@/spool/etc"/*
98 # set LOCKDIR in setup.cache
99 sed --regexp-extended 's|^(UUCP_LOCKDIR=).*$|\1'"'@lockPath@'|g" --in-place setup.cache
101 # etc/{xferfaxlog,lastrun} are stored in the spool root
102 lnsymfrc
--target-directory=. ..
/xferfaxlog
103 lnsymfrc
--no-target-directory ..
/faxcron.lastrun lastrun
105 # etc/hosts.hfaxd is provided by the NixOS configuration
106 lnsymfrc
--no-target-directory "@userAccessFile@" hosts.hfaxd
108 # etc/config and etc/config.${DEVID} must be copied:
109 # hfaxd reads these file after locking itself up in a chroot
110 cprd
--no-target-directory "@globalConfigPath@" config
111 cprd
--target-directory=.
"@modemConfigPath@"/*