#2734 Issue closed: Set nano as default editor for rear recover

Labels: enhancement, discuss / RFC, needs sponsorship

speefak opened issue at 2021-12-27 01:27:

  • ReaR version ("/usr/sbin/rear -V"):
    Relax-and-Recover 2.6 / Git

  • OS version ("cat /etc/os-release" or "lsb_release -a" or "cat /etc/rear/os.conf"):
    Debain 11

  • ReaR configuration files ("cat /etc/rear/site.conf" and/or "cat /etc/rear/local.conf"):

OUTPUT=ISO
ISO_DIR=/mnt/user@host_ReaR/ReaR_Backups
ISO_PREFIX="system-LTC93_2021-12-26-131942_OS"
OUTPUT_URL=null
BACKUP=NETFS
BACKUP_URL="iso:///backup"
export TMPDIR=/home/rear_tmp
BACKUP_PROG_COMPRESS_OPTIONS=( --use-compress-program=pigz )
REQUIRED_PROGS+=( pigz )
USER_INPUT_TIMEOUT=3
AUTORESIZE_PARTITIONS=true
BACKUP_PROG_EXCLUDE=( '/mnt/*' '/media/*' '/home/rear_tmp/*' '/home/vbox/*'  )
  • Hardware vendor/product (PC or PowerNV BareMetal or ARM) or VM (KVM guest or PowerVM LPAR):
    Intel i3 4XXX

  • System architecture (x86 compatible or PPC64/PPC64LE or what exact ARM device):
    AMD64

  • Firmware (BIOS or UEFI or Open Firmware) and bootloader (GRUB or ELILO or Petitboot):
    VBOX VM

  • Storage (local disk or SSD) and/or SAN (FC or iSCSI or FCoE) and/or multipath (DM or NVMe):
    VBOX SSD

  • Storage layout ("lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,LABEL,SIZE,MOUNTPOINT"):
    VBOX SSD

  • Description of the issue (ideally so that others can reproduce it):
    reaplce vi by nano

  • Workaround, if any:
    in rear recover shell :

$ cd /bin
$ mv vi vi_BAK
$ ln -s nano vi
$ rear recover

I dont like vi so i would like to replace vi by nano.
The command export EDITOR="/bin/nano" doesnt work
so i replace the vi binary with a link to nano in the /bin directory.
This is a quick 'n' dirty sollution but it works.

Can i replace the vi default editor in the rear iso by nano
using the rear config file by an option ?
Must write the config line export EDITOR="/bin/nano"
to the rear config or can i create an "auto execution script"
when building the ISO which does the vi/nano substitution
like above discriped ?

jsmeix commented at 2022-01-04 08:57:

We won't set nano as default editor for "rear recover"
i.e. the editor one gets when nothing was specified.

The traditional Unix/Linux editor used by system admins is vi
so vi must be kept as default editor in ReaR because
ReaR is first and foremost meant for system admins.

It is a different question if a user can use another editor
when he does not like to use the default vi.

I think this is currently already sufficiently solved via
https://github.com/rear/rear/issues/1298
therein see in particular
https://github.com/rear/rear/issues/1298#issuecomment-423070755

What is not yet done is that all hardcoded places that call vi
(mainly user dialogs that offer choices to edit files
like disklayout.conf and diskrestore.sh)
would have to be cleaned up and enhanced
to call a different (and available) editor, cf.
https://github.com/rear/rear/issues/1298#issuecomment-299864994

When there are user dialogs where the generic choice
Use Relax-and-Recover shell and return back to here
makes sense but is missing I could add it (as time permits).

But I won't implement REAR_EDITOR support as described in
https://github.com/rear/rear/issues/1298#issuecomment-299864994

When REAR_EDITOR support is wanted someone else would have to
implement it and provide it as a GitHub pull request according to
https://github.com/rear/rear/wiki/Coding-Style
and "Contributing" in
http://relax-and-recover.org/development/
and "How to contribute to Relax-and-Recover" in
https://en.opensuse.org/SDB:Disaster_Recovery

schlomo commented at 2023-02-22 21:11:

Pickung up on this old thread because I recently had the fun to work with vi (not vim) during recovery, and it was no fun.

I'm thinking about adding some code to make sure that something provides /bin/editor similar how to some distros set a /usr/bin/editor symink via update-alternatives to point to some editor. And then the code would look at $(type -p editor) on the source system and replicate that, falling back to vi of course.

The result would be a closer match of the rescue system to the source system.


[Export of Github issue for rear/rear.]