@@ -152,51 +152,56 @@ module.exports = function (pkg) {
152152 // return
153153 }
154154 let out = `${ pkg . _out } /${ pkg . package } _${ pkg . version } _${ pkg . architecture } `
155- installScript ( 'preinst' , pkg . preinst , out , cb )
156- installScript ( 'postinst' , pkg . postinst , out , cb )
157- installScript ( 'prerm' , pkg . prerm , out , cb )
158- installScript ( 'postrm' , pkg . postrm , out , cb )
159- installCopyright ( pkg . package , pkg . _copyright , out , cb )
160- installConffiles ( pkg . conffiles , out , cb )
161- ctrl = ctrl . filter ( function ( line ) {
162- if ( ! / O u t | T a r g e t | V e r b o s e | C h a n g e l o g | P r e i n s t | P o s t i n s t | P r e r m | P o s t r m | C l e a n | C o p y r i g h t | C o n f f i l e s / . test ( line ) ) {
163- return line
164- }
165- } )
166155
167- writeChangelog ( pkg , out , cb )
156+ fs . mkdirs ( ` ${ out } /DEBIAN` , '0775' , function ( err ) {
168157
169- fs . mkdir ( `${ out } /DEBIAN` , '0775' , function ( err ) {
170158 if ( err ) {
171159 cb ( new gutil . PluginError ( P , err ) )
172160 // return
173161 }
174-
162+
163+ installScript ( 'preinst' , pkg . preinst , out , cb )
164+ installScript ( 'postinst' , pkg . postinst , out , cb )
165+ installScript ( 'prerm' , pkg . prerm , out , cb )
166+ installScript ( 'postrm' , pkg . postrm , out , cb )
167+ installScript ( 'triggers' , pkg . triggers , out , cb )
168+ installCopyright ( pkg . package , pkg . _copyright , out , cb )
169+ installConffiles ( pkg . conffiles , out , cb )
170+ ctrl = ctrl . filter ( function ( line ) {
171+ if ( ! / O u t | T a r g e t | V e r b o s e | C h a n g e l o g | P r e i n s t | P o s t i n s t | P r e r m | P o s t r m | C l e a n | C o p y r i g h t | C o n f f i l e s / . test ( line ) ) {
172+ return line
173+ }
174+ } )
175+
176+ writeChangelog ( pkg , out , cb )
177+
175178 files . map ( function ( f ) {
176179 let t = f . path . split ( '/' )
177180 t = t [ t . length - 1 ]
178181 fs . copySync ( f . path , `${ out } /${ pkg . _target } /${ t } ` )
179182 chmodRegularFile ( `${ out } /${ pkg . _target } /${ t } ` )
180183 } )
181184 _exec ( `chmod ${ dirMode } $(find ${ pkg . _out } -type d)` )
182- _exec ( `dpkg-deb -Zxz --build ${ pkg . _out } /${ pkg . package } _${ pkg . version } _${ pkg . architecture } ` ,
183- function ( err , stdout , stderr ) {
184- if ( pkg . _clean ) {
185- fs . removeSync ( `${ pkg . _out } /${ pkg . package } _${ pkg . version } _${ pkg . architecture } ` )
186- }
187- if ( pkg . _verbose && stdout . length > 1 ) {
188- gutil . log ( stdout . trim ( ) + '\n' )
189- }
190- if ( stderr ) {
191- gutil . log ( gutil . colors . red ( stderr . trim ( ) ) )
192- }
193185 const ctrlf = ctrl . join ( '\n' )
194186 fs . outputFile ( `${ out } /DEBIAN/control` , ctrlf . substr ( 0 , ctrlf . length - 1 ) ,
195187 function ( err ) {
196188 if ( err ) {
197189 cb ( new gutil . PluginError ( P , err ) )
198190 // return
199- } } )
191+ }
192+ _exec ( `dpkg-deb -Zxz --build ${ pkg . _out } /${ pkg . package } _${ pkg . version } _${ pkg . architecture } ` ,
193+ function ( err , stdout , stderr ) {
194+ if ( pkg . _clean ) {
195+ fs . removeSync ( `${ pkg . _out } /${ pkg . package } _${ pkg . version } _${ pkg . architecture } ` )
196+ }
197+ if ( pkg . _verbose && stdout . length > 1 ) {
198+ gutil . log ( stdout . trim ( ) + '\n' )
199+ }
200+ if ( stderr ) {
201+ gutil . log ( gutil . colors . red ( stderr . trim ( ) ) )
202+ }
203+ cb ( err ) ;
204+ } )
200205 } )
201206 } )
202207 } )
0 commit comments