src/cmd/udev.js
function promptAndInstallUdevRules(err = null) {
	if (!systemSupportsUdev()) {
		return when.reject(new Error('Not supported'));
	}
	if (udevRulesInstalled()) {
		if (err) {
			console.log(chalk.bold.red('Physically unplug and reconnect your Particle devices and try again.'));
			return when.reject(err);
		}
		return when.resolve();
	}
	console.log(chalk.yellow('You are missing the permissions to access USB devices without root.'));
	return prompt({
		type: 'confirm',
		name: 'install',
		message: 'Would you like to install a udev rules file to get access?',
		default: true
	})
		.then(r => {
			if (!r.install) {
				if (err) {
					throw err;
				}
				throw new Error('Cancelled');
			}
			return installUdevRules();
		})
		.then(() => {
			console.log('udev rules installed.');
			if (err) {
				console.log(chalk.bold.red('Physically unplug and reconnect your Particle devices and try again.'));
				throw err;
			}
		});
}
function promptAndInstallUdevRules(err = null) {
	if (!systemSupportsUdev()) {
		return when.reject(new Error('Not supported'));
	}
	if (udevRulesInstalled()) {
		if (err) {
			console.log(chalk.bold.red('Physically unplug and reconnect your Particle devices and try again.'));
			return when.reject(err);
		}
		return when.resolve();
	}
	console.log(chalk.yellow('You are missing the permissions to access USB devices without root.'));
	return prompt({
		type: 'confirm',
		name: 'install',
		message: 'Would you like to install a udev rules file to get access?',
		default: true
	})
		.then(r => {
			if (!r.install) {
				if (err) {
					throw err;
				}
				throw new Error('Cancelled');
			}
			return installUdevRules();
		})
		.then(() => {
			console.log('udev rules installed.');
			if (err) {
				console.log(chalk.bold.red('Physically unplug and reconnect your Particle devices and try again.'));
				throw err;
			}
		});
}
function promptAndInstallUdevRules ( err = null ) { if ( ! systemSupportsUdev ( ) ) { return when . reject ( new Error ( 'Not supported' ) ) ; } if ( udevRulesInstalled ( ) ) { if ( err ) { console . log ( chalk . bold . red ( 'Physically unplug and reconnect your Particle devices and try again.' ) ) ; return when . reject ( err ) ; } return when . resolve ( ) ; } console . log ( chalk . yellow ( 'You are missing the permissions to access USB devices without root.' ) ) ; return prompt ( { type : 'confirm' , name : 'install' , message : 'Would you like to install a udev rules file to get access?' , default : true } ) . then ( r => { if ( ! r . install ) { if ( err ) { throw err ; } throw new Error ( 'Cancelled' ) ; } return installUdevRules ( ) ; } ) . then ( ( ) => { console . log ( 'udev rules installed.' ) ; if ( err ) { console . log ( chalk . bold . red ( 'Physically unplug and reconnect your Particle devices and try again.' ) ) ; throw err ; } } ) ; }
Prompts the user to install the udev rules.

@param {Error} [err] Original error that led to this prompt.
@return {Promise}
Prompts the user to install the udev rules .