From 6a139b4382e88ad2e15cebf429faf211ded55864 Mon Sep 17 00:00:00 2001 From: procount Date: Thu, 16 Aug 2018 16:30:45 +0100 Subject: [PATCH] Made wallpaper changeable --- buildroot/package/recovery/init | 9 ++- recovery/main.cpp | 105 +++++++++++++++++++------------- recovery/translation_ae.ts | 10 +-- recovery/translation_ast.ts | 10 +-- recovery/translation_ca.ts | 10 +-- recovery/translation_de.ts | 10 +-- recovery/translation_en.ts | 10 +-- recovery/translation_es.ts | 10 +-- recovery/translation_eu.ts | 10 +-- recovery/translation_fi.ts | 10 +-- recovery/translation_fr.ts | 10 +-- recovery/translation_hu.ts | 10 +-- recovery/translation_it.ts | 10 +-- recovery/translation_ja.ts | 10 +-- recovery/translation_ko.ts | 10 +-- recovery/translation_nl.ts | 10 +-- recovery/translation_no.ts | 10 +-- recovery/translation_pl.ts | 10 +-- recovery/translation_pt.ts | 10 +-- recovery/translation_ru.ts | 10 +-- recovery/translation_sv.ts | 10 +-- recovery/translation_tr.ts | 10 +-- recovery/translation_zh_TW.ts | 10 +-- 23 files changed, 174 insertions(+), 150 deletions(-) diff --git a/buildroot/package/recovery/init b/buildroot/package/recovery/init index 1f1085069..2128f65ba 100755 --- a/buildroot/package/recovery/init +++ b/buildroot/package/recovery/init @@ -62,7 +62,7 @@ if [ -e /sys/devices/platform/rpi_ft5406 ]; then fi #Check for user init script - +pinndrive= mkdir -p /tmp/mnt cd /sys/class/block for d in *1/; @@ -79,6 +79,7 @@ do mount /dev/$d /tmp/mnt 2>/dev/null if [ $? -eq 0 ]; then if [ -f "/tmp/mnt/recovery.rfs" ]; then + pinndrive=/dev/$d if [ -f "/tmp/mnt/pinn_init.sh" ]; then sh -c "/tmp/mnt/pinn_init.sh" fi @@ -114,6 +115,7 @@ fi EXTRA_REPOS= REPO_LIST= DEFAULT_STYLE= + DEFAULT_DRIVE= if grep -q runinstaller /proc/cmdline; then RUN_INSTALLER=-runinstaller @@ -158,6 +160,9 @@ fi if [ "${p%%=*}" == "style" ] ; then DEFAULT_STYLE="-style=${p#*=}" fi + if [ -n "$pinndrive" ] ; then + DEFAULT_DRIVE="-pinndrive=$pinndrive" + fi done if grep -q vncinstall /proc/cmdline; then @@ -168,7 +173,7 @@ fi echo fi - /usr/bin/recovery $RUN_INSTALLER $GPIO_TRIGGER $KEYBOARD_NO_TRIGGER $FORCE_TRIGGER $DEFAULT_KBD $DEFAULT_LANG $DEFAULT_DISPLAY $DEFAULT_PARTITION $DEFAULT_NOCONFIG $DEFAULT_DSI $DEFAULT_REPOS $EXTRA_REPOS $REPO_LIST $DEFAULT_STYLE -qws 2>/tmp/debug + /usr/bin/recovery $RUN_INSTALLER $GPIO_TRIGGER $KEYBOARD_NO_TRIGGER $FORCE_TRIGGER $DEFAULT_KBD $DEFAULT_LANG $DEFAULT_DISPLAY $DEFAULT_PARTITION $DEFAULT_NOCONFIG $DEFAULT_DSI $DEFAULT_REPOS $EXTRA_REPOS $REPO_LIST $DEFAULT_STYLE $DEFAULT_DRIVE -qws 2>/tmp/debug # Recovery should have rebooted diff --git a/recovery/main.cpp b/recovery/main.cpp index bea6bb7a6..3e4d25c1e 100644 --- a/recovery/main.cpp +++ b/recovery/main.cpp @@ -192,6 +192,9 @@ int main(int argc, char *argv[]) GpioInput *gpio=NULL; cec = enableCEC(); + QString drive; + bool driveReady = false; + bool runinstaller = false; bool keyboard_trigger = true; bool force_trigger = false; @@ -248,6 +251,11 @@ int main(int argc, char *argv[]) if (argc > i+1) defaultPartition = argv[i+1]; } + else if (strcmp(argv[i], "-pinndrive") == 0) + { + if (argc > i+1) + drive = argv[i+1]; + } // Allow default repos to be specified in commandline else if (strcmp(argv[i], "-no_default_source") == 0) { @@ -273,6 +281,47 @@ int main(int argc, char *argv[]) } } + //========================== + // Wait for drive device to show up + QTime t; + t.start(); + + while (t.elapsed() < 10000) + { + if (drive.isEmpty()) + { + /* We do not know the exact drive name to wait for */ + drive = findRecoveryDrive(); + if (!drive.isEmpty()) + { + driveReady = true; + break; + } + } + else if (drive.startsWith("/dev")) + { + if (QFile::exists(drive)) + { + driveReady = true; + break; + } + } + + QApplication::processEvents(QEventLoop::WaitForMoreEvents, 100); + } + if (!driveReady) + { + QMessageBox::critical(NULL, "Files not found", QString("Cannot find the drive with PINN files %1").arg(drive), QMessageBox::Close); + return 1; + } + qDebug() << "PINN drive:" << drive; + + QProcess::execute("mount -o ro -t vfat "+partdev(drive, 1)+" /mnt"); + cec->loadCECmap("/mnt/cec_keys.json"); + + // do some stuff at start in background. + runCustomScript(drive, 1,"background.sh", true); + if (use_default_source) { QStringList urls = QString(DEFAULT_REPO_SERVER).split(' ', QString::SkipEmptyParts); @@ -302,7 +351,16 @@ int main(int argc, char *argv[]) int r,g,b; int newBGnd; - QPixmap pixmap(":/wallpaper.png"); + + QPixmap pixmap; + if (QFile::exists("/mnt/wallpaper.png")) + { + pixmap.load("/mnt/wallpaper.png"); + } + else + { + pixmap.load(":/wallpaper.png"); + } QString cmdline = getFileContents("/proc/cmdline"); QStringList args = cmdline.split(QChar(' '),QString::SkipEmptyParts); foreach (QString s, args) @@ -356,48 +414,7 @@ int main(int argc, char *argv[]) splash->show(); QApplication::processEvents(); - // Wait for drive device to show up - QString drive; - bool driveReady = false; - QTime t; - t.start(); - - while (t.elapsed() < 10000) - { - if (drive.isEmpty()) - { - /* We do not know the exact drive name to wait for */ - drive = findRecoveryDrive(); - if (!drive.isEmpty()) - { - driveReady = true; - break; - } - } - else if (drive.startsWith("/dev")) - { - if (QFile::exists(drive)) - { - driveReady = true; - break; - } - } - - QApplication::processEvents(QEventLoop::WaitForMoreEvents, 100); - } - if (!driveReady) - { - QMessageBox::critical(NULL, "Files not found", QString("Cannot find the drive with PINN files %1").arg(drive), QMessageBox::Close); - return 1; - } - qDebug() << "PINN drive:" << drive; - - QProcess::execute("mount -o ro -t vfat "+partdev(drive, 1)+" /mnt"); - cec->loadCECmap("/mnt/cec_keys.json"); - QProcess::execute("umount /mnt"); - - // do some stuff at start in background. - runCustomScript(drive, 1,"background.sh", true); + //------------------------------------------------ // If -runinstaller is not specified, only continue if SHIFT is pressed, GPIO is triggered, // or no OS is installed (/settings/installed_os.json does not exist) @@ -434,6 +451,8 @@ int main(int argc, char *argv[]) } } + QProcess::execute("umount /mnt"); //restore mounted behaviour + cec->clearKeyPressed(); if (bailout) diff --git a/recovery/translation_ae.ts b/recovery/translation_ae.ts index e9645d0e2..9afdac122 100644 --- a/recovery/translation_ae.ts +++ b/recovery/translation_ae.ts @@ -14,28 +14,28 @@ خطا في تركيب قسم إعدادات - + HDMI safe mode HDMI الوضع الأمن - + composite PAL mode وضع PAL المركب - + composite NTSC mode وضع NTSC المركب - + PINN - Previously selected OS will boot in %1 seconds PINN - سيتم اختيار نظام التشغيل المحدد سابقا في %1 ثانية - + PINN - Select OS to boot PINN - حدد نظام التشغيل للاقلاع diff --git a/recovery/translation_ast.ts b/recovery/translation_ast.ts index 9de1a62ef..c443d3b62 100644 --- a/recovery/translation_ast.ts +++ b/recovery/translation_ast.ts @@ -14,28 +14,28 @@ Fallu montando la partición d'axustes - + HDMI safe mode Mou seguru HDMI - + composite PAL mode Mou compuestu PAL - + composite NTSC mode mou compuestu NTSC - + PINN - Previously selected OS will boot in %1 seconds - + PINN - Select OS to boot diff --git a/recovery/translation_ca.ts b/recovery/translation_ca.ts index 513605c95..6fedc2c6f 100644 --- a/recovery/translation_ca.ts +++ b/recovery/translation_ca.ts @@ -14,28 +14,28 @@ - + HDMI safe mode mode HDMI segur - + composite PAL mode mode PAL compost - + composite NTSC mode mode NTSC compost - + PINN - Previously selected OS will boot in %1 seconds - + PINN - Select OS to boot diff --git a/recovery/translation_de.ts b/recovery/translation_de.ts index 32387e425..4e609b759 100644 --- a/recovery/translation_de.ts +++ b/recovery/translation_de.ts @@ -14,28 +14,28 @@ Fehler beim Einbinden der Einstellungspartition - + HDMI safe mode HDMI-Modus (sicher) - + composite PAL mode Composite-PAL-Modus - + composite NTSC mode Composite-NTSC-Modus - + PINN - Previously selected OS will boot in %1 seconds - + PINN - Select OS to boot diff --git a/recovery/translation_en.ts b/recovery/translation_en.ts index 18d0e85f6..f372bc239 100644 --- a/recovery/translation_en.ts +++ b/recovery/translation_en.ts @@ -5,7 +5,7 @@ BootSelectionDialog - + PINN - Select OS to boot @@ -30,22 +30,22 @@ - + HDMI safe mode - + composite PAL mode - + composite NTSC mode - + PINN - Previously selected OS will boot in %1 seconds diff --git a/recovery/translation_es.ts b/recovery/translation_es.ts index a3d5e4387..b7935203a 100644 --- a/recovery/translation_es.ts +++ b/recovery/translation_es.ts @@ -15,28 +15,28 @@ Error al montar la partición Settings - + HDMI safe mode Modo HDMI seguro (safe) - + composite PAL mode Modo PAL compuesto - + composite NTSC mode Modo NTSC compuesto - + PINN - Previously selected OS will boot in %1 seconds PINN - El SO previamente seleccionado se iniciara en %1 segundos - + PINN - Select OS to boot PINN - Seleccione el SO qué desea iniciar diff --git a/recovery/translation_eu.ts b/recovery/translation_eu.ts index f5aaa9474..c40f6b4af 100644 --- a/recovery/translation_eu.ts +++ b/recovery/translation_eu.ts @@ -14,28 +14,28 @@ Errorea ezarpenen partizioa muntatzean - + HDMI safe mode HDMI segurua modua - + composite PAL mode PAL konposatua modua - + composite NTSC mode NTSC konposatua modua - + PINN - Previously selected OS will boot in %1 seconds PINN - Aurrez hautatutako SEa %1 segundo barru abiaraziko da - + PINN - Select OS to boot PINN - Hautatu SEa abiarazteko diff --git a/recovery/translation_fi.ts b/recovery/translation_fi.ts index d230fe6c6..5ef1a7e72 100644 --- a/recovery/translation_fi.ts +++ b/recovery/translation_fi.ts @@ -14,28 +14,28 @@ - + HDMI safe mode - + composite PAL mode - + composite NTSC mode - + PINN - Previously selected OS will boot in %1 seconds - + PINN - Select OS to boot diff --git a/recovery/translation_fr.ts b/recovery/translation_fr.ts index 07299e2b1..ccb94ca90 100644 --- a/recovery/translation_fr.ts +++ b/recovery/translation_fr.ts @@ -14,28 +14,28 @@ Erreur pendant le montage de la partition de réglages - + HDMI safe mode Mode HDMI sans échec - + composite PAL mode Mode PAL composite - + composite NTSC mode Mode NTSC composite - + PINN - Previously selected OS will boot in %1 seconds - + PINN - Select OS to boot diff --git a/recovery/translation_hu.ts b/recovery/translation_hu.ts index ddd5d3c8e..6a1bb57a0 100644 --- a/recovery/translation_hu.ts +++ b/recovery/translation_hu.ts @@ -14,28 +14,28 @@ Nem sikerült a beállítások partíció felcsatolása - + HDMI safe mode Biztonságos HDMI mód - + composite PAL mode kompozit PAL mód - + composite NTSC mode kompozit NTSC mód - + PINN - Previously selected OS will boot in %1 seconds - + PINN - Select OS to boot diff --git a/recovery/translation_it.ts b/recovery/translation_it.ts index f77252236..7ad0e6390 100644 --- a/recovery/translation_it.ts +++ b/recovery/translation_it.ts @@ -14,28 +14,28 @@ Errore montaggio partizione impostazioni - + HDMI safe mode Modo HDMI sicuro - + composite PAL mode Modo PAL composito - + composite NTSC mode Modo NTSC composito - + PINN - Previously selected OS will boot in %1 seconds PINN - Il sistema operativo precedentemente selezionato si avvierà tra %1 secondi - + PINN - Select OS to boot PINN - Seleziona il SO di avvio diff --git a/recovery/translation_ja.ts b/recovery/translation_ja.ts index f93c0d965..1b935e4a6 100644 --- a/recovery/translation_ja.ts +++ b/recovery/translation_ja.ts @@ -14,28 +14,28 @@ 設定パーティションをマウント中のエラー - + HDMI safe mode HDMI セーフモード - + composite PAL mode コンポジット PALモード - + composite NTSC mode コンポジット NTSCモード - + PINN - Previously selected OS will boot in %1 seconds - + PINN - Select OS to boot diff --git a/recovery/translation_ko.ts b/recovery/translation_ko.ts index 445d32d0f..b86b48897 100644 --- a/recovery/translation_ko.ts +++ b/recovery/translation_ko.ts @@ -5,7 +5,7 @@ BootSelectionDialog - + PINN - Select OS to boot PINN - 부팅할 OS 선택 @@ -30,22 +30,22 @@ 설정 파티선을 마운트하는 과정에서 오류가 발생하였습니다 - + HDMI safe mode HDMI 안전 모드 - + composite PAL mode PAL 영상 출력 모드 - + composite NTSC mode NTSC 영상 출력 모드 - + PINN - Previously selected OS will boot in %1 seconds PINN - %1 초 뒤에 이전에 선택한 OS로 부팅합니다 diff --git a/recovery/translation_nl.ts b/recovery/translation_nl.ts index d1a81cec3..75f6c5ed2 100644 --- a/recovery/translation_nl.ts +++ b/recovery/translation_nl.ts @@ -14,28 +14,28 @@ Fout bij mounten instellingen partitie - + HDMI safe mode HDMI safe mode - + composite PAL mode composite PAL mode - + composite NTSC mode composite NTSC mode - + PINN - Previously selected OS will boot in %1 seconds - + PINN - Select OS to boot diff --git a/recovery/translation_no.ts b/recovery/translation_no.ts index c9cf4a506..b52861daa 100644 --- a/recovery/translation_no.ts +++ b/recovery/translation_no.ts @@ -14,28 +14,28 @@ Feil ved oppsett av innstillingspartisjon - + HDMI safe mode HDMI sikker-modus - + composite PAL mode komposit PAL-modus - + composite NTSC mode komposit NTSC-modus - + PINN - Previously selected OS will boot in %1 seconds PINN - Tidligere valgt OS vil boote om %1 sekunder - + PINN - Select OS to boot PINN - Velg OS som skal boote diff --git a/recovery/translation_pl.ts b/recovery/translation_pl.ts index 5d994e8d2..2f08d5e56 100644 --- a/recovery/translation_pl.ts +++ b/recovery/translation_pl.ts @@ -14,28 +14,28 @@ Błąd montowania partycji z ustawieniami - + HDMI safe mode tryb bezpieczny HDMI - + composite PAL mode tryb composite PAL - + composite NTSC mode tryb composite NTSC - + PINN - Previously selected OS will boot in %1 seconds - + PINN - Select OS to boot diff --git a/recovery/translation_pt.ts b/recovery/translation_pt.ts index ca036d9ab..68da81eb7 100644 --- a/recovery/translation_pt.ts +++ b/recovery/translation_pt.ts @@ -14,28 +14,28 @@ Erro ao montar partição de configurações - + HDMI safe mode Modo HDMI seguro - + composite PAL mode Modo PAL composto - + composite NTSC mode Modo NTSC composto - + PINN - Previously selected OS will boot in %1 seconds PINN - O SO previamente selecionado irá inicializar em %1 segundos - + PINN - Select OS to boot PINN - Selecione o SO para inicializar diff --git a/recovery/translation_ru.ts b/recovery/translation_ru.ts index f50373fc5..5d1c86376 100644 --- a/recovery/translation_ru.ts +++ b/recovery/translation_ru.ts @@ -14,28 +14,28 @@ Ошибка монтироваия настроек раздела - + HDMI safe mode Безопасные режим HDMI - + composite PAL mode Композитный PAL режим - + composite NTSC mode Композитный NTSC режим - + PINN - Previously selected OS will boot in %1 seconds - + PINN - Select OS to boot diff --git a/recovery/translation_sv.ts b/recovery/translation_sv.ts index 08ca10f08..69d28171e 100644 --- a/recovery/translation_sv.ts +++ b/recovery/translation_sv.ts @@ -14,28 +14,28 @@ Fel vid montering av inställningspartition - + HDMI safe mode HDMI säkert läge - + composite PAL mode Kompositvideo PAL-läge - + composite NTSC mode Kompositvideo NTSC-läge - + PINN - Previously selected OS will boot in %1 seconds - + PINN - Select OS to boot diff --git a/recovery/translation_tr.ts b/recovery/translation_tr.ts index ce04e649a..ad185e266 100644 --- a/recovery/translation_tr.ts +++ b/recovery/translation_tr.ts @@ -14,28 +14,28 @@ Ayar bölümünü bağlamada hata - + HDMI safe mode HDMI güvenli mod - + composite PAL mode Kompozit PAL mod - + composite NTSC mode Kompozit NTSC mod - + PINN - Previously selected OS will boot in %1 seconds - + PINN - Select OS to boot diff --git a/recovery/translation_zh_TW.ts b/recovery/translation_zh_TW.ts index 7dbaf3b90..a0c28beb0 100644 --- a/recovery/translation_zh_TW.ts +++ b/recovery/translation_zh_TW.ts @@ -14,28 +14,28 @@ 掛載 settings 分割區時發生錯誤 - + HDMI safe mode HDMI 安全模式 - + composite PAL mode 合成 PAL 模式 - + composite NTSC mode 合成 NTSC 模式 - + PINN - Previously selected OS will boot in %1 seconds PINN - 先前選擇的作業系統將會在 %1 秒內啟動 - + PINN - Select OS to boot PINN - 選取要啟動的作業系統