見出し画像

TWSNMP FC:Linux版のパッケージと配布サイトの作成 途中

Windows版のインストラーができたので、昨日からLinux版(Debian)のパッケージと配布サイトを作っています。
昨日の夜はいろいろ予習しました。沢山あって頭が痛くなりました。寝ている間も調べたことが夢にでてきました。結局今朝は3時半に起きて開発開始です。

まずはDebianパッケージの作成を

を参考に練習しました。
配布サイトの作成は

を参考にして練習しました。

7時間かかって何とか

FROM debian:11-slim
RUN  apt update && apt upgrade -yq && apt install -yq  \
dpkg-sig reprepro binutils fakeroot binutils-arm-linux-gnueabihf
COPY mk.sh /root/
RUN  chmod +x /root/mk.sh
ENTRYPOINT [ "/root/mk.sh" ]

のようなDockerコンテナの中で、

#!/bin/sh
cd  /root
# 鍵をインポート
rm -rf .gnupg
tar xzf /src/conf/gnupg.tgz

rm -rf /tmp/deb
#AMD64パッケージの作成
mkdir -p /tmp/deb/amd64/DEBIAN
mkdir -p /tmp/deb/amd64/opt/twsnmpfc
mkdir -p /tmp/deb/amd64/var/twsnmpfc
mkdir -p /tmp/deb/amd64/etc/systemd/system/
mkdir -p /tmp/deb/amd64/etc/default
cp /src/conf/control.amd64 /tmp/deb/amd64/DEBIAN/control
cp /src/bin/twsnmpfc /tmp/deb/amd64/opt/twsnmpfc/
cp /src/bin/twpcap /tmp/deb/amd64/opt/twsnmpfc/
cp /src/bin/twWifiScan /tmp/deb/amd64/opt/twsnmpfc/
cp /src/bin/twBlueScan /tmp/deb/amd64/opt/twsnmpfc/
strip /tmp/deb/amd64/opt/twsnmpfc/*
chmod a+x /tmp/deb/amd64/opt/twsnmpfc/*
chmod o+w /tmp/deb/amd64/opt/twsnmpfc/*
chown root:root /tmp/deb/amd64/opt/twsnmpfc/*
cp /src/conf/twsnmpfc.service /tmp/deb/amd64/etc/systemd/system/
cp /src/conf/twsnmpfc.conf /tmp/deb/amd64/etc/default/
cp /src/conf/twpcap.service /tmp/deb/amd64/etc/systemd/system/
cp /src/conf/twpcap.conf /tmp/deb/amd64/etc/default/
cp /src/conf/twWifiScan.service /tmp/deb/amd64/etc/systemd/system/
cp /src/conf/twWifiScan.conf /tmp/deb/amd64/etc/default/
cp /src/conf/twBlueScan.service /tmp/deb/amd64/etc/systemd/system/
cp /src/conf/twBlueScan.conf /tmp/deb/amd64/etc/default/
fakeroot dpkg-deb --build /tmp/deb/amd64 /tmp/deb

#ARMパッケージの作成
mkdir -p /tmp/deb/arm/DEBIAN
mkdir -p /tmp/deb/arm/opt/twsnmpfc
mkdir -p /tmp/deb/arm/var/twsnmpfc
mkdir -p /tmp/deb/arm/etc/systemd/system/
mkdir -p /tmp/deb/arm/etc/default
cp /src/conf/control.arm /tmp/deb/arm/DEBIAN/control
cp /src/bin/twsnmpfc.arm /tmp/deb/arm/opt/twsnmpfc/twsnmpfc
cp /src/bin/twpcap.arm /tmp/deb/arm/opt/twsnmpfc/twpcap
cp /src/bin/twWifiScan.arm /tmp/deb/arm/opt/twsnmpfc/twWifiScan
cp /src/bin/twBlueScan.arm /tmp/deb/arm/opt/twsnmpfc/twBlueScan
arm-linux-gnueabihf-strip /tmp/deb/arm/opt/twsnmpfc/*
chmod a+x /tmp/deb/arm/opt/twsnmpfc/*
chmod o+w /tmp/deb/arm/opt/twsnmpfc/*
chown root:root /tmp/deb/arm/opt/twsnmpfc/*
cp /src/conf/twsnmpfc.service /tmp/deb/arm/etc/systemd/system/twsnmpfc.service
cp /src/conf/twsnmpfc.conf /tmp/deb/arm/etc/default/
cp /src/conf/twpcap.service /tmp/deb/arm/etc/systemd/system/twpcap.service
cp /src/conf/twpcap.conf /tmp/deb/arm/etc/default/
cp /src/conf/twWifiScan.service /tmp/deb/arm/etc/systemd/system/twWifiScan.service
cp /src/conf/twWifiScan.conf /tmp/deb/arm/etc/default/
cp /src/conf/twBlueScan.service /tmp/deb/arm/etc/systemd/system/
cp /src/conf/twBlueScan.conf /tmp/deb/arm/etc/default/
fakeroot dpkg-deb --build /tmp/deb/arm /tmp/deb
#
GPG_TTY=$(tty) dpkg-sig -k 4AC1F34BD20F307442D1DB2EC5974ACD14ADAF03 --sign builder /tmp/deb/*.deb
cp /tmp/deb/*.deb /src/

#配布サイト作成
rm -r /tmp/rep
mkdir -p /tmp/rep/conf
cp /src/conf/distributions /tmp/rep/conf
cp /src/conf/override.buster /tmp/rep/conf
cd /tmp/rep
reprepro export
reprepro includedeb bulleseye /tmp/deb/twsnmpfc_*.deb
rm  /src/debianrep.tgz
tar czf /src/debianrep.tgz .

#公開鍵のエクスポート
rm /src/twsnmp.gpg.key
gpg --armor --output /src/twsnmp.gpg.key --export-options export-minimal --export 4AC1F34BD20F307442D1DB2EC5974ACD14ADAF03

のようなスクリプトを実行してパッケージとサイトのデータができました。

 % ls -l dist
total 190376
-rw-r--r--  1 ymimacmini  staff  27993924 10 30 10:47 debianrep.tgz
-rw-r--r--@ 1 ymimacmini  staff  19341917 10 28 05:25 twsnmpfc.dmg
-rw-------  1 ymimacmini  staff  20381696 10 29 07:04 twsnmpfc.msi
-rw-r--r--  1 ymimacmini  staff  14600148 10 30 10:47 twsnmpfc_1.15.0_amd64.deb
-rw-r--r--  1 ymimacmini  staff  13385384 10 30 10:47 twsnmpfc_1.15.0_armhf.deb

% tar tzf dist/debianrep.tgz
./
./pool/
./pool/main/
./pool/main/t/
./pool/main/t/twsnmpfc/
./pool/main/t/twsnmpfc/twsnmpfc_1.15.0_amd64.deb
./pool/main/t/twsnmpfc/twsnmpfc_1.15.0_armhf.deb
./dists/
./dists/bulleseye/
./dists/bulleseye/main/
./dists/bulleseye/main/binary-amd64/
./dists/bulleseye/main/binary-amd64/Packages.gz
./dists/bulleseye/main/binary-amd64/Packages
./dists/bulleseye/main/binary-amd64/Release
./dists/bulleseye/main/binary-armhf/
./dists/bulleseye/main/binary-armhf/Packages.gz
./dists/bulleseye/main/binary-armhf/Packages
./dists/bulleseye/main/binary-armhf/Release
./dists/bulleseye/InRelease
./dists/bulleseye/Release
./dists/bulleseye/Release.gpg
./db/
./db/version
./db/checksums.db
./db/references.db
./db/packages.db
./db/release.caches.db
./db/contents.cache.db
./conf/
./conf/override.buster
./conf/distributions

のような感じです。
作ってみて、Dockerのイメージ作成や配布が簡単で便利だということを実感しました。でも一つ技を習得しました。
作ったパッケージやサイトの動作確認は午後からにしようと思います。

午後に続く


開発のための諸経費(機材、Appleの開発者、サーバー運用)に利用します。 ソフトウェアのマニュアルをnoteの記事で提供しています。 サポートによりnoteの運営にも貢献できるのでよろしくお願います。