トップ 追記

Masa's blog

検索キーワード:

2024年08月12日 Slackware64-current on LIFEBOOK AH Series [長年日記]

_ Slackware64-current on LIFEBOOK AH Series

メインマシンをLIFEBOOK WA3/F3(中古 Core-i7 1195G7, Memory 32GB, M.2 SSD 1TB)に買い換えた機会にSlackware64-14.2からSlackware64-currentに変更した。

/etc/fstab

/dev/nvme0n1p2   swap             swap        defaults         0   0
/dev/nvme0n1p3   /                ext4        defaults,noatime 1   1
/dev/nvme0n1p1   /boot/efi        vfat        defaults         1   0
#/dev/cdrom      /mnt/cdrom       auto        noauto,owner,ro,comment=x-gvfs-show 0   0
/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       nosuid,nodev,noexec 0   0

gdisk -l /dev/nvme0n1

GPT fdisk (gdisk) version 1.0.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/nvme0n1: 1953525168 sectors, 931.5 GiB
Model: WD_BLACK SN770 1TB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): BAB62137-FDB7-4CBF-B6B0-313F47EF3E72
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 2048-sector boundaries
Total free space is 3437 sectors (1.7 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   EF00  EFI system partition
   2          206848        79898623   38.0 GiB    8200  Linux swap
   3        79898624      1953523711   893.4 GiB   8300  Linux filesystem

独自にインストールしたもの

How to build

tar xvf clamav-1.0.0.tar.gz
cd clamav-1.0.0
mkdir build
cd build
cmake ..
make

su
make install
mkdir /usr/local/share/clamav
chown clamav.clamav /usr/local/share/clamav
chmod 775 /usr/local/share/clamav

/etc/passwd

clamav:x:513:513:clamav anti virus:/usr/local/share/clamav:/bin/false

/etc/group

clamav:x:513:

/usr/local/etc/clamd.conf

##Example
DatabaseDirectory /usr/local/share/clamav
LocalSocket /tmp/clamd.socket
TCPSocket 3310
TCPAddr localhost

/usr/local/etc/freshclamd.conf

##Example
DatabaseDirectory /usr/local/share/clamav
##HTTPProxyServer 192.168.0.100
##HTTPProxyPort 8080

filterdcpj552n

*** /opt/brother/Printers/dcpj552n/lpd/filterdcpj552n.ORG	2024-05-03 23:29:12.182264882 +0900
--- /opt/brother/Printers/dcpj552n/lpd/filterdcpj552n	2024-08-11 09:09:08.931587840 +0900
***************
*** 77,84 ****
  		rm -f $PS_TEMP
  		;;
  	* )
! 		A2PS_OP="--output=- -q -1 --no-header --borders no"
! 		eval cat $INPUT_TEMP | a2ps $A2PS_OP | $PSCONV $PSCONV_OP | $BRCONV $BRCONV_OP
  		RET=$?
  		;;
  esac
--- 77,87 ----
  		rm -f $PS_TEMP
  		;;
  	* )
! ##		A2PS_OP="--output=- -q -1 --no-header --borders no"
! ##		eval cat $INPUT_TEMP | a2ps $A2PS_OP | $PSCONV $PSCONV_OP | $BRCONV $BRCONV_OP
! 		A2PS_OP=""
! ####		eval cat $INPUT_TEMP | /usr/local/bin/a2ps-j $A2PS_OP | $PSCONV $PSCONV_OP | $BRCONV $BRCONV_OP
! 		eval /usr/local/bin/nkf -w $INPUT_TEMP | /usr/local/bin/a2ps-j $A2PS_OP | $PSCONV $PSCONV_OP | $BRCONV $BRCONV_OP
  		RET=$?
  		;;
  esac
tar xvf aaa_glibc-solibs-2.39-i586-2.txz lib/incoming/ld-2.39.so lib/incoming/libc-2.39.so lib/incoming/libm-2.39.so
cp lib/incoming/lib*so /lib/
ldconfig
/opt/brother/Printers/dcpj552n/cupswrapper/cupswrapperdcpj552n -i
mkdir /var/spool/lpd
http://localhost:631/admin/
 -> 管理
 -> プリンターの追加
 -> LPD/LPR ホストまたはプリンター
 -> lpd://192.168.0.100/lpraw
 -> 名前、説明、場所
 -> または PPD ファイルを提供: /opt/brother/Printers/dcpj552n/cupswrapper/brother_dcpj552n_printer_en.ppd
 -> プリンターの追加
# sh VMware-Workstation-Full-17.5.2-23775571.x86_64.bundle --ignore-errors
## https://bbs.archlinux.org/viewtopic.php?pid=1992431
$ git clone -b workstation-17.5.1 https://github.com/mkubecek/vmware-host-modules.git
$ cd vmware-host-modules/
$ make
# make install
# /etc/init.d/vmware restart
*** ./root/vmware-host-modules/vmnet-only/vmnetInt.h.ORG	2024-05-16 21:39:10.539013690 +0900
--- ./root/vmware-host-modules/vmnet-only/vmnetInt.h	2024-05-16 21:43:04.991016552 +0900
***************
*** 41,48 ****
      compat_skb_set_network_header(skb, sizeof (struct ethhdr)),  \
      dev_queue_xmit(skb)                                   \
    )
! #define dev_lock_list()    read_lock(&dev_base_lock)
! #define dev_unlock_list()  read_unlock(&dev_base_lock)


  extern struct proto vmnet_proto;
--- 41,53 ----
      compat_skb_set_network_header(skb, sizeof (struct ethhdr)),  \
      dev_queue_xmit(skb)                                   \
    )
! #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 9, 0)
! #    define dev_lock_list()    rcu_read_lock()
! #    define dev_unlock_list()  rcu_read_unlock()
! #else
! #    define dev_lock_list()    read_lock(&dev_base_lock)
! #    define dev_unlock_list()  read_unlock(&dev_base_lock)
! #endif


  extern struct proto vmnet_proto;
*** ./vmware-host-modules/vmmon-only/include/iocontrols.h.ORG	2024-05-14 22:39:47.000000000 +0900
--- ./vmware-host-modules/vmmon-only/include/iocontrols.h	2024-09-08 01:01:50.244040200 +0900
***************
*** 146,152 ****
   * the NT specific VMX86_DRIVER_VERSION.
   */

! #define VMMON_VERSION           (416 << 16 | 0)
  #define VMMON_VERSION_MAJOR(v)  ((uint32) (v) >> 16)
  #define VMMON_VERSION_MINOR(v)  ((uint16) (v))

--- 146,152 ----
   * the NT specific VMX86_DRIVER_VERSION.
   */

! #define VMMON_VERSION           (417 << 16 | 0)
  #define VMMON_VERSION_MAJOR(v)  ((uint32) (v) >> 16)
  #define VMMON_VERSION_MINOR(v)  ((uint16) (v))
# cd /etc/rc.d/rc4.d
# ln -s /etc/rc.d/init.d/vmware K08vmware
# ln -s /etc/rc.d/init.d/vmware-USBArbitrator K08vmware-USBArbitrator
# ln -s /etc/rc.d/init.d/vmware S19vmware
# ln -s /etc/rc.d/init.d/vmware-USBArbitrator S50vmware-USBArbitrator
$ /usr/libexec/polkit-gnome-authentication-agent-1 &
$ vmplayer
You can use /usr/lib/vmware/bin/vmware-netcfg for nettwork setting
 o vmnet1 for Hostonly network
 o vmnet8 for Nat network
$ curl -sSLf https://github.com/aclap-dev/vdhcoapp/releases/latest/download/install.sh | bash
#! /bin/sh
#
# mfs fontfile fndry fmly cp
#
# cd /usr/share/fonts/TTF
# cp fonts.scale fonts.scale.backup
# cp fonts.dir fonts.dir.backup
# /home/m-ito/INSTALLED/makefontscale.sh >fonts.add
# cat fonts.scale.backup | egrep -v 'dfjgyomd.ttf|dfjkaibd.ttf|dfjkailt.ttf|dfjkaimd.ttf|dfjktrxb.ttf|dfjleimd.ttf|dfjmrgbd.ttf|dfjmrglt.ttf|dfjmrgmd.ttf|dfjmrmmd.ttf|dfjmrmw7.ttf|dfjmrmw9.ttf|dfjpop1.ttf|dfjpopw5.ttf|dfjpopw9.ttf|dfjgyomd-unicode.ttf|dfjkaibd-unicode.ttf|dfjkailt-unicode.ttf|dfjkaimd-unicode.ttf|dfjktrxb-unicode.ttf|dfjleimd-unicode.ttf|dfjmrgbd-unicode.ttf|dfjmrgbd-unicode.ttf|dfjmrglt-unicode.ttf|dfjmrgmd-unicode.ttf|dfjmrmmd-unicode.ttf|dfjmrmw7-unicode.ttf|dfjmrmw9-unicode.ttf|dfjpop1-unicode.ttf|dfjpopw5-unicode.ttf|dfjpopw9-unicode.ttf|kochi-gothic.ttf|kochi-mincho.ttf|kouzanmouhitu.ttf|sazanami-gothic.ttf|sazanami-mincho.ttf|ipag.ttf|ipagp.ttf|ipam.ttf|ipamp.ttf|ipamjm.ttf' >junk
# cat junk fonts.add | sort | uniq >fonts.scale
# rm junk
# wc -l fonts.scale # remember LINE
# vim fonts.scale # edit number in first line to (LINE - 1)
# mkfontdir -e /usr/share/fonts/encodings -e /usr/share/fonts/encodings/large
# cp fonts.dir fonts.scale
# fc-cache -f -v
#
# JISX0208-1978, 1983, 1990, 1997, 2012
# JISX0213-2000, 2004, 2012
#
function mfs() {
	fontfile="$1"
	fndry="$2"
	fmly="$3"
	cp="$4"
	jisx="$5"

	for i in iso8859-1 jisx0201.1976-0 ${jisx}
	do
		bw=""
		colon=""
		if [ $i = "iso8859-1" -o $i = "jisx0201.1976-0" ]
		then
			bw="bw=0.5"
			colon=":"
		fi
		echo ${bw}${colon}${fontfile} -${fndry}-${fmly}-medium-r-normal--0-0-0-0-${cp}-0-$i
		echo ai=0.4:${bw}${colon}${fontfile} -${fndry}-${fmly}-medium-i-normal--0-0-0-0-${cp}-0-$i
		echo ai=0.2:${bw}${colon}${fontfile} -${fndry}-${fmly}-medium-o-normal--0-0-0-0-${cp}-0-$i
		echo ds=y:${bw}${colon}${fontfile} -${fndry}-${fmly}-bold-r-normal--0-0-0-0-${cp}-0-$i
		echo ds=y:ai=0.4:${bw}${colon}${fontfile} -${fndry}-${fmly}-bold-i-normal--0-0-0-0-${cp}-0-$i
		echo ds=y:ai=0.2:${bw}${colon}${fontfile} -${fndry}-${fmly}-bold-o-normal--0-0-0-0-${cp}-0-$i
	done
}

# jisx0208.1983-0
mfs dfjgyomd.ttf dynalab "dfgyosho lt" m jisx0208.1983-0
mfs dfjkaibd.ttf dynalab "dfkaisho xb" m jisx0208.1983-0
mfs dfjkailt.ttf dynalab "dfkaisho lt" m jisx0208.1983-0
mfs dfjkaimd.ttf dynalab "dfkaisho md" m jisx0208.1983-0
mfs dfjktrxb.ttf dynalab "dfkanteiryu xb" m jisx0208.1983-0
mfs dfjleimd.ttf dynalab "dfleisho sb" m jisx0208.1983-0
mfs dfjmrgbd.ttf dynalab "dfmarugothic bd" m jisx0208.1983-0
mfs dfjmrglt.ttf dynalab "dfmarugothic lt" m jisx0208.1983-0
mfs dfjmrgmd.ttf dynalab "dfmarugothic md" m jisx0208.1983-0
mfs dfjmrmmd.ttf dynalab "dfmarumoji sl" m jisx0208.1983-0
mfs dfjmrmw7.ttf dynalab "dfmarumoji w7" m jisx0208.1983-0
mfs dfjmrmw9.ttf dynalab "dfmarumoji w9" m jisx0208.1983-0
mfs dfjpop1.ttf dynalab "dfpop1 sb" m jisx0208.1983-0
mfs dfjpopw5.ttf dynalab "dfpop1 w5" m jisx0208.1983-0
mfs dfjpopw9.ttf dynalab "dfpop1 w9" m jisx0208.1983-0

# jisx0208.1983-0
mfs dfjgyomd-unicode.ttf dynalab "dfgyosho-u lt" m jisx0208.1983-0
mfs dfjkaibd-unicode.ttf dynalab "dfkaisho-u xb" m jisx0208.1983-0
mfs dfjkailt-unicode.ttf dynalab "dfkaisho-u lt" m jisx0208.1983-0
mfs dfjkaimd-unicode.ttf dynalab "dfkaisho-u md" m jisx0208.1983-0
mfs dfjktrxb-unicode.ttf dynalab "dfkanteiryu-u xb" m jisx0208.1983-0
mfs dfjleimd-unicode.ttf dynalab "dfleisho-u sb" m jisx0208.1983-0
mfs dfjmrgbd-unicode.ttf dynalab "dfmarugothic-u bd" m jisx0208.1983-0
mfs dfjmrglt-unicode.ttf dynalab "dfmarugothic-u lt" m jisx0208.1983-0
mfs dfjmrgmd-unicode.ttf dynalab "dfmarugothic-u md" m jisx0208.1983-0
mfs dfjmrmmd-unicode.ttf dynalab "dfmarumoji-u sl" m jisx0208.1983-0
mfs dfjmrmw7-unicode.ttf dynalab "dfmarumoji-u w7" m jisx0208.1983-0
mfs dfjmrmw9-unicode.ttf dynalab "dfmarumoji-u w9" m jisx0208.1983-0
mfs dfjpop1-unicode.ttf dynalab "dfpop1-u sb" m jisx0208.1983-0
mfs dfjpopw5-unicode.ttf dynalab "dfpop1-u w5" m jisx0208.1983-0
mfs dfjpopw9-unicode.ttf dynalab "dfpop1-u w9" m jisx0208.1983-0

# jisx0208.1983-0
mfs kochi-gothic.ttf misc "kochi gothic" m jisx0208.1983-0
mfs kochi-mincho.ttf misc "kochi mincho" m jisx0208.1983-0

# jisx0208.1983-0
mfs kouzanmouhitu.ttf misc kouzanbrushfont m jisx0208.1983-0

# jisx0208.1983-0
mfs sazanami-gothic.ttf misc "sazanami gothic" m jisx0208.1983-0
mfs sazanami-mincho.ttf misc "sazanami mincho" m jisx0208.1983-0

# jisx0208.1983-0
#mfs ipag.ttf misc ipagothic m jisx0208.1983-0
#mfs ipagp.ttf misc ipapgothic p jisx0208.1983-0
#mfs ipam.ttf misc ipamincho m jisx0208.1983-0
#mfs ipamp.ttf misc ipapmincho p jisx0208.1983-0
mfs ipag.ttf misc ipagothic m jisx0213.2004-0
mfs ipagp.ttf misc ipapgothic p jisx0213.2004-0
mfs ipam.ttf misc ipamincho m jisx0213.2004-0
mfs ipamp.ttf misc ipapmincho p jisx0213.2004-0

