Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
libre
keyringer-macosx
Commits
20125ba1
Commit
20125ba1
authored
Aug 16, 2014
by
Silvio Rhatto
Browse files
New action 'cp' (2)
parent
cb21ca66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
lib/keyringer/actions/cp
lib/keyringer/actions/cp
+33
-0
No files found.
lib/keyringer/actions/cp
0 → 100755
View file @
20125ba1
#!/bin/bash
#
# Copy secrets.
#
# Load functions
LIB
=
"
`
dirname
$0
`
/../functions"
source
"
$LIB
"
||
exit
1
# Aditional parameters
CWD
=
"
`
pwd
`
"
# Avoid leading slash
ORIG
=
"
$(
keyringer_filename
`
echo
"
$2
"
|
sed
-e
"s|^/*||"
`
)
"
DEST
=
"
`
echo
"
$3
"
|
sed
-e
"s|^/*||"
`
"
# Set destination
if
[
!
-d
"
$KEYDIR
/
$RELATIVE_PATH
/
$DEST
"
]
;
then
keyringer_get_new_file
$DEST
else
FILE
=
"
$DEST
"
fi
# Check if secret exists
if
!
echo
"
$ORIG
"
|
grep
-q
'*'
&&
[
!
-e
"
$KEYDIR
/
$RELATIVE_PATH
/
$ORIG
"
]
;
then
echo
"Secret not found:
$ORIG
"
exit
1
fi
# Run move command
cd
"
$KEYDIR
"
&&
cp
-a
"./
$RELATIVE_PATH
/
$ORIG
"
"./
$FILE
"
keyringer_exec git
"
$BASEDIR
"
add
"keys/
$FILE
"
cd
"
$CWD
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment