mirror of
https://github.com/Snigdha-OS/snigdhaos-assistant.git
synced 2025-09-20 19:45:01 +02:00
chore(users): fixed all the possible bugs and enhanced ui.
This commit is contained in:
@@ -70,7 +70,7 @@ void SnigdhaOSAssistant::doInternetUpRequest(){
|
|||||||
|
|
||||||
|
|
||||||
void SnigdhaOSAssistant::doUpdate(){
|
void SnigdhaOSAssistant::doUpdate(){
|
||||||
if (qEnvironmentVariableIsSet("SETUP_ASSISTANT_SELFUPDATE")) {
|
if (qEnvironmentVariableIsSet("SNIGDHAOS_ASSISTANT_SELFUPDATE")) {
|
||||||
updateState(State::SELECT);
|
updateState(State::SELECT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ void SnigdhaOSAssistant::doUpdate(){
|
|||||||
QTemporaryFile* file = new QTemporaryFile(this);
|
QTemporaryFile* file = new QTemporaryFile(this);
|
||||||
file->open();
|
file->open();
|
||||||
file->setAutoRemove(true);
|
file->setAutoRemove(true);
|
||||||
process->start("/usr/bin/gnome-terminal", QStringList() << QString("sudo pacman -Syyu" + file->fileName() + "\"; read -p 'Press enter to exit'"));
|
process->start("/usr/lib/snigdhaos/launch-terminal", QStringList() << QString("sudo pacman -Syyu 2>&1 && rm \"" + file->fileName() + "\"; read -p 'Press enter to exit'"));
|
||||||
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process, file](int exitcode, QProcess::ExitStatus status) {
|
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process, file](int exitcode, QProcess::ExitStatus status) {
|
||||||
process->deleteLater();
|
process->deleteLater();
|
||||||
file->deleteLater();
|
file->deleteLater();
|
||||||
@@ -140,7 +140,7 @@ void SnigdhaOSAssistant::doApply(){
|
|||||||
setupFile->close();
|
setupFile->close();
|
||||||
|
|
||||||
auto process = new QProcess(this);
|
auto process = new QProcess(this);
|
||||||
process->start("/usr/bin/gnome-terminal", QStringList() << QString("/usr/lib/snigdhaos-assistant/apply.sh \"") + prepareFile->fileName() + "\" \"" + packagesFile->fileName() + "\" \"" + setupFile->fileName() + "\"");
|
process->start("/usr/lib/snigdhaos/launch-terminal", QStringList() << QString("/usr/lib/snigdhaos-assistant/apply.sh \"") + prepareFile->fileName() + "\" \"" + packagesFile->fileName() + "\" \"" + setupFile->fileName() + "\"");
|
||||||
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process, prepareFile, packagesFile, setupFile](int exitcode, QProcess::ExitStatus status) {
|
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process, prepareFile, packagesFile, setupFile](int exitcode, QProcess::ExitStatus status) {
|
||||||
process->deleteLater();
|
process->deleteLater();
|
||||||
prepareFile->deleteLater();
|
prepareFile->deleteLater();
|
||||||
@@ -148,44 +148,44 @@ void SnigdhaOSAssistant::doApply(){
|
|||||||
setupFile->deleteLater();
|
setupFile->deleteLater();
|
||||||
|
|
||||||
if (exitcode == 0 && !packagesFile->exists()) {
|
if (exitcode == 0 && !packagesFile->exists()) {
|
||||||
updateState(State::SUCCESS);
|
updateState(State::SELECT);
|
||||||
} else {
|
} else {
|
||||||
updateState(State::APPLY_RETRY);
|
updateState(State::APPLY_RETRY);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnigdhaOSAssistant::doNvidiaCheck(){
|
// void SnigdhaOSAssistant::doNvidiaCheck(){
|
||||||
auto process = new QProcess(this);
|
// auto process = new QProcess(this);
|
||||||
process->start("mhwd", QStringList() << "-li"
|
// process->start("mhwd", QStringList() << "-li"
|
||||||
<< "--pci");
|
// << "--pci");
|
||||||
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process](int exitcode, QProcess::ExitStatus status) {
|
// connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process](int exitcode, QProcess::ExitStatus status) {
|
||||||
process->deleteLater();
|
// process->deleteLater();
|
||||||
if (exitcode == 0 && !QString(process->readAllStandardOutput()).contains("nvidia")) {
|
// if (exitcode == 0 && !QString(process->readAllStandardOutput()).contains("nvidia")) {
|
||||||
auto process2 = new QProcess(this);
|
// auto process2 = new QProcess(this);
|
||||||
process2->start("mhwd", QStringList() << "-l"
|
// process2->start("mhwd", QStringList() << "-l"
|
||||||
<< "--pci");
|
// << "--pci");
|
||||||
connect(process2, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process2](int exitcode, QProcess::ExitStatus status) {
|
// connect(process2, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process2](int exitcode, QProcess::ExitStatus status) {
|
||||||
process2->deleteLater();
|
// process2->deleteLater();
|
||||||
if (exitcode == 0 && QString(process2->readAllStandardOutput()).contains("nvidia"))
|
// if (exitcode == 0 && QString(process2->readAllStandardOutput()).contains("nvidia"))
|
||||||
updateState(State::NVIDIA);
|
// updateState(State::NVIDIA);
|
||||||
else
|
// else
|
||||||
updateState(State::SELECT);
|
// updateState(State::SELECT);
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
updateState(State::SELECT);
|
// updateState(State::SELECT);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
void SnigdhaOSAssistant::doNvidiaApply(){
|
// void SnigdhaOSAssistant::doNvidiaApply(){
|
||||||
auto process = new QProcess(this);
|
// auto process = new QProcess(this);
|
||||||
process->start("/usr/bin/gnome-terminal", QStringList() << "sudo mhwd -a pci nonfree 0300; echo; read -p 'Press enter to exit'");
|
// process->start("/usr/lib/snigdhaos/launch-terminal", QStringList() << "sudo mhwd -a pci nonfree 0300; echo; read -p 'Press enter to exit'");
|
||||||
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process](int exitcode, QProcess::ExitStatus status) {
|
// connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this, process](int exitcode, QProcess::ExitStatus status) {
|
||||||
process->deleteLater();
|
// process->deleteLater();
|
||||||
updateState(State::SELECT);
|
// updateState(State::SELECT);
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
void SnigdhaOSAssistant::populateSelectWidget(){
|
void SnigdhaOSAssistant::populateSelectWidget(){
|
||||||
if (ui->selectWidget_tabs->count() > 1)
|
if (ui->selectWidget_tabs->count() > 1)
|
||||||
@@ -280,21 +280,21 @@ void SnigdhaOSAssistant::updateState(State state){
|
|||||||
ui->textStackedWidget->setCurrentWidget(ui->textWidget_updateRetry);
|
ui->textStackedWidget->setCurrentWidget(ui->textWidget_updateRetry);
|
||||||
ui->textWidget_buttonBox->setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No);
|
ui->textWidget_buttonBox->setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No);
|
||||||
break;
|
break;
|
||||||
case State::NVIDIA_CHECK:
|
// case State::NVIDIA_CHECK:
|
||||||
ui->mainStackedWidget->setCurrentWidget(ui->waitingWidget);
|
// ui->mainStackedWidget->setCurrentWidget(ui->waitingWidget);
|
||||||
ui->waitingWidget_text->setText("Checking for NVIDIA drivers...");
|
// ui->waitingWidget_text->setText("Checking for NVIDIA drivers...");
|
||||||
doNvidiaCheck();
|
// doNvidiaCheck();
|
||||||
break;
|
// break;
|
||||||
case State::NVIDIA:
|
// case State::NVIDIA:
|
||||||
ui->mainStackedWidget->setCurrentWidget(ui->textWidget);
|
// ui->mainStackedWidget->setCurrentWidget(ui->textWidget);
|
||||||
ui->textStackedWidget->setCurrentWidget(ui->textWidget_nvidia);
|
// ui->textStackedWidget->setCurrentWidget(ui->textWidget_nvidia);
|
||||||
ui->textWidget_buttonBox->setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No);
|
// ui->textWidget_buttonBox->setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No);
|
||||||
break;
|
// break;
|
||||||
case State::NVIDIA_APPLY:
|
// case State::NVIDIA_APPLY:
|
||||||
ui->mainStackedWidget->setCurrentWidget(ui->waitingWidget);
|
// ui->mainStackedWidget->setCurrentWidget(ui->waitingWidget);
|
||||||
ui->waitingWidget_text->setText("Installing NVIDIA drivers...");
|
// ui->waitingWidget_text->setText("Installing NVIDIA drivers...");
|
||||||
doNvidiaApply();
|
// doNvidiaApply();
|
||||||
break;
|
// break;
|
||||||
case State::QUIT:
|
case State::QUIT:
|
||||||
ui->mainStackedWidget->setCurrentWidget(ui->textWidget);
|
ui->mainStackedWidget->setCurrentWidget(ui->textWidget);
|
||||||
ui->textStackedWidget->setCurrentWidget(ui->textWidget_quit);
|
ui->textStackedWidget->setCurrentWidget(ui->textWidget_quit);
|
||||||
@@ -325,7 +325,7 @@ void SnigdhaOSAssistant::updateState(State state){
|
|||||||
|
|
||||||
void SnigdhaOSAssistant::updateState(QString state){
|
void SnigdhaOSAssistant::updateState(QString state){
|
||||||
if (state == "POST_UPDATE")
|
if (state == "POST_UPDATE")
|
||||||
updateState(State::NVIDIA_CHECK);
|
updateState(State::SELECT);
|
||||||
else if (state == "UPDATE_RETRY")
|
else if (state == "UPDATE_RETRY")
|
||||||
updateState(State::UPDATE_RETRY);
|
updateState(State::UPDATE_RETRY);
|
||||||
else
|
else
|
||||||
@@ -354,12 +354,12 @@ void SnigdhaOSAssistant::on_textWidget_buttonBox_clicked(QAbstractButton* button
|
|||||||
updateState(State::INTERNET);
|
updateState(State::INTERNET);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case State::NVIDIA:
|
// case State::NVIDIA:
|
||||||
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Yes)
|
// if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Yes)
|
||||||
updateState(State::NVIDIA_APPLY);
|
// updateState(State::NVIDIA_APPLY);
|
||||||
else
|
// else
|
||||||
updateState(State::SELECT);
|
// updateState(State::SELECT);
|
||||||
return;
|
// return;
|
||||||
case State::APPLY_RETRY:
|
case State::APPLY_RETRY:
|
||||||
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Yes) {
|
if (ui->textWidget_buttonBox->standardButton(button) == QDialogButtonBox::Yes) {
|
||||||
updateState(State::APPLY);
|
updateState(State::APPLY);
|
||||||
|
@@ -28,9 +28,9 @@ public:
|
|||||||
INTERNET,
|
INTERNET,
|
||||||
UPDATE,
|
UPDATE,
|
||||||
UPDATE_RETRY,
|
UPDATE_RETRY,
|
||||||
NVIDIA_CHECK,
|
// NVIDIA_CHECK,
|
||||||
NVIDIA,
|
// NVIDIA,
|
||||||
NVIDIA_APPLY,
|
// NVIDIA_APPLY,
|
||||||
SELECT,
|
SELECT,
|
||||||
APPLY,
|
APPLY,
|
||||||
APPLY_RETRY,
|
APPLY_RETRY,
|
||||||
@@ -52,8 +52,8 @@ private:
|
|||||||
void doInternetUpRequest();
|
void doInternetUpRequest();
|
||||||
void doUpdate();
|
void doUpdate();
|
||||||
void doApply();
|
void doApply();
|
||||||
void doNvidiaCheck();
|
// void doNvidiaCheck();
|
||||||
void doNvidiaApply();
|
// void doNvidiaApply();
|
||||||
void populateSelectWidget();
|
void populateSelectWidget();
|
||||||
void populateSelectWidget(QString filename, QString label);
|
void populateSelectWidget(QString filename, QString label);
|
||||||
void updateState(State state);
|
void updateState(State state);
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QStackedWidget" name="mainStackedWidget">
|
<widget class="QStackedWidget" name="mainStackedWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="textWidget">
|
<widget class="QWidget" name="textWidget">
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
@@ -30,12 +30,15 @@
|
|||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
|
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="centerButtons">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QStackedWidget" name="textStackedWidget">
|
<widget class="QStackedWidget" name="textStackedWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>4</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="textWidget_welcome">
|
<widget class="QWidget" name="textWidget_welcome">
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
@@ -48,7 +51,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p><span style=" font-size:24pt;">Welcome to Snigdha OS!</span><br/>This interactive assistant will help you set up your system to your wishes.</p><p>Before the setup assistant can continue, initial system updates have to be applied and the Snigdha OS Assistant updated.<br/>Make sure you have a working internet connection before you continue.</p></body></html></string>
|
<string><html><head/><body><p><span style=" font-size:24pt;">Welcome to <b>Snigdha OS!</b>😊</span><br/><b>Snigdha OS Assistant</b> will help you set up your system to your wishes.</p><p>Before the Snigdha OS Assistant can continue, initial system updates have to be applied and the Snigdha OS Assistant is updated.<br/>Make sure you have a working internet connection before you continue.</p></br>This application is inspired from <b>Garuda Linux</b></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textFormat">
|
<property name="textFormat">
|
||||||
<enum>Qt::TextFormat::RichText</enum>
|
<enum>Qt::TextFormat::RichText</enum>
|
||||||
@@ -77,7 +80,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p><span style=" font-size:20pt;">Update failed!</span><br/>System update failed. Try again?</p><p><a href="https://forum.snigdhaos.org"><span style=" text-decoration: underline; color:#754ffe;">Visit the Snigdha OS Forum</span></a> if further issues occour.<br/>Finishing this update via the Snigdha OS Assistant is highly recommended in order to apply release-specific fixes.</p></body></html></string>
|
<string><html><head/><body><p><span style=" font-size:20pt;">Update failed!😒</span><br/>System update failed. Try again?😬</p><p><a href="https://forum.snigdhaos.org"><span style=" text-decoration: underline; color:#754ffe;">Visit the Snigdha OS Forum</span></a> if further issues occour.<br/>Finishing this update via the Snigdha OS Assistant is highly recommended in order to apply release-specific fixes.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textFormat">
|
<property name="textFormat">
|
||||||
<enum>Qt::TextFormat::RichText</enum>
|
<enum>Qt::TextFormat::RichText</enum>
|
||||||
@@ -173,7 +176,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p><span style=" font-size:20pt;">Success!</span><br/>Your system is set up and ready to go!</p><p><a href="https://forum.snigdhais.org"><span style=" text-decoration: underline; color:#754ffe;">Visit the Snigdha OS Forum</span></a> if issues occour.<br/><a href="https://snigdhaos.org/"><span style=" text-decoration: underline; color:#754ffe;">Snigdha OS Documentation<br/></span></a><a href="https://wiki.archlinux.org/"><span style=" text-decoration: underline; color:#754ffe;">Arch Linux Wiki</span></a></p></body></html></string>
|
<string><html><head/><body><p><span style=" font-size:20pt;">Success!😎</span><br/>Your system is set up and ready to go!</p><p><a href="https://forum.snigdhais.org"><span style=" text-decoration: underline; color:#754ffe;">Visit the Snigdha OS Forum</span></a> if issues occour.<br/><a href="https://snigdhaos.org/"><span style=" text-decoration: underline; color:#754ffe;">Snigdha OS Documentation<br/></span></a><a href="https://wiki.archlinux.org/"><span style=" text-decoration: underline; color:#754ffe;">Arch Linux Wiki</span></a></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textFormat">
|
<property name="textFormat">
|
||||||
<enum>Qt::TextFormat::RichText</enum>
|
<enum>Qt::TextFormat::RichText</enum>
|
||||||
@@ -205,7 +208,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p><span style=" font-size:20pt;">Before you go</span></p><p>You can restart the setup assistant at any time.<br/>Finishing the Snigdha OS Assistant is recommended in order to apply release-specific fixes.</p><p><a href="https://forum.snigdhaos.org"><span style=" text-decoration: underline; color:#754ffe;">Visit the Snigdha OS Forum</span></a> if issues occour.<br/><a href="https://snigdhaos.org/documentation/"><span style=" text-decoration: underline; color:#754ffe;">Snigdha OS Documentation<br/></span></a><a href="https://wiki.archlinux.org/"><span style=" text-decoration: underline; color:#754ffe;">Arch Linux Wiki</span></a></p></body></html></string>
|
<string><html><head/><body><p><span style=" font-size:20pt;">Before you go🧸</span></p><p>You can restart the Snigdha OS Assistant at any time.<br/>Finishing the Snigdha OS Assistant is recommended in order to apply release-specific fixes.</p><p><a href="https://forum.snigdhaos.org"><span style=" text-decoration: underline; color:#754ffe;">Visit the Snigdha OS Forum</span></a> if issues occour.<br/><a href="https://snigdhaos.org/documentation/"><span style=" text-decoration: underline; color:#754ffe;">Snigdha OS Documentation<br/></span></a><a href="https://wiki.archlinux.org/"><span style=" text-decoration: underline; color:#754ffe;">Arch Linux Wiki</span></a></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textFormat">
|
<property name="textFormat">
|
||||||
<enum>Qt::TextFormat::RichText</enum>
|
<enum>Qt::TextFormat::RichText</enum>
|
||||||
@@ -321,7 +324,6 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="packages" stdset="0">
|
<property name="packages" stdset="0">
|
||||||
<stringlist notr="true">
|
<stringlist notr="true">
|
||||||
<string>garuda-blackarch</string>
|
|
||||||
<string>blackarch-keyring</string>
|
<string>blackarch-keyring</string>
|
||||||
<string>blackarch-menus</string>
|
<string>blackarch-menus</string>
|
||||||
<string>blackarch-mirrorlist</string>
|
<string>blackarch-mirrorlist</string>
|
||||||
|
@@ -9,7 +9,7 @@ echo ""
|
|||||||
echo "Installing packages.."
|
echo "Installing packages.."
|
||||||
echo ""
|
echo ""
|
||||||
installable_packages=$(comm -12 <(pacman -Slq | sort) <(sed s/\\s/\\n/g - <$2 | sort))
|
installable_packages=$(comm -12 <(pacman -Slq | sort) <(sed s/\\s/\\n/g - <$2 | sort))
|
||||||
sudo pacman -S --needed $installable_packages && rm $2 || { read -p "Error! Press enter to return to setup assistant."; exit; }
|
sudo pacman -S --needed $installable_packages && rm $2 || { read -p "Error! Press enter to return to Snigdha OS Assistant."; exit; }
|
||||||
|
|
||||||
if [ -e "$3" ]; then
|
if [ -e "$3" ]; then
|
||||||
echo ""
|
echo ""
|
||||||
@@ -19,4 +19,4 @@ if [ -e "$3" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Press enter to return to setup assistant."
|
read -p "Press enter to return to Snigdha OS Assistant."
|
||||||
|
Reference in New Issue
Block a user