0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

コマンドを実行する Deb ファイル (その2)

Last updated at Posted at 2021-03-27

こちらのプログラムを改造して、コマンドをインストールして実行するようにしました。
コマンドを実行する Deb ファイルの作成

ファイル構成

$ tree package-test_1.0-1_amd64
package-test_1.0-1_amd64
├── DEBIAN
│   ├── control
│   └── postinst
└── usr
    └── share
        └── doc
            └── package-test
                └── go_inst.sh

postinst go_inst.sh のファイル属性は 0755 です。

package-test_1.0-1_amd64/DEBIAN/control
Package: package-test
Version: 1.0.1
Architecture: all
Maintainer: ekzemplaro
Section: education
Priority: extra
Description: Packaging test.
package-test_1.0-1_amd64/DEBIAN/postinst
#! /bin/bash
# postinst.skeleton
# Skeleton maintainer script showing all the possible cases.
# Written by Charles Briscoe-Smith, March-June 1998.  Public Domain.
# Abort if any command returns an error value
#

set -e

#        written Tue Jan 20 2015

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

echo 'postinst' > /tmp/postinst.txt


/usr/share/doc/package-test/go_inst.sh

echo 'postinst *** end ***' >> /tmp/postinst.txt

exit 0
package-test_1.0-1_amd64/usr/share/doc/package-test/go_inst.sh
#! /bin/bash

set -e
#


echo 'go_inst.sh' > /tmp/go_inst.txt

cd /tmp
git clone https://github.com/ekzemplaro/storytelling

echo 'go_inst *** end ***' >> /tmp/go_inst.txt

exit 0

パッケージの作成

dpkg-deb --build package-test_1.0-1_amd64

package-test_1.0-1_amd64.deb が作成されます。

実行

sudo dpkg -i package-test_1.0-1_amd64.deb
0
1
0

Register as a new user and use Qiita more conveniently

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?