#!/usr/bin/perl use Getopt::Long; use strict; use lib "/opt/vyatta/share/perl5"; use Vyatta::Config; my ($iface, $route, $table, $option); GetOptions("interface=s" => \$iface, "route=s" => \$route, "table=s" => \$table, "option=s" => \$option ); my $hash = `echo $iface $route $table | md5sum | cut -c1-10`; chomp $hash; my $FILE_DHCP_HOOK = "/etc/dhcp/dhclient-exit-hooks.d/static-route-$hash"; my $dhcp_hook = ''; if ($option eq 'create') { $dhcp_hook =<', $FILE_DHCP_HOOK or die "cannot open $FILE_DHCP_HOOK"; print ${dhcp_hook_file} $dhcp_hook; close $dhcp_hook_file; exit 0;