- my $init=pkgfile($package,$script) || pkgfile($package,"init") ||
- pkgfile($package,"init.d");
- my $default=pkgfile($package,'default');
+ my $job=pkgfile($package,"upstart");
+ my $init='';
+
+ if ($job ne '' || ($dh{ONLYSCRIPTS} && -e "$tmp/etc/init/$jobfile.conf")) {
+ if (! $dh{ONLYSCRIPTS}) {
+ if (! -d "$tmp/etc/init") {
+ doit("install","-d","$tmp/etc/init");
+ }
+
+ doit("install","-p","-m644",$job,"$tmp/etc/init/$jobfile.conf");
+ }
+
+ # ensures that our /etc/init.d/ symlink points to a valid
+ # implementation
+ addsubstvar($package, "misc:Depends", "upstart-job");
+
+ if (! -d "$tmp/etc/init.d") {
+ doit("install","-d","$tmp/etc/init.d");
+ }
+ doit("ln","-sf","/lib/init/upstart-job","$tmp/etc/init.d/$jobfile");
+ }
+ else {
+ $init=pkgfile($package,$script) || pkgfile($package,"init") ||
+ pkgfile($package,"init.d");
+ }