OpenWrt パッケージインストール

:warning:Japanese notation
![OpenWrt_icon.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3412833/00cb7976-bf5f-1c85-4544-6cbbc043b497.png)

# こちらに統合しました

::: note
### [オールインワンスクリプト](https://qiita.com/site_u/items/c6a50aa6dea965b5a774)

![selector.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3412833/809fa65b-d98d-16f6-50e2-72a0030c1a56.png)

<details><summary>対応スクリプト構成</summary>

- [package-config.sh](https://github.com/site-u2023/config-software/blob/main/package-config.sh)
  - [package-auto-g.sh](https://github.com/site-u2023/config-software/blob/main/package-auto-g.sh)
  - [package-manual-g.sh](https://github.com/site-u2023/config-software/blob/main/package-manual-g.sh)
- [install-config.sh](https://github.com/site-u2023/config-software/blob/main/install-config.sh)

---

</details>

:::

# はじめに
::: note
### 初心者対応構成
- スクリプトでの自動設定
- [UCI (ttyd)](https://openwrt.org/docs/guide-user/base-system/uci)、[Webコンソール (LuCi)](https://openwrt.org/docs/guide-user/luci/start)、[ファイラー (SFTP)](https://openwrt.org/docs/guide-user/services/nas/sftp.server)にて比較作業がおススメ:exclamation:
:::

::: note
### デバイスアクセス
#### [PowerShell](https://learn.microsoft.com/ja-jp/powershell/scripting/what-is-windows-powershell?view=powershell-7.4)の開始
- キー入力：**`Win`+`x` > `a` > `はい`**

<details><summary>パワーシェル7のインストールとショートカット作成</summary>

```powershell:powershell
$currentVersion = $PSVersionTable.PSVersion
Write-Host "Current PowerShell version: $($currentVersion)"
$installed = Get-Command pwsh -ErrorAction SilentlyContinue
if ($installed) {
    Write-Host "PowerShell 7 is already installed. Skipping installation."
} else {
    Write-Host "Installing PowerShell 7..."
    $url = "https://aka.ms/install-powershell.ps1"
    Invoke-WebRequest -Uri $url -OutFile "install-powershell.ps1"
    .\install-powershell.ps1
    Write-Host "PowerShell 7 installation completed."
}
$desktop = [Environment]::GetFolderPath("Desktop")
$shortcutPath = "$desktop\PowerShell 7 (Admin).lnk"
$targetPath = "C:\Program Files\PowerShell\7\pwsh.exe"
$arguments = "-Command Start-Process pwsh -Verb runAs"
$shell = New-Object -ComObject WScript.Shell
$shortcut = $shell.CreateShortcut($shortcutPath)
$shortcut.TargetPath = $targetPath
$shortcut.Arguments = $arguments
$shortcut.Description = "PowerShell 7 Administrator Shortcut"
$shortcut.WorkingDirectory = "$HOME"
$shortcut.IconLocation = $targetPath
$shortcut.Save()
Write-Host "PowerShell 7 administrator shortcut has been created."

```

---

</details>

#### [UCI（SSH）アクセス](https://openwrt.org/docs/guide-quick-start/sshadministration)
```powershell:powershell:初期設定用
ssh -o StrictHostKeyChecking=no -oHostKeyAlgorithms=+ssh-rsa root@192.168.1.1
```
- root@192.168.1.1's password:`初期値：パスワード無し`

<details><summary>OpenSSHのインストールが無い場合:exclamation:</summary>

- 機能の確認
※Windows 10 Fall Creators Update(1709)以降標準搭載
```powershell:powershell
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
```
- 機能のインストール
```powershell:powershell
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
```
---

:::

# インストール
:::note warn
インストールは目的で取捨選択

:::

:::note alert
### [アップデート](https://openwrt.org/docs/guide-user/additional-software/opkg)
- 最初必須
※**アップデート情報は再起動でリセット**
```sh
opkg update
UPDATE="1"

```
**非推奨**
`opkg list-upgradable | cut -f 1 -d ' ' | xargs opkg upgrade`
:::

:::note warn
### [デバイス再起動](スケジュール確認)
- 必要に応じて
```sh
reboot

```
:::

::: note
### 終了
- TeraTerm終了
```sh
exit

```
:::

:::note
### [Webコンソール（LuCi）](https://openwrt.org/docs/guide-user/luci/luci.essentials)
リリースビルド(RC含む)は不要
- [LuCiログイン](https://openwrt.org/jp/doc/howto/firstlogin#login_to_webui)
- [スナップショットには、デフォルトでは LuCI Web インターフェイスが含まれていません](https://openwrt.org/docs/guide-quick-start/developmentinstallation#snapshots_do_not_include_the_luci_web_interface_by_default)
```sh
#! /bin/sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
opkg install luci

```

### [LuCi日本語化](https://openwrt.org/packages/pkgdata/luci-i18n-base-lang)
```sh
#! /bin/sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
opkg install luci-i18n-base-ja 
opkg install luci-i18n-opkg-ja #v24から廃止
opkg install luci-i18n-firewall-ja #v24から自動

```

- ブラウザ:
**[192.168.1.1](http://192.168.1.1/cgi-bin/luci/)**
  - ユーザー名：`root`
  - パスワード：`設定したパスワード`

- QRコード: 
**192.168.1.1**
![QR192.168.1.1.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3412833/93eed9ce-7319-9332-99ba-74455b471cdd.png) 
:::

::: note
### [Dashboard](https://openwrt.org/docs/guide-user/luci/dashboard)

```sh
#! /bin/sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
opkg install luci-mod-dashboard
opkg install luci-i18n-dashboard-ja

```
:::


::: note
### [UCI（TTYD）](https://github.com/tsl0922/ttyd/blob/main/README.md)
WEBからSSHが使える
かなり便利
- [luci-app-ttyd](https://openwrt.org/packages/pkgdata/luci-app-ttyd)
- [クライアントオプション](https://github.com/tsl0922/ttyd/wiki/Client-Options)

```sh
#! /bin/sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
opkg install luci-app-ttyd
opkg install luci-i18n-ttyd-ja
uci set ttyd.@ttyd[0]=ttyd
uci set ttyd.@ttyd[0].interface='@lan'
# uci set ttyd.@ttyd[0].command='/bin/login -f root ' # 自動ログイン
uci set ttyd.@ttyd[0].ipv6='1'
uci set ttyd.@ttyd[0].debug='7'
uci set ttyd.@ttyd[0].url_arg='1'
uci commit ttyd
service ttyd restart
/etc/init.d/rpcd restart

```

TTYDログイン
- ブラウザ:
**[192.168.1.1:7681](http://192.168.1.1:7681/)**
  - ユーザー名：`root`
  - パスワード：`設定したパスワード`

- QRコード:
**192.168.1.1:7681**
![QR_062248.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3412833/e7929d2e-d9b0-b599-33cf-55413d584b19.png)

:::

:::note
### [ファイラー（SFTP）](https://qiita.com/site_u/items/a23d165201081817cb00#sftp-server)

```sh
#! /bin/sh
opkg update
opkg install openssh-sftp-server
```

- クライアント設定（WIndows）
  - 手動インストール
    - ダウンロード：[WinSCP](https://winscp.net/eng/download.php)

<details><summary>自動インストール</summary>

- キー入力：`Win`+`x` > `a` > `はい`
- 最新版ソフトウェアのインストール
```powershell:powershell:クライアントPC
$psVersion = $PSVersionTable.PSVersion.Major
$LINKS = Invoke-WebRequest "https://winscp.net/eng/download.php"
$LINKS_VERSION = $LINKS.Links | Where-Object {$_.href -like "*WinSCP-*-Setup.exe*"} | Select-Object -ExpandProperty href
$VERSION = ($LINKS_VERSION -split '/')[-2] -replace "WinSCP-([0-9]+\.[0-9]+\.[0-9]+).*", '$1'
Write-Host "Version to install: $VERSION"
$downloadUrl = "https://jaist.dl.sourceforge.net/project/winscp/WinSCP/$VERSION/WinSCP-$VERSION-Setup.exe?viasf=1"
Write-Host "Downloading from: $downloadUrl"
$ONAMAE = (whoami).Split('\')[1]
$destinationPath = "C:\Users\$ONAMAE\Downloads\WinSCP-$VERSION-Setup.exe"
Invoke-WebRequest -Uri $downloadUrl -OutFile $destinationPath
Write-Host "Installing WinSCP..."
Start-Process -FilePath $destinationPath -ArgumentList "/VERYSILENT /NORESTART" -Wait
Invoke-Expression "C:\Users\$ONAMAE\AppData\Local\Programs\WinSCP\WinSCP.exe"
```

---

</details>

- `警告` > `強制的に貼り付け`
- WinSCP設定
  - セッション
    - ホスト名：`192.168.1.1`
    - ユーザー名：`root`
    - パスワード：`設定したパスワード`
    - `ログイン`をクリック
:::

::: note
### [BusyBoxフルバージョン](https://en.wikipedia.org/wiki/BusyBox)
参考
- [OpenWrtバージョン](https://busybox.net/downloads/BusyBox.html)

```sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
opkg install coreutils

```

:::

:::note
### [CPU負荷分散](https://openwrt.org/docs/guide-user/services/irqbalance)
4コアシステム以上でより有効
※全体的なパフォーマンスが向上し、さらには消費電力が削減される可能性があります
※2core ターゲットでは、ベンチマークのみを除くと、パフォーマンスが低下する可能性があります

```sh
#! /bin/sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
opkg install irqbalance
uci set irqbalance.irqbalance=irqbalance
uci set irqbalance.irqbalance.enabled='1'
uci commit irqbalance
/etc/init.d/irqbalance start

```
:::

:::note
### [SQM(Smart Queue Management)](https://openwrt.org/docs/guide-user/network/traffic-shaping/sqm-details)
WAN側帯域コントローラー
[**★スナップショット必須**](https://openwrt.org/docs/guide-quick-start/developmentinstallation#optional_next_steps)
※リリースビルドも効果大
※要チューニング
```sh
#! /bin/sh
DOWNLOAD='0' #初期値
UPLOAD='0' #初期値
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
opkg install luci-app-sqm
opkg install luci-i18n-sqm-ja
. /lib/functions/network.sh
network_flush_cache
network_find_wan6 NET_IF6
network_get_physdev NET_L2D6 "${NET_IF6}"
uci set sqm.@queue[0].enabled='1'
uci set sqm.@queue[0].interface=${NET_L2D6}
uci set sqm.@queue[0].download=${DOWNLOAD}
uci set sqm.@queue[0].upload=${UPLOAD}
uci commit sqm
/etc/init.d/sqm start
/etc/init.d/sqm enable
# reboot

```
- [SQMチューニング](https://qiita.com/site_u/items/599124e2904d1374c2c9#sqm%E3%83%81%E3%83%A5%E3%83%BC%E3%83%8B%E3%83%B3%E3%82%B0)
:::

:::note
### [QoS(Network Traffic Control)](https://openwrt.org/docs/guide-user/network/traffic-shaping/packet.scheduler)

LAN側帯域コントローラー

```sh
#! /bin/sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
opkg install tc-full
opkg install luci-app-qos
opkg install luci-i18n-qos-ja
# reboot

```
:::

::: note
### [ネットワーク統計インターフェイス](https://openwrt.org/docs/guide-user/luci/luci_app_statistics)

```sh
#! /bin/sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
opkg install luci-i18n-statistics-ja
/etc/init.d/collectd enable
/etc/init.d/rpcd restart

```
:::

:::note
### [帯域幅モニター](https://github.com/jow-/nlbwmon?tab=readme-ov-file#nlbwmon---simple-conntrack-netlink-based-traffic-accounting)
```sh
#! /bin/sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
opkg install luci-i18n-nlbwmon-ja
# reboot

```
:::

:::note
### [WiFiスケジュール](https://github.com/newkit/luci-app-wifischedule#wifischedule)
WiFi制御
```sh
#! /bin/sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
opkg install wifischedule
opkg install luci-app-wifischedule
opkg install luci-i18n-wifischedule-ja

```
:::

:::note
### [追加テーマ](https://openwrt.org/docs/guide-user/luci/luci.themes)
```sh
#! /bin/sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
# OpnWrt
opkg install luci-theme-openwrt
# マテリアル
opkg install luci-theme-material
# モダン
opkg install luci-theme-openwrt-2020

```
:::

::: note
### LOLCAT
虹色で綺麗（なだけ）
```
#! /bin/sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
opkg install lolcat

```
サンプル
```sh
lolcat /etc/config/network

```
:::

::: note
### [Attended Sysupgrade](https://openwrt.org/docs/guide-user/installation/attended.sysupgrade)
自動アップグレード

![アップグレード.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3412833/1dd20246-91fe-510d-0c47-fe9eeac33d9b.png)

```sh
#! /bin/sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
opkg install attendedsysupgrade-common
opkg install luci-app-attendedsysupgrade
opkg install luci-i18n-attendedsysupgrade-ja
opkg install auc

```
:::

## [カスタム フィード](https://openwrt.org/docs/guide-developer/feeds#custom_feeds) [gSpotx2f](https://github.com/gSpotx2f)

::: note
###  現在のバージョン
※カスタムフィードに関し、配布元の構成変更が頻繁にある為、インストール出来ない事場合、適弁コマンドを修正下さい
また依頼あれば対応します
- ログ情報
- CPUステータス
- CPUパフォーマンス
- 温度センサー
- インターネット可用性確認
  - モデム再起動モジュール
  - 電子メール通知モジュール
```sh
{
#! /bin/sh

# バージョンチェック
OPENWRT_RELEASE=$(grep 'DISTRIB_RELEASE' /etc/openwrt_release | cut -d"'" -f2 | cut -c 1-2)
case "$OPENWRT_RELEASE" in
	19|20|21|22|23|24|SN)
		echo -e "The version of this device is \033[1;33m$OPENWRT_RELEASE\033[0;39m"
		echo -e "Version Check: \033[1;36mOK\033[0;39m"
		;;
	*)
		echo "Incompatible version."
		return 1
		;;
esac

# 一時ディレクトリ
mkdir -p /tmp/config-software

# パッケージリストをダウンロード
WGET_URL="https://github.com/gSpotx2f/packages-openwrt/tree/master/current"
WGET_OUT="/tmp/config-software/package_list"
wget --no-check-certificate -q -O "$WGET_OUT" "$WGET_URL"

# HTMLパース
PACKAGE_LIST=$(cat "$WGET_OUT" | sed -ne '/ <script type/,/<\/script>/p' | sed -e 's/<[^>]*>//g')

# パッケージ名を抽出する関数
extract_package() {
  local keyword="$1"
  local result
  result=$(echo ${PACKAGE_LIST} | awk -v keyword="$keyword" '{print substr($0,index($0,keyword),60)}' | awk '{sub(".ipk.*$",""); print $0;}')
  if [ -z "$result" ] || [ "$result" = "$keyword" ]; then
    echo "[ERROR] Not found: $keyword"
  else
    echo "$result"
  fi
}

# パッケージ名を抽出
LOG_VIEWER=$(extract_package "current/luci-app-log-viewer")
CPU_STATUS=$(extract_package "current/luci-app-cpu-status")
CPU_PERF=$(extract_package "current/luci-app-cpu-perf")
TEMP_STATUS=$(extract_package "current/luci-app-temp-status")
INTERNET_DETECTOR=$(extract_package "current/internet-detector_")
INTERNET_DETECTER_A=$(extract_package "current/luci-app-internet-detector")
INTERNET_DETECTOR_MODEM=$(extract_package "current/internet-detector-mod-modem")
INTERNET_DETECTOR_EMAIL=$(extract_package "current/internet-detector-mod-email")
DISKA_INFO=$(extract_package "current/luci-app-disks-info")

# 一時的なディレクトリをクリーンアップ
rm -rf /tmp/config-software

# パッケージ名の表示
echo "Current Version -------------------------"
echo "${LOG_VIEWER}.ipk"
echo "${CPU_STATUS}.ipk"
echo "${CPU_PERF}.ipk"
echo "${TEMP_STATUS}.ipk"
echo "${INTERNET_DETECTOR}.ipk"
echo "${INTERNET_DETECTER_A}.ipk"
echo "${INTERNET_DETECTOR_MODEM}.ipk"
echo "${INTERNET_DETECTOR_EMAIL}.ipk"
echo "${DISKA_INFO}.ipk"
echo "-----------------------------------------"
}
```
:::

::: note
### [ログ情報](https://github.com/gSpotx2f/luci-app-log?tab=readme-ov-file#luci-app-log-viewer)

```sh
#! /bin/sh
# custom feed (log viewer, cpu status, cpu perf, temp status, Internet detector, disk info)
OPENWRT_RELEAS=$(grep 'DISTRIB_RELEASE' /etc/openwrt_release | cut -d"'" -f2 | cut -c 1-2)
if [[ "${OPENWRT_RELEAS}" = "24" || "${OPENWRT_RELEAS}" = "23" || "${OPENWRT_RELEAS}" = "22" || "${OPENWRT_RELEAS}" = "21" ]]; then
   echo -e " The version of this device is \033[1;33m$OPENWRT_RELEAS\033[0;39m"
   echo -e " Version Check: \033[1;36mOK\033[0;39m"
 else
   read -p " Exit due to different versions"
 exit
fi
mkdir -p /tmp/config-software
wget --no-check-certificate -O /tmp/config-software/pacage_list https://github.com/gSpotx2f/packages-openwrt/raw/master/current/
PACAGE_LIST=`cat /tmp/config-software/pacage_list |sed -ne '/ <script type/,/<\/script>/p' |sed -e 's/<[^>]*>//g'`
LOG_VIEWER=`echo ${PACAGE_LIST} | awk '{print substr($0,index($0,"current/luci-app-log-viewer") ,60)}' | awk '{ sub(".ipk.*$",""); print $0; }'`
wget --no-check-certificate -O /tmp/luci-app-log-viewer_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/${LOG_VIEWER}.ipk
opkg install /tmp/luci-app-log-viewer_all.ipk
rm /tmp/luci-app-log-viewer_all.ipk

```
:::

:::note
### [CPUステータス](https://github.com/gSpotx2f/luci-app-cpu-status#luci-app-cpu-status)
CPUの使用率等リアルタイム表示
```sh
#! /bin/sh
# custom feed (log viewer, cpu status, cpu perf, temp status, Internet detector, disk info)
OPENWRT_RELEAS=$(grep 'DISTRIB_RELEASE' /etc/openwrt_release | cut -d"'" -f2 | cut -c 1-2)
if [[ "${OPENWRT_RELEAS}" = "24" || "${OPENWRT_RELEAS}" = "23" || "${OPENWRT_RELEAS}" = "22" || "${OPENWRT_RELEAS}" = "21" ]]; then
   echo -e " The version of this device is \033[1;33m$OPENWRT_RELEAS\033[0;39m"
   echo -e " Version Check: \033[1;36mOK\033[0;39m"
 else
   read -p " Exit due to different versions"
 exit
fi
mkdir -p /tmp/config-software
wget --no-check-certificate -O /tmp/config-software/pacage_list https://github.com/gSpotx2f/packages-openwrt/raw/master/current/
PACAGE_LIST=`cat /tmp/config-software/pacage_list |sed -ne '/ <script type/,/<\/script>/p' |sed -e 's/<[^>]*>//g'`
CPU_STATUS=`echo ${PACAGE_LIST} | awk '{ if (gsub(/luci-app-cpu-status-mini/, "HOGEHOGE")) print }' | awk '{print substr($0,index($0,"current/luci-app-cpu-status") ,60)}' | awk '{ sub(".ipk.*$",""); print $0; }'`
wget --no-check-certificate -O /tmp/luci-app-cpu-status_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/${CPU_STATUS}.ipk
opkg install /tmp/luci-app-cpu-status_all.ipk
rm /tmp/luci-app-cpu-status_all.ipk

```
:::
:::note
### [CPUパフォーマンス](https://github.com/gSpotx2f/luci-app-cpu-perf#luci-app-cpu-perf)
CPUのパフォーマンスコントローラー
```sh
#! /bin/sh
# custom feed (log viewer, cpu status, cpu perf, temp status, Internet detector, disk info)
OPENWRT_RELEAS=$(grep 'DISTRIB_RELEASE' /etc/openwrt_release | cut -d"'" -f2 | cut -c 1-2)
if [[ "${OPENWRT_RELEAS}" = "24" || "${OPENWRT_RELEAS}" = "23" || "${OPENWRT_RELEAS}" = "22" || "${OPENWRT_RELEAS}" = "21" ]]; then
   echo -e " The version of this device is \033[1;33m$OPENWRT_RELEAS\033[0;39m"
   echo -e " Version Check: \033[1;36mOK\033[0;39m"
 else
   read -p " Exit due to different versions"
 exit
fi
mkdir -p /tmp/config-software
wget --no-check-certificate -O /tmp/config-software/pacage_list https://github.com/gSpotx2f/packages-openwrt/raw/master/current/
PACAGE_LIST=`cat /tmp/config-software/pacage_list |sed -ne '/ <script type/,/<\/script>/p' |sed -e 's/<[^>]*>//g'`
CPU_PERF=`echo ${PACAGE_LIST} | awk '{print substr($0,index($0,"current/luci-app-cpu-perf") ,60)}' | awk '{ sub(".ipk.*$",""); print $0; }'`
wget --no-check-certificate -O /tmp/luci-app-cpu-perf_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/${CPU_PERF}.ipk
opkg install /tmp/luci-app-cpu-perf_all.ipk
rm /tmp/luci-app-cpu-perf_all.ipk

```
:::

:::note
### [温度センサー](https://github.com/gSpotx2f/luci-app-temp-status#luci-app-temp-status)
デバイス各センサーのリアルタイム表示
```sh
#! /bin/sh
# custom feed (log viewer, cpu status, cpu perf, temp status, Internet detector, disk info)
OPENWRT_RELEAS=$(grep 'DISTRIB_RELEASE' /etc/openwrt_release | cut -d"'" -f2 | cut -c 1-2)
if [[ "${OPENWRT_RELEAS}" = "24" || "${OPENWRT_RELEAS}" = "23" || "${OPENWRT_RELEAS}" = "22" || "${OPENWRT_RELEAS}" = "21" ]]; then
   echo -e " The version of this device is \033[1;33m$OPENWRT_RELEAS\033[0;39m"
   echo -e " Version Check: \033[1;36mOK\033[0;39m"
 else
   read -p " Exit due to different versions"
 exit
fi
mkdir -p /tmp/config-software
wget --no-check-certificate -O /tmp/config-software/pacage_list https://github.com/gSpotx2f/packages-openwrt/raw/master/current/
PACAGE_LIST=`cat /tmp/config-software/pacage_list |sed -ne '/ <script type/,/<\/script>/p' |sed -e 's/<[^>]*>//g'`
TEMP_STATUS=`echo ${PACAGE_LIST} | awk '{print substr($0,index($0,"current/luci-app-temp-status") ,60)}' | awk '{ sub(".ipk.*$",""); print $0; }'`
wget --no-check-certificate -O /tmp/luci-app-temp-status_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/${TEMP_STATUS}.ipk
opkg install /tmp/luci-app-temp-status_all.ipk
rm /tmp/luci-app-temp-status_all.ipk

```
:::

::: note
### [インターネット可用性確認](https://github.com/gSpotx2f/luci-app-internet-detector?tab=readme-ov-file#internet-detector-for-openwrt)
```sh
#! /bin/sh
# custom feed (log viewer, cpu status, cpu perf, temp status, Internet detector, disk info)
OPENWRT_RELEAS=$(grep 'DISTRIB_RELEASE' /etc/openwrt_release | cut -d"'" -f2 | cut -c 1-2)
if [[ "${OPENWRT_RELEAS}" = "24" || "${OPENWRT_RELEAS}" = "23" || "${OPENWRT_RELEAS}" = "22" || "${OPENWRT_RELEAS}" = "21" ]]; then
   echo -e " The version of this device is \033[1;33m$OPENWRT_RELEAS\033[0;39m"
   echo -e " Version Check: \033[1;36mOK\033[0;39m"
 else
   read -p " Exit due to different versions"
 exit
fi
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
mkdir -p /tmp/config-software
wget --no-check-certificate -O /tmp/config-software/pacage_list https://github.com/gSpotx2f/packages-openwrt/raw/master/current/
PACAGE_LIST=`cat /tmp/config-software/pacage_list |sed -ne '/ <script type/,/<\/script>/p' |sed -e 's/<[^>]*>//g'`
INTERNET_DETECTOR=`echo ${PACAGE_LIST} | awk '{print substr($0,index($0,"current/internet-detector_") ,60)}' | awk '{ sub(".ipk.*$",""); print $0; }'`
wget --no-check-certificate -O /tmp/internet-detector_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/${INTERNET_DETECTOR}.ipk
opkg install /tmp/internet-detector_all.ipk
rm /tmp/internet-detector_all.ipk
/tmp/init.d/internet-detector enable
INTERNET_DETECTER_A=`echo ${PACAGE_LIST} | awk '{print substr($0,index($0,"current/luci-app-internet-detector") ,60)}' | awk '{ sub(".ipk.*$",""); print $0; }'`
wget --no-check-certificate -O /tmp/luci-app-internet-detector_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/${INTERNET_DETECTER_A}.ipk
opkg install /tmp/luci-app-internet-detector_all.ipk
rm /tmp/luci-app-internet-detector_all.ipk

```

- [モデム再起動モジュール](https://github.com/gSpotx2f/luci-app-internet-detector?tab=readme-ov-file#modem-restart-module-internet-detector-mod-modem-restart)
```sh
#! /bin/sh
# custom feed (log viewer, cpu status, cpu perf, temp status, Internet detector, disk info)
OPENWRT_RELEAS=$(grep 'DISTRIB_RELEASE' /etc/openwrt_release | cut -d"'" -f2 | cut -c 1-2)
if [[ "${OPENWRT_RELEAS}" = "24" || "${OPENWRT_RELEAS}" = "23" || "${OPENWRT_RELEAS}" = "22" || "${OPENWRT_RELEAS}" = "21" ]]; then
   echo -e " The version of this device is \033[1;33m$OPENWRT_RELEAS\033[0;39m"
   echo -e " Version Check: \033[1;36mOK\033[0;39m"
 else
   read -p " Exit due to different versions"
 exit
fi
mkdir -p /tmp/config-software
wget --no-check-certificate -O /tmp/config-software/pacage_list https://github.com/gSpotx2f/packages-openwrt/raw/master/current/
PACAGE_LIST=`cat /tmp/config-software/pacage_list |sed -ne '/ <script type/,/<\/script>/p' |sed -e 's/<[^>]*>//g'`
INTERNET_DETECTOR_MODEM=`echo ${PACAGE_LIST} | awk '{print substr($0,index($0,"current/internet-detector-mod-modem") ,65)}' | awk '{ sub(".ipk.*$",""); print $0; }'`
wget --no-check-certificate -O /tmp/internet-detector-mod-modem-restart_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/${INTERNET_DETECTOR_MODEM}.ipk
opkg install /tmp/internet-detector-mod-modem-restart_all.ipk
rm /tmp/internet-detector-mod-modem-restart_all.ipk
/etc/init.d/internet-detector restart

```

- [電子メール通知モジュール](https://github.com/gSpotx2f/luci-app-internet-detector?tab=readme-ov-file#email-notification-module-internet-detector-mod-email)
```sh
#! /bin/sh
# custom feed (log viewer, cpu status, cpu perf, temp status, Internet detector, disk info)
OPENWRT_RELEAS=$(grep 'DISTRIB_RELEASE' /etc/openwrt_release | cut -d"'" -f2 | cut -c 1-2)
if [[ "${OPENWRT_RELEAS}" = "24" || "${OPENWRT_RELEAS}" = "23" || "${OPENWRT_RELEAS}" = "22" || "${OPENWRT_RELEAS}" = "21" ]]; then
   echo -e " The version of this device is \033[1;33m$OPENWRT_RELEAS\033[0;39m"
   echo -e " Version Check: \033[1;36mOK\033[0;39m"
 else
   read -p " Exit due to different versions"
 exit
fi
mkdir -p /tmp/config-software
wget --no-check-certificate -O /tmp/config-software/pacage_list https://github.com/gSpotx2f/packages-openwrt/raw/master/current/
PACAGE_LIST=`cat /tmp/config-software/pacage_list |sed -ne '/ <script type/,/<\/script>/p' |sed -e 's/<[^>]*>//g'`
INTERNET_DETECTOR_EMAIL=`echo ${PACAGE_LIST} | awk '{print substr($0,index($0,"current/internet-detector-mod-email") ,60)}' | awk '{ sub(".ipk.*$",""); print $0; }'`
wget --no-check-certificate -O /tmp/internet-detector-mod-email_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/${INTERNET_DETECTOR_EMAIL}.ipk
opkg install /tmp/internet-detector-mod-email_all.ipk
rm /tmp/internet-detector-mod-email_all.ipk
/etc/init.d/internet-detector restart

```
:::

# カスタムフィード ARGON
::: note
### [テーマ ARGON (テンプレート)](https://github.com/jerrykuku/luci-theme-argon?tab=readme-ov-file#a-brand-new-openwrt-luci-theme)
※Chrome ブラウザを強くお勧めします。このテーマではいくつかの新しい css3 機能が使用されていますが、現時点で最も互換性が高いのは Chrome のみです。

```sh
#! /bin/sh
ARGON_VERSION='2.3.1'
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
opkg install luci-compat
opkg install luci-lib-ipkg
wget --no-check-certificate -O /tmp/luci-theme-argon.ipk https://github.com/jerrykuku/luci-theme-argon/releases/download/v${ARGON_VERSION}/luci-theme-argon_${ARGON_VERSION}_all.ipk
opkg install /tmp/luci-theme-argon.ipk
rm /tmp/luci-theme-argon.ipk
/etc/init.d/rpcd restart

```
### [テーマ EDGE](https://github.com/kiddin9/luci-theme-edge?tab=readme-ov-file#luci-theme-edge)
```sh
#! /bin/sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
wget --no-check-certificate -O /tmp/luci-theme-edge.ipk https://github.com/noct99/blog.vpngame.com/raw/main/luci-theme-edge.ipk
opkg install /tmp/luci-theme-edge.ipk
rm /tmp/luci-theme-edge.ipk
/etc/init.d/rpcd restart

```
### [テーマ OPENTOMATO](https://github.com/Leo-Jo-My/luci-theme-opentomato?tab=readme-ov-file#luci-theme-opentomato)

```sh
#! /bin/sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
wget --no-check-certificate -O /tmp/luci-theme-opentomato.ipk https://github.com/noct99/blog.vpngame.com/raw/main/luci-theme-opentomato.ipk
opkg install /tmp/luci-theme-opentomato.ipk
rm /tmp/luci-theme-opentomato.ipk
/etc/init.d/rpcd restart

```
### [テーマ TANO](https://github.com/tano-systems/luci-theme-tano?tab=readme-ov-file#tano-systems-luci-theme)
```sh
#! /bin/sh
if [ -e ${UPDATE} ]; then
opkg update
UPDATE="1"
fi
wget --no-check-certificate -O /tmp/luci-theme-tano.ipk https://github.com/noct99/blog.vpngame.com/raw/main/luci-theme-tano.ipk
opkg install /tmp/luci-theme-tano.ipk
rm /tmp/luci-theme-tano.ipk
/etc/init.d/rpcd restart

```
:::

# パッケージ確認
:::note
### [インストール済みパッケージ確認](https://qiita.com/site_u/items/3236b10a480d4ca9495e#%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E6%B8%88%E3%81%BF%E3%83%91%E3%83%83%E3%82%B1%E3%83%BC%E3%82%B8%E7%A2%BA%E8%AA%8D)


:::

# 他デバイス設定
::: note
### [Wi-Fi](https://qiita.com/site_u/items/f42be7c0953187b9428a)
- [Dynamic frequency selection (DFS)](https://qiita.com/site_u/items/f42be7c0953187b9428a#dynamic-frequency-selection-dfs)

- [Guest Wi-Fi (QR code)](https://qiita.com/site_u/items/f42be7c0953187b9428a#guest-wi-fi-qr-code)

- [Target Wake Time (TWT)](https://qiita.com/site_u/items/f42be7c0953187b9428a#target-wake-time-twt)
:::

::: note
### [USBとディスク](https://qiita.com/site_u/items/597199882dc4d56c2385)

:::

::: note
### [ボタンとスイッチ](https://qiita.com/site_u/items/08764ce9473231482c17)

:::

:::note
### [SAMBA4 (WSDD2)](https://qiita.com/site_u/items/aa9164859a78cb4e3f8f)

:::

## WAN
::: note
### [選択型インターネット接続自動設定](https://qiita.com/site_u/items/4b8076cb8c9b05bc3f9a)
階層
※それぞれの階層に設定とその復元がある
※一度設定すると、そのバックアップを取るので、復元が出来る仕様
- OCNバーチャルコネクト
  - ニチバン対策のみ 
- V6プラス・IPv6オプション
  - ニチバン対策のみ 
- トランジックス
- クロスパス
- v6 コネクト
- ひかりone系・他PPPoE
- アクセスポイント
- 終了
:::

::: note
### [DNS暗号化及び広告ブロッカー](https://qiita.com/site_u/items/cf34ea1ee9a1971272bc)
- [AdGuard](https://qiita.com/site_u/items/cf34ea1ee9a1971272bc#adguard)
- [HTTPS-DNS-PROXY](https://qiita.com/site_u/items/cf34ea1ee9a1971272bc#https-dns-proxy)
- [STUBBY](https://qiita.com/site_u/items/cf34ea1ee9a1971272bc#stubby)
- [AdBlock](https://qiita.com/site_u/items/cf34ea1ee9a1971272bc#adblock)
:::

## 初期化

:::note alert
### [ファクトリーリセット(初期化)](https://openwrt.org/docs/guide-user/troubleshooting/failsafe_and_factory_reset#soft_factory_reset)
```bash
# 要注意
firstboot && reboot now

```

`This will erase all settings and remove any installed packages. Are you sure? [N/y]`

```bash:初期化:入力モード
y

```
### [デバイスリセットボタン](https://openwrt.org/docs/guide-user/troubleshooting/failsafe_and_factory_reset#reset_button)
デバイスのリセットボタンを5秒押し続ける
:::

# あとがき


# 参考資料（感謝:relaxed:）

[https://github.com/gSpotx2f](https://github.com/gSpotx2f)

[新しいOpenWrt LuCIテーマ](https://github.com/jerrykuku/luci-theme-argon?tab=readme-ov-file#a-brand-new-openwrt-luci-theme)