# jisx0208.1983-0
#mfs ipamjm.ttf misc ipapmjmincho m jisx0208.1983-0
mfs ipamjm.ttf misc ipapmjmincho m jisx0213.2004-0
tar xvvf less-382.tar.gz
chmod -R +w less-382
cd less-382
zcat ../less-382-iso258.patch.gz | patch -p1
zcat ../less-382-iso258-259.patch.gz | patch -p1
zcat ../less-382-iso259-260.patch.gz | patch -p1
zcat ../less-382-iso260-261.patch.gz | patch -p1
zcat ../less-382-iso261-262.patch.gz | patch -p1
##zcat ../less-382-iso262.ext02.patch.gz | patch -p1
zcat ../less-382-iso262.ext03.patch.gz | patch -p1
CFLAGS="-Wno-error=implicit-function-declaration -Wno-error=implicit-int" ./configure
CFLAGS="-Wno-error=implicit-function-declaration -Wno-error=implicit-int" make
CFLAGS="-Wno-error=implicit-function-declaration -Wno-error=implicit-int" make install

Canna37p3.diff

*** Makefile.ORG	2024-07-12 23:12:36.912950194 +0900
--- Makefile	2024-07-12 23:14:29.256951565 +0900
***************
*** 290,296 ****

        PROJECTROOT = /usr

!       CDEBUGFLAGS = -O2 -fno-strength-reduce -fno-strict-aliasing
          CCOPTIONS =

        ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(INSTALLED_INCLUDES) $(STD_INCLUDES)
--- 290,296 ----

        PROJECTROOT = /usr

!       CDEBUGFLAGS = -O2 -fno-strength-reduce -fno-strict-aliasing -Wno-error=implicit-int -Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types
          CCOPTIONS =

        ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(INSTALLED_INCLUDES) $(STD_INCLUDES)

How to build

$ xmkmf -a
$ patch -p0 <../Canna37p3.diff
$ make canna
$ su
# make install
# make install.man

/etc/rc.d/rc.local

if [ -x /usr/local/canna/sbin/cannaserver ]
then
        rm /tmp/.iroha_unix/IROHA
        /usr/local/canna/sbin/cannaserver -inet -u bin
        echo "Starting cannaserver."
fi

/var/log/CANNA0msgs

touch /var/log/CANNA0msgs
chown bin.bin /var/log/CANNA0msgs

/etc/ld.so.conf

/usr/local/canna/lib

kinput-v3.1.diff

*** Makefile.ORG	2024-07-12 23:38:49.433969389 +0900
--- Makefile	2024-07-12 23:42:59.724972445 +0900
***************
*** 169,175 ****

             CXXLIB = -lstdc++

!     CXXDEBUGFLAGS = -O2 -fno-strength-reduce -fno-strict-aliasing
  CXXDEPENDINCLUDES =
   CXXEXTRA_DEFINES =
  CXXEXTRA_INCLUDES =
--- 169,175 ----

             CXXLIB = -lstdc++

!     CXXDEBUGFLAGS = -O2 -fno-strength-reduce -fno-strict-aliasing -Wno-error=implicit-function-declaration -Wno-error=implicit-int
  CXXDEPENDINCLUDES =
   CXXEXTRA_DEFINES =
  CXXEXTRA_INCLUDES =
***************
*** 290,296 ****

        PROJECTROOT = /usr

!       CDEBUGFLAGS = -O2 -fno-strength-reduce -fno-strict-aliasing
          CCOPTIONS =

        ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(INSTALLED_INCLUDES) $(STD_INCLUDES)
--- 290,296 ----

        PROJECTROOT = /usr

!       CDEBUGFLAGS = -O2 -fno-strength-reduce -fno-strict-aliasing -Wno-error=implicit-function-declaration -Wno-error=implicit-int
          CCOPTIONS =

        ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(INSTALLED_INCLUDES) $(STD_INCLUDES)

How to build

$ xmkmf -a
$ patch -p0 <../kinput-v3.1.diff
$ make
# make install
# make install.man

/usr/X11R6/lib/X11/app-defaults/Kinput2 like following.

*IMProtocol.locales: ja_JP.UTF-8, ja_JP.SJIS, ja_JP.EUC, ja_JP, japanese, japan, ja

~/.xinitrc

kinput2 -kinput +ximp -xim -canna &
*** Makefile.ORG	2024-07-13 19:03:29.710096163 +0900
--- Makefile	2024-07-13 19:09:10.727100326 +0900
***************
*** 9,16 ****
  # Keep this list in sync with pyproject.toml includes/artifacts
  # intended use: when building a source distribution,
  # make pypi-files && python3 -m build -sn .
! pypi-files: AUTHORS Changelog.md LICENSE README.md README.txt supportedsites \
!             completions yt-dlp.1 pyproject.toml setup.cfg devscripts/* test/*

  .PHONY: all clean clean-all clean-test clean-dist clean-cache \
          completions completion-bash completion-fish completion-zsh \
--- 9,18 ----
  # Keep this list in sync with pyproject.toml includes/artifacts
  # intended use: when building a source distribution,
  # make pypi-files && python3 -m build -sn .
! #pypi-files: AUTHORS Changelog.md LICENSE README.md README.txt supportedsites \
! #            completions yt-dlp.1 pyproject.toml setup.cfg devscripts/* test/*
! pypi-files: AUTHORS Changelog.md LICENSE README.md            supportedsites \
!             completions          pyproject.toml setup.cfg devscripts/* test/*

  .PHONY: all clean clean-all clean-test clean-dist clean-cache \
          completions completion-bash completion-fish completion-zsh \
***************
*** 50,60 ****
  MARKDOWN != $(MARKDOWN_CMD)
  MARKDOWN ?= $(shell $(MARKDOWN_CMD))

! install: lazy-extractors yt-dlp yt-dlp.1 completions
  	mkdir -p $(DESTDIR)$(BINDIR)
  	install -m755 yt-dlp $(DESTDIR)$(BINDIR)/yt-dlp
! 	mkdir -p $(DESTDIR)$(MANDIR)/man1
! 	install -m644 yt-dlp.1 $(DESTDIR)$(MANDIR)/man1/yt-dlp.1
  	mkdir -p $(DESTDIR)$(SHAREDIR)/bash-completion/completions
  	install -m644 completions/bash/yt-dlp $(DESTDIR)$(SHAREDIR)/bash-completion/completions/yt-dlp
  	mkdir -p $(DESTDIR)$(SHAREDIR)/zsh/site-functions
--- 52,63 ----
  MARKDOWN != $(MARKDOWN_CMD)
  MARKDOWN ?= $(shell $(MARKDOWN_CMD))

! #install: lazy-extractors yt-dlp yt-dlp.1 completions
! install: lazy-extractors yt-dlp          completions
  	mkdir -p $(DESTDIR)$(BINDIR)
  	install -m755 yt-dlp $(DESTDIR)$(BINDIR)/yt-dlp
! #	mkdir -p $(DESTDIR)$(MANDIR)/man1
! #	install -m644 yt-dlp.1 $(DESTDIR)$(MANDIR)/man1/yt-dlp.1
  	mkdir -p $(DESTDIR)$(SHAREDIR)/bash-completion/completions
  	install -m644 completions/bash/yt-dlp $(DESTDIR)$(SHAREDIR)/bash-completion/completions/yt-dlp
  	mkdir -p $(DESTDIR)$(SHAREDIR)/zsh/site-functions
*** ./istream.h.ORG	2012-11-28 12:23:44.903821617 +0900
--- ./istream.h	2012-11-28 12:24:31.368727065 +0900
***************
*** 20,26 ****

  typedef struct stream_buffer *StreamBuffer;

! struct file_handle {
      FILE *f;
      void (*close) ();
  };
--- 20,26 ----

  typedef struct stream_buffer *StreamBuffer;

! struct File_handle {
      FILE *f;
      void (*close) ();
  };
***************
*** 53,59 ****

  struct file_stream {
      struct stream_buffer stream;
!     struct file_handle *handle;
      char type;
      char iseos;
      int (*read) ();
--- 53,59 ----

  struct file_stream {
      struct stream_buffer stream;
!     struct File_handle *handle;
      char type;
      char iseos;
      int (*read) ();
*** ./istream.c.ORG	2012-11-28 12:23:39.465130387 +0900
--- ./istream.c	2012-11-28 12:24:16.455831711 +0900
***************
*** 22,29 ****
  static void basic_close(int *handle);
  static int basic_read(int *handle, char *buf, int len);

! static void file_close(struct file_handle *handle);
! static int file_read(struct file_handle *handle, char *buf, int len);

  static int str_read(Str handle, char *buf, int len);

--- 22,29 ----
  static void basic_close(int *handle);
  static int basic_read(int *handle, char *buf, int len);

! static void file_close(struct File_handle *handle);
! static int file_read(struct File_handle *handle, char *buf, int len);

  static int str_read(Str handle, char *buf, int len);

***************
*** 114,120 ****
      stream = New(union input_stream);
      init_base_stream(&stream->base, STREAM_BUF_SIZE);
      stream->file.type = IST_FILE;
!     stream->file.handle = New(struct file_handle);
      stream->file.handle->f = f;
      if (closep)
  	stream->file.handle->close = closep;
--- 114,120 ----
      stream = New(union input_stream);
      init_base_stream(&stream->base, STREAM_BUF_SIZE);
      stream->file.type = IST_FILE;
!     stream->file.handle = New(struct File_handle);
      stream->file.handle->f = f;
      if (closep)
  	stream->file.handle->close = closep;
***************
*** 638,650 ****
  }

  static void
! file_close(struct file_handle *handle)
  {
      handle->close(handle->f);
  }

  static int
! file_read(struct file_handle *handle, char *buf, int len)
  {
      return fread(buf, 1, len, handle->f);
  }
--- 638,650 ----
  }

  static void
! file_close(struct File_handle *handle)
  {
      handle->close(handle->f);
  }

  static int
! file_read(struct File_handle *handle, char *buf, int len)
  {
      return fread(buf, 1, len, handle->f);
  }
*** ./main.c.ORG	2016-08-01 21:43:32.714706108 +0900
--- ./main.c	2016-08-01 21:45:27.569705061 +0900
***************
*** 833,839 ****
--- 833,844 ----
      mySignal(SIGPIPE, SigPipe);
  #endif

+ #if 0
      orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc);
+ #else
+     orig_GC_warn_proc = GC_get_warn_proc();
+     GC_set_warn_proc(wrap_GC_warn_proc);
+ #endif
      err_msg = Strnew();
      if (load_argc == 0) {
  	/* no URL specified */
*** ./url.c.ORG	2023-01-08 23:11:48.763189100 +0900
--- ./url.c	2023-01-08 23:12:29.258188644 +0900
***************
*** 268,277 ****
--- 268,279 ----
      if (RAND_status())
  	return;
      if ((file = RAND_file_name(buffer, sizeof(buffer)))) {
+ #if 0
  #ifdef USE_EGD
  	if (RAND_egd(file) > 0)
  	    return;
  #endif
+ #endif
  	RAND_load_file(file, -1);
      }
      if (RAND_status())

How to build

CFLAGS="-Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types" ./configure --disable-mouse && make

realesrgan-ncnn-vulkanを利用した動画の変換スクリプト

#! /bin/sh
input="$1"
output="$2"
fps=`ffmpeg -i ${input} 2>&1 | egrep 'Stream.*Video' | sed -e 's/^.* \([0-9\.][0-9\.]*\) fps.*$/\1/'`

rm -f tmp_frames/frame*.jpg
rm -f out_frames/frame*.jpg

ffmpeg -i ${input} -qscale:v 1 -qmin 1 -qmax 1 -vsync 0 tmp_frames/frame%08d.jpg

./realesrgan-ncnn-vulkan -i tmp_frames -o out_frames -n realesr-animevideov3 -s 2 -f jpg
#./realesrgan-ncnn-vulkan -i tmp_frames -o out_frames -n realesrgan-x4plus -s 4 -f jpg

ffmpeg -framerate ${fps} -i out_frames/frame%08d.jpg -i ${input} -map 0:v:0 -map 1:a:0 -c:a copy -c:v libx264 -r ${fps} -pix_fmt yuv420p ${output}

rm -f tmp_frames/frame*.jpg
rm -f out_frames/frame*.jpg
*** ffmpeg.SlackBuild.ORG	2024-08-04 23:00:00.000000000 +0900
--- ffmpeg.SlackBuild	2024-08-04 23:10:38.000000000 +0900
***************
*** 106,112 ****
  libglslang="" ; [ "${GLSLANG:-no}" != "no" ]      && libglslang="--enable-libglslang"
  shaderc=""    ; [ "${SHADERC:-yes}" != "no" ]     && libshaderc="--enable-libshaderc"

! libx264=""    ; [ "${X264:-no}" != "no" ]         && libx264="--enable-libx264"
  libcelt=""    ; [ "${CELT:-no}" != "no" ]         && libcelt="--enable-libcelt"
  libdc1394=""  ; [ "${DC1394:-no}" != "no" ]       && libdc1394="--enable-libdc1394"
  libgsm=""     ; [ "${GSM:-no}" != "no" ]          && libgsm="--enable-libgsm"
--- 106,112 ----
  libglslang="" ; [ "${GLSLANG:-no}" != "no" ]      && libglslang="--enable-libglslang"
  shaderc=""    ; [ "${SHADERC:-yes}" != "no" ]     && libshaderc="--enable-libshaderc"

! libx264=""    ; [ "${X264:-yes}" != "no" ]         && libx264="--enable-libx264"
  libcelt=""    ; [ "${CELT:-no}" != "no" ]         && libcelt="--enable-libcelt"
  libdc1394=""  ; [ "${DC1394:-no}" != "no" ]       && libdc1394="--enable-libdc1394"
  libgsm=""     ; [ "${GSM:-no}" != "no" ]          && libgsm="--enable-libgsm"
***************
*** 136,142 ****
  vapoursynth=""  ; [ "${VAPOURSYNTH:-no}" != "no" ] && vapoursynth="--enable-vapoursynth"
  opencore_amr="" ; [ "${OPENCORE:-no}" != "no" ] && \
    opencore_amr="--enable-libopencore-amrnb --enable-libopencore-amrwb"
