1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-18 05:21:47 +03:00
mobile-nixos/boot/init/tasks/symlink.rb

19 lines
428 B
Ruby
Raw Normal View History

2019-12-23 06:32:34 +03:00
# Symlinks from source to target.
# Depends on target's `#dirname` existing.
class Tasks::Symlink < Task
def initialize(source, target)
@source = source
@target = target
# The actual source is not a dependency; the symlink can dangle freely.
add_dependency(:Files, File.dirname(target))
end
def run()
File.symlink(@source, @target)
end
def name()
"#{super}(#{@source}, #{@target})"
end
end