LoginSignup
1
1

docker(72)uudecodeをdockerで

Last updated at Posted at 2019-09-04

ある日、メールで「添付したファイル、解答してuudecodeしてください」って書いてあった。

何年uudecodeしていないのだろう。

現在のOSでuudecodeするの面倒くさいし、機材4種類いれていて、どこで何使うかわからない。

dockerで作業すれば、いつでも大丈夫ってことでdocker でuudecode

macOS
$ docker run -v /Users/administrator/work:/home/work -it  ubuntu /bin/bash

/Users/administrator/workは、hostOSに実在するフォルダ名
そこにファイルを入れてuudecodeすればよい。

ファイルをdockerとコピーする必要はない。

いつもはデータも公開するものが多く、docker内でcpするが、今回はない。

docker/ubuntu
# apt update; apt -y upgrade; apt install vim apt-utils uudecode
...
E: Unable to locate package uudecode

# apt search uudecode
Sorting... Done
Full Text Search... Done
sharutils/bionic 1:4.15.2-3 amd64
  shar, unshar, uuencode, uudecode


uudecodeのパッケージ名おぼえてなくて、ひとまず入れた。
だめっていわれたので 検索した。

# apt install -y sharutils

# sharutils --help
bash: sharutils: command not found

# uudecode --help
uudecode (GNU sharutils) - decode an encoded file
Usage:  uudecode [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [<file>...]

   -o, --output-file=str      direct output to file
   -c, --ignore-chmod         ignore fchmod(3P) errors
   -v, --version[=MODE]       output version information and exit
   -h, --help                 display extended usage information and exit
   -!, --more-help            extended usage information passed thru pager
   -R, --save-opts[=FILE]     save the option state to a config file FILE
   -r, --load-opts=FILE       load options from the config file FILE
                                - disabled with '--no-load-opts'
                                - may appear multiple times

Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
If no 'file'(s) are provided, then standard input is decoded.

The following option preset mechanisms are supported:
 - reading file $HOME/.sharrc

'uudecode' transforms uuencoded files into their original form.

The encoded file(s) may be specified on the command line, or one may be
read from standard input.  The output file name is specified in the encoded
file, but may be overridden with the '-o' option.  It will have the mode of
the original file, except that setuid and execute bits are not retained.  If
the output file is specified to be '/dev/stdout' or '-', the result will be
written to standard output.  If there are multiple input files and the
second or subsquent file specifies standard output, the decoded data will
be written to the same file as the previous output.  Don't do that.

'uudecode' ignores any leading and trailing lines.  It looks for a line
that starts with "'begin'" and proceeds until the end-of-encoding marker is
found.  The program determines from the header line of the encoded file
which of the two supported encoding schemes was used and whether or not the
output file name has been encoded with base64 encoding.  See 'uuencode(5)'.

Please send bug reports to:  <bug-gnu-utils@gnu.org>

# uudecode uudecodeme.txt 

root@ca6a391e2db5:/home/work#

無事処理できた。

別の機材でも利用するためdocker hubにあげる。

macOS
$ docker commit ca6a391e2db5 kaizenjapan/uudecode
sha256:dff2a6fd681b6635a13251f5285daa2e27573e5966b6f2b82d9aa05a73c33036
KM-S05:~ administrator$ docker push kaizenjapan/uudecode
The push refers to repository [docker.io/kaizenjapan/uudecode]
d9df9028d70c: Pushing [================>                   ] 32.11MB/96.41MB
b079b3fa8d1b: Mounted from kaizenjapan/gawk 
a31dbd3063d7: Mounted from kaizenjapan/gawk 
c56e09e1bd18: Mounted from kaizenjapan/gawk 
543791078bdb: Mounted from kaizenjapan/gawk 

使う時はこっちで起動。

macOS
$ docker run -v /Users/administrator/work:/home/work -it  kaizenjapan/uudecode /bin/bash

/Users/administrator/workはhostOS側の存在するフォルダ名です。

最後までおよみいただきありがとうございました。

いいね 💚、フォローをお願いします。

Thank you very much for reading to the last sentence.

Please press the like icon 💚 and follow me for your happy life.

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1