! fdk=""          ; [ "${FDK_AAC:-no}" != "no" ]  && \
    { fdk="--enable-libfdk-aac"; non_free="--enable-nonfree" ; }
  decklink=""   ; [ "${DECKLINK:-no}" != "no" ]   && \
    { decklink="--enable-decklink" ; \
--- 136,142 ----
  vapoursynth=""  ; [ "${VAPOURSYNTH:-no}" != "no" ] && vapoursynth="--enable-vapoursynth"
  opencore_amr="" ; [ "${OPENCORE:-no}" != "no" ] && \
    opencore_amr="--enable-libopencore-amrnb --enable-libopencore-amrwb"
! fdk=""          ; [ "${FDK_AAC:-yes}" != "no" ]  && \
    { fdk="--enable-libfdk-aac"; non_free="--enable-nonfree" ; }
  decklink=""   ; [ "${DECKLINK:-no}" != "no" ]   && \
    { decklink="--enable-decklink" ; \
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install --upgrade pip
$ pip install Cython
$ pip install wheel
$ git clone https://github.com/reazon-research/ReazonSpeech
$ pip install ReazonSpeech/pkg/nemo-asr
$ pip uninstall huggingface_hub
$ pip install huggingface-hub==0.23.2
$ pip uninstall numpy
$ pip install numpy==1.26.4
$ reazonspeech-nemo-asr HogeHoge.mp3

システム設定

/opt/brother/scanner/brscan4/brsanenetdevice4.cfg
*** ./opt/brother/scanner/brscan4/brsanenetdevice4.cfg.ORG	2024-05-06 17:05:15.931250255 +0900
--- ./opt/brother/scanner/brscan4/brsanenetdevice4.cfg	2024-07-22 22:33:10.883075608 +0900
***************
*** 1,2 ****
!

--- 1,2 ----
! DEVICE=dcp-j552n , "DCP-J552N" , 0x4f9:0x2e3 , IP-ADDRESS=192.168.0.52
/opt/brother/Printers/dcpj552n/lpd/filterdcpj552n
*** ./opt/brother/Printers/dcpj552n/lpd/filterdcpj552n.ORG	2024-05-03 23:29:12.182264882 +0900
--- ./opt/brother/Printers/dcpj552n/lpd/filterdcpj552n	2024-08-11 09:09:08.931587840 +0900
***************
*** 77,84 ****
  		rm -f $PS_TEMP
  		;;
  	* )
! 		A2PS_OP="--output=- -q -1 --no-header --borders no"
! 		eval cat $INPUT_TEMP | a2ps $A2PS_OP | $PSCONV $PSCONV_OP | $BRCONV $BRCONV_OP
  		RET=$?
  		;;
  esac
--- 77,87 ----
  		rm -f $PS_TEMP
  		;;
  	* )
! ##		A2PS_OP="--output=- -q -1 --no-header --borders no"
! ##		eval cat $INPUT_TEMP | a2ps $A2PS_OP | $PSCONV $PSCONV_OP | $BRCONV $BRCONV_OP
! 		A2PS_OP=""
! ####		eval cat $INPUT_TEMP | /usr/local/bin/a2ps-j $A2PS_OP | $PSCONV $PSCONV_OP | $BRCONV $BRCONV_OP
! 		eval /usr/local/bin/nkf -w $INPUT_TEMP | /usr/local/bin/a2ps-j $A2PS_OP | $PSCONV $PSCONV_OP | $BRCONV $BRCONV_OP
  		RET=$?
  		;;
  esac
/usr/share/ghostscript/10.03.1/Resource/Init/cidfmap
*** ./usr/share/ghostscript/10.03.1/Resource/Init/cidfmap.ORG	2024-07-14 21:35:50.412262431 +0900
--- ./usr/share/ghostscript/10.03.1/Resource/Init/cidfmap	2024-07-14 21:36:04.651262605 +0900
***************
*** 113,118 ****
--- 113,138 ----
  /Adobe-Japan1           	/Sazanami-Gothic        ;
  /Adobe-Japan2           	/Sazanami-Gothic-JaH    ;

+ % add by m-ito
+ /Tyukaisyo-Medium               << /FileType /TrueType /Path (dfjkaimd.ttf) /CSI [(Japan1) 6] >> ;
+ /Tyukaisyo-Medium-Unocode       << /FileType /TrueType /Path (dfjkaimd-unicode.ttf) /CSI [(Japan1) 6] >> ;
+ /Tyumarugothic-Medium           << /FileType /TrueType /Path (dfjmrgmd.ttf) /CSI [(Japan1) 6] >> ;
+ /Tyumarugothic-Medium-Unicode   << /FileType /TrueType /Path (dfjmrgmd-unicode.ttf) /CSI [(Japan1) 6] >> ;
+ /Gyosyo-Medium                  << /FileType /TrueType /Path (dfjgyomd.ttf) /CSI [(Japan1) 6] >> ;
+ /Gyosyo-Medium-Unicode          << /FileType /TrueType /Path (dfjgyomd-unicode.ttf) /CSI [(Japan1) 6] >> ;
+ /Kanteiryu-Medium               << /FileType /TrueType /Path (dfjktrxb.ttf) /CSI [(Japan1) 6] >> ;
+ /Kanteiryu-Medium-Unicode       << /FileType /TrueType /Path (dfjktrxb-unicode.ttf) /CSI [(Japan1) 6] >> ;
+ /Reisyo-Medium                  << /FileType /TrueType /Path (dfjleimd.ttf) /CSI [(Japan1) 6] >> ;
+ /Reisyo-Medium-Unicode          << /FileType /TrueType /Path (dfjleimd-unicode.ttf) /CSI [(Japan1) 6] >> ;
+ /Pop1-Medium                    << /FileType /TrueType /Path (dfjpop1.ttf)  /CSI [(Japan1) 6] >> ;
+ /Pop1-Medium-Unicode            << /FileType /TrueType /Path (dfjpop1-unicode.ttf)  /CSI [(Japan1) 6] >> ;
+ /Marumoji-Medium                << /FileType /TrueType /Path (dfjmrmmd.ttf) /CSI [(Japan1) 6] >> ;
+ /Marumoji-Medium-Unicode        << /FileType /TrueType /Path (dfjmrmmd-unicode.ttf) /CSI [(Japan1) 6] >> ;
+ %
+ /Kouzanmouhitu-Medium           << /FileType /TrueType /Path (kouzanmouhitu.ttf) /CSI [(Japan1) 6] >> ;
+ %/Eudc                          << /FileType /TrueType /Path (eudc.ttf) /CSI [(Artifex) (Unicode) 0] >> ;
+ %/SME                           << /FileType /TrueType /Path (sazanami-mincho-eudc.ttf) /CSI [(Artifex) (Unicode) 0] >> ;
+
  %% cidfmap.ko
  %% To enable Korean printing support, install the fonts shown in the example
  %% here and uncomment the block below:
