File: csp_scp_keep_mode

package info (click to toggle)
caspar 20100624-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 756 kB
  • ctags: 147
  • sloc: sh: 711; makefile: 124
file content (26 lines) | stat: -rwxr-xr-x 1,045 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

# $Id: csp_scp_keep_mode,v 1.2 2009-09-26 02:06:25 joostvb Exp $
# $Source: /cvsroot/caspar/caspar/caspar/script/csp_scp_keep_mode,v $

# csp_scp_keep_mode - use ssh to copy a file, keeping its file permission mode

# based upon an idea of Wessel Dankers

# user joe pushed file bar to host murphy, in directory /foo/. on murphy,
# /foo/bar is owned by joe:joe.  Now, ann wants to change murphy:/foo/bar.  She
# however lacks permissions.  Using a new group "hackers", and performing chmod
# g+s on murphy:/foo/ fixes this partially: the files now belong to the right
# group "hackers".  However, a mode g+w on a file is generally _not_ preserved
# when scp-ing a new version of the file.
#
# Zorg dat op alle desktops het scriptje "csp_install_origal_mode" ergens
# in het $PATH van de gebruikers staat.
# Voorzie de include/install.mk verder van:
#
#  csp_scp_keep_mode_FUNC = csp_scp_keep_mode $(1) $(2) $(3)
#  csp_PUSH = $(csp_scp_keep_mode_FUNC)
#

: ${csp_SSH:=ssh}
exec $csp_SSH $2 't=`mktemp` && cat >$t && mv $t $3/$1' < $1