.\" Copyright (c) 2016 Joost van Baal-Ilić .TH "dr_symlinks" 1 "22 дец 2016" "dr_symlinks 20180520" "USER COMMANDS " .po 2m .de ZI .\" Zoem Indent/Itemize macro I. .br 'in +\\$1 .nr xa 0 .nr xa -\\$1 .nr xb \\$1 .nr xb -\\w'\\$2' \h'|\\n(xau'\\$2\h'\\n(xbu'\\ .. .de ZJ .br .\" Zoem Indent/Itemize macro II. 'in +\\$1 'in +\\$2 .nr xa 0 .nr xa -\\$2 .nr xa -\\w'\\$3' .nr xb \\$2 \h'|\\n(xau'\\$3\h'\\n(xbu'\\ .. .if n .ll -2m .am SH .ie n .in 4m .el .in 8m .. .SH NAME dr_symlinks \- maintain a symlink forest .SH SYNOPSIS dr_symlinks .SH DESCRIPTION For each pair directory/subdirectory under each word in DR_SL_TARGETS, a directory and symlink DR_SL_SOURCE/directory/symlink is created (or adjusted)\&. The script is implemented as a wrapper around oggsymlinks, by Wessel Dankers\&. .SH EXAMPLE If, in the configuration file $HOME/\&.draai/symlinksrc, DR_SL_SOURCE is set to /srv/audio and DR_SL_TARGETS is set to "\&.\&./data/a \&.\&./data/b", while directories .di ZV .in 0 .nf \fC /srv/data/a/And_You_Will_Know_Us_By_the_Trail_of_Dead/Source_Tags_And_Codes/ /srv/data/a/And_You_Will_Know_Us_By_the_Trail_of_Dead/The_Century_of_Self/ /srv/data/a/John_Coltrane/A_Love_Supreme/ /srv/data/b/John_Coltrane/Giant_Steps/ /srv/data/b/Tinariwen/Amassakoul/ .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR exist, the following directories holding the following symlinks will get created in /srv/audio/ : .di ZV .in 0 .nf \fC And_You_Will_Know_Us_By_the_Trail_of_Dead/Source_Tags_And_Codes -> \&.\&./\&.\&./\&.\&./a/And_You_Will_Know_Us_By_the_Trail_of_Dead/Source_Tags_And_Codes/ And_You_Will_Know_Us_By_the_Trail_of_Dead/The_Century_of_Self -> \&.\&./\&.\&./\&.\&./a/And_You_Will_Know_Us_By_the_Trail_of_Dead/The_Century_of_Self/ John_Coltrane/A_Love_Supreme -> \&.\&./\&.\&./\&.\&./a/John_Coltrane/A_Love_Supreme/ John_Coltrane/Giant_Steps -> \&.\&./\&.\&./\&.\&./b/John_Coltrane/Giant_Steps/ Tinariwen/Amassakoul -> \&.\&./\&.\&./\&.\&./b/Tinariwen/Amassakoul/ .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR All dangling symlinks and empty directories (if any) under /srv/audio/ will get removed\&. This script is idempotent\&. .SH ANOTHER EXAMPLE .di ZV .in 0 .nf \fC joostvb@hille:~% ls media/usb/audio/200504/Al_Green The_Very_Best_Of/ joostvb@hille:~% ls media/usb/audio/ 200504/ 200708/ 200801/ 200805/ 200807/ 200812/ 200910/ 201005/ 201009/ 200609/ 200712/ 200803/ 200806/ 200808/ 200905/ 201004/ 201006/ joostvb@hille:~% cat \&.draai/symlinksrc\&.usb DR_SL_SOURCE=~/media/audio DR_SL_TARGETS="$( cd $DR_SL_SOURCE && ls -d \&.\&./usb/audio/* )" joostvb@hille:~% DR_SL_RCFILE=\&.draai/symlinksrc\&.usb dr_symlinks joostvb@hille:~% ls -l media/audio/Al_Green total 0 lrwxrwxrwx 1 joostvb joostvb 48 2011-03-11 09:12 The_Very_Best_Of -> \&.\&./\&.\&./usb/audio/200504/Al_Green/The_Very_Best_Of/ .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR .SH ENVIRONMENT dr_symlinks honors booleans: DR_SL_VERBOSE, DR_DEBUG and DR_DRYRUN and strings: DR_SL_RCFILE, DR_SL_TARGETS and DR_SL_SOURCE\&. .SH FILES, CONFIGURATION All configuration variables (see ENVIRONMENT) can be set in \fC~/\&.draai/symlinksrc\fP\&. This rc-file is sourced as a shell script\&. If DR_SL_RCFILE is set, its value is assumed to be the dr_symlinks rc-file\&. .SH COPYRIGHT AND LICENSE This manpage is copyright 2009, 2011 Joost van Baal-Ilić \&. Draai is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version\&. This program is distributed WITHOUT ANY WARRANTY\&. You should have received a copy of the GNU General Public License along with draai\&. If not, see http://www\&.gnu\&.org/licenses/\&. .SH AUTHOR Joost van Baal-Ilić