File tree Expand file tree Collapse file tree 5 files changed +56
-0
lines changed
image_config/cli_sessions Expand file tree Collapse file tree 5 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -412,6 +412,13 @@ echo "ntpsec.service" | sudo tee -a $GENERATED_SERVICE_FILE
412
412
# Copy DNS templates
413
413
sudo cp $BUILD_TEMPLATES /dns.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES /
414
414
415
+ # Copy cli-sessions config files
416
+ sudo cp $IMAGE_CONFIGS /cli_sessions/tmout-env.sh.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES /
417
+ sudo cp $IMAGE_CONFIGS /cli_sessions/sysrq-sysctl.conf.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES /
418
+ sudo cp $IMAGE_CONFIGS /cli_sessions/serial-config.sh $FILESYSTEM_ROOT /usr/bin/
419
+ sudo cp $IMAGE_CONFIGS /cli_sessions/serial-config.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
420
+ echo " serial-config.service" | sudo tee -a $GENERATED_SERVICE_FILE
421
+
415
422
# Copy warmboot-finalizer files
416
423
sudo LANG=C cp $IMAGE_CONFIGS /warmboot-finalizer/finalize-warmboot.sh $FILESYSTEM_ROOT /usr/local/bin/finalize-warmboot.sh
417
424
sudo LANG=C cp $IMAGE_CONFIGS /warmboot-finalizer/warmboot-finalizer.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
Original file line number Diff line number Diff line change
1
+ [Unit]
2
+ Description =Update serial console config
3
+ Requires =sonic.target
4
+ After =sonic.target
5
+ Before =getty-pre.target
6
+ StartLimitIntervalSec =0
7
+
8
+ [Service]
9
+ Type =oneshot
10
+ ExecStart =/usr/bin/serial-config.sh
11
+
12
+ [Install]
13
+ WantedBy =sonic.target
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # generate conf file for sysrq capabilities.
4
+ sonic-cfggen -d -t /usr/share/sonic/templates/sysrq-sysctl.conf.j2 > /etc/sysctl.d/95-sysrq-sysctl.conf
5
+
6
+ SYSRQ_CONF=0
7
+ # update sysrq for current boot.
8
+ sysrq_conf=` sonic-db-cli CONFIG_DB HGET " SERIAL_CONSOLE|POLICIES" sysrq_capabilities`
9
+ if [ ${sysrq_conf} = " enabled" ]; then
10
+ SYSRQ_CONF=1
11
+ fi
12
+ sudo echo $SYSRQ_CONF > /proc/sys/kernel/sysrq
13
+
14
+ # generate env file for profile.d to set auto-logout timeout for serial consoles.
15
+ sonic-cfggen -d -t /usr/share/sonic/templates/tmout-env.sh.j2 > /etc/profile.d/tmout-env.sh
Original file line number Diff line number Diff line change
1
+ ###############################################################################
2
+ # This file was AUTOMATICALLY GENERATED. DO NOT MODIFY.
3
+ # Controlled by cli-sesisons.sh
4
+ ###############################################################################
5
+ {% set sysrq = 0 %}
6
+ {% set serial_policies = (SERIAL_CONSOLE | d ({})).get ('POLICIES' , {}) -%}
7
+ {% if serial_policies .sysrq_capabilities == 'enabled' %}
8
+ {% set sysrq = 1 %}
9
+ {% endif %}
10
+ kernel.sysrq={{ sysrq }}
Original file line number Diff line number Diff line change
1
+ {# Default timeout (15 min) #}
2
+ {% set inactivity_timeout_sec = 900 %}
3
+
4
+ {% set serial_pol = (SERIAL_CONSOLE | d ({})).get ('POLICIES' , {}) -%}
5
+ {% if serial_pol and serial_pol .inactivity_timeout and serial_pol .inactivity_timeout | int >= 0 %}
6
+ {% set inactivity_timeout_sec = serial_pol .inactivity_timeout | int * 60 %}
7
+ {% endif %}
8
+
9
+ {# apply only for serial tty #}
10
+ tty | grep -q tty && \
11
+ export TMOUT={{ inactivity_timeout_sec }}
You can’t perform that action at this time.
0 commit comments