Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Config
Commits
2992430d
Commit
2992430d
authored
Apr 09, 2018
by
Igor Pecovnik
Browse files
Add checking if package manager is running, introducing new file for functins ... rfc next time
parent
8590c46d
Changes
4
Hide whitespace changes
Inline
Side-by-side
debian-config
View file @
2992430d
...
...
@@ -33,6 +33,7 @@ fi
# load functions
[[
-f
/usr/lib/armbian-config/jobs.sh
]]
&&
source
/usr/lib/armbian-config/jobs.sh
||
source
${
BASH_SOURCE
}
-jobs
[[
-f
/usr/lib/armbian-config/submenu.sh
]]
&&
source
/usr/lib/armbian-config/submenu.sh
||
source
${
BASH_SOURCE
}
-submenu
[[
-f
/usr/lib/armbian-config/functions.sh
]]
&&
source
/usr/lib/armbian-config/functions.sh
||
source
${
BASH_SOURCE
}
-functions
...
...
@@ -60,7 +61,7 @@ do
DIALOG_ESC
=
255
TITLELENGHT
=
${#
MENUTITLE
}
[[
"
$TITLELENGHT
"
-lt
5
0
]]
&&
TITLELENGHT
=
"
5
0"
[[
"
$TITLELENGHT
"
-lt
6
0
]]
&&
TITLELENGHT
=
"
6
0"
exec
3>&1
selection
=
$(
dialog
--colors
--backtitle
"
$BACKTITLE
"
--title
" armbian-config "
--clear
\
...
...
debian-config-functions
0 → 100644
View file @
2992430d
#!/bin/bash
#
# Copyright (c) 2017 Igor Pecovnik, igor.pecovnik@gma**.com
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
#-----------------------------------------------------------------------------------------------------------------------------------------#
# gather info about the board and start with loading menu
#
DIALOG_CANCEL
=
1
DIALOG_ESC
=
255
[[
-f
/etc/armbian-release
]]
&&
source
/etc/armbian-release
&&
ARMBIAN
=
"Armbian
$VERSION
$IMAGE_TYPE
"
;
DISTRO
=
$(
lsb_release
-is
)
DISTROID
=
$(
lsb_release
-sc
)
KERNELID
=
$(
uname
-r
)
[[
-z
"
${
ARMBIAN
//
}
"
]]
&&
ARMBIAN
=
"
$DISTRO
$DISTROID
"
BACKTITLE
=
"Configuration utility,
$ARMBIAN
, https://www.armbian.com"
TITLE
=
"
$BOARD_NAME
"
DEFAULT_ADAPTER
=
$(
ip
-4
route
ls
|
grep
default |
grep
-Po
'(?<=dev )(\S+)'
)
[[
-z
"
${
DEFAULT_ADAPTER
//
}
"
]]
&&
DEFAULT_ADAPTER
=
"lo"
OVERLAYDIR
=
"/boot/dtb/overlay"
;
[[
"
$LINUXFAMILY
"
==
"sunxi64"
]]
&&
OVERLAYDIR
=
"/boot/dtb/allwinner/overlay"
;
dialog
--backtitle
"
$BACKTITLE
"
--title
"Please wait"
--infobox
"
\n
Loading Armbian configuration utility ... "
5 45
sleep
1
#-----------------------------------------------------------------------------------------------------------------------------------------#
# check if package manager is doing something
#
function
is_package_manager_running
()
{
fuser
-s
/var/lib/dpkg/lock
if
[[
$?
=
0
]]
;
then
# 0 = true
dialog
--colors
--title
"
\Z
1Error
\Z
0 "
--backtitle
"
$BACKTITLE
"
--no-collapse
--msgbox
\
"
\n\Z
1Package manager is running in the background.
\n\n
Can't proceed. Try again later."
9 53
return
0
else
# 1 = false
return
1
fi
}
debian-config-jobs
View file @
2992430d
...
...
@@ -27,29 +27,37 @@ function jobs ()
# Remove BT
#
"BT remove"
)
debconf-apt-progress
--
apt-get
-y
remove bluetooth bluez bluez-tools
check_if_installed xserver-xorg
&&
debconf-apt-progress
--
apt-get
-y
remove pulseaudio-module-bluetooth blueman
debconf-apt-progress
--
apt
-y
-qq
autoremove
if
!
is_package_manager_running
;
then
debconf-apt-progress
--
apt-get
-y
remove bluetooth bluez bluez-tools
check_if_installed xserver-xorg
&&
debconf-apt-progress
--
apt-get
-y
remove pulseaudio-module-bluetooth blueman
debconf-apt-progress
--
apt
-y
-qq
autoremove
fi
;;
# Enabling BT
#
"BT install"
)
debconf-apt-progress
--
apt-get
-y
install
bluetooth bluez bluez-tools
check_if_installed xserver-xorg
&&
debconf-apt-progress
--
apt-get
-y
--no-install-recommends
install
pulseaudio-module-bluetooth blueman
if
!
is_package_manager_running
;
then
debconf-apt-progress
--
apt-get
-y
install
bluetooth bluez bluez-tools
check_if_installed xserver-xorg
&&
debconf-apt-progress
--
apt-get
-y
--no-install-recommends
install
pulseaudio-module-bluetooth blueman
fi
;;
# Removing IR
#
"Remove IR"
)
debconf-apt-progress
--
apt-get
-y
remove lirc
debconf-apt-progress
--
apt
-y
-qq
autoremove
if
!
is_package_manager_running
;
then
debconf-apt-progress
--
apt-get
-y
remove lirc
debconf-apt-progress
--
apt
-y
-qq
autoremove
fi
;;
# Enabling IR
#
"IR"
)
debconf-apt-progress
--
apt-get
-y
--no-install-recommends
install
lirc
if
!
is_package_manager_running
;
then
debconf-apt-progress
--
apt-get
-y
--no-install-recommends
install
lirc
fi
;;
...
...
@@ -129,12 +137,14 @@ function jobs ()
# Install kernel headers
#
"Headers"
)
TARGET_BRANCH
=
$BRANCH
exceptions
"
$BRANCH
"
if
[[
-n
$(
dpkg
-l
|
grep
linux-headers
)
]]
;
then
debconf-apt-progress
--
apt-get
-y
remove linux-headers
${
TARGET_BRANCH
}
-
${
TARGET_FAMILY
}
else
debconf-apt-progress
--
apt-get
-y
install
linux-headers
${
TARGET_BRANCH
}
-
${
TARGET_FAMILY
}
if
!
is_package_manager_running
;
then
TARGET_BRANCH
=
$BRANCH
exceptions
"
$BRANCH
"
if
[[
-n
$(
dpkg
-l
|
grep
linux-headers
)
]]
;
then
debconf-apt-progress
--
apt-get
-y
remove linux-headers
${
TARGET_BRANCH
}
-
${
TARGET_FAMILY
}
else
debconf-apt-progress
--
apt-get
-y
install
linux-headers
${
TARGET_BRANCH
}
-
${
TARGET_FAMILY
}
fi
fi
;;
...
...
@@ -262,6 +272,7 @@ function jobs ()
# Create WiFi access point
#
"Hotspot"
)
if
!
is_package_manager_running
;
then
systemctl daemon-reload
CURRENT_UUID
=
$(
LC_ALL
=
C nmcli
-f
DEVICE,TYPE,STATE device status |
grep
-w
" wifi "
|
grep
-w
" disconnected"
)
if
[[
-n
$(
service hostapd status |
grep
-w
active |
grep
-w
running
)
]]
;
then
...
...
@@ -480,6 +491,7 @@ function jobs ()
reload-nety
"reload"
fi
fi
fi
;;
...
...
@@ -654,19 +666,21 @@ function jobs ()
# Firmware update
#
"Firmware"
)
clear
exec
3>&1
monitor
=
$(
dialog
--print-maxsize
2>&1 1>&3
)
exec
3>&-
mon_x
=
$(
echo
$monitor
|
awk
'{print $2}'
|
sed
's/,//'
)
;
mon_x
=
$((
$mon_x
/
2
))
mon_y
=
$(
echo
$monitor
|
awk
'{print $3}'
|
sed
's/,//'
)
;
dialog
--title
" Update "
--backtitle
"
$BACKTITLE
"
--no-label
"Cancel"
--yesno
"
\n
Do you want to update board firmware?"
7 41
if
[[
$?
=
0
]]
;
then
debconf-apt-progress
--
apt-get update
debconf-apt-progress
--
apt-get
-o
Dpkg::Options::
=
"--force-confdef"
-o
Dpkg::Options::
=
"--force-confold"
-y
upgrade
dialog
--title
" Firmware update "
--colors
--no-label
"Cancel"
--backtitle
"
$BACKTITLE
"
--yesno
\
"
\n
Firmware has been updated. Reboot? "
7 39
if
[[
$?
=
0
]]
;
then
reboot
;
fi
if
!
is_package_manager_running
;
then
clear
exec
3>&1
monitor
=
$(
dialog
--print-maxsize
2>&1 1>&3
)
exec
3>&-
mon_x
=
$(
echo
$monitor
|
awk
'{print $2}'
|
sed
's/,//'
)
;
mon_x
=
$((
$mon_x
/
2
))
mon_y
=
$(
echo
$monitor
|
awk
'{print $3}'
|
sed
's/,//'
)
;
dialog
--title
" Update "
--backtitle
"
$BACKTITLE
"
--no-label
"Cancel"
--yesno
"
\n
Do you want to update board firmware?"
7 41
if
[[
$?
=
0
]]
;
then
debconf-apt-progress
--
apt-get update
debconf-apt-progress
--
apt-get
-o
Dpkg::Options::
=
"--force-confdef"
-o
Dpkg::Options::
=
"--force-confold"
-y
upgrade
dialog
--title
" Firmware update "
--colors
--no-label
"Cancel"
--backtitle
"
$BACKTITLE
"
--yesno
\
"
\n
Firmware has been updated. Reboot? "
7 39
if
[[
$?
=
0
]]
;
then
reboot
;
fi
fi
fi
;;
...
...
@@ -681,6 +695,7 @@ function jobs ()
# Freeze and unfreeze kernel and board support packages
#
"Freeze"
|
"Defreeze"
)
if
!
is_package_manager_running
;
then
dialog
--title
" Updating "
--backtitle
"
$BACKTITLE
"
--yes-label
"
$1
"
--no-label
"Cancel"
--yesno
\
"
\n
Do you want to
${
1
,,
}
kernel updates?"
7 44
if
[[
$?
=
0
]]
;
then
...
...
@@ -695,6 +710,7 @@ function jobs ()
[[
$1
==
"Freeze"
]]
&&
local command
=
"hold"
for
word
in
$PACKAGE_LIST
;
do
apt-mark
$command
$word
;
done
| dialog
--backtitle
"
$BACKTITLE
"
--title
"Packages
${
1
,,
}
"
--progressbox
$((${#
words
[@]
}
+
2
))
64
fi
fi
;;
...
...
@@ -708,20 +724,22 @@ function jobs ()
[[
$exitstatus
=
0
]]
&&
service nodm stop
>
/dev/null 2>&1
&&
service lightdm stop
>
/dev/null 2>&1
&&
\
sed
-i
"s/^NODM_ENABLED=.*/NODM_ENABLED=false/"
/etc/default/nodm
else
if
[[
-n
$DESKTOP_INSTALLED
]]
;
then
dialog
--colors
--title
" Choose a display manager "
--backtitle
"
$BACKTITLE
"
--help-button
--help-label
"Cancel"
--yes-label
"Lightdm"
\
--no-label
"Nodm"
--yesno
"
\n\Z
1Lightdm
\Z
0 = full featured login display manager
\n\Z
1Nodm
\Z
0 = autoloading into desktop"
8 70
exitstatus
=
$?
;
[[
$exitstatus
=
0
]]
&&
[[
-f
/etc/X11/default-display-manager
]]
&&
\
echo
"/usr/sbin/lightdm"
>
/etc/X11/default-display-manager
&&
\
debconf-apt-progress
--
apt-get
-o
Dpkg::Options::
=
"--force-confold"
-y
--no-install-recommends
install
lightdm-gtk-greeter lightdm
\
&&
systemctl start lightdm.service
[[
$exitstatus
=
1
]]
&&
[[
-f
/etc/X11/default-display-manager
]]
&&
\
debconf-apt-progress
--
apt-get
-o
Dpkg::Options::
=
"--force-confold"
-y
--no-install-recommends
install
nodm
\
&&
echo
"/usr/sbin/nodm"
>
/etc/X11/default-display-manager
&&
\
sed
-i
"s/^NODM_ENABLED=.*/NODM_ENABLED=true/"
/etc/default/nodm
&&
service nodm start
else
configure_desktop
if
!
is_package_manager_running
;
then
if
[[
-n
$DESKTOP_INSTALLED
]]
;
then
dialog
--colors
--title
" Choose a display manager "
--backtitle
"
$BACKTITLE
"
--help-button
--help-label
"Cancel"
--yes-label
"Lightdm"
\
--no-label
"Nodm"
--yesno
"
\n\Z
1Lightdm
\Z
0 = full featured login display manager
\n\Z
1Nodm
\Z
0 = autoloading into desktop"
8 70
exitstatus
=
$?
;
[[
$exitstatus
=
0
]]
&&
[[
-f
/etc/X11/default-display-manager
]]
&&
\
echo
"/usr/sbin/lightdm"
>
/etc/X11/default-display-manager
&&
\
debconf-apt-progress
--
apt-get
-o
Dpkg::Options::
=
"--force-confold"
-y
--no-install-recommends
install
lightdm-gtk-greeter lightdm
\
&&
systemctl start lightdm.service
[[
$exitstatus
=
1
]]
&&
[[
-f
/etc/X11/default-display-manager
]]
&&
\
debconf-apt-progress
--
apt-get
-o
Dpkg::Options::
=
"--force-confold"
-y
--no-install-recommends
install
nodm
\
&&
echo
"/usr/sbin/nodm"
>
/etc/X11/default-display-manager
&&
\
sed
-i
"s/^NODM_ENABLED=.*/NODM_ENABLED=true/"
/etc/default/nodm
&&
service nodm start
else
configure_desktop
fi
fi
fi
;;
...
...
@@ -737,12 +755,14 @@ function jobs ()
"Lightdm"
)
[[
-f
/etc/X11/default-display-manager
]]
&&
echo
"/usr/sbin/lightdm"
>
/etc/X11/default-display-manager
debconf-apt-progress
--
apt-get
-o
Dpkg::Options::
=
"--force-confold"
-y
--no-install-recommends
install
lightdm-gtk-greeter lightdm
service nodm stop
&&
sed
-i
"s/^NODM_ENABLED=.*/NODM_ENABLED=false/"
/etc/default/nodm
systemctl
enable
lightdm.service
>
/dev/null 2>&1
systemctl start lightdm.service
>
/dev/null 2>&1
DISPLAY_MANAGER
=
"lightdm"
if
!
is_package_manager_running
;
then
[[
-f
/etc/X11/default-display-manager
]]
&&
echo
"/usr/sbin/lightdm"
>
/etc/X11/default-display-manager
debconf-apt-progress
--
apt-get
-o
Dpkg::Options::
=
"--force-confold"
-y
--no-install-recommends
install
lightdm-gtk-greeter lightdm
service nodm stop
&&
sed
-i
"s/^NODM_ENABLED=.*/NODM_ENABLED=false/"
/etc/default/nodm
systemctl
enable
lightdm.service
>
/dev/null 2>&1
systemctl start lightdm.service
>
/dev/null 2>&1
DISPLAY_MANAGER
=
"lightdm"
fi
;;
...
...
@@ -751,11 +771,14 @@ function jobs ()
systemctl stop xrdp.service
>
/dev/null 2>&1
systemctl disable xrdp.service
>
/dev/null 2>&1
else
debconf-apt-progress
--
apt-get
-y
install
xrdp vnc4server
systemctl
enable
xrdp.service
>
/dev/null 2>&1
systemctl start xrdp.service
>
/dev/null 2>&1
dialog
--title
"Info"
--backtitle
"
$BACKTITLE
"
--nocancel
--no-collapse
--pause
\
"
\n
Remote graphical login to
$BOARD_NAME
using Microsoft Remote Desktop Protocol (RDP) is enabled."
11 57 3
if
!
is_package_manager_running
;
then
debconf-apt-progress
--
apt-get
-y
install
xrdp vnc4server
systemctl
enable
xrdp.service
>
/dev/null 2>&1
systemctl start xrdp.service
>
/dev/null 2>&1
dialog
--title
"Info"
--backtitle
"
$BACKTITLE
"
--nocancel
--no-collapse
--pause
\
"
\n
Remote graphical login to
$BOARD_NAME
using Microsoft Remote Desktop Protocol (RDP) is enabled."
11 57 3
fi
fi
;;
...
...
@@ -1024,16 +1047,18 @@ function jobs ()
# Switch to daily builds
#
"Nightly"
)
dialog
--colors
--title
"
\Z
1Warning
\Z
0 "
--backtitle
"
$BACKTITLE
"
--yes-label
"OK"
--no-label
"Cancel"
--yesno
\
"
\n
You are switching to untested auto-build repository which might break your system.
\n\n
Are you fine with that?"
10 48
if
!
is_package_manager_running
;
then
dialog
--colors
--title
"
\Z
1Warning
\Z
0 "
--backtitle
"
$BACKTITLE
"
--yes-label
"OK"
--no-label
"Cancel"
--yesno
\
"
\n
You are switching to untested auto-build repository which might break your system.
\n\n
Are you fine with that?"
10 48
if
[[
$?
=
0
]]
;
then
sed
-i
's/apt.armbian.com/beta.armbian.com/'
/etc/apt/sources.list.d/armbian.list
debconf-apt-progress
--
apt-get update
debconf-apt-progress
--
apt-get
-y
upgrade
dialog
--title
"Switching to nightly"
--backtitle
"
$BACKTITLE
"
--yes-label
"Reboot"
\
--no-label
"Cancel"
--yesno
"
\n
Reboot to apply new settings?"
7 34
if
[[
$?
=
0
]]
;
then
reboot
;
fi
if
[[
$?
=
0
]]
;
then
sed
-i
's/apt.armbian.com/beta.armbian.com/'
/etc/apt/sources.list.d/armbian.list
debconf-apt-progress
--
apt-get update
debconf-apt-progress
--
apt-get
-y
upgrade
dialog
--title
"Switching to nightly"
--backtitle
"
$BACKTITLE
"
--yes-label
"Reboot"
\
--no-label
"Cancel"
--yesno
"
\n
Reboot to apply new settings?"
7 34
if
[[
$?
=
0
]]
;
then
reboot
;
fi
fi
fi
;;
...
...
@@ -1041,74 +1066,80 @@ function jobs ()
# Switch to stable builds
#
"Stable"
)
dialog
--colors
--title
"
\Z
1Warning
\Z
0 "
--backtitle
"
$BACKTITLE
"
--yes-label
"OK"
--no-label
"Cancel"
\
--yesno
"
\n
You are switching back to stable respository where you are going to get future updates. Are you fine with that?"
9 44
if
[[
$?
=
0
]]
;
then
sed
-i
's/beta.armbian.com/apt.armbian.com/'
/etc/apt/sources.list.d/armbian.list
debconf-apt-progress
--
apt-get update
debconf-apt-progress
--
apt-get
-y
upgrade
dialog
--title
"Switching to stable"
--backtitle
"
$BACKTITLE
"
--yes-label
"Reboot"
--no-label
"Cancel"
--yesno
\
"
\n
Reboot to apply new settings?"
7 34
if
[[
$?
=
0
]]
;
then
reboot
;
fi
if
!
is_package_manager_running
;
then
dialog
--colors
--title
"
\Z
1Warning
\Z
0 "
--backtitle
"
$BACKTITLE
"
--yes-label
"OK"
--no-label
"Cancel"
\
--yesno
"
\n
You are switching back to stable respository where you are going to get future updates. Are you fine with that?"
9 44
if
[[
$?
=
0
]]
;
then
sed
-i
's/beta.armbian.com/apt.armbian.com/'
/etc/apt/sources.list.d/armbian.list
debconf-apt-progress
--
apt-get update
debconf-apt-progress
--
apt-get
-y
upgrade
dialog
--title
"Switching to stable"
--backtitle
"
$BACKTITLE
"
--yes-label
"Reboot"
--no-label
"Cancel"
--yesno
\
"
\n
Reboot to apply new settings?"
7 34
if
[[
$?
=
0
]]
;
then
reboot
;
fi
fi
fi
;;
# Switch to alternative kernels
#
"DTB"
)
aval_cubox
if
[[
$exitstatus
=
0
]]
;
then
BOX_LENGHT
=
$((${#
TARGET_BOARD
}
+
24
))
;
dialog
--title
"Switching board config"
--backtitle
"
$BACKTITLE
"
--yes-label
"Reboot"
--no-label
"Cancel"
--yesno
"
\n
Reboot to
$TARGET_BOARD
settings?"
7
$BOX_LENGHT
if
[[
$?
=
0
]]
;
then
sed
-i
"s/^fdt_file=.*/fdt_file=
$TARGET_BOARD
/"
/boot/armbianEnv.txt
&&
grep
-q
"fdt_file=
$TARGET_BOARD
"
/boot/armbianEnv.txt
||
echo
"fdt_file=
$TARGET_BOARD
"
>>
/boot/armbianEnv.txt
reboot
;
fi
if
!
is_package_manager_running
;
then
aval_cubox
if
[[
$exitstatus
=
0
]]
;
then
BOX_LENGHT
=
$((${#
TARGET_BOARD
}
+
24
))
;
dialog
--title
"Switching board config"
--backtitle
"
$BACKTITLE
"
--yes-label
"Reboot"
--no-label
"Cancel"
--yesno
"
\n
Reboot to
$TARGET_BOARD
settings?"
7
$BOX_LENGHT
if
[[
$?
=
0
]]
;
then
sed
-i
"s/^fdt_file=.*/fdt_file=
$TARGET_BOARD
/"
/boot/armbianEnv.txt
&&
grep
-q
"fdt_file=
$TARGET_BOARD
"
/boot/armbianEnv.txt
||
echo
"fdt_file=
$TARGET_BOARD
"
>>
/boot/armbianEnv.txt
reboot
;
fi
fi
fi
;;
# Switch to alternative kernels
#
"Switch"
)
aval_kernel
if
[[
-n
$TARGET_BRANCH
]]
;
then
exceptions
"
$INSTALL_KERNEL
"
dialog
--title
" Install and reboot "
--colors
--backtitle
"
$BACKTITLE
"
--yes-label
"OK"
--no-label
"Cancel"
--yesno
\
"
\n
Switching to
\Z
1linux-image
${
TARGET_BRANCH
}
-
${
TARGET_FAMILY
}
\Z
0
\n\n
Warning: another kernel might not provide
\
the same functionality or can be broken!
\n\n
Board config will be reverted to defaults."
12 50
if
[[
$?
=
0
]]
;
then
# remove old
dialog
--backtitle
"
$BACKTITLE
"
--title
"Please wait"
--infobox
"
\n
Removing current kernel."
5 28
apt-get
-s
-y
-qq
--no-install-recommends
install
linux-image
${
TARGET_BRANCH
}
-
${
TARGET_FAMILY
}
\
linux-headers
${
TARGET_BRANCH
}
-
${
TARGET_FAMILY
}
linux-u-boot-
${
BOARD
}
-
${
UBOOT_BRANCH
}
\
linux-
$(
lsb_release
-cs
)
-root
$TARGET_BRANCH
-
$BOARD
>
/dev/null 2>&1
# if test download is ok, remove old kernel
if
!
is_package_manager_running
;
then
aval_kernel
if
[[
-n
$TARGET_BRANCH
]]
;
then
exceptions
"
$INSTALL_KERNEL
"
dialog
--title
" Install and reboot "
--colors
--backtitle
"
$BACKTITLE
"
--yes-label
"OK"
--no-label
"Cancel"
--yesno
\
"
\n
Switching to
\Z
1linux-image
${
TARGET_BRANCH
}
-
${
TARGET_FAMILY
}
\Z
0
\n\n
Warning: another kernel might not provide
\
the same functionality or can be broken!
\n\n
Board config will be reverted to defaults."
12 50
if
[[
$?
=
0
]]
;
then
aptitude remove ~nlinux-image
--quiet
=
100
-y
>>
/var/log/upgrade.log
aptitude remove ~nlinux-dtb
--quiet
=
100
-y
>>
/var/log/upgrade.log
aptitude remove ~nlinux-headers
--quiet
=
100
-y
>>
/var/log/upgrade.log
# remove old
dialog
--backtitle
"
$BACKTITLE
"
--title
"Please wait"
--infobox
"
\n
Removing current kernel."
5 28
apt-get
-s
-y
-qq
--no-install-recommends
install
linux-image
${
TARGET_BRANCH
}
-
${
TARGET_FAMILY
}
\
linux-headers
${
TARGET_BRANCH
}
-
${
TARGET_FAMILY
}
linux-u-boot-
${
BOARD
}
-
${
UBOOT_BRANCH
}
\
linux-
$(
lsb_release
-cs
)
-root
$TARGET_BRANCH
-
$BOARD
>
/dev/null 2>&1
# if test download is ok, remove old kernel
if
[[
$?
=
0
]]
;
then
aptitude remove ~nlinux-image
--quiet
=
100
-y
>>
/var/log/upgrade.log
aptitude remove ~nlinux-dtb
--quiet
=
100
-y
>>
/var/log/upgrade.log
aptitude remove ~nlinux-headers
--quiet
=
100
-y
>>
/var/log/upgrade.log
fi
# install new packages
INSTALL_DTB
=
""
[[
-n
$(
apt-cache search
--names-only
"^linux-dtb
$TARGET_BRANCH
-
$TARGET_FAMILY
"
)
]]
&&
\
INSTALL_DTB
=
"linux-dtb
$TARGET_BRANCH
-
$TARGET_FAMILY
"
debconf-apt-progress
--
apt-get
--reinstall
-o
Dpkg::Options::
=
"--force-confdef"
-o
Dpkg::Options::
=
"--force-confold"
-y
-qq
--no-install-recommends
install
linux-image
${
TARGET_BRANCH
}
-
${
TARGET_FAMILY
}
\
linux-headers
${
TARGET_BRANCH
}
-
${
TARGET_FAMILY
}
linux-u-boot-
${
BOARD
}
-
${
UBOOT_BRANCH
}
\
linux-
$(
lsb_release
-cs
)
-root
$TARGET_BRANCH
-
$BOARD
$INSTALL_DTB
# install new boot script
[[
-f
/usr/share/armbian/boot.cmd
]]
&&
cp
/usr/share/armbian/boot.cmd /boot/boot.cmd
&&
mkimage
-C
none
-A
arm
-T
script
-d
/boot/boot.cmd /boot/boot.scr
[[
-f
/usr/share/armbian/boot.ini
]]
&&
cp
/usr/share/armbian/boot.ini /boot/boot.ini
# create armbianEnv.txt
[[
!
-f
/boot/armbianEnv.txt
]]
&&
printf
"verbosity=1
\n
rootdev=
$(
sed
-e
's/^.*root=//'
-e
's/ .*$//'
< /proc/cmdline
)
"
>
/boot/armbianEnv.txt
dialog
--title
"Kernel switch"
--backtitle
"
$BACKTITLE
"
--yes-label
"Yes"
--no-label
"Cancel"
\
--yesno
"
\n
New kernel was installed. Reboot?"
7 64
exitstatus
=
$?
;
[[
$exitstatus
=
0
]]
&&
reboot
fi
# install new packages
INSTALL_DTB
=
""
[[
-n
$(
apt-cache search
--names-only
"^linux-dtb
$TARGET_BRANCH
-
$TARGET_FAMILY
"
)
]]
&&
\
INSTALL_DTB
=
"linux-dtb
$TARGET_BRANCH
-
$TARGET_FAMILY
"
debconf-apt-progress
--
apt-get
--reinstall
-o
Dpkg::Options::
=
"--force-confdef"
-o
Dpkg::Options::
=
"--force-confold"
-y
-qq
--no-install-recommends
install
linux-image
${
TARGET_BRANCH
}
-
${
TARGET_FAMILY
}
\
linux-headers
${
TARGET_BRANCH
}
-
${
TARGET_FAMILY
}
linux-u-boot-
${
BOARD
}
-
${
UBOOT_BRANCH
}
\
linux-
$(
lsb_release
-cs
)
-root
$TARGET_BRANCH
-
$BOARD
$INSTALL_DTB
# install new boot script
[[
-f
/usr/share/armbian/boot.cmd
]]
&&
cp
/usr/share/armbian/boot.cmd /boot/boot.cmd
&&
mkimage
-C
none
-A
arm
-T
script
-d
/boot/boot.cmd /boot/boot.scr
[[
-f
/usr/share/armbian/boot.ini
]]
&&
cp
/usr/share/armbian/boot.ini /boot/boot.ini
# create armbianEnv.txt
[[
!
-f
/boot/armbianEnv.txt
]]
&&
printf
"verbosity=1
\n
rootdev=
$(
sed
-e
's/^.*root=//'
-e
's/ .*$//'
< /proc/cmdline
)
"
>
/boot/armbianEnv.txt
dialog
--title
"Kernel switch"
--backtitle
"
$BACKTITLE
"
--yes-label
"Yes"
--no-label
"Cancel"
\
--yesno
"
\n
New kernel was installed. Reboot?"
7 64
exitstatus
=
$?
;
[[
$exitstatus
=
0
]]
&&
reboot
else
dialog
--backtitle
"
$BACKTITLE
"
--title
" Info "
--msgbox
"
\n
No alternative kernels available!"
7 38
fi
else
dialog
--backtitle
"
$BACKTITLE
"
--title
" Info "
--msgbox
"
\n
No alternative kernels available!"
7 38
fi
;;
...
...
@@ -1116,21 +1147,23 @@ function jobs ()
# Toggle virtual read-only root filesystem
#
"Overlayroot"
)
if
[[
-n
$(
mount |
grep
-w
overlay
)
]]
;
then
dialog
--title
" Root overlay "
--backtitle
"
$BACKTITLE
"
--yes-label
"Disable"
\
--no-label
"Cancel"
\
--yesno
"
\n
Your system is already virtual read-only.
\n\n
Do you want to disable this feature and reboot?"
9 60
[[
$?
=
0
]]
&&
overlayroot-chroot
sed
-i
"s/^overlayroot=.*/overlayroot=
\"\"
/"
/etc/overlayroot.conf
&&
\
overlayroot-chroot
rm
/etc/update-motd.d/97-overlayroot
&&
reboot
else
debconf-apt-progress
--
apt-get
-o
Dpkg::Options::
=
"--force-confnew"
-y
--no-install-recommends
install
overlayroot
echo
'#!/bin/bash'
>
/etc/update-motd.d/97-overlayroot
echo
'if [ -n "$(mount | grep -w tmpfs-root)" ]; then \
echo -e "\n[\e[0m \e[1mremember: your system is in virtual read only mode\e[0m ]";fi'
>>
/etc/update-motd.d/97-overlayroot
chmod
+x /etc/update-motd.d/97-overlayroot
dialog
--title
"Root overlay"
--backtitle
"
$BACKTITLE
"
--yes-label
"Reboot"
\
--no-label
"Cancel"
--yesno
"
\n
Enable virtual read-only root and reboot."
7 45
[[
$?
=
0
]]
&&
sed
-i
"s/^overlayroot=.*/overlayroot=
\"
tmpfs
\"
/"
/etc/overlayroot.conf
&&
reboot
if
!
is_package_manager_running
;
then
if
[[
-n
$(
mount |
grep
-w
overlay
)
]]
;
then
dialog
--title
" Root overlay "
--backtitle
"
$BACKTITLE
"
--yes-label
"Disable"
\
--no-label
"Cancel"
\
--yesno
"
\n
Your system is already virtual read-only.
\n\n
Do you want to disable this feature and reboot?"
9 60
[[
$?
=
0
]]
&&
overlayroot-chroot
sed
-i
"s/^overlayroot=.*/overlayroot=
\"\"
/"
/etc/overlayroot.conf
&&
\
overlayroot-chroot
rm
/etc/update-motd.d/97-overlayroot
&&
reboot
else
debconf-apt-progress
--
apt-get
-o
Dpkg::Options::
=
"--force-confnew"
-y
--no-install-recommends
install
overlayroot
echo
'#!/bin/bash'
>
/etc/update-motd.d/97-overlayroot
echo
'if [ -n "$(mount | grep -w tmpfs-root)" ]; then \
echo -e "\n[\e[0m \e[1mremember: your system is in virtual read only mode\e[0m ]";fi'
>>
/etc/update-motd.d/97-overlayroot
chmod
+x /etc/update-motd.d/97-overlayroot
dialog
--title
"Root overlay"
--backtitle
"
$BACKTITLE
"
--yes-label
"Reboot"
\
--no-label
"Cancel"
--yesno
"
\n
Enable virtual read-only root and reboot."
7 45
[[
$?
=
0
]]
&&
sed
-i
"s/^overlayroot=.*/overlayroot=
\"
tmpfs
\"
/"
/etc/overlayroot.conf
&&
reboot
fi
fi
;;
...
...
debian-config-submenu
View file @
2992430d
...
...
@@ -993,27 +993,4 @@ while true; do
jobs
"
$selection
"
done
}
DIALOG_CANCEL
=
1
DIALOG_ESC
=
255
#-----------------------------------------------------------------------------------------------------------------------------------------#
# gather info about the board and start with loading menu
#
[[
-f
/etc/armbian-release
]]
&&
source
/etc/armbian-release
&&
ARMBIAN
=
"Armbian
$VERSION
$IMAGE_TYPE
"
;
DISTRO
=
$(
lsb_release
-is
)
DISTROID
=
$(
lsb_release
-sc
)
KERNELID
=
$(
uname
-r
)
[[
-z
"
${
ARMBIAN
//
}
"
]]
&&
ARMBIAN
=
$KERNELID
BACKTITLE
=
"Configuration utility,
$ARMBIAN
, https://www.armbian.com"
TITLE
=
"
$BOARD_NAME
"
DEFAULT_ADAPTER
=
$(
ip
-4
route
ls
|
grep
default |
grep
-Po
'(?<=dev )(\S+)'
)
[[
-z
"
${
DEFAULT_ADAPTER
//
}
"
]]
&&
DEFAULT_ADAPTER
=
"lo"
OVERLAYDIR
=
"/boot/dtb/overlay"
;
[[
"
$LINUXFAMILY
"
==
"sunxi64"
]]
&&
OVERLAYDIR
=
"/boot/dtb/allwinner/overlay"
;
dialog
--backtitle
"
$BACKTITLE
"
--title
"Please wait"
--infobox
"
\n
Loading Armbian configuration utility ... "
5 45
sleep
1
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment