1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-18 21:41:53 +03:00
mobile-nixos/boot/init/tasks/symlink.rb
2020-02-03 16:19:10 -05:00

19 lines
428 B
Ruby

# 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