invariant.pl 689 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. my $cfg = $CONFIG->{autoupdater};
  2. print <<'END';
  3. #/bin/sh
  4. uci -q get autoupdater.settings || {
  5. uci -q batch <<EOF
  6. set autoupdater.settings=autoupdater
  7. END
  8. for (qw(enabled branch)) {
  9. print "set autoupdater.settings.$_=$cfg->{$_}\n";
  10. }
  11. print <<'END';
  12. EOF
  13. }
  14. uci -q batch <<EOF
  15. END
  16. foreach my $name (sort keys $cfg->{branches}) {
  17. my $branch = $cfg->{branches}->{$name};
  18. print <<END;
  19. delete autoupdater.$name
  20. set autoupdater.$name=branch
  21. END
  22. for (qw(url probability good_signatures)) {
  23. print "set autoupdater.$name.$_=$branch->{$_}\n";
  24. }
  25. for (@{$branch->{pubkeys}}) {
  26. print "add_list autoupdater.$name.pubkey=$_\n";
  27. }
  28. }
  29. print <<END;
  30. commit autoupdater
  31. EOF
  32. END