Skip to content

Commit

Permalink
Update docs. Add silentreinstallnewer
Browse files Browse the repository at this point in the history
Added select log messages
Fixed reinstall
  • Loading branch information
procount committed Jul 9, 2018
1 parent 7a13b6a commit 77a89c3
Show file tree
Hide file tree
Showing 29 changed files with 2,666 additions and 2,578 deletions.
661 changes: 306 additions & 355 deletions README.md

Large diffs are not rendered by default.

32 changes: 28 additions & 4 deletions README_PINN.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The latest version of [PINN](http://downloads.sourceforge.net/projects/pinn/pinn

### - [If you have PINN v2.4.3 - v2.4.4b installed, please manually update to v2.4.4c](https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574&start=200#p1239359)

This README relates to v2.8.5
This README relates to v2.8.5.1

<sup>(PINN-lite does not include any operating systems at all. It is more akin to `NOOBS-lite` rather than `NOOBS`. For that reason, the filename that you download is called `pinn-lite.zip`. More recently, `pinn.zip` has also been made available for download which includes versions of Raspbian and LibreELEC.)</sup>

Expand Down Expand Up @@ -153,7 +153,7 @@ There are three toolbars:
- **[Replace](#replace-individual-oses)**: Allows individual installed OSes to be replaced by other/different OSes without affecting any of the other installed OSes.
- **[Info](#info-on-os)**: [Networking Required] Opens a browser that displays the webpage for the selected OS.

The `more` button can be used to cycle through the 3 toolbars.
The `more` button can be used to cycle through the 3 toolbars. (shortcuts = M or PageDown)

## Main OS List Window

Expand Down Expand Up @@ -397,6 +397,7 @@ In addition to specifying a list of OS names, some reserved words are also avail
- `waitsd` - Waits for all OSes on the SD card to be listed
- `waitall` - Waits for OSes from all sources to be listed

- **silentreinstallnewer**: This is an advanced option and potentially _**Destructive to your data!**_. Do not use unless you are fully aware of its consequences. See [Auto-Reinstalling OSes](#auto-reinstalling-oses)

- **alt_image_source=\<url\>**: Provides the URL of an additional os_list_v3.json file indicating the location of other OSes that can be downloaded from the Internet. Multiple instances of this option can be used.

Expand Down Expand Up @@ -591,9 +592,17 @@ If a particular OS you want to install is on a particular source, you can force
`waitnetwork` will wait for all OSes on remote OSes to be listed.
`waitall` is a shorthand way of including all OSes and is equivalent to `waitsd,waitusb,waitnetwork`

PINN only carries out the OS selection once all sources are present. So if you wait for a source that is not present, PINN will wait indefinitely until it appears.
PINN only carries out the OS selection once all sources are present. So if you wait for a source that is not present, PINN may wait indefinitely until it appears.
(This is modified in v2.8.5.1 to try and avoid indefinite waits).

The `select=` option will not install the listed OSes by itself, but by adding the `silentinstall` option as well, then all selected OSes will be silently installed without user intervention. However, `silentinstall` only works if there are no OSes installed already to prevent accidental OS deletion.
The `select=` option only determines which OSes are selected in the recovery menu at startup; it will not do anything with the listed OSes by itself.
By adding the `silentinstall` option as well, then all selected OSes will be silently installed without user intervention. However, `silentinstall` only works
if there are no OSes installed already to prevent accidental OS deletion.
It is also used with the `silentreinstallnewer` option, but this has fewer safeguards. Please read the warnings below.

Unlike using `silentinstall` on its own to install a single local OS, when using it with the `select=` option, PINN must read in all installation sources,
so the recovery menu MUST be entered for this to occur. You can do this by using one of the many trigger options at startup, e.g. pressing the shift-key.
For remote operation, consider using the `forcetrigger` option, maybe in combination with `remotetimeout` if necessary.

### Auto-Installing OSes based on their source

Expand All @@ -611,6 +620,21 @@ An installer slideshow guides you through your first steps with each OS while it

![alt text](screenshots/installer_slides.png "An installer slideshow guides you through your first steps with each OS.")

### Auto-Reinstalling OSes

The `silentreinstallnewer` option is added by particular request for a specific purpose, so be sure you understand how it works before using, otherwise you are at risk of
losing your data.

It is used in conjunction with the `select=` option to automatically reinstall any installed OS selected by that option if a newer version is found to exist
on any installation source that is newer than the currently installed version. THERE ARE NO OTHER CHECKS except the name of the OS and its release date, so this option may
unexpectedly wipe out any existing OS and restore it to a factory default state if you make a mistake - YOU HAVE BEEN WARNED!
For this reason, it may be beneficial to install a Data Partition on your installation drive, on which all user data is stored, rather than storing it on the OS partition.
In this way, the user data can be preserved when the OS is re-installed.

It is advisable to only use named OSes in the `select=` option. Using any of the general options like `allinstalled` & `allnetwork` etc. May result in unexpected consequences!
Likewise, you may wish to resict your installation sources to a single location with judiciious use of the `disableusbimages`, `disablesdimages` and the network source options
to avoid a newer OS being installed from an unintended source.

## Installation Progress

During the installation of the operating systems, PINN will write the percentage completed to a text file called `/tmp/progress`. The format of this file is an integer (0-100) followed by a space, a '%' symbol, and a line feed. It is only updated when the progress changes by at least 1%. Sometimes PINN will not know the maximum size; in this case, it shows the amount data written in MBs.
Expand Down
6 changes: 6 additions & 0 deletions README_SUM.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ Please note that in some cases it may extract the files into a folder, if this i

## Change History

## V2.8.5.1

- **Reinstall** - BUGFIX for Re-install.
- **translations** - Updated it and zh_TW translations.
- **silentreinstallnewer** - **USE WITH CAUTION**. With `select=` it will silently re-install any selected OSes that are newer than the installed version.

### V2.8.5

- **Boot Cancel** - Added a new cancel button to the bootselection dialog which will reboot back into PINN
Expand Down
4 changes: 4 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,4 +409,8 @@ Fixes the incorrect recovery.cmdline bug in v2.5.2.
- **Added flavours.tar.xz** - Remote flavours need to include flavours.tar.xz
- **RPi Model Name** - Added name of RPi model to MainMenu screen

## V2.8.5.1

- **Reinstall** - BUGFIX for Re-install.
- **translations** - Updated it and zh_TW translations.
- **silentreinstallnewer** - **USE WITH CAUTION**. With `select=` it will silently re-install any selected OSes that are newer than the installed version.
6 changes: 6 additions & 0 deletions history.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ PINN is a version of the NOOBS Operating System Installer for the Raspberry Pi w

## Change History

## V2.8.5.1

- **Reinstall** - BUGFIX for Re-install.
- **translations** - Updated it and zh_TW translations.
- **silentreinstallnewer** - **USE WTIH CAUTION**. With `select=` it will silently re-install any selected OSes that are newer than the installed version.

## V2.8.5

- **Boot Cancel** - Added a new cancel button to the bootselection dialog which will reboot back into PINN
Expand Down
2 changes: 1 addition & 1 deletion recovery/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define CONFIG_H

/* Version number displayed in the title bar */
#define VERSION_NUMBER "2.8.5"
#define VERSION_NUMBER "2.8.5.1"

/* Color of the background */
// #define BACKGROUND_COLOR Qt::white
Expand Down
120 changes: 108 additions & 12 deletions recovery/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ MainWindow::MainWindow(const QString &drive, const QString &defaultDisplay, QSpl
_availableImages = 0;
_selectImages = 0;
_waitforImages = 0;
_processedImages = 0;
_numListsToDownload=0;

QWidget* spacer = new QWidget();
Expand Down Expand Up @@ -710,6 +711,7 @@ void MainWindow::repopulate()
filterList();
ug->showTab(DEFGROUP);
ug->setDefaultItems();
_processedImages |= ALLSD;
}

/* Whether this OS should be displayed in the list of installable OSes */
Expand Down Expand Up @@ -1095,10 +1097,11 @@ void MainWindow::on_actionReinstall_triggered()
}
else
{
QMessageBox::warning(this,
tr("ReInstall OSes"),
tr("Warning: No OSes selected or available\n"),
QMessageBox::Close);
if (!_silent)
QMessageBox::warning(this,
tr("ReInstall OSes"),
tr("Warning: No OSes selected or available\n"),
QMessageBox::Close);

}
}
Expand All @@ -1109,7 +1112,7 @@ void MainWindow::prepareMetaFiles()

QString warning = tr("Warning: this will Reinstall/Replace the selected Operating System(s). The existing data will be deleted.");

if (QMessageBox::warning(this,
if ( _silent || QMessageBox::warning(this,
tr("Confirm"),
warning,
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
Expand Down Expand Up @@ -1317,7 +1320,7 @@ void MainWindow::onCompleted()
// Return back to main menu
setEnabled(true);
show();

_silent=false;
// Update list of installed OSes.
ug->listInstalled->clear();
addInstalledImages();
Expand All @@ -1339,7 +1342,8 @@ void MainWindow::onError(const QString &msg)
qDebug() << "Error:" << msg;
if (_qpssd)
_qpssd->hide();
QMessageBox::critical(this, tr("Error"), msg, QMessageBox::Close);
if (!_silent)
QMessageBox::critical(this, tr("Error"), msg, QMessageBox::Close);
setEnabled(true);
_piDrivePollTimer.start(POLLTIME);
show();
Expand Down Expand Up @@ -2076,7 +2080,10 @@ void MainWindow::downloadListComplete()

reply->deleteLater();
if (_numListsToDownload==0)
{
_availableImages |= ALLNETWORK;
_processedImages |= ALLNETWORK;
}
}

void MainWindow::processJson(QVariant json)
Expand Down Expand Up @@ -2823,6 +2830,7 @@ void MainWindow::startImageReinstall()
QVariantMap partition = partitions[i].toMap();
partition.insert("tarball", tarball); //change to download
partitions[i] = partition;
i++;
}
i=partitions.count();
json["partitions"] = partitions;
Expand Down Expand Up @@ -2972,6 +2980,9 @@ void MainWindow::startImageDownload()

void MainWindow::hideDialogIfNoNetwork()
{
//Maybe more OSes will be downloaded after wifi is connected - WJDK
_processedImages |= ALLNETWORK | ALLUSB; //So for now we assume it is done and allow silentinstall/update to continue

if (_qpd)
{
if (!isOnline())
Expand Down Expand Up @@ -3038,8 +3049,10 @@ void MainWindow::pollForNewDisks()

if (_selectImages || _selectOsList.count())
{ //We asked for some autoselection when there is no OS installed, and at least one available
if ((_waitforImages & _availableImages) == _waitforImages)
{ //All required sources are listed
qDebug() <<"Waiting for OSes..." << _processedImages;
if (_processedImages == (ALLSD | ALLUSB | ALLNETWORK))
{ //All required sources have been processed (see _availableImages for those that are present)
qDebug() <<"Selecting OSes...";
QList<QListWidgetItem *> all = ug->allItems();
foreach (QListWidgetItem * witem, all)
{
Expand All @@ -3048,33 +3061,116 @@ void MainWindow::pollForNewDisks()
witem->setCheckState(Qt::Unchecked);

if ((existing_details["source"].toString()==SOURCE_SDCARD) && (_selectImages & ALLSD))
{
witem->setCheckState(Qt::Checked); //No option for SOURCE_USB, so we'll assume it's the same as SOURCE_SD
qDebug() <<" " << existing_details["name"].toString() << " " << "(allsd)";
}

if ((existing_details["source"].toString()==SOURCE_USB) && (_selectImages & ALLUSB))
{
witem->setCheckState(Qt::Checked);
qDebug() <<" " << existing_details["name"].toString() << " " << "(allusb)";
}

if ((existing_details["source"].toString()==SOURCE_NETWORK) && (_selectImages & ALLNETWORK))
{
witem->setCheckState(Qt::Checked);
qDebug() <<" " << existing_details["name"].toString() << " " << "(allnetwork)";
}

if ((existing_details["installed"].toBool()==true) && (_selectImages & ALLINSTALLED))
{
witem->setCheckState(Qt::Checked);
qDebug() <<" " << existing_details["name"].toString() << " " << "(allinstalled)";
}


foreach (QString osname, _selectOsList)
{
if (existing_details["name"].toString()== osname)
{
witem->setCheckState(Qt::Checked);
qDebug() <<" " << existing_details["name"].toString();
}
}

}

//Also, Select any installed os names that match the `select` parameter
qDebug() <<"Selecting installed OSes...";
for (int i=0; i< ug->listInstalled->count(); i++)
{
QListWidgetItem * witem = ug->listInstalled->item(i);
witem->setCheckState(Qt::Unchecked);
QVariantMap installed_os = witem->data(Qt::UserRole).toMap();
foreach (QString osname, _selectOsList)
{
if (installed_os["name"].toString()== osname)
{
witem->setCheckState(Qt::Checked);
}
}
}

_selectImages=0; //Prevent re-entry
_selectOsList.clear();

//Check for silentinstall & install them
if ((_allowSilent) && !_numInstalledOS && ug->count() >= 1)
{ //silentInstall was selected, so let's auto-install them
_silent=true;
_eDownloadMode = MODE_INSTALL; //Just to be sure!
on_actionWrite_image_to_disk_triggered();
addInstalledImages(); //Update the installed lists
updateInstalledStatus();
//Following will be done in onCompleted()
//addInstalledImages(); //Update the installed lists
//updateInstalledStatus();
}

//Check for silentreinstallnewer option
QString cmdline = getFileContents("/proc/cmdline");
int nReinstalls=0;
if (cmdline.contains("silentreinstallnewer"))
{ //Restrict the items to those that have newer versions
QList<QListWidgetItem *> select = ug->selectedInstalledItems();
nReinstalls = select.count();

foreach (QListWidgetItem * witem, select)
{
QVariantMap selected_os = witem->data(Qt::UserRole).toMap();
QString installedName = selected_os["name"].toString();

QListWidgetItem * matchItem = ug->findItemByDataName(installedName);
if (matchItem)
{
QVariantMap matchEntry = matchItem->data(Qt::UserRole).toMap();
if (selected_os["release_date"].toString() >= matchEntry["release_date"].toString() )
{
witem->setCheckState(Qt::Unchecked);
nReinstalls--;
qDebug() <<"Deselecting " << selected_os["name"].toString();
}
else
qDebug() << " X " << installedName;
}
else
{
witem->setCheckState(Qt::Unchecked);
nReinstalls--;
qDebug() <<"No replacement for " << selected_os["name"].toString();
}
}

if (nReinstalls)
{
_silent=true;
qDebug() <<"Silently re-installing updates";
on_actionReinstall_triggered();

//Following will be done in onCompleted()
//addInstalledImages(); //Update the installed lists
//updateInstalledStatus();
}
else
qDebug() <<"No new updates";
}
}
}
Expand Down
1 change: 1 addition & 0 deletions recovery/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class MainWindow : public QMainWindow
unsigned _availableImages;
unsigned _selectImages;
unsigned _waitforImages;
unsigned _processedImages;
QStringList _selectOsList;

enum ModeTag {
Expand Down
Loading

0 comments on commit 77a89c3

Please sign in to comment.