Unverified Commit 6c79f66a authored by Igor Pečovnik's avatar Igor Pečovnik Committed by GitHub
Browse files

Tvboxes (#41)

- prepare for new packaging
- tested for backward compatibility
- RFC alternative kernel install. It changes kernel/dtb only.
- update mirrors.
parent 05209c58
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
# description # description
# reload_bsp # reload_bsp
# other_kernel_version # other_kernel_version
# aval_kernel
# aval_dtbs # aval_dtbs
# get_a20modes # get_a20modes
# get_h3modes # get_h3modes
...@@ -275,6 +274,12 @@ function description ...@@ -275,6 +274,12 @@ function description
*uk.armbian.com*) *uk.armbian.com*)
echo "United Kingdom" echo "United Kingdom"
;; ;;
*mirrors.tuna.tsinghua.edu.cn/armbian/*)
echo "China"
;;
*mirror.cyberbits.eu/armbian/apt*)
echo "France"
;;
*.armbian.com*) *.armbian.com*)
echo "Estonia" echo "Estonia"
;; ;;
...@@ -307,29 +312,47 @@ function reload_bsp(){ ...@@ -307,29 +312,47 @@ function reload_bsp(){
# test install packages # test install packages
TARGET_BRANCH=$BRANCH TARGET_BRANCH=$BRANCH
exceptions "$INSTALL_KERNEL" exceptions "$INSTALL_KERNEL"
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nTest install ..." 5 36 dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nProbing test install ..." 5 28
apt-get -s -y -qq --no-install-recommends install linux-image${TARGET_BRANCH}-${TARGET_FAMILY} \ unset PACKAGE_LIST
linux-headers${TARGET_BRANCH}-${TARGET_FAMILY} linux-u-boot-${BOARD}-${UBOOT_BRANCH} \
linux-$(lsb_release -cs)-root$TARGET_BRANCH-$BOARD > /dev/null 2>&1 [[ -n $(apt-cache search --names-only "^armbian-${LINUXFAMILY}$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${LINUXFAMILY}"
[[ -n $(apt-cache search --names-only "^armbian-${BOARD}$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${BOARD}"
[[ -n $(apt-cache search --names-only "^armbian-${DISTROID}$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${DISTROID}"
[[ -n $(apt-cache search --names-only "^armbian-${DISTROID}-desktop-xfce$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${DISTROID}-desktop-xfce"
# if new packages are absent, reinstall old ones
if [[ -z $PACKAGE_LIST ]]; then
PACKAGE_LIST="linux-${DISTROID}-root$TARGET_BRANCH-$BOARD"
fi
# reinstall headers only if they are already installed
check_if_installed linux-headers${TARGET_BRANCH}-${TARGET_FAMILY} && PACKAGE_LIST=$PACKAGE_LIST" linux-headers${TARGET_BRANCH}-${TARGET_FAMILY}"
IFS=" "
[[ -n $(apt-cache search --names-only "^linux-dtb$TARGET_BRANCH-$TARGET_FAMILY") ]] && PACKAGE_LIST=$PACKAGE_LIST" linux-dtb$TARGET_BRANCH-$TARGET_FAMILY"
PACKAGE_LIST=$PACKAGE_LIST" linux-image${TARGET_BRANCH}-${TARGET_FAMILY}"
apt-get -s -y --no-install-recommends install $PACKAGE_LIST > /tmp/reload_bsp.log 2>&1
# if test download is ok, remove old packages # if test download is ok, remove old packages
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nRemoving current kernel ..." 5 36 dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nRemoving current kernel ..." 5 36
aptitude remove ~nlinux-image --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~nlinux-image*${LINUXFAMILY} --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~nlinux-dtb --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~nlinux-dtb --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~nlinux-headers --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~nlinux-headers --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~nlinux-$(lsb_release -cs)-root --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~nlinux-${DISTROID}-root --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-config --quiet=100 -y >> /var/log/upgrade.log 2>&1 aptitude remove ~narmbian-config --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-${LINUXFAMILY} --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-${BOARD} --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-${DISTROID} --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-${DISTROID}-desktop-xfce --quiet=100 -y >> /var/log/upgrade.log 2>&1
# install packages # install packages
INSTALL_DTB="" echo $PACKAGE_LIST >> /var/log/upgrade.log
[[ -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" \ 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} \ -y -qq --no-install-recommends install $PACKAGE_LIST armbian-config
linux-headers${TARGET_BRANCH}-${TARGET_FAMILY} linux-u-boot-${BOARD}-${UBOOT_BRANCH} \
linux-$(lsb_release -cs)-root$TARGET_BRANCH-$BOARD armbian-config $INSTALL_DTB
dialog --title "Switching to $1" --backtitle "$BACKTITLE" --yes-label "Reboot" \ dialog --title "Switching to $1" --backtitle "$BACKTITLE" --yes-label "Reboot" \
--no-label "Cancel" --yesno "\nReboot to apply new settings?" 7 34 --no-label "Cancel" --yesno "\nReboot to apply new settings?" 7 34
if [[ $? = 0 ]]; then reboot; fi if [[ $? = 0 ]]; then reboot; fi
else
dialog --backtitle "$BACKTITLE" --title "Warning" --msgbox "\nTest install failed. Can't change firmware \n\nCheck /tmp/reload_bsp.log" 9 48
fi fi
} }
...@@ -337,91 +360,76 @@ function reload_bsp(){ ...@@ -337,91 +360,76 @@ function reload_bsp(){
function other_kernel_version () function other_kernel_version ()
{ {
IFS=$'\r\n' IFS=$'\r\n'
GLOBIGNORE='*' GLOBIGNORE='*'
TARGET_BRANCH="-"${BRANCH}
[[ $BRANCH == "default" ]] && TARGET_BRANCH="" # get current kernel information
CURRENT_VERSION=$(apt-cache policy linux-image${TARGET_BRANCH}-${LINUXFAMILY} | grep Installed| sed -n -e 's/^.*Installed: //p') CURRENT_VERSION_TEMP=$(dpkg -l | grep '^ii' | grep linux-image)
LIST=($(apt-cache show linux-image${TARGET_BRANCH}-${LINUXFAMILY} | grep -E "version: |Version:" | sed -n -e 's/^.*ersion: //p' | sed 's/\.$//g' | head -20)) CURRENT_VERSION=$(echo $CURRENT_VERSION_TEMP | awk '{print $2}')"="$(echo $CURRENT_VERSION_TEMP | awk '{print $3}')
# make a temporally array # check what is available from the repository
LIST=($(apt-cache show linux-image*${LINUXFAMILY} | grep -E "Package:|version:|Version:" | sed -n -e 's/^.*: //p' | sed 's/\.$//g'))
new_list=() new_list=()
#printf '%s\n' "${LIST[@]}"
#read
# create a human readable menu
for ((n=0;n<$((${#LIST[@]}));n++)); for ((n=0;n<$((${#LIST[@]}));n++));
do do
# skip currently installed package m=$(( $n + 1 ))
if [[ ${LIST[$n]} == $CURRENT_VERSION ]]; then prvi=$((3*$m - 3))
n=$(( $n + 1 )) drugi=$((3*$m - 2))
else tretji=$((3*$m - 1))
new_list+=( "${LIST[$n]}" ) [[ -z ${LIST[$prvi]} ]] && break
fi if [[ $CURRENT_VERSION != "${LIST[$prvi]}=${LIST[$drugi]}" ]]; then
new_list+=( "${LIST[$prvi]}=${LIST[$drugi]}" )
new_list+=( ${LIST[$tretji]} )
fi
done done
# copy back to main array # copy back to main array
LIST=("${new_list[@]}") LIST=("${new_list[@]}")
LIST_LENGHT=$((${#LIST[@]}/2)); LIST_LENGHT=$((${#LIST[@]}/2));
if [ "$LIST_LENGHT" -eq 0 ]; then if [ "$LIST_LENGHT" -eq 0 ]; then
dialog --backtitle "$BACKTITLE" --title " linux-image${TARGET_BRANCH}-${LINUXFAMILY} " --msgbox "\nOther versions are not available!" 7 38 dialog --backtitle "$BACKTITLE" --title " Warning " --msgbox "\nNo other kernels available!" 7 32
else else
beta_disclaimer "Switching between kernels might change functionality of your board or it might fail to boot." beta_disclaimer "Switching between kernels might change functionality of your board or it might fail to boot."
if [[ -n $ACKNOWLEDGEMENT ]]; then if [[ -n $ACKNOWLEDGEMENT ]]; then
exec 3>&1 exec 3>&1
TARGET_VERSION=$(dialog --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse \ TARGET_VERSION=$(dialog --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse \
--title "Switch to other kernel versions" --clear --menu "\nSwitch from package ${CURRENT_VERSION} / $(uname -r) to:\n \n" $((9+${LIST_LENGHT})) 60 25 "${LIST[@]}" 2>&1 1>&3) --title "Switch from" --clear --menu "\n${CURRENT_VERSION} $(uname -r) \n \n" $((9+${LIST_LENGHT})) 62 25 "${LIST[@]}" 2>&1 1>&3)
exitstatus=$?; exitstatus=$?;
exec 3>&- exec 3>&-
if [[ $exitstatus = 0 ]]; then if [[ $exitstatus = 0 ]]; then
# install packages IFS=" "
INSTALL_DTB="" # install packages
[[ -n $(apt-cache search --names-only "^linux-dtb$TARGET_BRANCH-$LINUXFAMILY") ]] && INSTALL_DTB="linux-dtb$TARGET_BRANCH-$LINUXFAMILY=$TARGET_VERSION" PACKAGE_LIST="$TARGET_VERSION"
debconf-apt-progress -- apt-get -y -qq --allow-downgrades --no-install-recommends install linux-image${TARGET_BRANCH}-${LINUXFAMILY}=$TARGET_VERSION $INSTALL_DTB TARGET_VERSION_DTB=${TARGET_VERSION/image/dtb}
dialog --title "Switching to $TARGET_VERSION" --backtitle "$BACKTITLE" --yes-label "Reboot" --no-label "Cancel" --yesno "\nReboot to apply new settings?" 7 34 TARGET_VERSION_PRE=$(echo $TARGET_VERSION_DTB | cut -f1 -d"=")
if [[ $? = 0 ]]; then reboot; fi TARGET_VERSION_SUB=$(echo $TARGET_VERSION_DTB | cut -f2 -d"=")
[[ -n $(apt-cache madison "$TARGET_VERSION_PRE" | grep $TARGET_VERSION_SUB ) ]] && PACKAGE_LIST=$PACKAGE_LIST" $TARGET_VERSION_DTB"
echo $PACKAGE_LIST > /tmp/switch_kernel.log 2>&1
apt-get -s -y --allow-downgrades --no-install-recommends install $PACKAGE_LIST >> /tmp/switch_kernel.log 2>&1
if [[ $? = 0 ]]; then
# remove old kernel
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nRemoving current kernel ..." 5 36
aptitude remove ~nlinux-image*${LINUXFAMILY} --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~nlinux-dtb --quiet=100 -y >> /var/log/upgrade.log 2>&1
debconf-apt-progress -- apt-get -y -qq --allow-downgrades --no-install-recommends install $PACKAGE_LIST
dialog --title "Switching kernel to" --backtitle "$BACKTITLE" --yes-label "Reboot" --no-label "Cancel" --yesno "\n$TARGET_VERSION?" 7 48
if [[ $? = 0 ]]; then reboot; fi
else
dialog --backtitle "$BACKTITLE" --title "Warning" --msgbox "\nTest install failed. Can't change firmware \n\nCheck /tmp/switch_kernel.log" 9 48
fi fi
fi
fi
}
#
# check if board has alternative kernels
#
function aval_kernel ()
{
IFS=$'\r\n'
GLOBIGNORE='*'
AVAL_KERNEL=($(apt-cache search --names-only '^linux-'$(lsb_release -cs)'-root.*.'$BOARD'*' \
| grep -w "$BOARD " | sed 's/.*(\(.*\))/\1/' | awk '{print $1}' | grep -v "$BRANCH" ))
local LIST=()
for i in "${AVAL_KERNEL[@]}"
do
VALUE="${i[0]//[[:blank:]]/}"
DESC=$(kernel_desc $VALUE)
LIST+=( "$VALUE" "$DESC" )
done
LIST_LENGHT=$((${#LIST[@]}/2));
if [ "$LIST_LENGHT" -eq 0 ]; then
TARGET_BRANCH=${AVAL_KERNEL[0]}
dialog --backtitle "$BACKTITLE" --title " Info " --msgbox "\nNo alternative kernels available!" 7 38
else
beta_disclaimer "Switching between kernels might change functionality of your board or it might fail to boot."
if [[ -n $ACKNOWLEDGEMENT ]]; then
exec 3>&1
TARGET_BRANCH=$(dialog --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse \
--title "Switch to alternative kernels" --clear --menu "\nSwitch from $(kernel_desc $BRANCH) to:\n \n" $((9+${LIST_LENGHT})) 60 25 "${LIST[@]}" 2>&1 1>&3)
exitstatus=$?;
exec 3>&-
fi fi
fi
fi fi
} }
# #
# check if board has alternative kernels # check if board has alternative kernels
# #
...@@ -604,22 +612,21 @@ function configure_desktop () ...@@ -604,22 +612,21 @@ function configure_desktop ()
# update packages # update packages
debconf-apt-progress -- apt-get update debconf-apt-progress -- apt-get update
# install new package if exists
unset PACKAGE_SUFIX
[[ -n $(apt-cache search --names-only "^armbian-${DISTROID}-desktop-xfce$") ]] && PACKAGE_SUFIX="-xfce"
# remove desktop package to secure proper install # remove desktop package to secure proper install
if check_if_installed armbian-${DISTROID}-desktop ; then if check_if_installed armbian-${DISTROID}-desktop ; then
debconf-apt-progress -- apt-get -y remove armbian-${DISTROID}-desktop debconf-apt-progress -- apt-get -y remove armbian-${DISTROID}-desktop${PACKAGE_SUFIX} lightdm lightdm-gtk-greeter
fi fi
# install desktop package # install desktop package
debconf-apt-progress -- apt-get -y install $1 armbian-${DISTROID}-desktop debconf-apt-progress -- apt-get -y install $1 armbian-${DISTROID}-desktop${PACKAGE_SUFIX} lightdm lightdm-gtk-greeter
# in case previous install was interrupted # in case previous install was interrupted
[[ $? -eq 130 ]] && dpkg --configure -a [[ $? -eq 130 ]] && dpkg --configure -a
# strectch workaround
[[ ${DISTROID} == stretch ]] && debconf-apt-progress -- apt -y purge lightdm
# install display manager
DEBIAN_FRONTEND=noninteractive debconf-apt-progress -- apt-get -y -qq install nodm
# clean apt cache # clean apt cache
apt-get clean apt-get clean
...@@ -648,18 +655,18 @@ function configure_desktop () ...@@ -648,18 +655,18 @@ function configure_desktop ()
# set up profile sync daemon on desktop systems # set up profile sync daemon on desktop systems
which psd >/dev/null 2>&1 which psd >/dev/null 2>&1
if [ $? -eq 0 ]; then if [[ $? -eq 0 && -z $(grep overlay-helper /etc/sudoers) ]]; then
echo "${CHOSEN_USER} ALL=(ALL) NOPASSWD: /usr/bin/psd-overlay-helper" >> /etc/sudoers echo "${CHOSEN_USER} ALL=(ALL) NOPASSWD: /usr/bin/psd-overlay-helper" >> /etc/sudoers
touch /home/${CHOSEN_USER}/.activate_psd touch /home/${CHOSEN_USER}/.activate_psd
fi fi
sed -i "s/NODM_USER=\(.*\)/NODM_USER=${CHOSEN_USER}/" /etc/default/nodm mkdir -p /etc/lightdm/lightdm.conf.d
sed -i "s/NODM_ENABLED=\(.*\)/NODM_ENABLED=true/g" /etc/default/nodm echo "[Seat:*]" > /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
chown -R ${CHOSEN_USER}:${CHOSEN_USER} /home/${CHOSEN_USER}/. echo "autologin-user=$CHOSEN_USER" >> /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
sleep 3 echo "autologin-user-timeout=0" >> /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
service nodm stop echo "user-session=xfce" >> /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
sleep 1 ln -s /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service >/dev/null 2>&1
service nodm start service lightdm start >/dev/null 2>&1
fi fi
} }
...@@ -863,18 +863,33 @@ function jobs () ...@@ -863,18 +863,33 @@ function jobs ()
"Freeze" | "Defreeze" ) "Freeze" | "Defreeze" )
if ! is_package_manager_running; then if ! is_package_manager_running; then
dialog --title " Updating " --backtitle "$BACKTITLE" --yes-label "$1" --no-label "Cancel" --yesno \ dialog --title " Updating " --backtitle "$BACKTITLE" --yes-label "$1" --no-label "Cancel" --yesno \
"\nDo you want to ${1,,} kernel updates?" 7 44 "\nDo you want to ${1,,} Armbian firmware updates?" 7 54
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
TARGET_BRANCH=$BRANCH TARGET_BRANCH=$BRANCH
exceptions "$BRANCH" exceptions "$BRANCH"
PACKAGE_LIST="linux-image${TARGET_BRANCH}-${TARGET_FAMILY} linux-u-boot-${BOARD}-${UBOOT_BRANCH} linux-$(lsb_release -cs)-root$TARGET_BRANCH-$BOARD" unset PACKAGE_LIST
if check_if_installed "linux-headers${TARGET_BRANCH}-${TARGET_FAMILY}"; then
PACKAGE_LIST=$PACKAGE_LIST" linux-headers${TARGET_BRANCH}-${TARGET_FAMILY}" # basic packages
fi check_if_installed linux-u-boot-${BOARD}-${UBOOT_BRANCH} && PACKAGE_LIST=$PACKAGE_LIST" linux-u-boot-${BOARD}-${UBOOT_BRANCH}"
[[ $BRANCH != "default" ]] && PACKAGE_LIST=$PACKAGE_LIST" linux-dtb$TARGET_BRANCH-$TARGET_FAMILY" check_if_installed linux-image${TARGET_BRANCH}-${TARGET_FAMILY} && PACKAGE_LIST=$PACKAGE_LIST" linux-image${TARGET_BRANCH}-${TARGET_FAMILY}"
check_if_installed linux-dtb$TARGET_BRANCH-$TARGET_FAMILY && PACKAGE_LIST=$PACKAGE_LIST" linux-dtb$TARGET_BRANCH-$TARGET_FAMILY"
# old BSP
check_if_installed linux-$(lsb_release -cs)-root$TARGET_BRANCH-$BOARD && PACKAGE_LIST=$PACKAGE_LIST" linux-$(lsb_release -cs)-root$TARGET_BRANCH-$BOARD"
check_if_installed linux-headers${TARGET_BRANCH}-${TARGET_FAMILY} && PACKAGE_LIST=$PACKAGE_LIST" linux-headers${TARGET_BRANCH}-${TARGET_FAMILY}"
# new BSP
check_if_installed armbian-${LINUXFAMILY} && PACKAGE_LIST=$PACKAGE_LIST" armbian-${LINUXFAMILY}"
check_if_installed armbian-${BOARD} && PACKAGE_LIST=$PACKAGE_LIST" armbian-${BOARD}"
check_if_installed armbian-$(lsb_release -cs) && PACKAGE_LIST=$PACKAGE_LIST" armbian-$(lsb_release -cs)"
check_if_installed armbian-$(lsb_release -cs)-desktop-xfce && PACKAGE_LIST=$PACKAGE_LIST" armbian-$(lsb_release -cs)-desktop-xfce"
check_if_installed armbian-firmware && PACKAGE_LIST=$PACKAGE_LIST" armbian-firmware"
check_if_installed armbian-firmware-full && PACKAGE_LIST=$PACKAGE_LIST" armbian-firmware-full"
local words=( $PACKAGE_LIST ) local words=( $PACKAGE_LIST )
local command="unhold" local command="unhold"
IFS=" "
[[ $1 == "Freeze" ]] && local command="hold" [[ $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 for word in $PACKAGE_LIST; do apt-mark $command $word; done | dialog --backtitle "$BACKTITLE" --title "Packages ${1,,}" --progressbox $((${#words[@]}+2)) 64
fi fi
...@@ -899,23 +914,29 @@ function jobs () ...@@ -899,23 +914,29 @@ function jobs ()
--yes-label "Stop" --no-label "Cancel" --yesno "\nDo you want to stop and disable this service?" 7 50 --yes-label "Stop" --no-label "Cancel" --yesno "\nDo you want to stop and disable this service?" 7 50
exitstatus=$?; exitstatus=$?;
if [[ $exitstatus = 0 ]]; then if [[ $exitstatus = 0 ]]; then
service nodm stop >/dev/null 2>&1 && sed -i "s/^NODM_ENABLED=.*/NODM_ENABLED=false/" /etc/default/nodm
service lightdm stop >/dev/null 2>&1 && systemctl disable lightdm.service >/dev/null 2>&1 service lightdm stop >/dev/null 2>&1 && systemctl disable lightdm.service >/dev/null 2>&1
fi fi
else else
if ! is_package_manager_running; then if ! is_package_manager_running; then
if [[ -n $DESKTOP_INSTALLED ]]; then if [[ -n $DESKTOP_INSTALLED ]]; then
dialog --colors --title " Choose a display manager " --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Lightdm" \ dialog --title " Display manager " --backtitle "$BACKTITLE" --yesno "\nDo you want to enable autologin?" 7 36
--no-label "Nodm" --yesno "\n\Z1Lightdm\Z0 = full featured login display manager\n\Z1Nodm\Z0 = autoloading into desktop" 8 70
exitstatus=$?; exitstatus=$?;
[[ $exitstatus = 0 ]] && [[ -f /etc/X11/default-display-manager ]] && \ if [[ $exitstatus = 0 ]]; then
echo "/usr/sbin/lightdm" > /etc/X11/default-display-manager && \ add_choose_user
debconf-apt-progress -- apt-get -o Dpkg::Options::="--force-confold" -y --no-install-recommends install lightdm-gtk-greeter lightdm \ if [ -n "$CHOSEN_USER" ]; then
&& systemctl start lightdm.service mkdir -p /etc/lightdm/lightdm.conf.d
[[ $exitstatus = 1 ]] && [[ -f /etc/X11/default-display-manager ]] && \ echo "[Seat:*]" > /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
debconf-apt-progress -- apt-get -o Dpkg::Options::="--force-confold" -y --no-install-recommends install nodm \ echo "autologin-user=$CHOSEN_USER" >> /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
&& echo "/usr/sbin/nodm" > /etc/X11/default-display-manager && \ echo "autologin-user-timeout=0" >> /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
sed -i "s/^NODM_ENABLED=.*/NODM_ENABLED=true/" /etc/default/nodm && service nodm start echo "user-session=xfce" >> /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
ln -s /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service >/dev/null 2>&1
service lightdm start >/dev/null 2>&1
fi
else
rm /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf >/dev/null 2>&1
ln -s /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service >/dev/null 2>&1
service lightdm start >/dev/null 2>&1
fi
fi fi
fi fi
fi fi
...@@ -929,28 +950,6 @@ function jobs () ...@@ -929,28 +950,6 @@ function jobs ()
configure_desktop "--install-recommends" configure_desktop "--install-recommends"
;; ;;
"Nodm" )
[[ -f /etc/X11/default-display-manager ]] && echo "/usr/sbin/nodm" > /etc/X11/default-display-manager
systemctl disable lightdm.service >/dev/null 2>&1
systemctl stop lightdm.service >/dev/null 2>&1
sed -i "s/^NODM_ENABLED=.*/NODM_ENABLED=true/" /etc/default/nodm && service nodm start
DISPLAY_MANAGER="nodm"
;;
"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
;;
"RDP" ) "RDP" )
if [[ -n $(service xrdp status | grep -w active) ]]; then if [[ -n $(service xrdp status | grep -w active) ]]; then
systemctl stop xrdp.service >/dev/null 2>&1 systemctl stop xrdp.service >/dev/null 2>&1
...@@ -1084,8 +1083,14 @@ function jobs () ...@@ -1084,8 +1083,14 @@ function jobs ()
GLOBIGNORE='*' GLOBIGNORE='*'
LIST_CONST=3 LIST_CONST=3
BEFORE="$(cat /etc/apt/sources.list.d/armbian.list | sed 's/http/\nhttp/g' | grep ^http | sed 's/\(^http[^ <]*\)\(.*\)/\1/g' | sed 's/https\?:\/\///')" BEFORE="$(cat /etc/apt/sources.list.d/armbian.list | sed 's/http/\nhttp/g' | grep ^http | sed 's/\(^http[^ <]*\)\(.*\)/\1/g' | sed 's/https\?:\/\///')"
BEFORE_DESC=$(description "${BEFORE}")
PREFIX="$(echo $BEFORE | cut -f1 -d".")" PREFIX="$(echo $BEFORE | cut -f1 -d".")"
AVAL_MIRROR=("${PREFIX}.armbian.com" "${PREFIX}.uk.armbian.com") AVAL_MIRROR=()
if [[ $PREFIX == beta ]]; then
AVAL_MIRROR=("beta.armbian.com")
else
AVAL_MIRROR+=("apt.armbian.com" "mirrors.tuna.tsinghua.edu.cn/armbian/" "mirror.cyberbits.eu/armbian/apt")
fi
local LIST=() local LIST=()
for i in "${AVAL_MIRROR[@]}" for i in "${AVAL_MIRROR[@]}"
do do
...@@ -1093,19 +1098,22 @@ function jobs () ...@@ -1093,19 +1098,22 @@ function jobs ()
[[ "${i[0]}" != "$BEFORE" ]] && LIST+=( "${i[0]//[[:blank:]]/}" "$DESC" ) [[ "${i[0]}" != "$BEFORE" ]] && LIST+=( "${i[0]//[[:blank:]]/}" "$DESC" )
done done
LIST_LENGHT=$(($LIST_CONST+${#LIST[@]}/2)); LIST_LENGHT=$(($LIST_CONST+${#LIST[@]}/2));
if [ "$LIST_LENGHT" -eq 1 ]; then echo "$LIST_LENGHT $BEFORE"
read
if [ "$LIST_LENGHT" -le 3 ]; then
TARGET_MIRROR=${AVAL_MIRROR[0]} TARGET_MIRROR=${AVAL_MIRROR[0]}
dialog --backtitle "$BACKTITLE" --title "Please wait" --colors --msgbox "\nThere are no mirrors available!" 7 35 dialog --backtitle "$BACKTITLE" --title "Please wait" --colors --msgbox "\nThere are no mirrors available!" 7 35
else else
exec 3>&1 exec 3>&1
TARGET_MIRROR=$(dialog --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse \ TARGET_MIRROR=$(dialog --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse \
--title "Change repository location" --colors --clear --menu "\nfrom \Z1$BEFORE\Z0 to:\n " $((6+${LIST_LENGHT})) 60 15 "${LIST[@]}" 2>&1 1>&3) --title "Change repository location" --colors --clear --menu "\nfrom \Z1$BEFORE_DESC\Z0 to:\n " $((6+${LIST_LENGHT})) 60 15 "${LIST[@]}" 2>&1 1>&3)
exitstatus=$?; exitstatus=$?;
exec 3>&- exec 3>&-
fi fi
if [[ $exitstatus == 0 ]]; then if [[ $exitstatus == 0 ]]; then
sed -i "s/$BEFORE/$TARGET_MIRROR/" /etc/apt/sources.list.d/armbian.list sed -i "s~$BEFORE~$TARGET_MIRROR~" /etc/apt/sources.list.d/armbian.list
dialog --backtitle "$BACKTITLE" --title "Info" --colors --msgbox "\nArmbian package repository was switched to:\n\n\Z1$TARGET_MIRROR\Z0" 9 47 dialog --backtitle "$BACKTITLE" --title "Info" --colors --msgbox "\nArmbian package repository was switched to:\n\n\Z1$TARGET_MIRROR\Z0" 9 47
fi fi
;; ;;
...@@ -1337,57 +1345,12 @@ function jobs () ...@@ -1337,57 +1345,12 @@ function jobs ()
fi fi
;; ;;
# Switch to alternative kernels
#
"Switch" )
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 \
"\nSwitching to \Z1linux-image${TARGET_BRANCH}-${TARGET_FAMILY}\Z0 \n\nWarning: another kernel might not provide\
the same functionality or can be broken!\n\nBoard config will be reverted to defaults." 12 50
if [[ $? = 0 ]]; then
# test install new and remove old if this is successfull
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nRemoving 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
if [[ $BRANCH == "default" ]]; then BRANCH=""; else BRANCH="-"$BRANCH; fi
debconf-apt-progress -- apt -y purge linux-image${BRANCH}-${LINUXFAMILY} linux-headers${BRANCH}-${LINUXFAMILY}
debconf-apt-progress -- apt -y purge linux-dtb${BRANCH}-${LINUXFAMILY}
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 && sed -i "s/setenv rootdev.*/setenv rootdev \""$(sed -e 's/^.*root=//' -e 's/ .*$//' < /proc/cmdline)"\" /" /boot/boot.ini
# create armbianEnv.txt
[[ ! -f /boot/armbianEnv.txt ]] && printf "verbosity=1\nrootdev=$(sed -e 's/^.*root=//' -e 's/ .*$//' < /proc/cmdline)\n" > /boot/armbianEnv.txt
dialog --title "Kernel switch" --backtitle "$BACKTITLE" --yes-label "Yes" --no-label "Cancel" \
--yesno "\nNew kernel was installed. Reboot?" 7 64
exitstatus=$?;
[[ $exitstatus = 0 ]] && reboot
fi
fi
fi
;;
# Toggle virtual read-only root filesystem # Toggle virtual read-only root filesystem
# #
"Overlayroot" ) "Overlayroot" )
if ! is_package_manager_running; then if ! is_package_manager_running; then
if [[ -n $(mount | grep -w overlay) ]]; then if [[ -n $(mount | grep -w overlay | grep -v chromium) ]]; then
dialog --title " Root overlay " --backtitle "$BACKTITLE" --yes-label "Disable" \ dialog --title " Root overlay " --backtitle "$BACKTITLE" --yes-label "Disable" \
--no-label "Cancel" \ --no-label "Cancel" \
--yesno "\nYour system is already virtual read-only.\n\nDo you want to disable this feature and reboot?" 9 60 --yesno "\nYour system is already virtual read-only.\n\nDo you want to disable this feature and reboot?" 9 60
......
...@@ -30,7 +30,7 @@ while true; do ...@@ -30,7 +30,7 @@ while true; do
check_desktop check_desktop
# check update status of BSP packages # check update status of BSP packages
local mark=$(apt-mark showhold | grep -w "$BOARD") local mark=$(apt-mark showhold | egrep "linux|armbian")
# check if install targets are avaliable # check if install targets are avaliable
if [[ $(sed -n 's/^DEVNAME=//p' /sys/dev/block/$(mountpoint -d /)/uevent 2> /dev/null) == mmcblk* \ if [[ $(sed -n 's/^DEVNAME=//p' /sys/dev/block/$(mountpoint -d /)/uevent 2> /dev/null) == mmcblk* \
...@@ -41,9 +41,9 @@ while true; do ...@@ -41,9 +41,9 @@ while true; do
# armbian specific function # armbian specific function
if [[ -f /etc/armbian-release ]]; then if [[ -f /etc/armbian-release ]]; then
if [[ -n "${mark}" ]]; then if [[ -n "${mark}" ]]; then
LIST+=( "Defreeze" "Enable kernel upgrades" ) LIST+=( "Defreeze" "Enable Armbian upgrades " )
else else
LIST+=( "Freeze" "Disable kernel upgrades" ) LIST+=( "Freeze" "Disable Armbian upgrades " )
fi fi
fi fi
...@@ -68,11 +68,7 @@ while true; do ...@@ -68,11 +68,7 @@ while true; do
[[ "$LINUXFAMILY" = odroidxu4 && $? == 0 ]] && LIST+=( "DTB" "Select optimised board configuration" ) [[ "$LINUXFAMILY" = odroidxu4 && $? == 0 ]] && LIST+=( "DTB" "Select optimised board configuration" )
[[ -f /usr/bin/bin2fex && "$LINUXFAMILY" = sun*i && "$BRANCH" = "default" ]] && LIST+=( "Fexedit" "Board (fex) settings editor" ) [[ -f /usr/bin/bin2fex && "$LINUXFAMILY" = sun*i && "$BRANCH" = "default" ]] && LIST+=( "Fexedit" "Board (fex) settings editor" )
[[ -z ${mark} ]] && [[ -f /etc/apt/sources.list.d/armbian.list ]] && [[ -n $(grep -w apt /etc/apt/sources.list.d/armbian.list) ]] \ [[ -z ${mark} ]] && [[ -f /etc/apt/sources.list.d/armbian.list ]] && LIST+=( "Other" "Switch to other kernels" )
&& LIST+=( "Other" "Switch to other kernel versions" )
[[ $(apt-cache search --names-only '^linux-'$(lsb_release -cs)'-root.*.'$BOARD'' | sed 's/.*(\(.*\))/\1/' | awk '{print $1}' \
| wc -l) -gt 1 && -z "${mark}" ]] && LIST+=( "Switch" "Switch to alternative kernel branches" )
LIST+=( "SSH" "Reconfigure SSH daemon" ) LIST+=( "SSH" "Reconfigure SSH daemon" )
LIST+=( "Firmware" "Run apt update & apt upgrade" ) LIST+=( "Firmware" "Run apt update & apt upgrade" )
...@@ -80,7 +76,7 @@ while true; do ...@@ -80,7 +76,7 @@ while true; do
if [[ "$SHELL" != "/bin/bash" ]]; then if [[ "$SHELL" != "/bin/bash" ]]; then
LIST+=( "BASH" "Revert to stock BASH shell" ) LIST+=( "BASH" "Revert to stock BASH shell" )
else else
LIST+=( "ZSH" "Install ZSH with most used plugins and tmux" ) LIST+=( "ZSH" "Install ZSH with plugins and tmux" )
fi fi
...@@ -93,8 +89,6 @@ while true; do ...@@ -93,8 +89,6 @@ while true; do
if ! check_if_installed mpv ; then if ! check_if_installed mpv ; then
LIST+=( "Default" "Install desktop with browser and extras" ) LIST+=( "Default" "Install desktop with browser and extras" )
fi fi
[[ $DISPLAY_MANAGER == 'nodm' ]] && LIST+=( "Lightdm" "Switch to standard login manager" )
[[ $DISPLAY_MANAGER == 'lightdm' ]] && LIST+=( "Nodm" "Switch to simple auto login manager" )
else else
if [[ -n $DESKTOP_INSTALLED ]]; then if [[ -n $DESKTOP_INSTALLED ]]; then
LIST+=( "Desktop" "Enable desktop" ) LIST+=( "Desktop" "Enable desktop" )
...@@ -121,10 +115,28 @@ while true; do ...@@ -121,10 +115,28 @@ while true; do
# count number of menu items to adjust window sizee # count number of menu items to adjust window sizee
LISTLENGHT="$((6+${#LIST[@]}/2))" LISTLENGHT="$((6+${#LIST[@]}/2))"
BOXLENGHT=${#LIST[@]} BOXLENGHT=${#LIST[@]}
temp_rc=$(mktemp)
if [[ -n ${mark} || -n $(grep -w beta /etc/apt/sources.list.d/armbian.list 2> /dev/null) ]]; then
cat <<-'EOF' > $temp_rc
dialog_color = (RED,WHITE,OFF)
screen_color = (WHITE,RED,ON)
tag_color = (RED,WHITE,ON)
item_selected_color = (WHITE,RED,ON)
tag_selected_color = (WHITE,RED,ON)
tag_key_selected_color = (WHITE,RED,ON)
EOF
[[ -n ${mark} ]] && local sys_title=" Warning - firmware packages frozen"
[[ -n $(grep -w beta /etc/apt/sources.list.d/armbian.list 2> /dev/null) ]] && local sys_title=" Warning - attached to beta repository"
[[ -n ${mark} && -n $(grep -w beta /etc/apt/sources.list.d/armbian.list 2> /dev/null) ]] && sys_title=" Warning - frozen & attached to beta repository"
else
local sys_title=" System settings "
echo > $temp_rc
fi
exec 3>&1 exec 3>&1
selection=$(dialog --colors --backtitle "$BACKTITLE" --title " System settings " --clear \ selection=$(DIALOGRC=$temp_rc dialog --colors --backtitle "$BACKTITLE" --title " $sys_title " --clear \
--cancel-label "Cancel" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \ --cancel-label "Cancel" --menu "$disclaimer" $LISTLENGHT 60 $BOXLENGHT \
"${LIST[@]}" 2>&1 1>&3) "${LIST[@]}" 2>&1 1>&3)
exit_status=$? exit_status=$?
exec 3>&- exec 3>&-
...@@ -294,7 +306,9 @@ while true; do ...@@ -294,7 +306,9 @@ while true; do
LIST+=( "Locales" "Reconfigure language \Z5($(locale | grep LANGUAGE | cut -d= -f2 | cut -d_ -f1))\Z0 and character set" ) LIST+=( "Locales" "Reconfigure language \Z5($(locale | grep LANGUAGE | cut -d= -f2 | cut -d_ -f1))\Z0 and character set" )
LIST+=( "Keyboard" "Change console keyboard layout (\Z5$(cat /etc/default/keyboard | grep XKBLAYOUT | grep -o '".*"' | sed 's/"//g')\Z0)") LIST+=( "Keyboard" "Change console keyboard layout (\Z5$(cat /etc/default/keyboard | grep XKBLAYOUT | grep -o '".*"' | sed 's/"//g')\Z0)")
LIST+=( "Hostname" "Change your hostname \Z5($(cat /etc/hostname))\Z0" ) LIST+=( "Hostname" "Change your hostname \Z5($(cat /etc/hostname))\Z0" )
[[ -f /etc/apt/sources.list.d/armbian.list ]] && LIST+=( "Mirror" "Change repository server" ) BEFORE="$(cat /etc/apt/sources.list.d/armbian.list | sed 's/http/\nhttp/g' | grep ^http | sed 's/\(^http[^ <]*\)\(.*\)/\1/g' | sed 's/https\?:\/\///')"
BEFORE_DESC=$(description "${BEFORE}")
[[ -f /etc/apt/sources.list.d/armbian.list ]] && LIST+=( "Mirror" "Change repository server \Z5(${BEFORE_DESC})\Z0" )
LIST+=( "Welcome" "Toggle welcome screen items" ) LIST+=( "Welcome" "Toggle welcome screen items" )
# count number of menu items to adjust window sizee # count number of menu items to adjust window sizee
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment