microcom icon indicating copy to clipboard operation
microcom copied to clipboard

add a 'paste' command to write a local file to the terminal

Open rohieb opened this issue 3 years ago • 1 comments

This command can be useful as replacement for the clipboard, e.g. when working remotely over SSH, and when file transfer to the target is not available otherwise.

Usage example (glados is my host machine, RPi3 is the target, non-printable key presses in angle brackets):

rohieb@glados:~ $ cat apparmor-profile
#include <tunables/global>
profile /usr/bin/rauc {
  #include <abstractions/base>
  
  capability sys_rawio,

  /usr/bin/rauc mr,
  /usr/bin/barebox-state cx,
  /usr/sbin/unsquashfs cx,
  /usr/bin/busybox.nosuid cx,
  /run/rauc/bundle/hook.sh Ux,
  /tmp/** rw,
  /mnt/updatebundle.rauc rk,
  /etc/rauc/* r,
  /proc/cmdline r, 
  /proc/*/fd/ r,
  /proc/*/mountinfo r,
  /run/rauc/** rw,
  /dev/mmcblk* rw,
  /sys/devices/**/mmcblk*/mmcblk*boot*/force_ro rw,
  /etc/ssl/openssl.cnf r,
}
  
rohieb@glados:~ $ microcom  -s 115200 /dev/ttyUSB0
root@RPi3:~ cat /usr/share/apparmor/usr.bin.rauc
cat: can't open '/usr/share/apparmor/usr.bin.rauc': No such file or directory
root@RPi3:~ cat > /usr/share/apparmor/usr.bin.rauc
<Ctrl-\>
Enter command. Try 'help' for a list of builtin commands
-> paste apparmor-profile

----------------------
#include <tunables/global>
profile /usr/bin/rauc flags=(attach_disconnected) {
  #include <abstractions/base>
  
  capability sys_rawio,
           
  /usr/bin/rauc mr,
  /usr/bin/barebox-state cx,
  /usr/sbin/unsquashfs cx,
  /usr/bin/busybox.nosuid cx,
  /run/rauc/bundle/hook.sh Ux,
  /tmp/** rw,
  /mnt/updatebundle.rauc rk,
  /etc/rauc/* r,
  /proc/cmdline r, 
  /proc/*/fd/ r,
  /proc/*/mountinfo r,
  /run/rauc/** rw,
  /dev/mmcblk* rw,
  /sys/devices/**/mmcblk*/mmcblk*boot*/force_ro rw,
  /etc/ssl/openssl.cnf r,
}
<Ctrl-D>
root@RPi3:~ ls -l /usr/share/apparmor/usr.bin.rauc
-rw-r--r--    1 root     root           521 Sep  1 00:12 /usr/share/apparmor/usr.bin.rauc

rohieb avatar Feb 06 '21 21:02 rohieb