« [iPhone]コピー&ペースト機能搭載テキストエディタgTxtEditJplus | Main | [iPhone][Jailbreak]iPhoneでrlToday!? Lock Screenに任意の文字や画像を表示する »

2008.09.28

[iPhone]Cydiaに登録するdebパッケージを作る手順(最低限版)

ほとんどのちなさんに対する私信ですが。
gtxtEditJplusを例に取って、Cydia用のdebパッケージの作り方の手記を置いときます。

のちなさんの母艦はWindowsとのことなので、iPhone/iPod touch上で作業するという前提の説明です。

Packagesファイルの作り方を含む完全な情報はSaurik氏のページのこちらに。
自分のやり方は、かなりはしょっているので念のため。

How to Host a Cydia Repository

まずは、動くアプリケーションを作る。

iPhone/iPod touch(以下iPhoneとする)にrootユーザとしてSSHでログインし、/var/root/に掘ったaptディレクトリへ移動して、パッケージの名前になるディレクトリ、com.gojohnnyboi.gtxteditjpuls_0.9-1_darwin-armを掘る。

# cd
# mkdir apt
# cd apt
# mkdir com.gojohnnyboi.gtxteditjpuls_0.9-1_darwin-arm

com.gojohnnyboi.gtxteditjpuls_0.9-1_darwin-arm内に移動して、インストールする必要のあるファイルをルートからの構造を再現するようにコピーする。

# cd com.gojohnnyboi.gtxteditjpuls_0.9-1_darwin-arm
# mkdir Applications
# cp -r /Applications/gTxtEditJplus.app/ Applications/

母艦がMacの場合は、.DS_Storeを掃除しておく。(下記はカレントディレクトリ以下にある.DS_Storeを再帰的に削除)

# find . -name .DS_Store -print -exec rm {} ";"

必要なパーミッションが外れてたら付けておく。

# cd Applications/gTxtEditJplus.app/
# ls -l
total 80
-rw-r--r-- 1 root wheel   877 Sep 28 19:38 Info.plist
-rwxr-xr-x 1 root wheel 58048 Sep 28 19:38 gTxtEditJplus*
-rwxr-xr-x 1 root wheel    60 Sep 28 19:38 gTxtEditJplus_exec*
-rw-r--r-- 1 root wheel 10631 Sep 28 19:38 icon.png
# chmod u+s gTxtEditJplus gTxtEditJplus_exec
# ls -l
total 80
-rw-r--r-- 1 root wheel   877 Sep 28 19:38 Info.plist
-rwsr-xr-x 1 root wheel 58048 Sep 28 19:38 gTxtEditJplus*
-rwsr-xr-x 1 root wheel    60 Sep 28 19:38 gTxtEditJplus_exec*
-rw-r--r-- 1 root wheel 10631 Sep 28 19:38 icon.png

com.gojohnnyboi.gtxteditjpuls_0.9-1_darwin-arm直下にDEBIANディレクトリを掘る。
controlファイルを作る。

cd ../../
mkdir DEBIAN
vi DEBIAN/control

内容はこんな感じ。

Package: com.gojohnnyboi.gtxteditjpuls
Name: gTxtEditJplus
Version: 0.9-1
Architecture: iphoneos-arm
Description: Copy & paste oriented text editor for Japanese.
 Once copy text on this app, paste anywhere via Japanese input method.
 gTxtEditJplus enable you to...
 Paste from Safari, Paste to Safari with modified iCopy bookmarklet.
 Make new mail message from clipboard, and so on.
 For details, please visit the following website.
Homepage: http://www.hamkumas.net/ipod/
Maintainer: moyashi <hitoriblog_NO_NO_SPAM@gmail.com>
Author: nochina <nochina_NO_NO_SPAM@hamkumas.net>
Section: System
Depends:
Conflicts:

Versionは、「アプリケーションのバージョン番号-パッケージのバージョン番号」と付ける。
パッケージをやり直したら「0.9-2」などとなっていく。
Descriptionの2行目以降は行頭にスペースを入れる。
Dependsにインストールを前提にしたいパッケージ名をカンマ区切りで書いておくと、もしインストールされていなかった場合に事前にインストールをしてくれる。
同時に存在できないパッケージがあるならば、項目Conflictsにパッケージ名を書いておくと警告が出て、トラブルを回避できる。
Name, Author, HomepageはCydia独自の項目。

ゴミが出来てたら消しておく。

# ls DEBIAN
control control~
# rm DEBIAN/control~

com.gojohnnyboi.gtxteditjpuls_0.9-1_darwin-armのあるディレクトリに移動して、パッケージ作成。
この際、tab補完すると、末尾に「dpkg-deb -b com.gojohnnyboi.gtxteditjpuls_0.9-1_darwin-arm/」といった感じで「/」が入るので、これは削除して実行。
非標準の項目(Name, Author, Homepage)が交じっているという内容のWarningが出るが無視。

# cd ..
# dpkg-deb -b com.gojohnnyboi.gtxteditjpuls_0.9-1_darwin-arm
# ls
com.gojohnnyboi.gtxteditjpuls_0.9-1_darwin-arm/
com.gojohnnyboi.gtxteditjpuls_0.9-1_darwin-arm.deb

debパッケージが出来ているはずなので、既にアプリケーションがあれば削除して、インストールテストする。

手動でインストールしていた場合。

# rm -rf /Applications/gTxtEditJplus.app

前回もdebパッケージから入れていた場合。
controlに書いた「Package: com.gojohnnyboi.gtxteditjpuls」が識別子になる。

# apt-get remove com.gojohnnyboi.gtxteditjpuls

SpringBoardのキャッシュをリフレッシュして、respring。

# su mobile
$ uicache
$ restart
$ exit

パッケージのインストールテスト。

# dpkg -i com.gojohnnyboi.gtxteditjpuls_0.9-1_darwin-arm.deb
# su mobile
$ uicache
$ restart

これで正常にインストールされていればdebパッケージの完成。

その他の知識

debパッケージの解凍方法。
-xでインストールするファイルの解凍、-eで管理ファイルの解凍。

# mkdir temp
# dpkg-deb -x com.gojohnnyboi.gtxteditjpuls_0.9-1_darwin-arm.deb temp
# dpkg-deb -e com.gojohnnyboi.gtxteditjpuls_0.9-1_darwin-arm.deb temp

今回題材にしたdebパッケージへの直リン
http://homepage3.nifty.com/moyashi/cydia/com.gojohnnyboi.gtxteditjpuls_0.9-1_darwin-arm.deb

« [iPhone]コピー&ペースト機能搭載テキストエディタgTxtEditJplus | Main | [iPhone][Jailbreak]iPhoneでrlToday!? Lock Screenに任意の文字や画像を表示する »

blogparts

  • Last.fm
  • twitter

Recent Comments

無料ブログはココログ