[13.1] Creating a file in the user's home

Robert Munteanu <[email protected]> Thu, 31 Jul 2014 18:12:23 +0300
Newsgroups gmane.linux.suse.autoinstall
Message-ID <CAC8ULPYN_Et3Su9PAR_oAxpLu=-8kNJ+715xDUVLyYTzPWA-+Q@mail.gmail.com>
Hi,

As part of my autoinst.xml file I want to place a file in a specific
user's home. Initially I tried to do it with a post-script, but that
failed since the user's home was not yet created

        <script>
            <filename>post-install-vagrant-ssh-key</filename>
            <network_needed
config:type="boolean">true</network_needed>
            <source><![CDATA[#!/bin/bash
cd /home/vagrant
mkdir -m 700 .ssh
curl -o .ssh/authorized_keys
'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub'
chmod 600 .ssh/authorized_keys
chown -R vagrant .ssh
]]>
            </source>
        </script>

I also tried using files/file section, but that seemed be completely
ignored. According to [1] this should work without any issues in 13.1.

  <files>
      <file>
          <file_path>/home/vagrant/.ssh/authorized_keys</file_path>
          <!-- <file_location>https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub</file_location>
 -->
          <file_contents><![CDATA[ssh-rsa
AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ==
vagrant insecure public key]]></file_contents>
          <file_owner>vagrant</file_owner>
          <file_permissions>600</file_permissions>
      </file>
  </files>

I tried both the file_contents and file_location variants ( one is
commented out above ).

What's the best way of placing a file in the user's home directory
using autoinst.xml ?

Thanks,

Robert

[1]: http://doc.opensuse.org/projects/autoyast/configuration.html#createprofile.completeconf

-- 
http://robert.muntea.nu/
-- 
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]