Skip to content
This repository was archived by the owner on Feb 25, 2023. It is now read-only.

Maintenance Menu on boot #317

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions armbian/base/build.conf
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@
# Make root filesystem read-only and overlay it with a temporary filesystem.
# All changes are lost on reboot, guaranteeing a safe state.
#BASE_OVERLAYROOT="true"

# Start Maintenance Menu if authorized maintenance token
# is found on USB flasdrive on boot
#BASE_MAINTENANCEMENU="false"
144 changes: 144 additions & 0 deletions armbian/base/config/dialog/.dialogrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#
# Run-time configuration file for dialog
#
# Automatically generated by "dialog --create-rc <file>"
#
#
# Types of values:
#
# Number - <number>
# String - "string"
# Boolean - <ON|OFF>
# Attribute - (foreground,background,highlight?)

# Set aspect-ration.
aspect = 0

# Set separator (for multiple widgets output).
separate_widget = ""

# Set tab-length (for textbox tab-conversion).
tab_len = 0

# Make tab-traversal for checklist, etc., include the list.
visit_items = OFF

# Shadow dialog boxes? This also turns on color.
use_shadow = OFF

# Turn color support ON or OFF
use_colors = ON

# Screen color
screen_color = (BLUE,BLACK,ON)

# Shadow color
shadow_color = (BLACK,BLACK,ON)

# Dialog box color
dialog_color = (BLACK,WHITE,OFF)

# Dialog box title color
title_color = (BLUE,WHITE,ON)

# Dialog box border color
border_color = (WHITE,WHITE,ON)

# Active button color
button_active_color = (WHITE,BLUE,ON)

# Inactive button color
button_inactive_color = dialog_color

# Active button key color
button_key_active_color = button_active_color

# Inactive button key color
button_key_inactive_color = (RED,WHITE,OFF)

# Active button label color
button_label_active_color = (YELLOW,BLUE,ON)

# Inactive button label color
button_label_inactive_color = (BLACK,WHITE,ON)

# Input box color
inputbox_color = dialog_color

# Input box border color
inputbox_border_color = dialog_color

# Search box color
searchbox_color = dialog_color

# Search box title color
searchbox_title_color = title_color

# Search box border color
searchbox_border_color = border_color

# File position indicator color
position_indicator_color = title_color

# Menu box color
menubox_color = dialog_color

# Menu box border color
menubox_border_color = border_color

# Item color
item_color = dialog_color

# Selected item color
item_selected_color = button_active_color

# Tag color
tag_color = title_color

# Selected tag color
tag_selected_color = button_label_active_color

# Tag key color
tag_key_color = button_key_inactive_color

# Selected tag key color
tag_key_selected_color = (RED,BLUE,ON)

# Check box color
check_color = dialog_color

# Selected check box color
check_selected_color = button_active_color

# Up arrow color
uarrow_color = (GREEN,WHITE,ON)

# Down arrow color
darrow_color = uarrow_color

# Item help-text color
itemhelp_color = (WHITE,BLACK,OFF)

# Active form text color
form_active_text_color = button_active_color

# Form text color
form_text_color = (WHITE,CYAN,ON)

# Readonly form item color
form_item_readonly_color = (CYAN,WHITE,ON)

# Dialog box gauge color
gauge_color = title_color

# Dialog box border2 color
border2_color = dialog_color

# Input box border2 color
inputbox_border2_color = dialog_color

# Search box border2 color
searchbox_border2_color = dialog_color

# Menu box border2 color
menubox_border2_color = dialog_color
1 change: 1 addition & 0 deletions armbian/base/config/signatures/maintenance-token-hashes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
657861a460401b2ec32183ea5b3b4d12ce80aea8c9be57c245a033dae776adf7 Shift factory token
4 changes: 2 additions & 2 deletions armbian/base/config/templates/bashrc-custom.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ #output: /home/base/.bashrc-custom }}
export LS_OPTIONS='--color=auto'
alias l='ls $LS_OPTIONS -l'
alias ll='ls $LS_OPTIONS -la'
alias l='ls $LS_OPTIONS -lh'
alias ll='ls $LS_OPTIONS -lah'

# Bitcoin
alias bcli='bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf -rpcuser=base -rpcpassword={{ bitcoind:rpcpassword }}'
Expand Down
20 changes: 17 additions & 3 deletions armbian/base/customize-armbian-rockpro64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ CONFIGURATION:
AUTOSETUP SSD: ${BASE_AUTOSETUP_SSD}
BITCOIN SERVICES ENABLED:
${BASE_ENABLE_BITCOIN_SERVICES}
MAINTENANCE MENU: ${BASE_MAINTENANCEMENU}

