File: csp_scp_keep_mode

package info (click to toggle)
caspar 20120530-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 824 kB
  • sloc: sh: 685; makefile: 124
file content (25 lines) | stat: -rwxr-xr-x 965 bytes parent folder | download | duplicates (8)
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
#!/bin/sh

# This file is maintained at http://git.mdcc.cx/caspar

# 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 $1 't=`mktemp` && cat >$t && mv $t $2/$3' < $3