/*
* This Script build or package the app .
*/


// Require some modules
var packager = require('electron-packager')
var rebuild = require('electron-rebuild')

function buildManager() {
  var options = {
    dir: './',
    all: false,
    appCopyright: 'Copyright (C) 2017 flofriday',
    arch: 'x64',
    icon: './img/icon',
    name: 'pixelFlow',
    out: './build',
    overwrite: true,
    platform: '',
    win32metadata: {
      CompanyName: 'flofriday',
      FileDescription: 'pixelFlow',
      OriginalFilename: 'pixelFlow.exe',
      ProductName: 'pixelFlow',
      InternalName: 'pixelFlow'
    },/*
    ignore: [
      'photon.css',
      'statistic.js',
      'build.js',
      'todo.txt'
    ],*/
    afterCopy: [(buildPath, electronVersion, platform, arch, callback) => {
      console.log('\tRebuilding native modules...')
      rebuild.rebuild({ buildPath, electronVersion, arch })
      .then(() => callback())
      .catch((error) => callback(error));
    }]
  }

  if(process.argv[2] == '--all') {
    options.platform = 'all'
  }
  else if (process.argv[2] == '--darwin') {
    options.platform = 'darwin'
  }
  else if (process.argv[2] == '--win32') {
    options.platform = 'win32'
  }
  else if (process.argv[2] == '--linux') {
    options.platform = 'linux'
  }
  else {
    console.log('ERROR: Unknown parameter for build platform')
    return
  }

  // Start the package
  packager(options, function done_callback (err, appPaths) {
    if (err) {
      console.log('ERROR: ' + err)
      return
    }

    console.log('DONE: Result in ' + appPaths)
  })
}

function packageManager() {
  console.log('Packaging not implemented yet!')
}

function main(){
  if(process.argv[3] == '--build') {
    buildManager()
  }
  else if (process.argv[3] == '--package') {
    packageManager()
  }
  else {
    console.log('ERROR: Unknown parameter for build.js')
    return
  }
}

main()

@@ -601,18 +601,16 @@
 '%0A    %7D,
-/*
 %0A    ign
@@ -696,17 +696,121 @@
 txt'
+,%0A      'build',%0A      'ubuntu-build.sh',%0A      'ubuntu-dependencies.sh',%0A      'ubuntu-download-build.sh'
 %0A    %5D,
-*/
 %0A   
@@ -1084,398 +1084,276 @@
 %0A%0A  
-if(process.argv%5B2%5D == '--all') %7B%0A    options.platform = 'all'%0A  %7D%0A  else if (process.argv%5B2%5D == '--darwin') %7B%0A    options.platform = 'darwin'%0A  %7D%0A  else if (process.argv%5B2%5D == '--win32') %7B%0A    options.platform = 'win32'%0A  %7D%0A  else if (process.argv%5B2%5D == '--linux') %7B%0A    options.platform = 'linux'%0A  %7D%0A  else %7B%0A    console.log('ERROR: Unknown parameter for build platform')%0A    return
+var platform = process.argv%5B2%5D;%0A  platform = platform.slice(2)%0A%0A  /*%0A  * Crosscompiling of native modules is not possible.%0A  */%0A  if (platform !== process.platform) %7B%0A    console.error('Sry crosscompiling is not possible with native modules')%0A    process.exit()
 %0A  %7D%0A%0A
+%0A
   //

Improve build script