File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,14 +16,15 @@ inject_into_iso() {
1616 local newpubkey=$2
1717 local backup=${isofile} .bak
1818 local tmpiso=${TMP} /$1
19- rm -rf $TMPDIR
20- mkdir -p $TMPDIR
21- [ ! -d $TMPDIR ] && echo " $( basename $0 ) : Could not find/create temporary dir $TMPDIR " && return 1
2219 [ ! -f $isofile ] && echo " $( basename $0 ) : Could not find systemvm iso patch file $isofile " && return 1
23- cp -b $isofile $backup
24- [ $? -ne 0 ] && echo " $( basename $0 ) : Failed to backup original iso $isofile " && return 1
2520 mount -o loop $isofile $MOUNTPATH
2621 [ $? -ne 0 ] && echo " $( basename $0 ) : Failed to mount original iso $isofile " && return 1
22+ diff -q $MOUNTPATH /authorized_keys $newpubkey & > /dev/null && return 0
23+ cp -b $isofile $backup
24+ [ $? -ne 0 ] && echo " $( basename $0 ) : Failed to backup original iso $isofile " && return 1
25+ rm -rf $TMPDIR
26+ mkdir -p $TMPDIR
27+ [ ! -d $TMPDIR ] && echo " $( basename $0 ) : Could not find/create temporary dir $TMPDIR " && return 1
2728 cp -fr $MOUNTPATH /* $TMPDIR /
2829 [ $? -ne 0 ] && echo " $( basename $0 ) : Failed to copy from original iso $isofile " && return 1
2930 cp $newpubkey $TMPDIR /authorized_keys
@@ -39,6 +40,7 @@ inject_into_iso() {
3940
4041copy_priv_key () {
4142 local newprivkey=$1
43+ diff -q $newprivkey $( dirname $0 ) /id_rsa.cloud && return 0
4244 cp -fb $newprivkey $( dirname $0 ) /id_rsa.cloud && chmod 0600 $( dirname $0 ) /id_rsa.cloud
4345 return $?
4446}
You can’t perform that action at this time.
0 commit comments