Major bugfixes to do-release-upgrade code
This commit is contained in:
parent
86c512a2ff
commit
9a41afd011
@ -144,14 +144,15 @@ void AptManager::handleUpdateProcessBuffer()
|
|||||||
conffileList.append(confLine);
|
conffileList.append(confLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (line == "Lubuntu Update !!! NEW RELEASE") {
|
} else if (line == "Lubuntu Update !!! NEW RELEASE\r\n") {
|
||||||
// Same busy-wait technique, but here we're just getting one extra line, the model code.
|
// Same busy-wait technique, but here we're just getting one extra line, the release code.
|
||||||
while (!aptProcess->canReadLine()) {
|
while (!aptProcess->canReadLine()) {
|
||||||
QThread::msleep(20);
|
QThread::msleep(20);
|
||||||
}
|
}
|
||||||
aptProcess->readLine(lineBuf, 2048);
|
aptProcess->readLine(lineBuf, 2048);
|
||||||
QString ltsReleaseCode = QString(lineBuf);
|
QString releaseCode = QString(lineBuf);
|
||||||
emit newLtsRelease(ltsReleaseCode);
|
releaseCode = releaseCode.left(releaseCode.count() - 2);
|
||||||
|
emit newRelease(releaseCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
double percentageDone = (static_cast<double>(internalUpdateProgress) / (((internalUpdateInfo[0].count() + internalUpdateInfo[1].count()) * 4) + internalUpdateInfo[2].count())) * 100;
|
double percentageDone = (static_cast<double>(internalUpdateProgress) / (((internalUpdateInfo[0].count() + internalUpdateInfo[1].count()) * 4) + internalUpdateInfo[2].count())) * 100;
|
||||||
|
@ -28,8 +28,7 @@ signals:
|
|||||||
void progressUpdated(int progress);
|
void progressUpdated(int progress);
|
||||||
void logLineReady(QString logLine);
|
void logLineReady(QString logLine);
|
||||||
void conffileListReady(QStringList conffileList);
|
void conffileListReady(QStringList conffileList);
|
||||||
void newLtsRelease(QString code);
|
void newRelease(QString code);
|
||||||
void newStableRelease(QString code);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleUpdateProcessBuffer();
|
void handleUpdateProcessBuffer();
|
||||||
|
@ -69,63 +69,66 @@ elif [ "$1" = 'doupdate' ]; then
|
|||||||
DEBIAN_FRONTEND='kde' apt-get -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' -o Apt::Color='0' -o Dpkg::Use-Pty='0' -y dist-upgrade |& tee /run/lubuntu-update-apt-log
|
DEBIAN_FRONTEND='kde' apt-get -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' -o Apt::Color='0' -o Dpkg::Use-Pty='0' -y dist-upgrade |& tee /run/lubuntu-update-apt-log
|
||||||
|
|
||||||
# Find all the conffiles
|
# Find all the conffiles
|
||||||
|
doConffiles='y';
|
||||||
mapfile conffileRawList <<< "$(grep -P "^Configuration file \'.*\'$" '/run/lubuntu-update-apt-log')"
|
mapfile conffileRawList <<< "$(grep -P "^Configuration file \'.*\'$" '/run/lubuntu-update-apt-log')"
|
||||||
if [ "$(echo "${conffileRawList[0]}" | head -c1)" != 'C' ]; then # Empty or invalid list, we're done
|
if [ "$(echo "${conffileRawList[0]}" | head -c1)" != 'C' ]; then # Empty or invalid list, we're done
|
||||||
exit 0
|
doConffiles='n';
|
||||||
fi
|
fi
|
||||||
|
|
||||||
conffileList=()
|
if [ "$doConffiles" = 'y' ]; then
|
||||||
counter=0
|
conffileList=()
|
||||||
while [ "$counter" -lt "${#conffileRawList[@]}" ]; do
|
counter=0
|
||||||
# Cut off "Configuration file '" from the start and "'" plus a couple trailing characters from the end
|
while [ "$counter" -lt "${#conffileRawList[@]}" ]; do
|
||||||
conffileList[counter]="$(echo "${conffileRawList[$counter]}" | tail -c+21 | head -c-3)"
|
# Cut off "Configuration file '" from the start and "'" plus a couple trailing characters from the end
|
||||||
counter=$((counter+1))
|
conffileList[counter]="$(echo "${conffileRawList[$counter]}" | tail -c+21 | head -c-3)"
|
||||||
done
|
counter=$((counter+1))
|
||||||
|
done
|
||||||
|
|
||||||
echo "Lubuntu Update !!! CONFIGURATION FILE LIST START";
|
echo "Lubuntu Update !!! CONFIGURATION FILE LIST START";
|
||||||
counter=0
|
counter=0
|
||||||
while [ "$counter" -lt "${#conffileList[@]}" ]; do
|
while [ "$counter" -lt "${#conffileList[@]}" ]; do
|
||||||
echo "${conffileList[$counter]}"
|
echo "${conffileList[$counter]}"
|
||||||
counter=$((counter+1))
|
counter=$((counter+1))
|
||||||
done
|
done
|
||||||
echo "Lubuntu Update !!! CONFIGURATION FILE LIST END";
|
echo "Lubuntu Update !!! CONFIGURATION FILE LIST END";
|
||||||
|
|
||||||
# If we make it this far, there were conffiles to deal with
|
# If we make it this far, there were conffiles to deal with
|
||||||
breakLoop='no'
|
breakLoop='no'
|
||||||
gotCommand='no'
|
gotCommand='no'
|
||||||
commandName=''
|
commandName=''
|
||||||
while [ "$breakLoop" = 'no' ]; do
|
while [ "$breakLoop" = 'no' ]; do
|
||||||
read -r inputVal
|
read -r inputVal
|
||||||
if [ "$gotCommand" = 'no' ]; then
|
if [ "$gotCommand" = 'no' ]; then
|
||||||
if [ "$inputVal" = 'done' ]; then
|
if [ "$inputVal" = 'done' ]; then
|
||||||
breakLoop='yes'
|
breakLoop='yes'
|
||||||
|
else
|
||||||
|
commandName="$inputVal"
|
||||||
|
gotCommand='yes'
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
commandName="$inputVal"
|
if [ "$commandName" = 'replace' ]; then # Replace an existing file
|
||||||
gotCommand='yes'
|
counter=0
|
||||||
|
while [ "$counter" -lt "${#conffileList[@]}" ]; do
|
||||||
|
if [ "$inputVal" = "${conffileList[$counter]}" ]; then
|
||||||
|
mv "$inputVal.dpkg-dist" "$inputVal"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
counter=$((counter+1))
|
||||||
|
done
|
||||||
|
elif [ "$commandName" = 'keep' ]; then # Keep an existing file
|
||||||
|
counter=0
|
||||||
|
while [ "$counter" -lt "${#conffileList[@]}" ]; do
|
||||||
|
if [ "$inputVal" = "${conffileList[$counter]}" ]; then
|
||||||
|
rm "$inputVal.dpkg-dist"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
counter=$((counter+1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
gotCommand='no'
|
||||||
fi
|
fi
|
||||||
else
|
done
|
||||||
if [ "$commandName" = 'replace' ]; then # Replace an existing file
|
fi
|
||||||
counter=0
|
|
||||||
while [ "$counter" -lt "${#conffileList[@]}" ]; do
|
|
||||||
if [ "$inputVal" = "${conffileList[$counter]}" ]; then
|
|
||||||
mv "$inputVal.dpkg-dist" "$inputVal"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
counter=$((counter+1))
|
|
||||||
done
|
|
||||||
elif [ "$commandName" = 'keep' ]; then # Keep an existing file
|
|
||||||
counter=0
|
|
||||||
while [ "$counter" -lt "${#conffileList[@]}" ]; do
|
|
||||||
if [ "$inputVal" = "${conffileList[$counter]}" ]; then
|
|
||||||
rm "$inputVal.dpkg-dist"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
counter=$((counter+1))
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
gotCommand='no'
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo 'Checking release status...'
|
echo 'Checking release status...'
|
||||||
|
|
||||||
@ -133,36 +136,52 @@ elif [ "$1" = 'doupdate' ]; then
|
|||||||
releaseYear="$(cut -d'.' -f1 <<< "$releaseCode")";
|
releaseYear="$(cut -d'.' -f1 <<< "$releaseCode")";
|
||||||
releaseMonth="$(cut -d'.' -f2 <<< "$releaseCode")";
|
releaseMonth="$(cut -d'.' -f2 <<< "$releaseCode")";
|
||||||
metaReleaseData="$(curl https://changelogs.ubuntu.com/meta-release)";
|
metaReleaseData="$(curl https://changelogs.ubuntu.com/meta-release)";
|
||||||
nextReleaseMonth='';
|
#nextReleaseMonth='';
|
||||||
nextReleaseYear='';
|
#nextReleaseYear='';
|
||||||
nextLTSReleaseMonth='';
|
#nextLTSReleaseMonth='';
|
||||||
nextLTSReleaseYear='';
|
#nextLTSReleaseYear='';
|
||||||
|
|
||||||
if ((releaseMonth == 4)); then
|
while true; do
|
||||||
nextReleaseMonth=((releaseMonth + 6));
|
if ((releaseMonth == 4)); then
|
||||||
nextReleaseYear="$releaseYear";
|
releaseMonth='10';
|
||||||
if (((releaseYear % 2) == 0)); then
|
else
|
||||||
nextLTSReleaseMonth='04';
|
releaseMonth='04';
|
||||||
nextLTSReleaseYear=((releaseYear + 2));
|
((releaseYear++));
|
||||||
fi
|
fi
|
||||||
else
|
if isReleaseSupported "$releaseYear" "$releaseMonth" "$metaReleaseData"; then
|
||||||
nextReleaseMonth="$releaseMonth";
|
|
||||||
nextReleaseYear=((releaseYear + 1));
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$nextLTSReleaseYear" ]; then
|
|
||||||
if isReleaseSupported "$nextLTSReleaseYear" "$nextLTSReleaseMonth" "$metaReleaseData"; then
|
|
||||||
echo 'Lubuntu Update !!! NEW RELEASE';
|
echo 'Lubuntu Update !!! NEW RELEASE';
|
||||||
echo "$nextLTSReleaseYear.$nextLTSReleaseMonth";
|
echo "$releaseYear.$releaseMonth";
|
||||||
|
break;
|
||||||
fi
|
fi
|
||||||
fi
|
done
|
||||||
|
|
||||||
if ! (((nextReleaseYear == nextLTSReleaseYear) && (nextReleaseMonth == nextLTSReleaseMonth))); then
|
# if ((releaseMonth == 4)); then
|
||||||
if isReleaseSupported "$nextReleaseYear" "$nextReleaseMonth" "$metaReleaseData"; then
|
# nextReleaseMonth=$((releaseMonth + 6));
|
||||||
echo 'Lubuntu Update !!! NEW RELEASE';
|
# nextReleaseYear="$releaseYear";
|
||||||
echo "$nextReleaseYear.$nextReleaseMonth";
|
# if (((releaseYear % 2) == 0)); then
|
||||||
fi
|
# nextLTSReleaseMonth='04';
|
||||||
fi
|
# nextLTSReleaseYear=$((releaseYear + 2));
|
||||||
|
# fi
|
||||||
|
# else
|
||||||
|
# nextReleaseMonth="$releaseMonth";
|
||||||
|
# nextReleaseYear=$((releaseYear + 1));
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# if [ -n "$nextLTSReleaseYear" ]; then
|
||||||
|
# if isReleaseSupported "$nextLTSReleaseYear" "$nextLTSReleaseMonth" "$metaReleaseData"; then
|
||||||
|
# echo 'Lubuntu Update !!! NEW RELEASE';
|
||||||
|
# echo "$nextLTSReleaseYear.$nextLTSReleaseMonth";
|
||||||
|
# fi
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# if ! (((nextReleaseYear == nextLTSReleaseYear) && (nextReleaseMonth == nextLTSReleaseMonth))); then
|
||||||
|
# if isReleaseSupported "$nextReleaseYear" "$nextReleaseMonth" "$metaReleaseData"; then
|
||||||
|
# echo 'Lubuntu Update !!! NEW RELEASE';
|
||||||
|
# echo "$nextReleaseYear.$nextReleaseMonth";
|
||||||
|
# else
|
||||||
|
# echo "Unsupported release: $nextReleaseYear.$nextReleaseMonth";
|
||||||
|
# fi
|
||||||
|
# fi
|
||||||
|
|
||||||
echo 'Update installation complete.'
|
echo 'Update installation complete.'
|
||||||
elif [ "$1" = 'doReleaseUpgrade' ]; then
|
elif [ "$1" = 'doReleaseUpgrade' ]; then
|
||||||
|
@ -25,7 +25,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
connect(aptManager, &AptManager::progressUpdated, this, &MainWindow::onProgressUpdate);
|
connect(aptManager, &AptManager::progressUpdated, this, &MainWindow::onProgressUpdate);
|
||||||
connect(aptManager, &AptManager::logLineReady, this, &MainWindow::onLogLineReady);
|
connect(aptManager, &AptManager::logLineReady, this, &MainWindow::onLogLineReady);
|
||||||
connect(aptManager, &AptManager::conffileListReady, this, &MainWindow::onConffileListReady);
|
connect(aptManager, &AptManager::conffileListReady, this, &MainWindow::onConffileListReady);
|
||||||
connect(aptManager, &AptManager::newLtsRelease, this, &MainWindow::onNewRelease);
|
connect(aptManager, &AptManager::newRelease, this, &MainWindow::onNewRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@ -144,7 +144,9 @@ void MainWindow::onUpdateCompleted()
|
|||||||
ui->progressBar->setVisible(false);
|
ui->progressBar->setVisible(false);
|
||||||
ui->statLabel->setText(tr("Update installation complete."));
|
ui->statLabel->setText(tr("Update installation complete."));
|
||||||
emit updatesInstalled(); // this tells the orchestrator to hide the tray icon
|
emit updatesInstalled(); // this tells the orchestrator to hide the tray icon
|
||||||
handleNewReleases();
|
if (releaseCodes.count() > 0) {
|
||||||
|
handleNewReleases();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onCheckUpdatesCompleted()
|
void MainWindow::onCheckUpdatesCompleted()
|
||||||
|
@ -26,7 +26,7 @@ Orchestrator::Orchestrator(QObject *parent)
|
|||||||
bool success = configFile.open(QFile::ReadOnly);
|
bool success = configFile.open(QFile::ReadOnly);
|
||||||
if (success) {
|
if (success) {
|
||||||
char lineBuf[2048];
|
char lineBuf[2048];
|
||||||
while (configFile.canReadLine()) {
|
while (!configFile.atEnd()) {
|
||||||
configFile.readLine(lineBuf, 2048);
|
configFile.readLine(lineBuf, 2048);
|
||||||
QString line(lineBuf);
|
QString line(lineBuf);
|
||||||
line = line.trimmed();
|
line = line.trimmed();
|
||||||
@ -107,7 +107,7 @@ void Orchestrator::onNewReleaseAvailable(QStringList releaseCodes)
|
|||||||
QString druType;
|
QString druType;
|
||||||
if (success) {
|
if (success) {
|
||||||
char lineBuf[2048];
|
char lineBuf[2048];
|
||||||
while (druTypeFile.canReadLine()) {
|
while (!druTypeFile.atEnd()) {
|
||||||
druTypeFile.readLine(lineBuf, 2048);
|
druTypeFile.readLine(lineBuf, 2048);
|
||||||
QString line(lineBuf);
|
QString line(lineBuf);
|
||||||
line = line.trimmed();
|
line = line.trimmed();
|
||||||
@ -125,6 +125,9 @@ void Orchestrator::onNewReleaseAvailable(QStringList releaseCodes)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
druType="normal";
|
||||||
|
druTypeFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0;i < releaseCodes.count();i++) {
|
for (int i = 0;i < releaseCodes.count();i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user