#!/usr/bin/env perl

# Use mandatory external modules
use strict;
use Cwd;
use File::Basename;

# Determine installation dir name
our $SELF_DIR = dirname(dirname(Cwd::abs_path(__FILE__)));

# Include parts of the system
require $SELF_DIR . '/lib/ifconfig.pm';

# Check params
if (scalar(@ARGV) < 2) {
    print "Usage: $0 <ip-address> <interface>\n\n";
    exit(1);
}

my $ip = $ARGV[0];
my $iface = $ARGV[1];

# Check if ip is here
CheckInterfaceIP($iface, $ip, 0);

# Clear ip
ClearInterfaceIP($iface, $ip);

print "OK: IP deleted\n";
exit(0);
