2017-07-17 29 views
0

uciドキュメントを元に戻す方法を述べている:UCI - すべてunstaged変更に

すべて「uci set」、「uci add」、「uci rename」と「uci delete」コマンドは、一時的な場所に上演し、一度にフラッシュに書かれています「uci commit」となります。

上記のようなコマンドをいくつか実行して、変更ファイルをuci commitに書き込むようにしてください。たとえば、次のような変更を行ったとします。

[email protected]:~# uci changes 
network.vlan15.ifname='eth1.15' 
network.vlan15.type='bridge' 
network.vlan15.proto='static' 
network.vlan15.netmask='255.255.255.0' 
network.vlan15.ipaddr='192.168.10.0' 

...私はそれらを続行してコミットしたくありません。ステージングされたすべての変更を元に戻す簡単な方法はありますか?

答えて

0

すべてのコミットされていない変更を元に戻すコマンドが見つかりませんでしたが、おそらくuci changesコマンドの出力をシェルスクリプトを使って解析して目的の結果を得ることができます。ここでは例のスクリプトは次のとおりです。

#!/bin/ash 

# uci-revert-all.sh 
# Revert all uncommitted uci changes 

# Iterate over changed settings 
# Each line has the form of an equation, e.g. parameter=value 
for setting in $(uci changes); do 

    # Extract parameter from equation 
    parameter=$(echo ${setting} | grep -o '^\(\w\|[._-]\)\+') 

    # Display a status message 
    echo "Reverting: ${parameter}" 

    # Revert the setting for the given parameter 
    uci revert "${parameter}" 
done 

シンプルな代替は例えば、uci revert <config>構文を使用することであるかもしれません。:

#!/bin/ash 

# uci-revert-all.sh 
# Revert all uncommitted uci changes 

for config in /etc/config/*; do 
    uci revert $(basename ${config}) 
done 

これらのアプローチの両方が稼働しているルータLEDE 4

上で私のためによく働きました
関連する問題