add 'current' alias
showing installed state
This commit is contained in:
12
install.py
12
install.py
@ -183,7 +183,7 @@ def write_when_new(filename, content, ignore_reduction=False):
|
|||||||
print('>>>')
|
print('>>>')
|
||||||
print('\n'.join(old[-bottom_lines:-1]))
|
print('\n'.join(old[-bottom_lines:-1]))
|
||||||
print("===")
|
print("===")
|
||||||
return True
|
return content
|
||||||
|
|
||||||
|
|
||||||
def create_if(name, cfg, mac, dhcp_server_cfg):
|
def create_if(name, cfg, mac, dhcp_server_cfg):
|
||||||
@ -447,7 +447,13 @@ def handle_config():
|
|||||||
if action == 'restart':
|
if action == 'restart':
|
||||||
unix_cmd('systemctl restart %s' % service)
|
unix_cmd('systemctl restart %s' % service)
|
||||||
unix_cmd('systemctl enable %s' % service)
|
unix_cmd('systemctl enable %s' % service)
|
||||||
return True
|
result = [f'config file:\n {cfgfile}']
|
||||||
|
for section in parser.sections():
|
||||||
|
result.append(section)
|
||||||
|
for key, value in parser.items(section):
|
||||||
|
result.append(f' {key} = {value}')
|
||||||
|
result.append('')
|
||||||
|
return '\n'.join(result)
|
||||||
|
|
||||||
|
|
||||||
doit = False
|
doit = False
|
||||||
@ -465,5 +471,7 @@ elif show.dirty and more_info == 'NONE':
|
|||||||
if answer.lower().startswith('y'):
|
if answer.lower().startswith('y'):
|
||||||
handle_config()
|
handle_config()
|
||||||
walk(Do())
|
walk(Do())
|
||||||
|
with open('/root/aputools/current', 'w') as f:
|
||||||
|
f.write(result)
|
||||||
else:
|
else:
|
||||||
print('nothing to do')
|
print('nothing to do')
|
||||||
|
11
servercfg/linseapu6_5fa5cc.cfg
Normal file
11
servercfg/linseapu6_5fa5cc.cfg
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[NETWORK]
|
||||||
|
; please refer to README.md for help
|
||||||
|
enp1s0=192.168.127.254
|
||||||
|
enp2s0=192.168.12.2
|
||||||
|
enp3s0=192.168.13.3
|
||||||
|
enp4s0=wan,192.168.1.0/24
|
||||||
|
|
||||||
|
[ROUTER]
|
||||||
|
; please refer to README.md for help
|
||||||
|
3001=192.168.127.254:3001
|
||||||
|
8080=192.168.127.254:80
|
@ -6,4 +6,6 @@ function service_status () {
|
|||||||
echo ${name} $(systemctl is-active ${name}) $(systemctl is-enabled ${name}); \
|
echo ${name} $(systemctl is-active ${name}) $(systemctl is-enabled ${name}); \
|
||||||
done | column -t | grep --color=always '\(disabled\|inactive\|$\)'
|
done | column -t | grep --color=always '\(disabled\|inactive\|$\)'
|
||||||
}
|
}
|
||||||
|
alias current='cat /root/aputools/current'
|
||||||
service_status router frappy
|
service_status router frappy
|
||||||
|
echo "> current # show currently installed state"
|
||||||
|
Reference in New Issue
Block a user