smeserver-runit/createlinks

36 lines
1.2 KiB
Perl
Executable File

#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
sub panel_link
{
my ($function, $panel) = @_;
unlink "root/etc/e-smith/web/panels/$panel/cgi-bin/$function";
symlink("../../../functions/$function",
"root/etc/e-smith/web/panels/$panel/cgi-bin/$function")
or die "Can't symlink to root/etc/e-smith/web/panels/$panel".
"/cgi-bin/$function: $!";
}
sub event_link2
{
my ($action, $event, $level) = @_;
unlink "root/etc/e-smith/events/${event}/S${level}${action}";
symlink("../actions/${action}",
"root/etc/e-smith/events/${event}/S${level}${action}")
or die "Can't symlink to root/etc/e-smith/events/${event}/S${level}${action}:".
" $!";
}
foreach my $target (qw(basic))
{
system('mkdir -p root/usr/lib/systemd/system/'.$target.'.target.wants/');
symlink("../runit.service",
"root/usr/lib/systemd/system/$target.target.wants/runit.service")
or die "Can't symlink to root/usr/lib/systemd/system/$target.target.wants/runit.service: $!";
}
my $event="e-smith-runit-update";
event_link("systemd-reload", $event, "89");
event_link("systemd-default", $event, "88");
safe_symlink("start", "root/etc/e-smith/events/$event/services2adjust/runit");