Skip to content

Instantly share code, notes, and snippets.

@tantan-tanuki
Created June 10, 2021 08:40
Show Gist options
  • 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

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

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