import { OperatingSystem } from '@/domain/OperatingSystem'; import { InstructionsBuilder } from './InstructionsBuilder'; export class LinuxInstructionsBuilder extends InstructionsBuilder { constructor() { super(OperatingSystem.Linux); super .withStep(() => ({ action: { instruction: 'Download the file.', details: 'You should have already been prompted to save the script file.' + '
If this was not the case or you did not save the script when prompted,' + '
please try to download your script file again.', }, })) .withStep(() => ({ action: { instruction: 'Open terminal.', details: 'Opening terminal changes based on the distro you run.' + '
You may search for "Terminal" in your application launcher to find it.' + '
' + '
Alternatively use terminal shortcut for your distro if it has one by default:' + '' , }, })) .withStep(() => ({ action: { instruction: 'Navigate to the folder where you downloaded the file e.g.:', }, code: { instruction: 'cd ~/Downloads', details: 'Press on enter/return key after running the command.' + '
If the file is not downloaded on Downloads folder,' + '
change Downloads to path where the file is downloaded.' + '
' + '
This command means:' + '', }, })) .withStep((data) => ({ action: { instruction: 'Give the file execute permissions:', }, code: { instruction: `chmod +x ${data.fileName}`, details: 'Press on enter/return key after running the command.
' + 'It will make the file executable.
' + 'If you use desktop environment you can alternatively (instead of running the command):' + '
    ' + '
  1. Locate the file using your file manager.
  2. ' + '
  3. Right click on the file, select "Properties".
  4. ' + '
  5. Go to "Permissions" and check "Allow executing file as program".
  6. ' + '
' + '
These GUI steps and name of options may change depending on your file manager.' , }, })) .withStep((data) => ({ action: { instruction: 'Execute the file:', }, code: { instruction: `./${data.fileName}`, details: 'If you have desktop environment, instead of running this command you can alternatively:' + '
    ' + '
  1. Locate the file using your file manager.
  2. ' + '
  3. Right click on the file, select "Run as program".
  4. ' + '
' , }, })) .withStep(() => ({ action: { instruction: 'If asked, enter your administrator password.', details: 'As you type, your password will be hidden but the keys are still registered, so keep typing.' + '
Press on enter/return key after typing your password.' + '
Administrator privileges are required to configure OS.', }, })); } }