Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use system LIST to avoid the need to escape commands #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cloud-init.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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);
}
}
}
Expand Down Expand Up @@ -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
Expand Down