一、安装基础软件包
[[email protected] software]# yum install libMagickCore libMagickWand libjpeg-turbo-devel libjpeg-turbo libpng-devel compat-glibc-headers libbsd-devel xdotool -y
二、安装ttyrec
[[email protected] software]# tar xf ttyrec-1.0.8.tar.gz [[email protected] software]# unzip -q ttyrec-1.0.8.RHEL5.patch.zip [[email protected] software]# cd ttyrec-1.0.8 [[email protected] ttyrec-1.0.8]# patch -i ttyrec-1.0.8.RHEL5.patch //打补丁 patching file Makefile patching file ttyrec.c [[email protected] ttyrec-1.0.8]# make gcc -O2 -DHAVE_openpty -c -o ttyrec.o ttyrec.c gcc -O2 -DHAVE_openpty -c -o io.o io.c gcc -O2 -DHAVE_openpty -o ttyrec ttyrec.o io.o -lutil gcc -O2 -DHAVE_openpty -c -o ttyplay.o ttyplay.c gcc -O2 -DHAVE_openpty -o ttyplay ttyplay.o io.o gcc -O2 -DHAVE_openpty -c -o ttytime.o ttytime.c gcc -O2 -DHAVE_openpty -o ttytime ttytime.o io.o [[email protected] ttyrec-1.0.8]# ll total 188 -rw-r--r-- 1 root root 4193 Jun 11 2006 io.c -rw-r--r-- 1 root root 371 Jun 11 2006 io.h -rw-r--r-- 1 root root 4256 Jul 23 04:32 io.o -rw-r--r-- 1 root root 654 Jul 23 04:32 Makefile -rw-r--r-- 1 root root 429 Jun 11 2006 README -rw-r--r-- 1 root root 1588 Mar 13 2015 tty2gif.py -rwxr-xr-x 1 root root 20327 Jul 23 09:57 ttygif -rwxr-xr-x 1 root root 15447 Jul 23 04:32 ttyplay -rw-r--r-- 1 root root 1128 Jun 11 2006 ttyplay.1 -rw-r--r-- 1 root root 7687 Jun 11 2006 ttyplay.c -rw-r--r-- 1 root root 8648 Jul 23 04:32 ttyplay.o -rwxr-xr-x 1 root root 24505 Jul 23 04:32 ttyrec -rw-r--r-- 1 root root 1454 Jun 11 2006 ttyrec.1 -rw-r--r-- 1 root root 935 Jul 23 04:31 ttyrec-1.0.8.RHEL5.patch -rw-r--r-- 1 root root 9789 Jul 23 04:32 ttyrec.c -rw-r--r-- 1 root root 145 Jun 11 2006 ttyrec.h -rw-r--r-- 1 root root 18168 Jul 23 04:32 ttyrec.o -rw-r--r-- 1 root root 441 Jul 23 09:21 ttyrecord -rwxr-xr-x 1 root root 9995 Jul 23 04:32 ttytime -rw-r--r-- 1 root root 432 Jun 11 2006 ttytime.1 -rw-r--r-- 1 root root 2459 Jun 11 2006 ttytime.c -rw-r--r-- 1 root root 2152 Jul 23 04:32 ttytime.o [[email protected] ttyrec-1.0.8]# cp ttyplay ttyrec ttytime /usr/local/bin [[email protected] ttyrec-1.0.8]# ttyrec //进行录制 [[email protected] ttyrec-1.0.8]# echo "hello,word" hello,word [[email protected] ttyrec-1.0.8]# exit //结束录制 [[email protected] ttyrec-1.0.8]# ttyplay ttyrecord //本地播放,ttyrecord录制后默认文件,可以自定义文件 [[email protected] ttyrec-1.0.8]# ttyrec test //自定义录制文件 [[email protected] ttyrec-1.0.8]# ll test -rw-r--r--. 1 root root 466 Jul 23 19:28 test
三、将录制文件转换成GIF
[[email protected] software]# unzip -q seq2gif-master.zip [[email protected] seq2gif-master]# ./configure [[email protected] seq2gif-master]# make [[email protected] seq2gif-master]# make install [[email protected] ttyrec-1.0.8]# seq2gif -i ttyrecord -o tty.gif [[email protected] ttyrec-1.0.8]# ll tty.gif -rw-r--r--. 1 root root 28068 Jul 23 19:31 tty.gif 附录: git clone https://github.com/saitoha/seq2gif wget http://0xcc.net/ttyrec/ttyrec-1.0.8.tar.gz wget https://codeload.github.com/gist/08c41b8b16ca3b969df4/zip/62767e5f3564346394f5a21bd4fe377d2e05c51c
四、结果
时间: 2024-10-24 20:44:51