diff --git a/electron-builder.yml b/electron-builder.yml index 8a65cf8d..1587f075 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -83,12 +83,10 @@ deb: - libxss1 - libxtst6 - polkit-1-auth-agent | policykit-1-gnome | polkit-kde-1 - - gksu | kdesudo rpm: icon: assets/icon.png depends: - lsb - libXScrnSaver - - beesu appImage: icon: assets/icon.png diff --git a/lib/shared/messages.js b/lib/shared/messages.js index 66f13d7a..45a50907 100644 --- a/lib/shared/messages.js +++ b/lib/shared/messages.js @@ -35,10 +35,6 @@ module.exports = { flashComplete: _.template([ '<%= imageBasename %> was successfully written to', '<%= drive.description %> (<%= drive.displayName %>)' - ].join(' ')), - - providePassword: _.template([ - '<%= displayName %> needs special permissions to interact with raw devices. Please provide your password.' ].join(' ')) }, diff --git a/lib/shared/sdk/index.js b/lib/shared/sdk/index.js index 1e7f5a8e..5e1151c2 100644 --- a/lib/shared/sdk/index.js +++ b/lib/shared/sdk/index.js @@ -233,7 +233,7 @@ SDK.Scanner = class Scanner extends EventEmitter { instance.removeListener('devices', this.onDevices) instance.removeListener('error', this.onError) - this.adapters.delete(instance.name) + this.adapters.delete(instance.id) this.emit('unsubscribe', adapter) return this diff --git a/lib/start.js b/lib/start.js index 91d07024..4462945e 100644 --- a/lib/start.js +++ b/lib/start.js @@ -29,91 +29,5 @@ if (process.env.ELECTRON_RUN_AS_NODE || process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE) { require('./cli/etcher') } else { - const electron = require('electron') - const os = require('os') - const _ = require('lodash') - const Bluebird = require('bluebird') - const commandExists = Bluebird.promisify(require('command-exists')) - const childProcess = require('child_process') - const permissions = require('./shared/permissions') - const errors = require('./shared/errors') - const EXIT_CODES = require('./shared/exit-codes') - const packageJSON = require('../package.json') - const messages = require('./shared/messages') - - const MESSAGE = messages.info.providePassword({ - displayName: packageJSON.displayName - }) - - const ELEVATOR_COMMANDS = [ - { - name: 'gksudo', - options: [ '--preserve-env', '--message', MESSAGE ] - }, - { - name: 'kdesudo', - options: [ '--comment', MESSAGE, '--' ] - }, - { - name: 'beesu', - options: [ '--preserve-environment' ] - } - ] - - if (_.includes([ 'win32', 'darwin' ], os.platform())) { - require('./gui/etcher') - } else { - permissions.isElevated().then((isElevated) => { - if (isElevated) { - require('./gui/etcher') - return Bluebird.resolve() - } - - return Bluebird.any(_.map(ELEVATOR_COMMANDS, (command) => { - return commandExists(command.name).then((exists) => { - if (!exists) { - throw new Error(`Command does not exist: ${command.name}`) - } - - return command - }) - })).then((command) => { - return new Bluebird((resolve, reject) => { - const argv = process.env.APPIMAGE ? [ process.env.APPIMAGE ] : process.argv - const options = command.options.concat([ 'env', 'SKIP=1' ]).concat(argv) - - console.log(`Running ${command.name}`) - - const child = childProcess.spawn(command.name, options, { - detached: true, - env: process.env - }) - - child.stdout.on('data', (data) => { - console.log(data.toString()) - }) - - child.stderr.on('data', (data) => { - console.error(data.toString()) - }) - - child.on('exit', () => { - electron.app.quit() - }) - - child.on('error', reject) - }) - }).catch(Bluebird.AggregateError, () => { - const commands = _.map(ELEVATOR_COMMANDS, 'name') - const formattedCommands = `${_.initial(commands).join(', ')}, or ${_.last(commands)}` - throw errors.createUserError({ - title: 'Can\'t elevate the application', - description: `Please ensure you have either ${formattedCommands} available in your system` - }) - }) - }).catch((error) => { - electron.dialog.showErrorBox(errors.getTitle(error), errors.getDescription(error)) - electron.app.exit(EXIT_CODES.GENERAL_ERROR) - }) - } + require('./gui/etcher') } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 96b0b41c..866752c3 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -855,11 +855,6 @@ "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz", "dev": true }, - "command-exists": { - "version": "1.2.2", - "from": "command-exists@latest", - "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.2.tgz" - }, "command-join": { "version": "2.0.0", "from": "command-join@2.0.0", diff --git a/package.json b/package.json index 967456bd..8def4615 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,6 @@ "bluebird": "3.4.1", "bootstrap-sass": "3.3.6", "chalk": "1.1.3", - "command-exists": "1.2.2", "command-join": "2.0.0", "debug": "2.6.0", "drivelist": "5.2.4",