xiaodongwang ae44332c69 update snippet to support preseed
Change-Id: I8442758ffaf3a55ec4773bf820bc4cdefb2e6452
2014-05-19 10:47:36 -07:00

24 lines
692 B
Plaintext

mkdir -p /target/root/.ssh; \
chmod 700 -R /target/root/.ssh; \
#if $getVar("push_ssh_keys", "") != ""
#set $ssh_keys = $push_ssh_keys.split(',')
#set $firstline = True
#for $ssh_key in $ssh_keys
#if not $ssh_key
#continue
#end if
#set $f = open($ssh_keys)
#for $line in $f
#set $line = $line.rstrip('\n')
#if $firstline
echo "$line" > /target/root/.ssh/authorized_keys; \
#else
echo "$line" >> /target/root/.ssh/authorized_keys; \
#end if
#set $firstline = False
#end for
#silent $f.close()
#end for
chmod 600 /target/root/.ssh/authorized_keys; \
#end if