Skip to content

Instantly share code, notes, and snippets.

@tantan-tanuki
Created June 10, 2021 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tantan-tanuki/06b71aff8913e0d1ef02050ba27f044c to your computer and use it in GitHub Desktop.
Save tantan-tanuki/06b71aff8913e0d1ef02050ba27f044c to your computer and use it in GitHub Desktop.
日本語MANページのインストールスクリプト
#!/bin/env bash
# JMプロジェクトURL
JM_URL=https://linuxjm.osdn.jp
# ダウンロードページ情報取得
DOWNLOAD_PAGE="$(curl -s $JM_URL/download.html)"
# 最新アーカイブ名取得
ARCHIVE_NAME="$(xmllint --html --xpath "//a[contains(@href, 'ja-2')]/text()" - < <(echo -e "$DOWNLOAD_PAGE"))"
# 一時作業ディレクトリ作成
TEMP_DIR="$(mktemp -d)"
# 一時作業ディレクトリへ移動
cd "$TEMP_DIR"
# アーカイブの解凍とダウンロード
curl -s "$JM_URL/$ARCHIVE_NAME" | tar xzvf -
# 解凍ディレクトリへ移動
cd man-pages-ja-????????
# make実行
expect -c "
set timeout 180
spawn make config
expect \"Install directory\"; send \"\n\"
expect \"select\"; send \"\n\"
expect \"uname\"; send \"\n\"
expect \"group\"; send \"\n\"
while 1 {
expect {
\"All OK?\" { send \"y\n\" }
-nocase \"Y/n\" { send \"\n\" }
\"Which to install\" { send \"\n\" }
\"make install\" { exit 0 }
}
}
"
# install
sudo make install
# 後片付け
cd && rm -fr $TEMP_DIR
@tantan-tanuki
Copy link
Author

tantan-tanuki commented Jun 10, 2021

JM Projectのインストール自動化スクリプトです

UbuntuのDocker上で動作確認した際に以下のパッケージをインストールしたので
使用する際は依存関係として確認して下さい。

apt install curl libxml2-utils expect make perl sudo

使い方は

curl RawのURL | bash -

で実行されます
インストール実行時に
sudo make install
するのでsudoが使えるユーザにて実行して下さい

make configの値をすべて初期値でインストルーしています

@tantan-tanuki
Copy link
Author

インストールの実行動画あげました
動作確認

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment