mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 05:36:47 +00:00
installer: add support for backup archive
This commit is contained in:
parent
58622d5821
commit
da30ef2ba4
@ -190,6 +190,7 @@ do_install_quick() {
|
|||||||
|
|
||||||
prompt_gpt
|
prompt_gpt
|
||||||
prompt_ssh
|
prompt_ssh
|
||||||
|
prompt_backup_unpack
|
||||||
|
|
||||||
EXTLINUX_SSH=""
|
EXTLINUX_SSH=""
|
||||||
if [ "$SSH" = "1" ]; then
|
if [ "$SSH" = "1" ]; then
|
||||||
@ -259,15 +260,15 @@ do_install_quick() {
|
|||||||
extlinux -i $TMPDIR/part1 >> $LOGFILE 2>&1
|
extlinux -i $TMPDIR/part1 >> $LOGFILE 2>&1
|
||||||
|
|
||||||
# install system files
|
# install system files
|
||||||
msg_progress_install "70" "installing Kernel"
|
msg_progress_install "60" "installing Kernel"
|
||||||
cp /flash/KERNEL $TMPDIR/part1 >> $LOGFILE 2>&1
|
cp /flash/KERNEL $TMPDIR/part1 >> $LOGFILE 2>&1
|
||||||
|
|
||||||
msg_progress_install "75" "installing System"
|
msg_progress_install "65" "installing System"
|
||||||
cp /flash/SYSTEM $TMPDIR/part1 >> $LOGFILE 2>&1
|
cp /flash/SYSTEM $TMPDIR/part1 >> $LOGFILE 2>&1
|
||||||
sync
|
sync
|
||||||
|
|
||||||
# configuring bootloader
|
# configuring bootloader
|
||||||
msg_progress_install "90" "setup bootloader with boot label = $DISKLABEL_SYSTEM and disk label = $DISKLABEL_STORAGE"
|
msg_progress_install "80" "setup bootloader with boot label = $DISKLABEL_SYSTEM and disk label = $DISKLABEL_STORAGE"
|
||||||
echo "DEFAULT linux" > $TMPDIR/part1/extlinux.conf
|
echo "DEFAULT linux" > $TMPDIR/part1/extlinux.conf
|
||||||
echo "PROMPT 0" >> $TMPDIR/part1/extlinux.conf
|
echo "PROMPT 0" >> $TMPDIR/part1/extlinux.conf
|
||||||
echo " " >> $TMPDIR/part1/extlinux.conf
|
echo " " >> $TMPDIR/part1/extlinux.conf
|
||||||
@ -277,12 +278,33 @@ do_install_quick() {
|
|||||||
sync
|
sync
|
||||||
|
|
||||||
# umount system partition, remove mountpoint
|
# umount system partition, remove mountpoint
|
||||||
msg_progress_install "95" "unmount $TMPDIR/part1"
|
msg_progress_install "85" "unmount $TMPDIR/part1"
|
||||||
umount $TMPDIR/part1 >> $LOGFILE 2>&1
|
umount $TMPDIR/part1 >> $LOGFILE 2>&1
|
||||||
|
|
||||||
msg_progress_install "100" "remove $TMPDIR/part1"
|
msg_progress_install "87" "remove $TMPDIR/part1"
|
||||||
rmdir $TMPDIR/part1 >> $LOGFILE 2>&1
|
rmdir $TMPDIR/part1 >> $LOGFILE 2>&1
|
||||||
|
|
||||||
|
if [ "$BACKUP_UNPACK" = "1" ]; then
|
||||||
|
# mount storage partition
|
||||||
|
msg_progress_install "89" "creating $TMPDIR/part2"
|
||||||
|
mkdir -p $TMPDIR/part2 >> $LOGFILE 2>&1
|
||||||
|
|
||||||
|
msg_progress_install "90" "mounting ${INSTALL_DEVICE}2 to $TMPDIR/part2"
|
||||||
|
mount -t ext4 ${INSTALL_DEVICE}2 $TMPDIR/part2 >> $LOGFILE 2>&1
|
||||||
|
|
||||||
|
msg_progress_install "92" "restoring backup"
|
||||||
|
[ -f /flash/backup.tar.bz2 ] && tar -xjf /flash/backup.tar.bz2 -C $TMPDIR/part2 >> $LOGFILE 2>&1
|
||||||
|
[ -f /flash/backup.zip ] && unzip -qq /flash/backup.zip -d $TMPDIR/part2 >> $LOGFILE 2>&1
|
||||||
|
sync
|
||||||
|
|
||||||
|
# umount system partition, remove mountpoint
|
||||||
|
msg_progress_install "97" "unmount $TMPDIR/part2"
|
||||||
|
umount $TMPDIR/part2 >> $LOGFILE 2>&1
|
||||||
|
|
||||||
|
msg_progress_install "100" "remove $TMPDIR/part2"
|
||||||
|
rmdir $TMPDIR/part2 >> $LOGFILE 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
menu_main
|
menu_main
|
||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
@ -388,6 +410,22 @@ prompt_ssh() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prompt_backup_unpack() {
|
||||||
|
# Prompt for unpacking backup files to /storage
|
||||||
|
# usage: prompt_backup_unpack
|
||||||
|
# uses:
|
||||||
|
# provides: BACKUP_UNPACK
|
||||||
|
BACKUP_UNPACK="0"
|
||||||
|
if [ -f /flash/backup.tar.bz2 -o -f /flash/backup.zip ]; then
|
||||||
|
MSG_TITLE="\Z1[ Restore backup files ]\Zn"
|
||||||
|
MSG_DETAIL="Restore backup files to storage partition.\nFile backup.tar.bz2 or/and backup.zip exist on\ninstallation USB stick."
|
||||||
|
DIALOG_OPTIONS="--defaultno"
|
||||||
|
if dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0; then
|
||||||
|
BACKUP_UNPACK="1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
menu_main() {
|
menu_main() {
|
||||||
# show the mainmenu
|
# show the mainmenu
|
||||||
MSG_TITLE="\Z4[ MAIN MENU ]\Zn"
|
MSG_TITLE="\Z4[ MAIN MENU ]\Zn"
|
||||||
@ -533,7 +571,8 @@ bios_erase() {
|
|||||||
|
|
||||||
logfile_show() {
|
logfile_show() {
|
||||||
# TODO: show the logfile
|
# TODO: show the logfile
|
||||||
msg_not_implemented
|
dialog --textbox "$LOGFILE" 20 70
|
||||||
|
clear
|
||||||
menu_main
|
menu_main
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user