From f6bd0866d555a483189d8284b50f4a2e94d9c9de Mon Sep 17 00:00:00 2001 From: guest20 Date: Thu, 13 Jul 2023 16:30:41 +0200 Subject: [PATCH] use system LIST to avoid stuff escaping quotes --- cloud-init.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cloud-init.pl b/cloud-init.pl index b949d8c..837e1fd 100755 --- a/cloud-init.pl +++ b/cloud-init.pl @@ -54,7 +54,7 @@ sub set_hostname { open my $fh, ">", "/etc/myname"; printf $fh "%s\n", $fqdn; close $fh; - system("hostname " . $fqdn); + system("/bin/hostname", $fqdn); } sub add_etc_hosts_entry { @@ -95,7 +95,7 @@ sub apply_user_data { if (defined($data->{packages})) { foreach my $package (@{ $data->{packages} }) { - system("pkg_add " . $package); + system("pkg_add", $package); } } @@ -120,7 +120,7 @@ sub apply_user_data { if (defined($data->{runcmd})) { foreach my $runcmd (@{ $data->{runcmd} }) { - system("sh -c \"$runcmd\""); + system("/bin/sh", "-c", $runcmd); } } } @@ -180,7 +180,7 @@ sub action_deploy { unlink "/etc/isakmpd/local.pub"; #-- remove cruft - unlink "/tmp/*"; + unlink glob "/tmp/*"; unlink "/var/db/dhclient.leases.vio0"; #-- disable root password