================================================================================
BUILD OPTIONS:
Expand Down Expand Up @@ -179,6 +180,7 @@ BASE_DASHBOARD_HDMI_ENABLED="false"
BASE_HDMI_BUILD="false"
BASE_MINIMAL="true"
BASE_OVERLAYROOT="true"
BASE_MAINTENANCEMENU="false" # TODO(Stadicus): set "true" by default after further review

# Overwrite defaults if BASE_PRODUCTION_IMAGE set to "false"
if [[ ${BASE_PRODUCTION_IMAGE} == "false" ]]; then
Expand Down Expand Up @@ -291,11 +293,11 @@ apt-get -y --fix-broken install
## remove unnecessary packages (only when building image, not ondevice)
if [[ "${BASE_BUILDMODE}" != "ondevice" ]] && [[ "${BASE_MINIMAL}" == "true" ]]; then
pkgToRemove="git libllvmkk build-essential libtool autotools-dev automake pkg-config gcc gcc-6 libgcc-6-dev
alsa-utils* autoconf* bc* bison* bridge-utils* btrfs-tools* bwm-ng* cmake* command-not-found* console-setup*
console-setup-linux* crda* dconf-gsettings-backend* dconf-service* debconf-utils* device-tree-compiler* dialog* dirmngr*
alsa-utils* autoconf* bc* bison* bridge-utils* btrfs-tools* bwm-ng* cmake* command-not-found*
crda* dconf-gsettings-backend* dconf-service* debconf-utils* device-tree-compiler* dirmngr*
dnsutils* dosfstools* ethtool* evtest* f2fs-tools* f3* fancontrol* figlet* fio* flex* fping* glib-networking* glib-networking-services*
gnome-icon-theme* gnupg2* gsettings-desktop-schemas* gtk-update-icon-cache* haveged* hdparm* hostapd* html2text* ifenslave* iotop*
iperf3* iputils-arping* iw* kbd* libatk1.0-0* libcroco3* libcups2* libdbus-glib-1-2* libgdk-pixbuf2.0-0* libglade2-0* libnl-3-dev*
iperf3* iputils-arping* iw* libatk1.0-0* libcroco3* libcups2* libdbus-glib-1-2* libgdk-pixbuf2.0-0* libglade2-0* libnl-3-dev*
libpango-1.0-0* libpolkit-agent-1-0* libpolkit-backend-1-0* libpolkit-gobject-1-0* libpython-stdlib* libpython2.7-stdlib* libssl-dev*
man-db* ncurses-term* psmisc* pv* python-avahi* python-pip* python2.7-minimal screen* shared-mime-info*
unattended-upgrades* unicode-data* unzip* vim* wireless-regdb* wireless-tools* wpasupplicant* "
Expand Down Expand Up @@ -348,6 +350,9 @@ mkdir -p /data_source/
ln -sfn /data_source /data
touch /data/.datadir_set_up

# import presync authorization token, will be deleted after presync or on initial setup
cp /opt/shift/config/signatures/maintenance-token-hashes /data_source

## install Redis
apt-get install -y --no-install-recommends redis
mkdir -p /data/redis/
Expand Down Expand Up @@ -446,6 +451,8 @@ ln -sfn /mnt/ssd/system/journal /var/log/journal
mkdir -p /etc/mender
generateConfig mender.conf.template # --> /etc/mender/mender.conf



## configure swap file (disable Armbian zram, configure custom swapfile on ssd)
if [[ -f /etc/default/armbian-zram-config ]] || [[ "${BASE_BUILDMODE}" != "ondevice" ]]; then
sed -i '/ENABLED=/Ic\ENABLED=false' /etc/default/armbian-zram-config
Expand All @@ -464,6 +471,13 @@ systemctl enable startup-after-redis.service
importFile /etc/systemd/system/update-checks.service
systemctl enable update-checks.service

## maintenance menu
importFile /etc/systemd/system/startup-maintenance.service

if [[ "${BASE_MAINTENANCEMENU}" == "true" ]]; then
systemctl enable startup-maintenance.service
fi

## disable ssh login messages
echo "MOTD_DISABLE='header tips updates armbian-config'" >> /etc/default/armbian-motd

Expand Down
14 changes: 14 additions & 0 deletions armbian/base/rootfs/etc/systemd/system/startup-maintenance.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=BitBoxBase: Maintenance menu
[email protected]

[Service]
Type=oneshot
ExecStart=/opt/shift/scripts/systemd-startup-maintenance.sh
StandardInput=tty
TTYPath=/dev/tty2
TTYReset=yes
TTYVHangup=yes

[Install]
WantedBy=default.target
Loading