Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #43 from gaining/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
gaining authored Jan 27, 2018
2 parents b53aa87 + 182df23 commit af65420
Show file tree
Hide file tree
Showing 29 changed files with 1,826 additions and 319 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Resetter v2.0.0-stable
# Resetter v2.1.0-stable
![alt tag](https://github.com/gaining/Resetter/blob/master/Resetter/resetter-screenshot.png)

It is an application built with python and pyqt that will help to reset an Ubuntu, Linux-Mint, and some other distros to stock, without having to manually re-install by using a live usb/cd/dvd image. For the list of supported distros, please see the *Officially supported distros* section.
Expand All @@ -8,15 +8,16 @@ Download the deb files found [here](https://github.com/gaining/Resetter/releases

1. `sudo apt install gdebi`
2. `sudo gdebi add-apt-key_1.0-0.5_all.deb`
3. `sudo gdebi resetter_2.0.0-stable_all.deb`
3. `sudo gdebi resetter_2.1.0-stable_all.deb`

# Official video tutorial - courtesy of *Byte of Linux*

[![Video Tutorial](http://i3.ytimg.com/vi/PSmzWdGrs1M/maxresdefault.jpg)](https://youtu.be/PSmzWdGrs1M "Resetter Tutorial")


# Status
- Version 2.0.0 adds support for Linux Mint 18.3
- Version 2.1.0 adds support for Deepin 15.5 and opens the possibility to easily make any other debian based distro compatible by using [Resetter Helper](https://github.com/gaining/ResetterHelper)
- then on the terminal, run the following commands:
- The software is stable. Feedback will be greatly appreciated.
- Working Project: Resetter-cli, a version of resetter that runs terminally.
- Please check the [changelog](https://github.com/gaining/Resetter/blob/master/changelog) for more details.
Expand Down
11 changes: 5 additions & 6 deletions Resetter/usr/lib/resetter/AboutPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from PyQt4 import QtGui, QtCore
from LicenceDialog import Licence
from Tools import UsefulTools

class About(QtGui.QDialog):
def __init__(self, parent=None):
Expand Down Expand Up @@ -30,12 +31,12 @@ def __init__(self, parent=None):
version_label = QtGui.QLabel(self)
version_label.setAlignment(QtCore.Qt.AlignCenter)
about_label.setAlignment(QtCore.Qt.AlignCenter)
cr_text = "(c) 2017 all rights reserved"
cr_text = u"© 2018 Jonathan Soivilus"
desc_text = "Built With PyQt\n\n " \
"This is a great utility software that will help you reset your linux installation its stock state" \
"among other things."
self.version = '2.0.0'
version_text = "Version: {}-stable".format(self.version)
" among other things.".decode()
version = UsefulTools().getVersion()
version_text = "Version: {}-stable".format(version)
donate_text = 'If you liked my project, please ' \
'<a href="https://github.com/gaining/Resetter/blob/master/DONATE.md">Donate </a>'
more_text = 'To find out more about this project, please visit my github:' \
Expand Down Expand Up @@ -63,8 +64,6 @@ def __init__(self, parent=None):
self.verticalLayout.addWidget(self.close_button, 0, QtCore.Qt.AlignRight)
self.verticalLayout.addWidget(self.liscence_button, 0, QtCore.Qt.AlignRight)

def getVersion(self):
return self.version

def showLicence(self):
lic = Licence(self)
Expand Down
21 changes: 6 additions & 15 deletions Resetter/usr/lib/resetter/Account.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
# -*- coding: utf-8 -*-

from PyQt4 import QtGui, QtCore
import crypt
import random
import logging
from Tools import UsefulTools


class AccountDialog(QtGui.QDialog):
Expand Down Expand Up @@ -66,21 +65,15 @@ def __init__(self, parent=None):
self.user = 'default'
self.password = 'NewLife3!'

def salt(self):
saltchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
return random.choice(saltchars) + random.choice(saltchars)

def custom_user(self):
self.user = self.textEditUser.text()
self.password = self.textEditPassword.text()
hashed_pw = crypt.crypt(str(self.password), "$6$" + self.salt())
if self.complexityChecker():
new_user = '/usr/lib/resetter/data/scripts/new-user.sh'
custom_user = '/usr/lib/resetter/data/scripts/custom_user.sh'
with open(new_user, "r") as f, open(custom_user, 'w') as out:
for line in f:
if line.startswith('PASSWORD'):
# line = ("PASSWORD=""\'{}\'\n".format(hashed_pw))
line = ("PASSWORD=""\'{}\'\n".format(self.password))
if line.startswith('USERNAME'):
line = ("USERNAME=""\'{}\'\n".format(self.user))
Expand All @@ -93,9 +86,9 @@ def complexityChecker(self):
num_count = 0
good_length = False
for s in password:
if any(s.isupper() for x in self.password):
if s.isupper():
upper_count += 1
if any(s.isdigit() for x in self.password):
if s.isdigit():
num_count += 1
if len(password) >= 8:
good_length = True
Expand All @@ -106,14 +99,12 @@ def complexityChecker(self):
return True

def showMessage(self):
msg = QtGui.QMessageBox(self)
msg.setWindowTitle('Password did not meet complexity requirements')
msg.setIcon(QtGui.QMessageBox.Warning)
msg.setText("Make sure that your password contains:\n"
title = 'Password did not meet complexity requirements'
text = ("Make sure that your password contains:\n"
"At least 8 characters\n"
"At least one number\n"
"At least one uppercase letter")
msg.exec_()
UsefulTools().showMessage(title, text, QtGui.QMessageBox.Warning)

def getUser(self):
return self.user
Expand Down
35 changes: 7 additions & 28 deletions Resetter/usr/lib/resetter/CustomApplyDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from Account import AccountDialog
from AptProgress import UIAcquireProgress, UIInstallProgress
from InstallMissingDialog import Install
from Tools import UsefulTools


class ProgressThread(QtCore.QThread):
Expand All @@ -22,9 +23,6 @@ def __init__(self, file_in, install):
self.cache.open()
self.file_in = file_in
self.isDone = False
self.error_msg = QtGui.QMessageBox()
self.error_msg.setIcon(QtGui.QMessageBox.Critical)
self.error_msg.setWindowTitle("Error")
self.logger = logging.getLogger(__name__)
self.logger.setLevel(logging.DEBUG)
handler = logging.FileHandler('/var/log/resetter/resetter.log')
Expand Down Expand Up @@ -112,9 +110,6 @@ def __init__(self, file_in, response, rsu, parent=None):
self.remaining = 0
self.no_show = False
self.setWindowTitle("Applying")
self.error_msg = QtGui.QMessageBox()
self.error_msg.setIcon(QtGui.QMessageBox.Critical)
self.error_msg.setWindowTitle("Error")
self.buttonCancel = QtGui.QPushButton()
self.buttonCancel.setText("Cancel")
self.buttonCancel.clicked.connect(self.finished)
Expand Down Expand Up @@ -365,33 +360,17 @@ def rebootMessage(self):

def showError(self, error, m_type):
self.movie.stop()
msg = QtGui.QMessageBox(self)
msg.setWindowTitle(m_type)
msg.setIcon(QtGui.QMessageBox.Critical)
msg.setText("Something went wrong, please check details.")
msg.setDetailedText(error)
msg.exec_()
UsefulTools().showMessage(m_type, "Something went wront, please check details.", QtGui.QMessageBox.Critical,
error)

def showMessage(self):
msg = QtGui.QMessageBox(self)
msg.setWindowTitle("Packages kept back")
msg.setIcon(QtGui.QMessageBox.Information)
msg.setText("These packages could cause problems if removed so they've been kept back.")
text = "\n".join(self.progressView.broken_list)
msg.setInformativeText(text)
msg.exec_()

def showUserInfo(self):
if not self.no_show:
msg = QtGui.QMessageBox(self)
msg.setWindowTitle("User Credentials")
msg.setIcon(QtGui.QMessageBox.Information)
msg.setText("Please use these credentials the next time you log-in")
msg.setInformativeText(
"USERNAME: <b>{}</b><br/> PASSWORD: <b>{}</b>".format(self.account.getUser(), self.account.getPassword()))
msg.setDetailedText("If you deleted your old user account, "
msg = "Please use these credentials the next time you log-in\n\n"
msginf = ("USERNAME: <b>{}</b><br/> PASSWORD: <b>{}</b>".format(self.account.getUser(), self.account.getPassword()))
msgd = ("If you deleted your old user account, "
"this account will be the only local user on your system")
msg.exec_()
UsefulTools().showMessage("User Credentials", msg + msginf, QtGui.QMessageBox.Information, msgd)
self.logger.info("Credential message info shown")
self.rebootMessage()
else:
Expand Down
12 changes: 7 additions & 5 deletions Resetter/usr/lib/resetter/CustomReset.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from PyQt4 import QtCore, QtGui
from CustomApplyDialog import Apply
from PackageView import AppView
from Tools import UsefulTools



class AppRemovalPage(QtGui.QWizardPage):
Expand Down Expand Up @@ -90,12 +92,9 @@ def toggleSwitch(self):
if self.switch is False:
self.switch = True
if self.count == 0: # show warning message only once
msg = QtGui.QMessageBox(self)
msg.setWindowTitle("Warning")
msg.setIcon(QtGui.QMessageBox.Warning)
msg.setText("Only use this option for single packages for which you're curious about. "
text = ("Only use this option for single packages for which you're curious about. "
"<strong>Do not use the <i>Select All</i> option while this is checked</strong>")
msg.exec_()
UsefulTools().showMessage("warning", text, QtGui.QMessageBox.Warning)
self.count += 1
else:
self.switch = False
Expand Down Expand Up @@ -168,7 +167,9 @@ def selectedAppsRemoval(self):
def closeCache(self):
self.cache.close()


class AppInstallPage(QtGui.QWizardPage):

def __init__(self, parent=None):
super(AppInstallPage, self).__init__(parent=parent)
self.setTitle('Packages to Install')
Expand Down Expand Up @@ -275,6 +276,7 @@ def selectedAppsInstall(self):


class UserRemovalPage(QtGui.QWizardPage):

def __init__(self, parent=None):
super(UserRemovalPage, self).__init__(parent)
self.setTitle('Delete Local users')
Expand Down
22 changes: 8 additions & 14 deletions Resetter/usr/lib/resetter/EasyInstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
import textwrap
from PyQt4 import QtCore, QtGui

from Tools import UsefulTools
from InstallMissingDialog import Install


Expand Down Expand Up @@ -167,11 +167,8 @@ def closeview(self):
self.close()

def alreadyInstalled(self, package):
msg = QtGui.QMessageBox(self)
msg.setWindowTitle("Package already installed")
msg.setIcon(QtGui.QMessageBox.Information)
msg.setText("{} is already on your system".format(package))
msg.exec_()
UsefulTools().showMessage("Package already installed ", "{} is already on your system".format(package),
QtGui.QMessageBox.Information)

def showMessage(self, package):
self.comboBox.clear()
Expand All @@ -183,11 +180,8 @@ def showMessage(self, package):
self.comboBox.addItem(p.shortname)
if self.comboBox.count() > 1:
self.comboBox.setVisible(True)
msg = QtGui.QMessageBox(self)
msg.setWindowTitle("Package not found")
msg.setIcon(QtGui.QMessageBox.Information)
msg.setText("The package that you've tried to add is not found in the cache")
msg.setDetailedText("If you've recently added a ppa containing this package, "
"please use [EasyPPA - refresh sources] feature, "
"then try adding the package again.")
msg.exec_()
msg = "The package that you've tried to add is not found in the cache"
msgd = "If you've recently added a ppa containing this package, "\
"please use [EasyPPA - refresh sources] feature, "\
"then try adding the package again."
UsefulTools().showMessage("Package not found", msg, QtGui.QMessageBox.Information, msgd)
30 changes: 8 additions & 22 deletions Resetter/usr/lib/resetter/EasyRepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from AptProgress import UIAcquireProgress
from PackageView import AppView
from Tools import UsefulTools


class EasyPPAInstall(QtGui.QDialog):
Expand Down Expand Up @@ -56,7 +57,7 @@ def __init__(self, parent=None):
self.verticalLayout.addWidget(self.table)
self.verticalLayout.addWidget(self.lbl1)
self.verticalLayout.addLayout(self.horizontalLayout2)
self.os_info = lsb_release.get_lsb_information()
self.os_info = lsb_release.get_distro_information()
self.sources = sourceslist.SourcesList()

self.aprogress = UIAcquireProgress(True)
Expand Down Expand Up @@ -240,15 +241,14 @@ def addPPA(self, ppa):
QtGui.QApplication.restoreOverrideCursor()
except Exception as e:
QtGui.QApplication.restoreOverrideCursor()
self.error_msg.setIcon(QtGui.QMessageBox.Critical)
self.error_msg.setText("Unable fetch PPA key")
self.error_msg.setDetailedText("Error: {}".format(e))
self.error_msg.exec_()
UsefulTools().showMessage("Unable to fetch PPA key", "Error: {}".format(e), QtGui.QMessageBox.Critical)
else:
self.successMessage()
UsefulTools().showMessage("PPA added", "This ppa has been successfully added to your sources list",
QtGui.QMessageBox.Information)
else:
self.showMessage()

UsefulTools().showMessage("PPA not compatible", "This PPA is not compatible with your system because it's "
"not available for {}".format(self.os_info['DESCRIPTION']),
QtGui.QMessageBox.Information)
def getTableData(self, sauce):
pasta = []
for i in sauce.select('tr'):
Expand All @@ -272,20 +272,6 @@ def showPackages(self, sauce):
available.show()
QtGui.QApplication.restoreOverrideCursor()

def showMessage(self):
msg = QtGui.QMessageBox(self)
msg.setWindowTitle("PPA not compatible")
msg.setIcon(QtGui.QMessageBox.Information)
msg.setText("This PPA is not compatible with your system because it's "
"not available for {}".format(self.os_info['DESCRIPTION']))
msg.exec_()

def successMessage(self):
msg = QtGui.QMessageBox(self)
msg.setWindowTitle("PPA added")
msg.setIcon(QtGui.QMessageBox.Information)
msg.setText("This ppa has been successfully added to your sources list")
msg.exec_()

if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
Expand Down
Loading

0 comments on commit af65420

Please sign in to comment.