modules/mu/clouds/google/userdata/linux.erb in cloud-mu-3.0.0beta vs modules/mu/clouds/google/userdata/linux.erb in cloud-mu-3.0.0

- old
+ new

@@ -1,7 +1,7 @@ #!/bin/sh -# Copyright:: Copyright (c) 2014 eGlobalTech, Inc., all rights reserved +# Copyright:: Copyright (c) 2017 eGlobalTech, Inc., all rights reserved # # Licensed under the BSD-3 license (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License in the root of the project or at # @@ -14,10 +14,17 @@ # limitations under the License. updates_run=0 need_reboot=0 instance_id="`curl http://metadata.google.internal/computeMetadata/v1/instance/name`" + +for f in /etc/rc.local /etc/rc.d/rc.local;do + if [ -f $f ];then + chmod 755 $f + fi +done + if [ -f /etc/debian_version ];then if ! grep '^/bin/sh /var/lib/cloud/instance/user-data.txt$' /etc/rc.local > /dev/null;then echo "/bin/sh /var/lib/cloud/instance/user-data.txt" >> /etc/rc.local fi apt-get update -y @@ -63,13 +70,11 @@ echo "/bin/sh $userdata_dir/user-data.txt" >> /etc/rc.d/rc.local fi sed -i 's/^Defaults.*requiretty$/Defaults !requiretty/' /etc/sudoers - if [ $version == 7 ];then - chmod 755 /etc/rc.d/rc.local - fi + chmod 755 /etc/rc.d/rc.local if [ ! -f /usr/bin/curl ] ;then /usr/bin/yum -y install curl;fi # Ugh, rando EPEL mirror if [ ! -f /etc/yum.repos.d/epel.repo ];then /bin/rpm -ivh http://mirror.metrocast.net/fedora/epel/epel-release-latest-$version.noarch.rpm fi @@ -125,10 +130,9 @@ key = OpenSSL::PKey::RSA.new(Base64.urlsafe_decode64("<%= $mu.deployKey %>")) print Base64.urlsafe_encode64(key.public_encrypt(File.read("<%= $mu.muID %>-secret"))) ' > encrypt_deploy_secret.rb deploykey="<%= $mu.deployKey %>" -instance_id="`curl http://metadata.google.internal/computeMetadata/v1/instance/name`" # Make double-sure sshd is actually up service sshd restart /usr/bin/curl -k --data mu_id="<%= $mu.muID %>" --data mu_resource_name="<%= $mu.resourceName %>" --data mu_resource_type="<%= $mu.resourceType %>" --data mu_instance_id="$instance_id" --data mu_bootstrap="1" --data mu_user="<%= $mu.muUser %>" --data mu_deploy_secret="`/opt/chef/embedded/bin/ruby encrypt_deploy_secret.rb`" https://<%= $mu.publicIP %>:<%= $mu.mommaCatPort %>/