/usr/share/sendmail/cf/cf/config.mc
*** ./usr/share/sendmail/cf/cf/config.mc.ORG	2024-04-29 23:44:23.006042321 +0900
--- ./usr/share/sendmail/cf/cf/config.mc	2024-04-29 23:53:04.007048681 +0900
***************
*** 14,28 ****
  OSTYPE(`linux')dnl
  dnl#
  dnl# You will need to create the certificates below with OpenSSL first:
! define(`confCACERT_PATH', `/etc/mail/certs/')
! define(`confCACERT', `/etc/mail/certs/CA.cert.pem')
! define(`confSERVER_CERT', `/etc/mail/certs/smtp.cert.pem')
! define(`confSERVER_KEY', `/etc/mail/certs/smtp.key.pem')
  dnl# These settings help protect against people verifying email addresses
  dnl# at your site in order to send you email that you probably don't want:
  define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
  dnl# Uncomment the line below to send outgoing mail through an external server:
  dnl define(`SMART_HOST',`mailserver.example.com')
  dnl# No timeout for ident:
  define(`confTO_IDENT', `0')dnl
  dnl# Enable the line below to use smrsh to restrict what sendmail can run:
--- 14,29 ----
  OSTYPE(`linux')dnl
  dnl#
  dnl# You will need to create the certificates below with OpenSSL first:
! dnl##define(`confCACERT_PATH', `/etc/mail/certs/')
! dnl##define(`confCACERT', `/etc/mail/certs/CA.cert.pem')
! dnl##define(`confSERVER_CERT', `/etc/mail/certs/smtp.cert.pem')
! dnl##define(`confSERVER_KEY', `/etc/mail/certs/smtp.key.pem')
  dnl# These settings help protect against people verifying email addresses
  dnl# at your site in order to send you email that you probably don't want:
  define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
  dnl# Uncomment the line below to send outgoing mail through an external server:
  dnl define(`SMART_HOST',`mailserver.example.com')
+ define(`SMART_HOST',`smtp:lib100.artie.or.jp')
  dnl# No timeout for ident:
  define(`confTO_IDENT', `0')dnl
  dnl# Enable the line below to use smrsh to restrict what sendmail can run:
***************
*** 34,46 ****
  FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
  FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
  FEATURE(`access_db', `hash -T<TMPF> /etc/mail/access')dnl
! FEATURE(`blacklist_recipients')dnl
  FEATURE(`local_procmail',`',`procmail -t -Y -a $h -d $u')dnl
  FEATURE(`always_add_domain')dnl
  FEATURE(`redirect')dnl
  FEATURE(`no_default_msa')dnl
  dnl# Turn this feature on if you don't always have DNS, or enjoy junk mail:
  dnl FEATURE(`accept_unresolvable_domains')dnl
  EXPOSED_USER(`root')dnl
  dnl# Also accept mail for localhost.localdomain:
  LOCAL_DOMAIN(`localhost.localdomain')dnl
--- 35,49 ----
  FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
  FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
  FEATURE(`access_db', `hash -T<TMPF> /etc/mail/access')dnl
! dnl##FEATURE(`blacklist_recipients')dnl
! FEATURE(`blocklist_recipients')dnl
  FEATURE(`local_procmail',`',`procmail -t -Y -a $h -d $u')dnl
  FEATURE(`always_add_domain')dnl
  FEATURE(`redirect')dnl
  FEATURE(`no_default_msa')dnl
  dnl# Turn this feature on if you don't always have DNS, or enjoy junk mail:
  dnl FEATURE(`accept_unresolvable_domains')dnl
+ FEATURE(`accept_unresolvable_domains')dnl
  EXPOSED_USER(`root')dnl
  dnl# Also accept mail for localhost.localdomain:
  LOCAL_DOMAIN(`localhost.localdomain')dnl
***************
*** 48,61 ****
  MAILER(smtp)dnl
  MAILER(procmail)dnl
  dnl# Allow SASL authentication/relaying:
! define(`confAUTH_OPTIONS', `A p y')dnl
! define(`confAUTH_MECHANISMS', `LOGIN PLAIN DIGEST-MD5 CRAM-MD5')dnl
! TRUST_AUTH_MECH(`LOGIN PLAIN DIGEST-MD5 CRAM-MD5')dnl
! DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
  dnl# Daemon options after M= below that might need to be changed are:
  dnl# s (allow SSL, not only TLS)
  dnl# a (require authentication)
! DAEMON_OPTIONS(`Port=smtps, Name=MSA-SSL, M=Esa')dnl
! LOCAL_CONFIG
  dnl# Do not allow the weak SSLv2:
! O CipherList=ALL:!ADH:!NULL:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:-LOW:+SSLv3:+TLSv1:-SSLv2:+EXP:+eNULL
--- 51,64 ----
  MAILER(smtp)dnl
  MAILER(procmail)dnl
  dnl# Allow SASL authentication/relaying:
! dnl##define(`confAUTH_OPTIONS', `A p y')dnl
! dnl##define(`confAUTH_MECHANISMS', `LOGIN PLAIN DIGEST-MD5 CRAM-MD5')dnl
! dnl##TRUST_AUTH_MECH(`LOGIN PLAIN DIGEST-MD5 CRAM-MD5')dnl
! dnl##DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
  dnl# Daemon options after M= below that might need to be changed are:
  dnl# s (allow SSL, not only TLS)
  dnl# a (require authentication)
! dnl##DAEMON_OPTIONS(`Port=smtps, Name=MSA-SSL, M=Esa')dnl
! dnl##LOCAL_CONFIG
  dnl# Do not allow the weak SSLv2:
! dnl##O CipherList=ALL:!ADH:!NULL:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:-LOW:+SSLv3:+TLSv1:-SSLv2:+EXP:+eNULL
/usr/local/etc/freshclam.conf
*** ./usr/local/etc/freshclam.conf.ORG	2024-04-30 00:55:24.980094347 +0900
--- ./usr/local/etc/freshclam.conf	2024-04-30 00:56:12.667094930 +0900
***************
*** 5,16 ****


  # Comment or remove the line below.
! Example

  # Path to the database directory.
  # WARNING: It must match clamd.conf's directive!
  # Default: hardcoded (depends on installation options)
  #DatabaseDirectory /var/lib/clamav

  # Path to the log file (make sure it has proper permissions)
  # Default: disabled
--- 5,17 ----


  # Comment or remove the line below.
! ##Example

  # Path to the database directory.
  # WARNING: It must match clamd.conf's directive!
  # Default: hardcoded (depends on installation options)
  #DatabaseDirectory /var/lib/clamav
+ DatabaseDirectory /usr/local/share/clamav

  # Path to the log file (make sure it has proper permissions)
  # Default: disabled
/usr/local/etc/clamd.conf
*** ./usr/local/etc/clamd.conf.ORG	2024-04-30 00:53:24.927092882 +0900
--- ./usr/local/etc/clamd.conf	2024-04-30 00:55:00.537094049 +0900
***************
*** 5,11 ****


  # Comment or remove the line below.
! Example

  # Uncomment this option to enable logging.
  # LogFile must be writable for the user running daemon.
--- 5,11 ----


  # Comment or remove the line below.
! ##Example

  # Uncomment this option to enable logging.
  # LogFile must be writable for the user running daemon.
***************
*** 83,88 ****
--- 83,89 ----
  # Path to the database directory.
  # Default: hardcoded (depends on installation options)
  #DatabaseDirectory /var/lib/clamav
+ DatabaseDirectory /usr/local/share/clamav

  # Only load the official signatures published by the ClamAV project.
  # Default: no
***************
*** 100,105 ****
--- 101,107 ----
  # Default: disabled (must be specified by a user)
  #LocalSocket /run/clamav/clamd.sock
  #LocalSocket /tmp/clamd.sock
+ LocalSocket /tmp/clamd.sock

  # Sets the group ownership on the unix socket.
  # Default: disabled (the primary group of the user running clamd)
***************
*** 116,121 ****
--- 118,124 ----
  # TCP port address.
  # Default: no
  #TCPSocket 3310
+ TCPSocket 3310

  # TCP address.
  # By default we bind to INADDR_ANY, probably not wise.
***************
*** 124,129 ****
--- 127,133 ----
  # times if you want to listen on multiple IPs. IPv6 is now supported.
  # Default: no
  #TCPAddr localhost
+ TCPAddr localhost

  # Maximum length the queue of pending connections may grow to.
  # Default: 200
/etc/fstab
*** ./etc/fstab.ORG	2024-05-19 10:41:23.292003714 +0900
--- ./etc/fstab	2024-05-19 10:43:09.653005012 +0900
***************
*** 1,5 ****
  /dev/nvme0n1p2   swap             swap        defaults         0   0
! /dev/nvme0n1p3   /                ext4        defaults         1   1
  /dev/nvme0n1p1   /boot/efi        vfat        defaults         1   0
  #/dev/cdrom      /mnt/cdrom       auto        noauto,owner,ro,comment=x-gvfs-show 0   0
  /dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
--- 1,5 ----
  /dev/nvme0n1p2   swap             swap        defaults         0   0
! /dev/nvme0n1p3   /                ext4        defaults,noatime 1   1
  /dev/nvme0n1p1   /boot/efi        vfat        defaults         1   0
  #/dev/cdrom      /mnt/cdrom       auto        noauto,owner,ro,comment=x-gvfs-show 0   0
  /dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
/etc/exports
*** ./etc/exports.ORG	2024-05-01 22:31:40.360597620 +0900
--- ./etc/exports	2024-05-01 22:32:08.650597965 +0900
***************
*** 1,4 ****
--- 1,6 ----
  # See exports(5) for a description.
  # This file contains a list of all directories exported to other computers.
  # It is used by rpc.nfsd and rpc.mountd.
+ /	192.168.0.0/255.255.255.0(ro,no_root_squash,no_subtree_check,sync)
+ #/mnt/export	192.168.0.0/255.255.255.0(rw,no_root_squash,no_subtree_check,sync)
/etc/sane.d/dll.conf
*** ./etc/sane.d/dll.conf.ORG	2024-05-06 17:07:45.526252081 +0900
--- ./etc/sane.d/dll.conf	2024-05-06 17:08:22.916252538 +0900
***************
*** 7,12 ****
--- 7,13 ----
  # The next line enables the network backend; comment it out if you don't
  # need to use a remote SANE scanner over the network -- see sane-net(5)
  # and saned(8) for details.
+ brother4
  net
  abaton
  agfafocus
/etc/sane.d/net.conf
*** ./etc/sane.d/net.conf.ORG	2024-05-06 17:06:59.263251516 +0900
--- ./etc/sane.d/net.conf	2024-05-06 17:07:28.824251877 +0900
***************
*** 12,14 ****
--- 12,16 ----
  # directly or through the net backend.  Going through the net backend
  # may be necessary to access devices that need special privileges.
  # localhost
+
+ 192.168.0.52
/etc/elogind/logind.conf.d/LidSwitch.conf
*** ./etc/elogind/logind.conf.d/LidSwitch.conf.ORG	2024-05-01 22:41:10.391604578 +0900
--- ./etc/elogind/logind.conf.d/LidSwitch.conf	2024-08-11 09:15:31.661592512 +0900
***************
*** 0 ****
--- 1,51 ----
+ #  This file is part of elogind.
+ #
+ #  elogind is free software; you can redistribute it and/or modify it under the
+ #  terms of the GNU Lesser General Public License as published by the Free
+ #  Software Foundation; either version 2.1 of the License, or (at your option)
+ #  any later version.
+ #
+ # Entries in this file show the compile time defaults. Local configuration
+ # should be created by either modifying this file (or a copy of it placed in
+ # /etc/ if the original file is shipped in /usr/), or by creating "drop-ins" in
+ # the /etc/elogind/logind.conf.d/ directory. The latter is generally
+ # recommended. Defaults can be restored by simply deleting the main
+ # configuration file and all drop-ins located in /etc/.
+ #
+ # See logind.conf(5) for details.
+
+ [Login]
+ #KillUserProcesses=no
+ #KillOnlyUsers=
+ #KillExcludeUsers=root
+ #InhibitDelayMaxSec=5
+ #UserStopDelaySec=10
+ #HandlePowerKey=poweroff
+ #HandlePowerKeyLongPress=ignore
+ #HandleRebootKey=reboot
+ #HandleRebootKeyLongPress=poweroff
+ #HandleSuspendKey=suspend
+ #HandleSuspendKeyLongPress=hibernate
+ #HandleHibernateKey=hibernate
+ #HandleHibernateKeyLongPress=ignore
+ #
+ # Don't sleep by closing LCD panel
+ #
+ HandleLidSwitch=ignore
+ #
+ #HandleLidSwitchExternalPower=suspend
+ #HandleLidSwitchDocked=ignore
+ #PowerKeyIgnoreInhibited=no
+ #SuspendKeyIgnoreInhibited=no
+ #HibernateKeyIgnoreInhibited=no
+ #LidSwitchIgnoreInhibited=yes
+ #RebootKeyIgnoreInhibited=no
+ #HoldoffTimeoutSec=30s
+ #IdleAction=ignore
+ #IdleActionSec=30min
+ #RuntimeDirectorySize=10%
+ #RuntimeDirectoryInodesMax=
+ #RemoveIPC=yes
+ #InhibitorsMax=8192
+ #SessionsMax=8192
+ #StopIdleSessionSec=infinity
/etc/modprobe.d/em28xx.conf
*** ./etc/modprobe.d/em28xx.conf.ORG	2024-07-07 19:24:45.886509874 +0900
--- ./etc/modprobe.d/em28xx.conf	2024-07-07 19:24:25.327509623 +0900
***************
*** 0 ****
--- 1,2 ----
+ install em28xx /sbin/modprobe --ignore-install em28xx card=72; /bin/echo "117f 5207" > /sys/bus/usb/drivers/em28xx/new_id
+
/etc/rc.d/rc.local
*** ./etc/rc.d/rc.local.ORG	2024-05-01 22:27:21.241594457 +0900
--- ./etc/rc.d/rc.local	2024-07-12 23:21:36.620956782 +0900
***************
*** 7,9 ****
--- 7,64 ----
  # make an /etc/rc.d/rc.local_shutdown script and put those
  # commands in there.

+ if [ -x /usr/bin/rm ]
+ then
+ 	/usr/bin/rm -fr /tmp/*.lock
+ 	for i in `find /tmp -ctime +10 | egrep '^/tmp/'`
+ 	do
+ 		/usr/bin/rm -fr $i
+ 	done
+ 	echo "Clean /tmp."
+ fi
+
+ #if [ -x /sbin/route ]
+ #then
+ #	/sbin/route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.0.10
+ #fi
+
+ #if [ -x /usr/bin/sensors ]
+ #then
+ #	/sbin/modprobe coretemp
+ #	/usr/bin/sensors -s
+ #fi
+
+ if [ -x /usr/sbin/pcscd ]
+ then
+ 	/etc/rc.d/rc.pcscd start
+ 	echo "Starting pcscd."
+ fi
+
+ if [ -x /usr/sbin/alsactl ]
+ then
+ 	/usr/sbin/alsactl restore
+ 	echo "Restore alsa setting."
+ fi
+
+ if [ -x /usr/local/canna/sbin/cannaserver ]
+ then
+ 	rm /tmp/.iroha_unix/IROHA
+ 	/usr/local/canna/sbin/cannaserver -inet -u bin
+ 	echo "Starting cannaserver."
+ fi
+
+ if [ -x /usr/local/sbin/clamd ]
+ then
+ 	/usr/local/sbin/clamd &
+ 	echo "Starting clamd."
+ fi
+
+ if [ -x /usr/bin/rsync ]
+ then
+ 	/usr/bin/rsync --daemon --config=/etc/rsyncd.conf
+ fi
+
+ #if [ -x /sbin/sysctl ]
+ #then
+ #	/sbin/sysctl --system -e
+ #fi
/etc/rc.d/rc.inet1.conf
*** ./etc/rc.d/rc.inet1.conf.ORG	2024-04-29 09:40:59.169002907 +0900
--- ./etc/rc.d/rc.inet1.conf	2024-04-29 10:26:02.407002458 +0900
***************
*** 18,24 ****
  # =============================================================================

  # IPv4 config options for eth0:
! IPADDRS[0]="192.168.0.3/24"
  USE_DHCP[0]=""
  # IPv6 config options for eth0:
  IP6ADDRS[0]=""
--- 18,25 ----
  # =============================================================================

  # IPv4 config options for eth0:
! #IPADDRS[0]="192.168.0.3/24"
! IPADDRS[0]=""
  USE_DHCP[0]=""
  # IPv6 config options for eth0:
  IP6ADDRS[0]=""
***************
*** 166,171 ****
--- 167,177 ----
  #WLAN_WPA[4]="wpa_supplicant"
  #WLAN_WPADRIVER[4]="wext"
  #WLAN_WPAWAIT[4]=30
+ IFNAME[4]="wlan0"
+ IPADDRS[4]="192.168.0.3"
+ WLAN_WPA[4]="wpa_supplicant"
+ #WLAN_WPADRIVER[4]="wext"
+ WLAN_WPADRIVER[4]="nl80211"

  # =============================================================================
/etc/rsyncd.conf
*** ./etc/rsyncd.conf.ORG	2024-05-01 22:38:52.097602890 +0900
--- ./etc/rsyncd.conf	2024-05-01 22:54:59.583008478 +0900
***************
*** 0 ****
--- 1,8 ----
+ uid = root
+ gid = root
+ [root_partition]
+ 	comment = lifebook1 root partition
+ 	path = /
+ 	read only = true
+ 	hosts allow = 192.168.0.100
+ 	hosts deny = *
/etc/httpd/httpd.conf
*** ./etc/httpd/httpd.conf.ORG	2024-06-20 23:28:37.410702067 +0900
--- ./etc/httpd/httpd.conf	2024-06-20 23:52:44.817719736 +0900
***************
*** 83,89 ****
--- 83,93 ----
  LoadModule access_compat_module lib64/httpd/modules/mod_access_compat.so
  LoadModule auth_basic_module lib64/httpd/modules/mod_auth_basic.so
  #LoadModule auth_form_module lib64/httpd/modules/mod_auth_form.so
+
+ # by m-ito
  #LoadModule auth_digest_module lib64/httpd/modules/mod_auth_digest.so
+ LoadModule auth_digest_module lib64/httpd/modules/mod_auth_digest.so
+
  #LoadModule allowmethods_module lib64/httpd/modules/mod_allowmethods.so
  #LoadModule file_cache_module lib64/httpd/modules/mod_file_cache.so
  #LoadModule cache_module lib64/httpd/modules/mod_cache.so
***************
*** 104,110 ****
--- 108,118 ----
  LoadModule reqtimeout_module lib64/httpd/modules/mod_reqtimeout.so
  #LoadModule ext_filter_module lib64/httpd/modules/mod_ext_filter.so
  #LoadModule request_module lib64/httpd/modules/mod_request.so
+
+ # by m-ito
  #LoadModule include_module lib64/httpd/modules/mod_include.so
+ LoadModule include_module lib64/httpd/modules/mod_include.so
+
  LoadModule filter_module lib64/httpd/modules/mod_filter.so
  #LoadModule reflector_module lib64/httpd/modules/mod_reflector.so
  #LoadModule substitute_module lib64/httpd/modules/mod_substitute.so
***************
*** 166,175 ****
--- 174,187 ----
  #LoadModule asis_module lib64/httpd/modules/mod_asis.so
  #LoadModule info_module lib64/httpd/modules/mod_info.so
  <IfModule !mpm_prefork_module>
+ # by m-ito
  	#LoadModule cgid_module lib64/httpd/modules/mod_cgid.so
+ 	LoadModule cgid_module lib64/httpd/modules/mod_cgid.so
  </IfModule>
  <IfModule mpm_prefork_module>
+ # by m-ito
  	#LoadModule cgi_module lib64/httpd/modules/mod_cgi.so
+ 	LoadModule cgi_module lib64/httpd/modules/mod_cgi.so
  </IfModule>
  #LoadModule dav_fs_module lib64/httpd/modules/mod_dav_fs.so
  #LoadModule dav_lock_module lib64/httpd/modules/mod_dav_lock.so
***************
*** 178,184 ****
--- 190,200 ----
  LoadModule dir_module lib64/httpd/modules/mod_dir.so
  #LoadModule actions_module lib64/httpd/modules/mod_actions.so
  #LoadModule speling_module lib64/httpd/modules/mod_speling.so
+
+ # by m-ito
  #LoadModule userdir_module lib64/httpd/modules/mod_userdir.so
+ LoadModule userdir_module lib64/httpd/modules/mod_userdir.so
+
  LoadModule alias_module lib64/httpd/modules/mod_alias.so
  #LoadModule rewrite_module lib64/httpd/modules/mod_rewrite.so

***************
*** 427,433 ****
--- 443,451 ----
      # To use CGI scripts outside of ScriptAliased directories:
      # (You will also need to add "ExecCGI" to the "Options" directive.)
      #
+ # by m-ito
      #AddHandler cgi-script .cgi
+     AddHandler cgi-script .cgi

      # For type maps (negotiated resources):
      #AddHandler type-map var
***************
*** 438,445 ****
--- 456,466 ----
      # To parse .shtml files for server-side includes (SSI):
      # (You will also need to add "Includes" to the "Options" directive.)
      #
+ # by m-ito
      #AddType text/html .shtml
      #AddOutputFilter INCLUDES .shtml
+     AddType text/html .shtml
+     AddOutputFilter INCLUDES .shtml
  </IfModule>

  #
***************
*** 499,505 ****
--- 520,528 ----
  #Include /etc/httpd/extra/httpd-languages.conf

  # User home directories
+ # by m-ito
  #Include /etc/httpd/extra/httpd-userdir.conf
+ Include /etc/httpd/extra/httpd-userdir.conf

  # Real-time info on requests and configuration
  #Include /etc/httpd/extra/httpd-info.conf
/etc/httpd/extra/httpd-userdir.conf
*** ./etc/httpd/extra/httpd-userdir.conf.ORG	2024-06-20 23:29:09.260702456 +0900
--- ./etc/httpd/extra/httpd-userdir.conf	2024-06-20 23:31:40.717704305 +0900
***************
*** 14,21 ****
  # for a site where these directories are restricted to read-only.
  #
  <Directory "/home/*/public_html">
!     AllowOverride FileInfo AuthConfig Limit Indexes
!     Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
      Require method GET POST OPTIONS
  </Directory>

--- 14,24 ----
  # for a site where these directories are restricted to read-only.
  #
  <Directory "/home/*/public_html">
! # by m-ito
! #    AllowOverride FileInfo AuthConfig Limit Indexes
! #    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
!     AllowOverride All
!     Options Includes FollowSymlinks ExecCGI
      Require method GET POST OPTIONS
  </Directory>
/etc/inittab
*** ./etc/inittab.ORG	2024-04-29 09:26:04.083000538 +0900
--- ./etc/inittab	2024-05-01 23:47:54.472001995 +0900
***************
*** 22,28 ****
  #   6 = reboot

  # Default runlevel. (Do not set to 0 or 6)
! id:3:initdefault:

  # System initialization (runs when system boots).
  si:S:sysinit:/etc/rc.d/rc.S
--- 22,29 ----
  #   6 = reboot

  # Default runlevel. (Do not set to 0 or 6)
! #id:3:initdefault:
! id:4:initdefault:

  # System initialization (runs when system boots).
  si:S:sysinit:/etc/rc.d/rc.S
***************
*** 34,40 ****
  rc:2345:wait:/etc/rc.d/rc.M

  # What to do at the "Three Finger Salute".
! ca::ctrlaltdel:/sbin/shutdown -t5 -r now

  # Runlevel 0 halts the system.
  l0:0:wait:/etc/rc.d/rc.0
--- 35,42 ----
  rc:2345:wait:/etc/rc.d/rc.M

  # What to do at the "Three Finger Salute".
! #ca::ctrlaltdel:/sbin/shutdown -t5 -r now
! ca::ctrlaltdel:/sbin/shutdown -h now

  # Runlevel 0 halts the system.
  l0:0:wait:/etc/rc.d/rc.0
/etc/passwd
*** ./etc/passwd.ORG	2024-05-05 17:32:58.979783410 +0900
--- ./etc/passwd	2024-05-05 23:32:22.840046641 +0900
***************
*** 43,45 ****
--- 43,48 ----
  ldap:x:330:330:OpenLDAP server:/var/lib/openldap:/bin/false
  openvpn:x:443:443:User for OpenVPN:/:/bin/false
  overflowuid:x:65534:65534:System UID overflow:/:/bin/false
+ m-ito:x:503:503::/home/m-ito:/bin/bash
+ clamav:x:513:513:clamav anti virus:/usr/local/share/clamav:/bin/false
+ pcscd:x:257:257::/var/run/pcscd:/bin/false
/etc/group
*** ./etc/group.ORG	2024-05-05 17:33:15.206783608 +0900
--- ./etc/group	2024-05-05 23:31:36.651046077 +0900
***************
*** 8,22 ****
  lp:x:7:lp
  mem:x:8:
  kmem:x:9:
! wheel:x:10:root
  floppy:x:11:
  mail:x:12:mail
  news:x:13:news
  uucp:x:14:uucp
  man:x:15:
  dialout:x:16:uucp
! audio:x:17:root,pulse
! video:x:18:sddm
  cdrom:x:19:m-ito
  games:x:20:
  slocate:x:21:
--- 8,22 ----
  lp:x:7:lp
  mem:x:8:
  kmem:x:9:
! wheel:x:10:root,m-ito,apache
  floppy:x:11:
  mail:x:12:mail
  news:x:13:news
  uucp:x:14:uucp
  man:x:15:
  dialout:x:16:uucp
! audio:x:17:root,pulse,m-ito
! video:x:18:sddm,m-ito,apache
  cdrom:x:19:m-ito
  games:x:20:
  slocate:x:21:
***************
*** 65,67 ****
--- 65,70 ----
  ldap:x:330:
  openvpn:x:443:
  overflowgid:x:65534:
+ m-ito:x:503:apache
+ clamav:x:513:
+ pcscd:x:257:
/etc/ld.so.conf
*** ./etc/ld.so.conf.ORG	2024-07-12 23:23:14.139957972 +0900
--- ./etc/ld.so.conf	2024-07-12 23:23:41.409958305 +0900
***************
*** 2,5 ****
--- 2,6 ----
  /lib64
  /usr/lib64
  /usr/local/lib64
+ /usr/local/canna/lib
  /usr/x86_64-slackware-linux/lib64
/etc/X11/app-defaults/Kinput2
*** ./etc/X11/app-defaults/Kinput2.ORG	2024-07-12 23:53:05.827979844 +0900
--- ./etc/X11/app-defaults/Kinput2	2024-07-12 23:55:19.242981472 +0900
***************
*** 96,102 ****
  ! XimpProtocol
  *XimpProtocol.ForceDefaultServer: true
  ! X Input Method Protocol
! *IMProtocol.locales: ja_JP.SJIS, ja_JP.EUC, ja_JP, japanese, japan, ja
  ! common to XimpProtocol and IMProtocol
  *defaultFontList: -misc-fixed-medium-r-normal--14-*-*-*-c-*
  *ConversionStartKeys: \
--- 96,102 ----
  ! XimpProtocol
  *XimpProtocol.ForceDefaultServer: true
  ! X Input Method Protocol
! *IMProtocol.locales: ja_JP.UTF-8, ja_JP.SJIS, ja_JP.EUC, ja_JP, japanese, japan, ja
  ! common to XimpProtocol and IMProtocol
  *defaultFontList: -misc-fixed-medium-r-normal--14-*-*-*-c-*
  *ConversionStartKeys: \
/etc/X11/xorg.conf.d/90-keyboard-layout.conf
*** ./etc/X11/xorg.conf.d/90-keyboard-layout.conf.ORG	2024-04-29 10:38:31.587008796 +0900
--- ./etc/X11/xorg.conf.d/90-keyboard-layout.conf	2024-04-29 10:38:31.608008796 +0900
***************
*** 0 ****
--- 1,46 ----
+ #
+ # cp /usr/share/X11/xorg.conf.d/90-keyboard-layout.conf /etc/X11/xorg.conf.d/
+ #
+ Section "InputClass"
+ 	Identifier "keyboard-all"
+ 	MatchIsKeyboard "on"
+ 	MatchDevicePath "/dev/input/event*"
+ 	Driver "evdev"
+ ##	Option "XkbLayout" "us"
+ 	Option "XkbLayout" "jp"
+ 	#Option "XkbVariant" ""
+ ##	Option "XkbOptions" "terminate:ctrl_alt_bksp"
+ 	Option "XkbOptions" "terminate:ctrl_alt_bksp,ctrl:nocaps"
+ EndSection
+
+ # READ THIS FOR CUSTOM KEYBOARD INFORMATION
+ #
+ #  If you want to add a custom model/layout/variant to X, you will need to COPY
+ #  this file to /etc/X11/xorg.conf.d/ and edit that copy.  After editing it to
+ #  suit, you will need to restart X.
+ #
+ #  Here's an example of the lines from above:
+ #
+ # Section "InputClass"
+ #	Identifier "keyboard-all"
+ #	MatchIsKeyboard "on"
+ #	MatchDevicePath "/dev/input/event*"
+ #	Driver "evdev"
+ #	Option "XkbLayout" "us"
+ #	Option "XkbVariant" "intl"
+ #	Option "XkbOptions" "compose:rwin,terminate:ctrl_alt_bksp"
+ # EndSection
+ #
+ #  Many desktop environments, including KDE and Xfce, have their own methods to
+ #  configure keyboard layouts and such if you'd like to use them.
+ #
+ #  If you prefer to use the "old" way of configuring keyboards (without input
+ #  device hotplugging), then you'll need to add the following lines to the
+ #  ServerFlags section of /etc/X11/xorg.conf:
+ #    Option   "AllowEmptyInput"     "false"
+ #    Option   "AutoAddDevices"      "false"
+ #    Option   "AutoEnableDevices"   "false"
+ #  Alternatively, you can break this up into separate "stubs" in the xorg.conf.d/
+ #  directory, but that's your call.  Assuming you elect to keep a monolithic
+ #  /etc/X11/xorg.conf file, you can now edit the Keyboard section as usual.
+
/etc/sudoers
*** ./etc/sudoers.ORG	2024-05-05 23:33:57.562047797 +0900
--- ./etc/sudoers	2024-05-05 23:34:16.917048033 +0900
***************
*** 108,114 ****
  # %wheel ALL=(ALL:ALL) ALL

  ## Same thing without a password
! # %wheel ALL=(ALL:ALL) NOPASSWD: ALL

  ## Uncomment to allow members of group sudo to execute any command
  # %sudo	ALL=(ALL:ALL) ALL
--- 108,114 ----
  # %wheel ALL=(ALL:ALL) ALL

  ## Same thing without a password
! %wheel ALL=(ALL:ALL) NOPASSWD: ALL

  ## Uncomment to allow members of group sudo to execute any command
  # %sudo	ALL=(ALL:ALL) ALL
/etc/wpa_supplicant.conf
*** ./etc/wpa_supplicant.conf.ORG	2024-04-29 09:45:20.568006098 +0900
--- ./etc/wpa_supplicant.conf	2024-04-29 10:21:30.306001334 +0900
***************
*** 1,2 ****
--- 1,12 ----
  ctrl_interface=/var/run/wpa_supplicant
  ctrl_interface_group=root
+ network={
+         scan_ssid=1
+         ssid="YOUR_SSID"
+         proto=RSN WPA
+         pairwise=CCMP TKIP
+         group=CCMP TKIP
+         key_mgmt=WPA-PSK WPA-EAP
+         #psk="YOUR_PSK"
+         # wpa_passphrase YOUR_SSID YOUR_PSK
+ 	psk=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ }
/etc/slackpkg/mirrors
*** ./etc/slackpkg/mirrors.ORG	2024-05-01 23:26:43.716031722 +0900
--- ./etc/slackpkg/mirrors	2024-05-01 23:27:22.569032196 +0900
***************
*** 189,196 ****
  #----------------------------------------------------------------
  # Slackware64-current
  #----------------------------------------------------------------
  # USE MIRRORS.SLACKWARE.COM (DO NOT USE FTP - ONLY HTTP FINDS A NEARBY MIRROR)
! # https://mirrors.slackware.com/slackware/slackware64-current/
  #
  #
  # Here are some individual mirrors that can be used instead of the
--- 189,197 ----
  #----------------------------------------------------------------
  # Slackware64-current
  #----------------------------------------------------------------
+ https://mirror.slackware.jp/slackware/slackware64-current/
  # USE MIRRORS.SLACKWARE.COM (DO NOT USE FTP - ONLY HTTP FINDS A NEARBY MIRROR)
! #https://mirrors.slackware.com/slackware/slackware64-current/
  #
  #
  # Here are some individual mirrors that can be used instead of the
***************
*** 275,283 ****
  # http://ba.mirror.garr.it/mirrors/Slackware/slackware64-current/
  # JAPAN (JP)
  # ftp://ftp.nara.wide.ad.jp/pub/Linux/slackware/slackware64-current/
! # http://ftp.nara.wide.ad.jp/pub/Linux/slackware/slackware64-current/
  # ftp://riksun.riken.go.jp/Linux/slackware/slackware64-current/
! # http://riksun.riken.go.jp/Linux/slackware/slackware64-current/
  # LITHUANIA (LT)
  # http://mirrors.atviras.lt/slackware/slackware64-current/
  # https://mirrors.atviras.lt/slackware/slackware64-current/
--- 276,284 ----
  # http://ba.mirror.garr.it/mirrors/Slackware/slackware64-current/
  # JAPAN (JP)
  # ftp://ftp.nara.wide.ad.jp/pub/Linux/slackware/slackware64-current/
! ##http://ftp.nara.wide.ad.jp/pub/Linux/slackware/slackware64-current/
  # ftp://riksun.riken.go.jp/Linux/slackware/slackware64-current/
! ##http://riksun.riken.go.jp/Linux/slackware/slackware64-current/
  # LITHUANIA (LT)
  # http://mirrors.atviras.lt/slackware/slackware64-current/
  # https://mirrors.atviras.lt/slackware/slackware64-current/
/etc/slackpkg/blacklist
*** ./etc/slackpkg/blacklist.ORG	2024-04-29 22:44:26.260257721 +0900
--- ./etc/slackpkg/blacklist	2024-08-14 10:39:19.989079565 +0900
***************
*** 35,41 ****
  #kernel-generic.*
  #kernel-huge.*
  #kernel-modules.*
! #kernel-source
  #
  # This one will blacklist all SBo packages:
! #[0-9]+_SBo
--- 35,67 ----
  #kernel-generic.*
  #kernel-huge.*
  #kernel-modules.*
! #kernel-source.*
  #
  # This one will blacklist all SBo packages:
! [0-9]+_SBo
!
! # add temorarily
! # git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
! #kernel-firmware.*
! #kernel-headers.*
!
! # Slackware package, but original configuration
! ffmpeg-.*
!
! # Slackware package, but removed
! postfix.*
!
! # Slackware Extra package
! sendmail.*
!
! # Non slackware packages
! dcpj552n.*
! brother-udev-rule-type1.*
! brscan-skey.*
! brscan4.*
! libobasis7.6.*
! libreoffice7.6.*
! libspiro.*
! libuninameslist.*
! fontforge.*
! audapolis.*
/boot/efi/EFI/Slackware/elilo.conf
*** ./boot/efi/EFI/Slackware/elilo.conf.ORG	2024-05-03 17:12:40.000000000 +0900
--- ./boot/efi/EFI/Slackware/elilo.conf	2024-07-15 00:13:44.000000000 +0900
***************
*** 1,9 ****
  chooser=simple
! delay=1
! timeout=1
  #
  image=vmlinuz
          label=vmlinuz
          initrd=initrd.gz
          read-only
          append="root=/dev/nvme0n1p3 vga=normal ro"
--- 1,18 ----
  chooser=simple
! delay=50
! timeout=50
! #
! prompt
! default=vmlinuz
  #
  image=vmlinuz
          label=vmlinuz
          initrd=initrd.gz
          read-only
+         append="root=/dev/nvme0n1p3 vga=normal mitigations=off ro"
+ #
+ image=vmlinuz.ORG
+         label=vmlinuz.ORG
+         initrd=initrd.ORG.gz
+         read-only
          append="root=/dev/nvme0n1p3 vga=normal ro"

システムアップデート

/root/update_system.sh
#! /bin/sh
slackpkg -batch=on -default_answer=y update </dev/null
slackpkg -batch=on -default_answer=y install-new </dev/null
slackpkg -batch=on -default_answer=y upgrade-all </dev/null
slackpkg -batch=on -default_answer=y clean-system </dev/null

echo '=== check .new files start ==='
/usr/bin/run-parts /etc/cron.daily

for i in `locate '*\.new' | egrep -v '^/home/|^/usr/local/' | egrep 'new$'`
do
	org=`echo $i | sed -e 's/\.new$//'`
	if [ -r ${org}  ]
	then
		diff -c ${org} $i 2>&1
	fi
done
echo '=== check .new files end   ==='

##mod_ver=`cd /lib/modules && /usr/bin/ls -r1 | egrep -v '\.BAK$' | head -1`
mod_ver=`cd /lib/modules && /usr/bin/ls -t1 | egrep -v '\.BAK$' | head -1`
kern_ver=`uname -r`

if [ -r /lib/modules/${kern_ver}/misc/vmnet.ko ]
then
	:
else
#	git clone -b workstation-17.5.1 https://github.com/mkubecek/vmware-host-modules.git
	cd vmware-host-modules && make && make install
	sync;sync;sync
	reboot
fi

if [ "X${mod_ver}" = "X${kern_ver}" ]
then
	:
else
#	cp /boot/initrd.gz /boot/efi/EFI/Slackware/initrd.gz
	cp /boot/vmlinuz /boot/efi/EFI/Slackware/vmlinuz
	sync;sync;sync
	reboot
fi

# deb s
#uname -a
#wget --no-check-certificate  https://mirrors.slackware.com/slackware/slackware64-current/slackware64/a/  -O - 2>/dev/null |
#	tr '<>' '\n\n' |
#	egrep "^kernel-.*txz$"

ffmpeg -h 2>&1 | head -1
wget --no-check-certificate  https://mirrors.slackware.com/slackware/slackware64-current/slackware64/l/  -O - 2>/dev/null |
	tr '<>' '\n\n' |
	egrep "^ffmpeg-.*txz$"

gs --version
ls /var/log/packages/ghostscript-*|egrep -v font
# deb e

2024年02月11日 VMware Workstation Player(Linux host)でゲストの動きが重い時の対応 [長年日記]

_ HogeHoge.vmx

MemTrimRate = "0"
mainmem.backing = "swap"
sched.mem.pshare.enable = "FALSE"
prefvmx.useRecommendedLockedMemSize = "TRUE"

2023年12月10日 vmplayer上のWindows11のCPU利用率が100%に張り付いていたのを解消 [長年日記]

_ vmplayer上のWindows11のCPU利用率が100%に張り付いて、なおかつホストであるLinuxまで動きに影響が出ていたのだが、以下のページを参考に不要なサービスを止めまくったら、かなり軽快になった。

Windows 11の不要サービス一覧・まとめて停止する方法


2023年10月15日 upgradepkg glibc-2.25 to build dhcpcd-10.0.3 on Slackware-14.2 [長年日記]

_ Slackware-14.2環境で、dhcpcd-10.0.2からdhcpcd-10.0.3にバージョンアップを試みたところ、explicit_bzeroのリンクに失敗した。 explicit_bzeroはglibc-2.25から導入された関数で、Slacklware-14.2はglibc-2.23止まりのためこのような結果となった。 explicit_bzeroを単純にbzeroに置き換えてもビルドは通るが、プロセス内のメモリに秘匿性の高い情報が残り、覗き見される可能性があるらしい。

そこで、glibc-2.25にアップグレードを行った。公式には既に更新は止まっているので、自己責任で行うこととなる。

手順は

###  zcat $CWD/glibc-c-utf8-locale.patch.gz | patch -p1 --verbose || exit 1
###  zcat $CWD/glibc.6a824767.dont.assert.on.older.intel.cpus.diff.gz | patch -p1 --verbose || exit 1
  • sh glibc.SlackBuild
  • ビルドされたパッケージで更新を行う
# init s
# upgradepkg /glibc-tmp-... snip .../glibc-2.25-i586-4_slack14.2.txz
# upgradepkg /glibc-tmp-... snip .../glibc-i18n-2.25-i586-4_slack14.2.txz
# upgradepkg /glibc-tmp-... snip .../glibc-profile-2.25-i586-4_slack14.2.txz
# upgradepkg /glibc-tmp-... snip .../glibc-solibs-2.25-i586-4_slack14.2.txz
# ldconfig
# reboot

最後に、/etc/slackpkg/blacklistにglibcを追加しておく

glibc

この後、dhcpcd-10.0.3の方もhttps://mirrors.slackware.com/slackware/slackware-current/source/n/dhcpcd/よりSlackBuild環境&ソースを取得し、アップデート完了。


2023年09月02日 マイナンバーカード with smart card reader(IDBridge CT30) on Windows11 on vmplayer-16.2.3 on Slackware64-14.2 [長年日記]

_ まずは、pcsc-lite-1.9.1

pcsc-lite-1.9.1をインストール(slackbuild)し、/usr/sbin/pcscdを起動するように設定。

/etc/rc.d/rc.local

if [ -x /usr/sbin/pcscd ]
then
        /etc/rc.d/rc.pcscd start
        echo "Starting pcscd."
fi

Linuxホスト側でカードリーダを認識。

$ lsusb
... snip ...
Bus 003 Device 005: ID 08e6:3437 Gemalto (was Gemplus) GemPC Twin SmartCard Reader
... snip ...

ただし、vmplayerでは認識せず...

_ で、いろいろ試したこと...

ホスト再起動後、Windows11 on vmplayer on Slackware64-14.2でカードリーダを認識。

[vmplayer] -> [Virtual Machine] -> [Removal Devices] -> [Shared Gemalt PC Twin Reader] -> [Connect]

無事マイナポータルにログインも成功!

ただし、上記の全てが必要というわけでは無いと思われるが...とりあえず動いたので良しとする。

追記 2014.11.02 カードの内容にアクセスできるか確認するコマンド

pkcs11-tool --list-objects --login

2023年08月27日 Slackware-14.2のHDDをSSDに置換 [長年日記]

_ Slackware64-14.2をインストールしたHDDがSmartでエラーを吐き出したので、SSDに置換した。効率よくSSDを利用するためにいくつか設定のポイントがあるらしい。

_ crontab(root)

毎週日曜日の4:50にトリムを実行してアクセス速度の低下を抑止する

# MIN HOUR DAY MONTH DAYOFWEEK  COMMAND
50    4    *   *     0          /sbin/fstrim -v / >/dev/null 2>&1"

_ /etc/fstab

アクセスタイムの更新を抑止(noatime)してSSDの寿命を伸ばす

/dev/sda2        /                ext4        defaults,noatime         1   1

_ /etc/sysctl.d/set_swapness.conf

スワップの頻度を極力減らしてSSDの寿命を伸ばす

vm.swappiness = 1

2023年07月15日 Windows Server評価版の利用期限を伸ばす方法 [長年日記]

_ 最大6回まで伸ばすことができるそうです(実質6ヶ月×6回=3年使えるということ?)

https://www.dot-plus.com/server/windows2016/3790/

slmgr /rearm

2023年06月18日 mplayerでdvd-videoをメニュー再生およびマウス操作する方法 [長年日記]

mplayer -mouse-movements  dvdnav:// -dvd-device /dev/dvd1

_ キーボードでの操作方法

keypad 8
    Select button up.
keypad 2
    Select button down.
keypad 4
    Select button left.
keypad 6
    Select button right.
keypad 5
    Return to main menu.
keypad 7
    Return to nearest menu (the order of preference is: chapter->title->root).
keypad ENTER
    Confirm choice.

(The following keys are used for controlling TV teletext. The data may come from either an analog TV source or an MPEG transport stream.)

X
    Switch teletext on/off.
Q and W
    Go to next/prev teletext page.

_ powershellでPUA、サロゲートペア、IVSを含んだ文字列を操作するサンプル

StringSample.ps1

function getLength($string){
	$count = 0
	for ($i = 0; $i -lt $s.length; $i++){
		if ([int][char]$s[$i] -ge 0xd800 -and [int][char]$s[$i] -le 0xdbff){
			if ([int][char]$s[$i] -eq 0xdb40){
#				IVS H
			}else{
#				SURR H
				$count++
			}
		}elseif ([int][char]$s[$i] -ge 0xdc00 -and [int][char]$s[$i] -le 0xdfff){
			if ([int][char]$s[$i] -ge 0xdd00 -and [int][char]$s[$i] -le 0xddef){
#				IVS L
			}else{
#				SURR L
			}
		}else{
#			BMP
			$count++
		}
	}
	return $count
}

function getCharByIndex($string, $index){
	$out = ""
	$windex = -1
	for ($i = 0; $i -lt $s.length; $i++){
		if ([int][char]$s[$i] -ge 0xd800 -and [int][char]$s[$i] -le 0xdbff){
			if ([int][char]$s[$i] -eq 0xdb40){
#				IVS H
			}else{
#				SURR H
				$windex++
			}
		}elseif ([int][char]$s[$i] -ge 0xdc00 -and [int][char]$s[$i] -le 0xdfff){
			if ([int][char]$s[$i] -ge 0xdd00 -and [int][char]$s[$i] -le 0xddef){
#				IVS L
			}else{
#				SURR L
			}
		}else{
#			BMP
			$windex++
		}
		if ($windex -eq $index){
			$out = $s[$i]
			if ([int][char]$s[$i] -ge 0xd800 -and [int][char]$s[$i] -le 0xdbff){
				if ([int][char]$s[$i] -eq 0xdb40){
#					IVS H
				}else{
#					SURR H
					$i++
					$out += $s[$i]	# add SURR L
				}
			}
			if ([int][char]$s[$i + 1] -eq 0xdb40){
#				IVS H
				$i++
				$out += $s[$i]	# add IVS H
				$i++
				$out += $s[$i]	# add IVS L
			}
		}
	}
	return $out
}

function getSubString($string, $index, $length){
	$out = ""
	for ($i = $index; $i -lt ($index + $length); $i++){
		$out += (getCharByIndex $string $i)
	}
	return $out
}

$s = "a漢𠮷辻󠄀b"
echo ("文字列:" + $s)
echo ("文字数:" + (getLength $s))
echo ("0文字目:" + (getCharByIndex $s 0))
echo ("1文字目(BMP):" + (getCharByIndex $s 1))
echo ("2文字目(PUA):" + (getCharByIndex $s 2))
echo ("3文字目(surrogate):" + (getCharByIndex $s 3))
echo ("4文字目(BMP+IVS):" + (getCharByIndex $s 4))
echo ("2文字目から3文字分:" + (getSubString $s 2 3))

実行結果

PS C:\Users\USER\Desktop\PowerShell> .\SampleString.ps1
文字列:a漢𠮷辻󠄀b
文字数:6
0文字目:a
1文字目(BMP):漢
2文字目(PUA):
3文字目(surrogate):𠮷
4文字目(BMP+IVS):辻󠄀
2文字目から3文字分:𠮷辻󠄀
PS C:\Users\USER\Desktop\PowerShell>

2022年08月14日 PostgreSQL-14.4 Windows11Pro npgsql.3.1.10 and Tips [長年日記]

_ pg_env.batの修正

PATHに「"」が含まれていると正しく動作しなかったので、「"」を削除する。

REM @SET PATH="C:\Users\USER\Desktop\PostgreSQL\14\bin";%PATH%
@SET PATH=C:\Users\USER\Desktop\PostgreSQL\14\bin;%PATH%

_ エンコーディングの設定

@SET PGCLIENTENCODING=UTF8

_ パスワードの設定

事前に設定しておくと認証時にパスワードを入力する必要がなくなる。

@SET PGPASSWORD=パスワード

_ DB作成(例)

> createdb.exe -E UTF8 testdb

_ テーブル作成(例)(psql.exe)

psql.exe -U postgres testdb
testdb=# create table tb_sample1 (
testdb=#	id integer primary key,
testdb=#	name varchar(50),
testdb=#	job varchar(50)
testdb=# };

_ psql.exe利用例

出力先をoutput.csvに設定、文字揃えをオフにし、区切り文字をタブに設定、rowのみ出力、tb_sample1テーブルの全てを出力して、出力先を元に戻す。

testdb=# \o output.csv
testdb=# \a
testdb=# \f '\t'
testdb=# \t on
testdb=# select * from tb_sample1;
testdb=# \o

-Aで文字揃えをオフに、-Fで区切り文字を「カンマ」に指定。

> psql -d testdb -U postgres -c "select * from tb_sample1;" -A -F ',' > output.csv

-Aで文字揃えをオフに、-Fで区切り文字を「タブ」に指定(Powershell限定)。

> psql -d testdb -U postgres -c "select * from tb_sample1;" -A -F "`t" > output.csv
  • タブ区切
  • 引用符(QUOTE)で囲む
  • NULL文字は空文字化
  • カラム名を表示
COPY tb_sample1 TO 'c:\temp\output.csv' WITH CSV DELIMITER E'\t' FORCE QUOTE * NULL AS '' HEADER;

_ npgsql.3.1.10.nupkg

pg_hba.confの認証methodを「trust」または「password」に設定する。

本来は、もっと新しいnpgsqlを使うべきだと思われるが、dllの依存関係をどうしても解決できなかった。 結局、このバージョン(3.1.10)と認証method(trust or password)でしか接続できなかった...

_ C#によるPostgreSQLアクセス例

//
// Compile: c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /r:npgsql.dll npgsqltest.cs
//
using System;
using System.IO;
using System.Data;
using Npgsql;

public class Program{
	static void Main(string[] args){
		var connString = @"Server=127.0.0.1;Port=5432;UserId=postgres;Password=パスワード;Database=testdb";
		var conn = new NpgsqlConnection(connString);
		conn.Open();

		NpgsqlTransaction tran = conn.BeginTransaction();
		var cmd = new NpgsqlCommand(@"delete from tb_sample1", conn);
		cmd.ExecuteNonQuery();
		tran.Commit();

		tran = conn.BeginTransaction();
		cmd = new NpgsqlCommand(@"insert into tb_sample1 (id, name, job) values (:id, :name, :job)", conn);
		cmd.Parameters.AddWithValue("id", 1);
		cmd.Parameters.AddWithValue("name", "山田 太郎");
		cmd.Parameters.AddWithValue("job", "会社員");
		cmd.ExecuteNonQuery();
		tran.Commit();

		tran = conn.BeginTransaction();
		cmd.Parameters.Remove("id");
		cmd.Parameters.Remove("name");
		cmd.Parameters.Remove("job");
		cmd.Parameters.AddWithValue("id", 2);
		cmd.Parameters.AddWithValue("name", "辻󠄀(一点しんにょうつじ) IVS");
		cmd.Parameters.AddWithValue("job", "会社員");
		cmd.ExecuteNonQuery();
		tran.Commit();

		tran = conn.BeginTransaction();
		cmd.Parameters.Remove("id");
		cmd.Parameters.Remove("name");
		cmd.Parameters.Remove("job");
		cmd.Parameters.AddWithValue("id", 3);
		cmd.Parameters.AddWithValue("name", "𠮷(土よし) サロゲート");
		cmd.Parameters.AddWithValue("job", "会社員");
		cmd.ExecuteNonQuery();
		tran.Commit();

		tran = conn.BeginTransaction();
		cmd.Parameters.Remove("id");
		cmd.Parameters.Remove("name");
		cmd.Parameters.Remove("job");
		cmd.Parameters.AddWithValue("id", 4);
		cmd.Parameters.AddWithValue("name", "(\uE000) 外字");
		cmd.Parameters.AddWithValue("job", "会社員");
		cmd.ExecuteNonQuery();
		tran.Commit();
//
// わざと重複キーでインサートして、どんなエラーメッセージが出るか観察してみる...
//
		tran = conn.BeginTransaction();
		cmd.Parameters.Remove("id");
		cmd.Parameters.Remove("name");
		cmd.Parameters.Remove("job");
		cmd.Parameters.AddWithValue("id", 4);
		cmd.Parameters.AddWithValue("name", "(\uE000) 外字");
		cmd.Parameters.AddWithValue("job", "会社員");

		try{
	 		cmd.ExecuteNonQuery();
	 		tran.Commit();
		}catch (Exception e){
			Concole.WriteLine(e.Message);
			tran.Rollback();
		}

		cmd = new NpgsqlCommand(@"select * from tb_sample1", conn);
		var dataReader = cmd.ExecuteReader();
		while (dataReader.Read()) {
			Console.WriteLine("{0},{1},{2}", dataReader["id"], dataReader["name"], dataReader["job"]);
		}
		dataReader.Close();

		tran = conn.BeginTransaction();
		cmd = new NpgsqlCommand(@"update tb_sample1 set job = :job where id = :id", conn);
		cmd.Parameters.AddWithValue("id", 1);
		cmd.Parameters.AddWithValue("job", "無職");
		cmd.ExecuteNonQuery();

		cmd.Parameters.Remove("id");
		cmd.Parameters.Remove("job");
		cmd.Parameters.AddWithValue("id", 2);
		cmd.Parameters.AddWithValue("job", "無職");
		cmd.ExecuteNonQuery();

		cmd.Parameters.Remove("id");
		cmd.Parameters.Remove("job");
		cmd.Parameters.AddWithValue("id", 3);
		cmd.Parameters.AddWithValue("job", "無職");
		cmd.ExecuteNonQuery();

		cmd.Parameters.Remove("id");
		cmd.Parameters.Remove("job");
		cmd.Parameters.AddWithValue("id", 4);
		cmd.Parameters.AddWithValue("job", "無職");
		cmd.ExecuteNonQuery();

		cmd = new NpgsqlCommand(@"select * from tb_sample1", conn);
		dataReader = cmd.ExecuteReader();
		while (dataReader.Read()) {
			Console.WriteLine("{0},{1},{2}", dataReader["id"], dataReader["name"], dataReader["job"]);
		}
		dataReader.Close();
		tran.Rollback();

		cmd = new NpgsqlCommand(@"select * from tb_sample1", conn);
		dataReader = cmd.ExecuteReader();
		while (dataReader.Read()) {
			Console.WriteLine("{0},{1},{2}", dataReader["id"], dataReader["name"], dataReader["job"]);
		}
		dataReader.Close();

		conn.Close();
	}
}

_ エラーメッセージ

二重キー
"0" 個の引数を指定して "ExecuteNonQuery" を呼び出し中に例外が発生しました: "23505: 重複したキー値は一意性制約"tb_sample1_pkey"違反となります"
デッドロック
"0" 個の引数を指定して "ExecuteNonQuery" を呼び出し中に例外が発生しました: "40P01: デッドロックを検出しました"

_ PowershellによるPostgreSQLアクセス例

[void][reflection.assembly]::LoadFrom("C:\Users\USER\Desktop\PostgreSQL\Npgsql.dll")
$ConnectionString = "Host=127.0.0.1;Username=postgres;Password=パスワード;Database=testdb"
$conn = New-Object NpgSql.NpgsqlConnection($ConnectionString)
$conn.Open()

$tran = $conn.BeginTransaction()
$command = New-Object NpgSql.NpgSqlCommand("delete from tb_sample1", $conn)
$effected_row_count = $command.ExecuteNonQuery();
$tran.Commit()

$tran = $conn.BeginTransaction()
$command = New-Object NpgSql.NpgSqlCommand("insert into tb_sample1 (id, name, job) values (:id, :name, :job)", $conn)
[void]$command.Parameters.AddWithValue("id", 1)
[void]$command.Parameters.AddWithValue("name", "山田 太郎")
[void]$command.Parameters.AddWithValue("job", "会社員")
$effected_row_count = $command.ExecuteNonQuery();
$tran.Commit()

$tran = $conn.BeginTransaction()
[void]$command.Parameters.Remove("id")
[void]$command.Parameters.Remove("name")
[void]$command.Parameters.Remove("job")
[void]$command.Parameters.AddWithValue("id", 2)
[void]$command.Parameters.AddWithValue("name", "辻󠄀(一点しんにょうつじ) IVS")
[void]$command.Parameters.AddWithValue("job", "会社員")
$effected_row_count = $command.ExecuteNonQuery();
$tran.Commit()

$tran = $conn.BeginTransaction()
[void]$command.Parameters.Remove("id")
[void]$command.Parameters.Remove("name")
[void]$command.Parameters.Remove("job")
[void]$command.Parameters.AddWithValue("id", 3)
[void]$command.Parameters.AddWithValue("name", "𠮷(土よし) サロゲート")
[void]$command.Parameters.AddWithValue("job", "会社員")
$effected_row_count = $command.ExecuteNonQuery();
$tran.Commit()

$tran = $conn.BeginTransaction()
[void]$command.Parameters.Remove("id")
[void]$command.Parameters.Remove("name")
[void]$command.Parameters.Remove("job")
[void]$command.Parameters.AddWithValue("id", 4)
[void]$command.Parameters.AddWithValue("name", "(\uE000) 外字")
[void]$command.Parameters.AddWithValue("job", "会社員")
$effected_row_count = $command.ExecuteNonQuery();
$tran.Commit()

#
# わざと重複キーでインサートして、どんなエラーメッセージが出るか観察してみる...
#
$tran = $conn.BeginTransaction()
[void]$command.Parameters.Remove("id")
[void]$command.Parameters.Remove("name")
[void]$command.Parameters.Remove("job")
[void]$command.Parameters.AddWithValue("id", 4)
[void]$command.Parameters.AddWithValue("name", "(\uE000) 外字")
[void]$command.Parameters.AddWithValue("job", "会社員")
try{
	$effected_row_count = $command.ExecuteNonQuery();
	$tran.Commit()
}catch{
	write-output $_.Exception.Message
#	"0" 個の引数を指定して "ExecuteNonQuery" を呼び出し中に例外が発生しました: "23505: 重複したキー値は一意性制約"tb_sample1_pkey"違反となります"
	$tran.Rollback()
}

$command = New-Object NpgSql.NpgSqlCommand("select * from tb_sample1 order by id", $conn)
$datareader = $command.ExecuteReader()
while ($datareader.Read()){
	write-output($datareader["id"].tostring() + "," + $datareader["name"] + "," + $datareader["job"])
}
$datareader.Close()

$tran = $conn.BeginTransaction()
$command = New-Object NpgSql.NpgSqlCommand("update tb_sample1 set job = :job where id = :id", $conn)
[void]$command.Parameters.AddWithValue("id", 1)
[void]$command.Parameters.AddWithValue("job", "無職")
$effected_row_count = $command.ExecuteNonQuery();

[void]$command.Parameters.Remove("id")
[void]$command.Parameters.Remove("job")
[void]$command.Parameters.AddWithValue("id", 2)
[void]$command.Parameters.AddWithValue("job", "無職")
$effected_row_count = $command.ExecuteNonQuery();

[void]$command.Parameters.Remove("id")
[void]$command.Parameters.Remove("job")
[void]$command.Parameters.AddWithValue("id", 3)
[void]$command.Parameters.AddWithValue("job", "無職")
$effected_row_count = $command.ExecuteNonQuery();

[void]$command.Parameters.Remove("id")
[void]$command.Parameters.Remove("job")
[void]$command.Parameters.AddWithValue("id", 4)
[void]$command.Parameters.AddWithValue("job", "無職")
$effected_row_count = $command.ExecuteNonQuery();

$command = New-Object NpgSql.NpgSqlCommand("select * from tb_sample1 order by id", $conn)
$datareader = $command.ExecuteReader()
while ($datareader.Read()){
	write-output($datareader["id"].tostring() + "," + $datareader["name"] + "," + $datareader["job"])
}
$datareader.Close()
$tran.Rollback()

$command = New-Object NpgSql.NpgSqlCommand("select * from tb_sample1 order by id", $conn)
$datareader = $command.ExecuteReader()
while ($datareader.Read()){
	write-output($datareader["id"].tostring() + "," + $datareader["name"] + "," + $datareader["job"])
}
$datareader.Close()

$conn.Close()

_ PowershellでUTF8を使う設定

# 標準出力(パイプ)への出力時のエンコーディングをバックアップ
$oe = $OutputEncoding
# 標準出力(画面)への出力時のエンコーディングをバックアップ
$scoe = [System.Console]::OutputEncoding

# 標準出力(パイプ)、標準出力(画面)への出力時のエンコーディングをUTF-8BOM無しに設定
$OutputEncoding = [System.Console]::OutputEncoding = New-Object System.Text.UTF8Encoding $false
# 標準出力(パイプ)、標準出力(画面)への出力時のエンコーディングをUTF-16、LE、BOM有りに設定
#$OutputEncoding = [System.Console]::OutputEncoding = New-Object System.Text.UnicodeEncoding $false,$true
# 標準出力(パイプ)、標準出力(画面)への出力時のエンコーディングをShift-JISに設定
#$OutputEncoding = [System.Console]::OutputEncoding = [Text.Encoding]::GetEncoding("Shift-JIS")

# ... UTF-8BOMなしデータを処理 ...
Hogge.exe | fuga.exe | foo.exe | bar.exe ...

# 標準出力(パイプ)への出力時のエンコーディングを元に戻す
$OutputEncoding = $oe
# 標準出力(画面)への出力時のエンコーディングを元に戻す
[System.Console]::OutputEncoding = $scoe

_ dotnet and npgsql.6.0.6

結局、pg_hba.confの認証methodを「md5」または「scram-sha-256」にする為にはdotnet6環境でのビルドが必要だった。

ソースディレクトリの準備

mkdir npgsqltest
cd npgsqltest
dotnet new console

npgsql.6.0.6のパッケージ追加(インターネット接続可能な場合)

dotnet add package npgsql

npgsql.6.0.6のパッケージ追加(インターネット接続不可能な場合)

mkdir packages
copy anywhere\npgsql.6.0.6.nupkg .\packages\
copy anywhere\ystem.runtime.compilerservices.unsafe.nupkg .\packages\
dotnet add package npgsql -s .\packages

ソースの編集

notepad Program.cs

ビルド

dotnet build

テスト実行

dotnet run

公開(デバッグ)

dotnet publish
bin\Debug\net6.0\publish\npgsqltest.exe

公開(本番)

dotnet publish -c Release
bin\Release\net6.0\publish\npgsqltest.exe

公開(本番、全部入り)

dotnet publish -c Release --self-contained true -r win-x64
bin\Release\net6.0\win-x64\publish\npgsqltest.exe

公開(本番、全部入り、単一exe)

dotnet publish -c Release --self-contained -p:PublicSingleFile=true -p:PublishTrimmed=true -r win-x64
bin\Release\net6.0\win-x64\publish\npgsqltest.exe

2022年06月27日 iText7 C# サンプル [長年日記]

_ C#からiTextを利用して、PDFを作成するサンプル。iTextAGPL3.0で利用可能。ネット上の各所から収集した情報を再構築して、個人的に必要十分な使用例をサンプルプログラムとして実装してみた。ただし、Windowsでの開発は本職ではないので、かなり自分勝手な解釈で行っている。

_ 開発環境

エディタ
メモ帳
コンパイラ
c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe

以上。

_ nupkg(dll)

nupkgの本来の使い方は全く知らないが、拡張子を.zipに変更して.dllを取り出す。

bouncycastle.1.8.9.nupkg
https://www.nuget.org/packages/BouncyCastle/
itext7.7.2.2.nupkg
https://www.nuget.org/packages/iText7/
itext7.commons.7.2.2.nupkg
https://www.nuget.org/packages/itext7.commons/
microsoft.extensions.logging.5.0.0.nupkg
https://www.nuget.org/packages/Microsoft.Extensions.Logging/
microsoft.extensions.logging.abstractions.5.0.0.nupkg
https://www.nuget.org/packages/Microsoft.Extensions.Logging.Abstractions/
microsoft.extensions.options.5.0.0.nupkg
https://www.nuget.org/packages/Microsoft.Extensions.Options/

_ コンパイル

c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /r:itext.commons.dll;itext.barcodes.dll;itext.forms.dll;itext.io.dll;itext.kernel.dll;itext.layout.dll;itext.pdfa.dll;itext.sign.dll;itext.styledxmlparser.dll;itext.svg.dll;BouncyCastle.Crypto.dll;Microsoft.Extensions.Logging.Abstractions.dll;Microsoft.Extensions.Logging.dll;Microsoft.Extensions.Options.dll Itext7Sample.cs

_ Itext7Sample.cs

//
// iText7利用サンプル(iTextSharp7使用につき、無償利用の場合はソース公開義務有り。注意!)
//
// Author. "Masahiko Ito"<m-ito@myh.no-ip.org>
//
// 開発環境
//   エディタ :メモ帳
//   コンパイル:c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /r:itext.commons.dll;itext.barcodes.dll;itext.forms.dll;itext.io.dll;itext.kernel.dll;itext.layout.dll;itext.pdfa.dll;itext.sign.dll;itext.styledxmlparser.dll;itext.svg.dll;BouncyCastle.Crypto.dll;Microsoft.Extensions.Logging.Abstractions.dll;Microsoft.Extensions.Logging.dll;Microsoft.Extensions.Options.dll Itext7Sample.cs
//
// 必要なDLL
//
//   bouncycastle.1.8.9.nupkg(https://www.nuget.org/packages/BouncyCastle/)
//     BouncyCastle.Crypto.dll
//
//   itext7.7.2.2.nupkg(https://www.nuget.org/packages/iText7/)
//     itext.barcodes.dll
//     itext.forms.dll
//     itext.io.dll
//     itext.kernel.dll
//     itext.layout.dll
//     itext.pdfa.dll
//     itext.sign.dll
//     itext.styledxmlparser.dll
//     itext.svg.dll
//
//   itext7.commons.7.2.2.nupkg(https://www.nuget.org/packages/itext7.commons/)
//     itext.commons.dll
//
//   microsoft.extensions.logging.5.0.0.nupkg(https://www.nuget.org/packages/Microsoft.Extensions.Logging/)
//     Microsoft.Extensions.Logging.dll
//
//   microsoft.extensions.logging.abstractions.5.0.0.nupkg(https://www.nuget.org/packages/Microsoft.Extensions.Logging.Abstractions/)
//     Microsoft.Extensions.Logging.Abstractions.dll
//
//   microsoft.extensions.options.5.0.0.nupkg(https://www.nuget.org/packages/Microsoft.Extensions.Options/)
//     Microsoft.Extensions.Options.dll
//

using System;
using System.IO;
using iText.Kernel.Pdf;
using iText.Kernel.Pdf.Canvas;
using iText.Kernel.Pdf.Xobject;
using iText.Kernel.Pdf.Extgstate;
using iText.Kernel.Geom;
using iText.Kernel.Font;
using iText.Kernel.Colors;
using iText.Layout;
using iText.Layout.Element;
using iText.Layout.Properties;
using iText.IO.Image;
using iText.Barcodes;

public class Program{
//======================================================================
// iText7 サンプル
//======================================================================
	static void Main(string[] args){
		Sample_ShowTextAligned("sample_showtextaligned.pdf");
		Sample_DrawLine("sample_drawline.pdf");
		Sample_DrawRectangle("sample_drawrectangle.pdf");
		Sample_FillRectangle("sample_fillrectangle.pdf");
		Sample_DrawEllipse("sample_drawellipse.pdf");
		Sample_FillEllipse("sample_fillellipse.pdf");
		Sample_DrawImage("sample_drawimage.pdf");
		Sample_DrawQRCode("sample_drawqrcode.pdf");
		Sample_SetTemplate("sample_settemplate.pdf");
	}
//======================================================================
// 文字列描画
//======================================================================
	static void Sample_ShowTextAligned(string filename){
//
// 出力する PdfDocument 作成
//
		PdfDocument PdfDocument = new PdfDocument(new PdfWriter(new FileStream(filename, FileMode.Create, FileAccess.Write)));
//
// PdfDocument から Document 作成
//
		Document Document = new Document(PdfDocument);
//
// PdfDocument に新しいページを追加し、用紙をA4縦に設定
//
//		PdfDocument.AddNewPage(new PageSize(new Rectangle(210.0f / 25.4f * 72.0f, 297.0f / 25.4f * 72.0f));
		PdfDocument.AddNewPage(PageSize.A4);
//		PdfDocument.AddNewPage(PageSize.A4.Rotate());	// A4横の場合

//
// PdfFont をMS明朝で作成
//
		PdfFont PdfFont = PdfFontFactory.CreateFont(@"C:\Windows\Fonts\msgothic.ttc,0", "Identity-H");
//
// Document にMS明朝を設定
//
		Document.SetFont(PdfFont);
//
// Document にフォントのサイズを 24point に設定
//
		Document.SetFontSize(24);
//
// Document にフォントの色を黒、不透過度を 1.0f に設定
//
		Document.SetFontColor(ColorConstants.BLACK, 1.0f);
//
// 用紙の右端から24.0point、下から48.0pointの位置に文字列を表示
// 指定する位置に文字列の左下が位置付けられる
// サロゲートペア文字は表示可能、IVS/IVD文字は表示不可能
//
		Document.ShowTextAligned("はろーわーるど!", 24.0f, 48.0f, TextAlignment.LEFT, VerticalAlignment.BOTTOM, 0.0f);
//
// 用紙の右端から24.0point、下から48.0pointの位置に45度傾けて文字列を表示。
//
		Document.ShowTextAligned("はろーわーるど!", 24.0f, 48.0f, TextAlignment.LEFT, VerticalAlignment.BOTTOM, (float)Math.PI / 180 * 45);
//
// Document を閉じてPDFを完成させる
//
		Document.Close();
	}
//======================================================================
// 直線描画
//======================================================================
	static void Sample_DrawLine(string filename){
//
// 出力する PdfDocument 作成
//
		PdfDocument PdfDocument = new PdfDocument(new PdfWriter(new FileStream(filename, FileMode.Create, FileAccess.Write)));
//
// PdfDocument から Document 作成
//
		Document Document = new Document(PdfDocument);
//
// PdfDocument に新しいページを追加および用紙をA4縦に設定し、PdfPage を作成
//
		PdfPage PdfPage = PdfDocument.AddNewPage(PageSize.A4);
//
// PdfPage から PdfCanvas 作成
//
		PdfCanvas PdfCanvas = new PdfCanvas(PdfPage);
//
// PdfCanvas に直線描画の色を RED に設定
//
		PdfCanvas.SetStrokeColor(ColorConstants.RED);
//
// PdfCanvas に描画の線幅を2.0point に設定
//
		PdfCanvas.SetLineWidth(2.0f);
//
// 用紙の左下を原点として、(100.0point, 50.0point)から(200.0point, 100.0point)に直線を描画
//
		PdfCanvas.MoveTo(100.0f,50.0f).LineTo(200.0f,100.0f).Stroke();
//
// Document を閉じてPDFを完成させる
//
		Document.Close();
	}
//======================================================================
// 矩形描画
//======================================================================
	static void Sample_DrawRectangle(string filename){
//
// 出力する PdfDocument 作成
//
		PdfDocument PdfDocument = new PdfDocument(new PdfWriter(new FileStream(filename, FileMode.Create, FileAccess.Write)));
//
// PdfDocument から Document 作成
//
		Document Document = new Document(PdfDocument);
//
// PdfDocument に新しいページを追加および用紙をA4縦に設定し、PdfPage を作成
//
		PdfPage PdfPage = PdfDocument.AddNewPage(PageSize.A4);
//
// PdfPage から PdfCanvas 作成
//
		PdfCanvas PdfCanvas = new PdfCanvas(PdfPage);
//
// PdfCanvas に直線描画の色を RED に設定
//
		PdfCanvas.SetStrokeColor(ColorConstants.RED);
//
// PdfCanvas に描画の線幅を2.0point に設定
//
		PdfCanvas.SetLineWidth(2.0f);
//
// 用紙の左下を原点として、(10.0point, 20.0point)から右方向に30.0pointの幅, 上方向に40.0pointの高さで矩形を描画
//
		PdfCanvas.Rectangle(10.0f,20.0f,30.0f,40.0f).Stroke();
//
// Document を閉じてPDFを完成させる
//
		Document.Close();
	}
//======================================================================
// 矩形塗りつぶし
//======================================================================
	static void Sample_FillRectangle(string filename){
//
// 出力する PdfDocument 作成
//
		PdfDocument PdfDocument = new PdfDocument(new PdfWriter(new FileStream(filename, FileMode.Create, FileAccess.Write)));
//
// PdfDocument から Document 作成
//
		Document Document = new Document(PdfDocument);
//
// PdfDocument に新しいページを追加および用紙をA4縦に設定し、PdfPage を作成
//
		PdfPage PdfPage = PdfDocument.AddNewPage(PageSize.A4);
//
// PdfPage から PdfCanvas 作成
//
		PdfCanvas PdfCanvas = new PdfCanvas(PdfPage);
//
// PdfCanvas に直線描画の色を RED に設定
//
		PdfCanvas.SetStrokeColor(ColorConstants.RED);
//
// PdfCanvas に直線描画の不透過度を 1.0f に設定
//
		PdfCanvas.SetExtGState(new PdfExtGState().SetStrokeOpacity(1.0f));
//
// PdfCanvas に塗りつぶしの色を GREEN に設定
//
		PdfCanvas.SetFillColor(ColorConstants.GREEN);
//
// PdfCanvas に塗りつぶしの不透過度を 0.5f に設定
//
		PdfCanvas.SetExtGState(new PdfExtGState().SetFillOpacity(0.5f));
//
// PdfCanvas に描画の線幅を2.0point に設定
//
		PdfCanvas.SetLineWidth(2.0f);
//
// 用紙の左下を原点として、(10.0point, 20.0point)から右方向に30.0pointの幅, 上方向に40.0pointの高さで矩形を描画し内部を塗りつぶす
//
		PdfCanvas.Rectangle(10.0f,20.0f,30.0f,40.0f).FillStroke();
//
// 用紙の左下を原点として、(25.0point, 40.0point)から右方向に30.0pointの幅, 上方向に40.0pointの高さで矩形を描画し内部を塗りつぶす
//
		PdfCanvas.Rectangle(25.0f,40.0f,30.0f,40.0f).FillStroke();
//
// Document を閉じてPDFを完成させる
//
		Document.Close();
	}
//======================================================================
// 楕円描画
//======================================================================
	static void Sample_DrawEllipse(string filename){
//
// 出力する PdfDocument 作成
//
		PdfDocument PdfDocument = new PdfDocument(new PdfWriter(new FileStream(filename, FileMode.Create, FileAccess.Write)));
//
// PdfDocument から Document 作成
//
		Document Document = new Document(PdfDocument);
//
// PdfDocument に新しいページを追加および用紙をA4縦に設定し、PdfPage を作成
//
		PdfPage PdfPage = PdfDocument.AddNewPage(PageSize.A4);
//
// PdfPage から PdfCanvas 作成
//
		PdfCanvas PdfCanvas = new PdfCanvas(PdfPage);
//
// PdfCanvas に直線描画の色を RED に設定
//
		PdfCanvas.SetStrokeColor(ColorConstants.RED);
//
// PdfCanvas に描画の線幅を2.0point に設定
//
		PdfCanvas.SetLineWidth(2.0f);
//
// 用紙の左下を原点として、(10.0point, 20.0point)-(30.0point, 40.0point)を対角とする矩形内に接する楕円を描画
//
		PdfCanvas.Ellipse(10.0f, 20.0f, 30.0f, 40.0f).Stroke();
//
// Document を閉じてPDFを完成させる
//
		Document.Close();
	}
//======================================================================
// 楕円塗りつぶし
//======================================================================
	static void Sample_FillEllipse(string filename){
//
// 出力する PdfDocument 作成
//
		PdfDocument PdfDocument = new PdfDocument(new PdfWriter(new FileStream(filename, FileMode.Create, FileAccess.Write)));
//
// PdfDocument から Document 作成
//
		Document Document = new Document(PdfDocument);
//
// PdfDocument に新しいページを追加および用紙をA4縦に設定し、PdfPage を作成
//
		PdfPage PdfPage = PdfDocument.AddNewPage(PageSize.A4);
//
// PdfPage から PdfCanvas 作成
//
		PdfCanvas PdfCanvas = new PdfCanvas(PdfPage);
//
// PdfCanvas に直線描画の色を RED に設定
//
		PdfCanvas.SetStrokeColor(ColorConstants.RED);
//
// PdfCanvas に直線描画の不透過度を 1.0f に設定
//
		PdfCanvas.SetExtGState(new PdfExtGState().SetStrokeOpacity(1.0f));
//
// PdfCanvas に塗りつぶしの色を GREEN に設定
//
		PdfCanvas.SetFillColor(ColorConstants.GREEN);
//
// PdfCanvas に塗りつぶしの不透過度を 0.5f に設定
//
		PdfCanvas.SetExtGState(new PdfExtGState().SetFillOpacity(0.5f));
//
// PdfCanvas に描画の線幅を2.0point に設定
//
		PdfCanvas.SetLineWidth(2.0f);
//
// 用紙の左下を原点として、(10.0point, 20.0point)-(30.0point, 40.0point)を対角とする矩形内に接する楕円を描画し内部を塗りつぶす
//
		PdfCanvas.Ellipse(10.0f,20.0f,30.0f,40.0f).FillStroke();
//
// 用紙の左下を原点として、(20.0point, 30.0point)-(40.0point, 50.0point)を対角とする矩形内に接する楕円を描画し内部を塗りつぶす
//
		PdfCanvas.Ellipse(20.0f,30.0f,40.0f,50.0f).FillStroke();
//
// Document を閉じてPDFを完成させる
//
		Document.Close();
	}
//======================================================================
// 画像ファイル描画
//======================================================================
	static void Sample_DrawImage(string filename){
//
// 出力する PdfDocument 作成
//
		PdfDocument PdfDocument = new PdfDocument(new PdfWriter(new FileStream(filename, FileMode.Create, FileAccess.Write)));
//
// PdfDocument から Document 作成
//
		Document Document = new Document(PdfDocument);
//
// PdfDocument に新しいページを追加および用紙をA4縦に設定し、PdfPage を作成
//
		PdfPage PdfPage = PdfDocument.AddNewPage(PageSize.A4);
//
// PdfPage から PdfCanvas 作成
//
		PdfCanvas PdfCanvas = new PdfCanvas(PdfPage);
//
// PdfCanvas に塗りつぶしの(描画の)不透過度を 0.5f に設定
//
		PdfCanvas.SetExtGState(new PdfExtGState().SetFillOpacity(0.5f));
//
// image.png を取り込んで、 ImageData を作成
//
		ImageData ImageData = ImageDataFactory.Create(@"image.png");
//
// ImageData から Image を作成
//
		Image Image = new Image(ImageData);
//
// イメージの幅を 100point、高さを 50point に設定
//
		Image.ScaleAbsolute(100.0f, 50.0f);
//
// 用紙の左下を原点として、(1ページ目の)(20.0point, 30.0point) にイメージを位置づけ
//
		Image.SetFixedPosition(1, 20.0f, 30.0f);
//
// Document に Image を描画
//
		Document.Add(Image);
//
// Document を閉じてPDFを完成させる
//
		Document.Close();
	}
//======================================================================
// QRCode描画
//======================================================================
	static void Sample_DrawQRCode(string filename){
//
// 出力する PdfDocument 作成
//
		PdfDocument PdfDocument = new PdfDocument(new PdfWriter(new FileStream(filename, FileMode.Create, FileAccess.Write)));
//
// PdfDocument から Document 作成
//
		Document Document = new Document(PdfDocument);
//
// PdfDocument に新しいページを追加および用紙をA4縦に設定し、PdfPage を作成
//
		PdfPage PdfPage = PdfDocument.AddNewPage(PageSize.A4);
//
// PdfPage から PdfCanvas 作成
//
		PdfCanvas PdfCanvas = new PdfCanvas(PdfPage);
//
// PdfCanvas に塗りつぶしの(描画の)不透過度を 1.0f に設定
//
		PdfCanvas.SetExtGState(new PdfExtGState().SetFillOpacity(1.0f));
//
// "this is test qrcode" を内容とする BarcodeQRCode を作成
//
		BarcodeQRCode BarcodeQRCode = new BarcodeQRCode("this is test qrcode");
//
// BarcodeQRCode から、描画色を BLACK で PdfFormXObject を作成
//
		PdfFormXObject PdfFormXObject = BarcodeQRCode.CreateFormXObject(ColorConstants.BLACK, PdfDocument);
//
// PdfFormXObject から ImageBarcode を作成
//
		Image ImageBarcode = new Image(PdfFormXObject);
//
// ImageBarcode にイメージの幅を 100point、高さを 100point に設定
//
		ImageBarcode.ScaleAbsolute(100.0f, 100.0f);
//
// ImageBarcode に用紙の左下を原点として、(1ページ目の)(20.0point, 30.0point) にイメージを位置づけ
//
		ImageBarcode.SetFixedPosition(1, 20.0f, 30.0f);
//
// Document に ImageBarcode を描画
//
		Document.Add(ImageBarcode);
//
// Document を閉じてPDFを完成させる
//
		Document.Close();
	}
//======================================================================
// テンプレート設定
//======================================================================
	static void Sample_SetTemplate(string filename){
//
// 出力する PdfDocument 作成
//
		PdfDocument PdfDocument = new PdfDocument(new PdfWriter(new FileStream(filename, FileMode.Create, FileAccess.Write)));
//
// PdfDocument から Document 作成
//
		Document Document = new Document(PdfDocument);
//
// template.pdf から PdfDocumentTemplate 生成
//
		PdfDocument PdfDocumentTemplate = new PdfDocument(new PdfReader(@"template.pdf"));
//
// PdfDocumentTemplate の1ページ目を取り込んで PagePdfTemplate 生成
//
		PdfPage PagePdfTemplate = PdfDocumentTemplate.GetPage(1);
//
// PagePdfTemplate から PdfXObject 生成
//
		PdfXObject PdfXObject = PagePdfTemplate.CopyAsFormXObject(PdfDocument);
//
// 取込が完了して不要になった PdfDocumentTemplate を閉じる
//
		PdfDocumentTemplate.Close();
//
// PdfDocument に新しいページ(1ページ目)を追加および用紙をA4縦に設定し、PdfPage を作成
//
		PdfPage PdfPage = PdfDocument.AddNewPage(PageSize.A4);
//
// PdfPage から PdfCanvas 作成
//
		PdfCanvas PdfCanvas = new PdfCanvas(PdfPage);
//
// 新しいページに PdfXObject(テンプレート) を設定
//
		PdfCanvas.AddXObjectAt(PdfXObject, 0, 0);
//
// PdfDocument に新しいページ(2ページ目)を追加および用紙をA4縦に設定し、PdfPage を作成
//
		PdfPage = PdfDocument.AddNewPage(PageSize.A4);
//
// PdfPage から PdfCanvas 作成
//
		PdfCanvas = new PdfCanvas(PdfPage);
//
// 新しいページに PdfXObject(テンプレート) を設定
//
		PdfCanvas.AddXObjectAt(PdfXObject, 0, 0);
//
// Document を閉じてPDFを完成させる
//
		Document.Close();
	}
}

_ 関連ページ

簡易なコマンドでPDFによる作表を可能とするツール。

テキストファイルまたは標準入力より、makepdfに対して

  • 文字列描画
  • 直線描画
  • 矩形描画
  • 矩形塗りつぶし
  • 楕円描画
  • 楕円塗りつぶし
  • 画像ファイル描画
  • QRCode描画
  • テンプレート描画(汎用機での作表で言うところのオーバーレイ印刷)

を簡易なコマンドにより指示し、PDFを生成する。