@@ -225,4 +225,65 @@ else
225225 sudo service ssh restart
226226fi
227227}
228+
229+ module_options+=(
230+ [" adjust_motd,author" ]=" igorpecovnik"
231+ [" adjust_motd,ref_link" ]=" "
232+ [" adjust_motd,feature" ]=" Adjust motd"
233+ [" adjust_motd,desc" ]=" Adjust welcome screen (motd)"
234+ [" adjust_motd,example" ]=" "
235+ [" adjust_motd,status" ]=" Active"
236+ )
237+ #
238+ # @description Toggle message of the day items
239+ #
240+ function adjust_motd
241+ {
242+
243+ # show motd description
244+ motd_desc (){
245+ case $1 in
246+ clear)
247+ echo " Clear screen on login"
248+ ;;
249+ header)
250+ echo " Show header with logo"
251+ ;;
252+ sysinfo)
253+ echo " Display system information"
254+ ;;
255+ tips)
256+ echo " Show Armbian team tips"
257+ ;;
258+ commands)
259+ echo " Show recommended commands"
260+ ;;
261+ * )
262+ echo " No description"
263+ ;;
264+ esac
265+ }
266+
267+ # read status
268+ function motd_status
269+ {
270+ source /etc/default/armbian-motd
271+ if [[ $MOTD_DISABLE == * $1 * ]] ; then
272+ echo " OFF"
273+ else
274+ echo " ON"
275+ fi
276+ }
277+
278+ LIST=()
279+ for v in $( grep THIS_SCRIPT= /etc/update-motd.d/* | cut -d" =" -f2 | sed " s/\" //g" ) ; do
280+ LIST+=(" $v " " $( motd_desc $v ) " " $( motd_status $v ) " )
281+ done
282+
283+ INLIST=($( grep THIS_SCRIPT= /etc/update-motd.d/* | cut -d" =" -f2 | sed " s/\" //g" ) )
284+ CHOICES=$( whiptail --separate-output --nocancel --title " Adjust welcome screen" --checklist " " 11 50 5 " ${LIST[@]} " 3>&1 1>&2 2>&3 )
285+ INSERT=$( echo ${INLIST[@]} ${CHOICES[@]} | tr ' ' ' \n' | sort | uniq -u | tr ' \n' ' ' | sed ' s/ *$//' )
286+ # adjust motd config
287+ sed -i " s/^MOTD_DISABLE=.*/MOTD_DISABLE=\" $INSERT \" /g" /etc/default/armbian-motd
288+
228289}
0 commit comments