update pmostools
This commit is contained in:
parent
d94b7727a7
commit
2a5dcc5bf8
Binary file not shown.
Binary file not shown.
|
@ -1,4 +1,3 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
import ttkbootstrap as ttk
|
import ttkbootstrap as ttk
|
||||||
#This will set the style to used for boostrap
|
#This will set the style to used for boostrap
|
||||||
#just change the name to what is needed for the
|
#just change the name to what is needed for the
|
||||||
|
|
|
@ -45,7 +45,7 @@ def center_screen():
|
||||||
|
|
||||||
def runxd():
|
def runxd():
|
||||||
"""Run the bash"""
|
"""Run the bash"""
|
||||||
cmd = "xfce4-terminal -e 'bash -c \"sudo xDaily -i\"' --title='xDaily by PeppermintOS' --icon=/usr/share/pixmaps/xd.png"
|
cmd = "xterm -e 'bash -c \"sudo xDaily -i\"' --title='xDaily by PeppermintOS' --icon=/usr/share/pixmaps/xd.png"
|
||||||
subprocess.Popen(cmd, shell=True)
|
subprocess.Popen(cmd, shell=True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ def hblock():
|
||||||
|
|
||||||
def hbon():
|
def hbon():
|
||||||
""" Turn on hblock """
|
""" Turn on hblock """
|
||||||
cmd = "xfce4-terminal -e 'bash -c \"hblock exit 0\";bash'"
|
cmd = "xterm -e 'bash -c \"hblock exit 0\";bash'"
|
||||||
subprocess.Popen(cmd, shell=True)
|
subprocess.Popen(cmd, shell=True)
|
||||||
hblock()
|
hblock()
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ def hbon():
|
||||||
|
|
||||||
def hboff():
|
def hboff():
|
||||||
""" Turn off hblock """
|
""" Turn off hblock """
|
||||||
cmd = "xfce4-terminal -e 'bash -c \"hblock -S none -D none exit 0\";bash'"
|
cmd = "xterm -e 'bash -c \"hblock -S none -D none exit 0\";bash'"
|
||||||
subprocess.Popen(cmd, shell=True)
|
subprocess.Popen(cmd, shell=True)
|
||||||
hblock()
|
hblock()
|
||||||
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
|
@ -54,7 +54,7 @@ def check_web_browsers():
|
||||||
# ***Install Packages***
|
# ***Install Packages***
|
||||||
def install_atril():
|
def install_atril():
|
||||||
""" Install atril """
|
""" Install atril """
|
||||||
cmd = 'xfce4-terminal -e "sudo apt install atril" \
|
cmd = 'xterm -e "sudo apt install atril" \
|
||||||
--title="Installing Atril Document Viewer" '
|
--title="Installing Atril Document Viewer" '
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
check_packages()
|
check_packages()
|
||||||
|
@ -62,7 +62,7 @@ def install_atril():
|
||||||
|
|
||||||
def install_parole():
|
def install_parole():
|
||||||
""" Install parole """
|
""" Install parole """
|
||||||
cmd = 'xfce4-terminal -e "sudo apt install parole" \
|
cmd = 'xterm -e "sudo apt install parole" \
|
||||||
--title="Installing Parole" '
|
--title="Installing Parole" '
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
check_packages()
|
check_packages()
|
||||||
|
@ -70,7 +70,7 @@ def install_parole():
|
||||||
|
|
||||||
def install_gufw():
|
def install_gufw():
|
||||||
""" Install gufw """
|
""" Install gufw """
|
||||||
cmd = 'xfce4-terminal -e "sudo apt install gufw" \
|
cmd = 'xterm -e "sudo apt install gufw" \
|
||||||
--title="Installing the Fire Wall" '
|
--title="Installing the Fire Wall" '
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
check_packages()
|
check_packages()
|
||||||
|
@ -78,7 +78,7 @@ def install_gufw():
|
||||||
|
|
||||||
def install_snap():
|
def install_snap():
|
||||||
""" Install install snap"""
|
""" Install install snap"""
|
||||||
cmd = 'xfce4-terminal -e "sudo apt install snapd" \
|
cmd = 'xterm -e "sudo apt install snapd" \
|
||||||
--title="Installing snap" '
|
--title="Installing snap" '
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
check_packages()
|
check_packages()
|
||||||
|
@ -86,7 +86,7 @@ def install_snap():
|
||||||
|
|
||||||
def install_flatpak():
|
def install_flatpak():
|
||||||
""" Install flatpak """
|
""" Install flatpak """
|
||||||
cmd = 'xfce4-terminal -e "sudo apt install flatpak" \
|
cmd = 'xterm -e "sudo apt install flatpak" \
|
||||||
--title="Installing flatpak" '
|
--title="Installing flatpak" '
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
check_packages()
|
check_packages()
|
||||||
|
@ -94,7 +94,7 @@ def install_flatpak():
|
||||||
|
|
||||||
def install_store():
|
def install_store():
|
||||||
""" Install gnome store"""
|
""" Install gnome store"""
|
||||||
cmd = 'xfce4-terminal -e "sudo apt install gnome-software" \
|
cmd = 'xterm -e "sudo apt install gnome-software" \
|
||||||
--title="Installing the gnome store" '
|
--title="Installing the gnome store" '
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
check_packages()
|
check_packages()
|
||||||
|
@ -102,7 +102,7 @@ def install_store():
|
||||||
|
|
||||||
def install_timeshift():
|
def install_timeshift():
|
||||||
""" Install timeshift"""
|
""" Install timeshift"""
|
||||||
cmd = 'xfce4-terminal -e "sudo apt install timeshift" \
|
cmd = 'xterm -e "sudo apt install timeshift" \
|
||||||
--title="Installing Timeshift" '
|
--title="Installing Timeshift" '
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
check_packages()
|
check_packages()
|
||||||
|
@ -111,7 +111,7 @@ def install_timeshift():
|
||||||
# ***Web browser defs***
|
# ***Web browser defs***
|
||||||
def install_firefox():
|
def install_firefox():
|
||||||
""" Install firefox-esr """
|
""" Install firefox-esr """
|
||||||
cmd = 'xfce4-terminal -e "sudo apt install firefox-esr" \
|
cmd = 'xterm -e "sudo apt install firefox-esr" \
|
||||||
--title="Installing Fire Fox ESR" '
|
--title="Installing Fire Fox ESR" '
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
check_web_browsers()
|
check_web_browsers()
|
||||||
|
@ -119,7 +119,7 @@ def install_firefox():
|
||||||
|
|
||||||
def install_konqueror():
|
def install_konqueror():
|
||||||
""" Install konqueror """
|
""" Install konqueror """
|
||||||
cmd = 'xfce4-terminal -e "sudo apt install konqueror" \
|
cmd = 'xterm -e "sudo apt install konqueror" \
|
||||||
--title="Installing Konqueror" '
|
--title="Installing Konqueror" '
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
check_web_browsers()
|
check_web_browsers()
|
||||||
|
@ -127,7 +127,7 @@ def install_konqueror():
|
||||||
|
|
||||||
def install_epiphany():
|
def install_epiphany():
|
||||||
""" Install epiphany-browser """
|
""" Install epiphany-browser """
|
||||||
cmd = 'xfce4-terminal -e "sudo apt install epiphany-browser" \
|
cmd = 'xterm -e "sudo apt install epiphany-browser" \
|
||||||
--title="Installing Gnome Web" '
|
--title="Installing Gnome Web" '
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
check_web_browsers()
|
check_web_browsers()
|
||||||
|
@ -135,7 +135,7 @@ def install_epiphany():
|
||||||
|
|
||||||
def install_tor():
|
def install_tor():
|
||||||
""" Install torbrowser-launcher """
|
""" Install torbrowser-launcher """
|
||||||
cmd = 'xfce4-terminal -e "sudo apt install torbrowser-launcher" \
|
cmd = 'xterm -e "sudo apt install torbrowser-launcher" \
|
||||||
--title="Installing Tor" '
|
--title="Installing Tor" '
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
check_web_browsers()
|
check_web_browsers()
|
||||||
|
@ -143,7 +143,7 @@ def install_tor():
|
||||||
|
|
||||||
def install_qute():
|
def install_qute():
|
||||||
""" Install install qutebrowser"""
|
""" Install install qutebrowser"""
|
||||||
cmd = 'xfce4-terminal -e "sudo apt install qutebrowser" \
|
cmd = 'xterm -e "sudo apt install qutebrowser" \
|
||||||
--title="Installing QuteBrowser" '
|
--title="Installing QuteBrowser" '
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
check_web_browsers()
|
check_web_browsers()
|
||||||
|
@ -151,7 +151,7 @@ def install_qute():
|
||||||
|
|
||||||
def install_chromium():
|
def install_chromium():
|
||||||
""" Install chromium"""
|
""" Install chromium"""
|
||||||
cmd = 'xfce4-terminal -e "sudo apt install chromium" \
|
cmd = 'xterm -e "sudo apt install chromium" \
|
||||||
--title="Installing Chromium" '
|
--title="Installing Chromium" '
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
check_web_browsers()
|
check_web_browsers()
|
||||||
|
@ -159,7 +159,7 @@ def install_chromium():
|
||||||
|
|
||||||
def install_falkon():
|
def install_falkon():
|
||||||
""" Install falkon"""
|
""" Install falkon"""
|
||||||
cmd = 'xfce4-terminal -e "sudo apt install falkon" \
|
cmd = 'xterm -e "sudo apt install falkon" \
|
||||||
--title="Installing falkom" '
|
--title="Installing falkom" '
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
check_web_browsers()
|
check_web_browsers()
|
||||||
|
|
|
@ -0,0 +1,169 @@
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
import shutil
|
||||||
|
import tkinter as tk
|
||||||
|
import ttkbootstrap as ttk
|
||||||
|
import upgradeconf
|
||||||
|
|
||||||
|
# setting up window
|
||||||
|
pepupdate = upgradeconf.bbstyle
|
||||||
|
pepupdate.resizable(False, False)
|
||||||
|
WINDOW_HEIGHT = 230
|
||||||
|
WINDOW_WIDTH = 370
|
||||||
|
|
||||||
|
# This will get the logged in user
|
||||||
|
gusr = os.getlogin()
|
||||||
|
spath = "/home/" + gusr
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Source things
|
||||||
|
fpath = "/etc/apt/sources.list"
|
||||||
|
text = "bullseye"
|
||||||
|
settext = "bookworm"
|
||||||
|
|
||||||
|
|
||||||
|
def setsource(fpath, text, settext, flags=0):
|
||||||
|
""" Replace the source code names """
|
||||||
|
with open(fpath,"r+") as file:
|
||||||
|
file_contents = file.read()
|
||||||
|
txt_pattern = re.compile(re.escape(text), flags)
|
||||||
|
file_contents = txt_pattern.sub(settext, file_contents)
|
||||||
|
file.seek(0)
|
||||||
|
file.truncate()
|
||||||
|
file.write(file_contents)
|
||||||
|
|
||||||
|
|
||||||
|
def movepins():
|
||||||
|
""" Check if the Pins exists if they do move them
|
||||||
|
to backup folder
|
||||||
|
"""
|
||||||
|
pin_path = "/etc/apt/preferences.d/99pin-unstable"
|
||||||
|
bkup_path= spath + '/pin_backup'
|
||||||
|
if os.path.exists(pin_path):
|
||||||
|
os.mkdir(bkup_path)
|
||||||
|
print('Pin backup folder made')
|
||||||
|
shutil.copy(pin_path, bkup_path)
|
||||||
|
print('Pin file copied')
|
||||||
|
os.remove(pin_path)
|
||||||
|
print('Pin file deleted')
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def upgrade_cmd():
|
||||||
|
# Put the commands together
|
||||||
|
set_terminal = 'xfce4-terminal -T \"Upgrade Peppermint" '
|
||||||
|
call_bash = '-e \"bash -c '
|
||||||
|
sudo_var = 'sudo apt '
|
||||||
|
update_cmd = sudo_var + 'update'
|
||||||
|
upgrade_cmd = sudo_var + 'upgrade'
|
||||||
|
full_cmd = sudo_var + 'full-upgrade'
|
||||||
|
clean_cmd = sudo_var + 'clean'
|
||||||
|
remove_cmd = sudo_var + 'autoremove'
|
||||||
|
reboot_cmd = sudo_var + 'shutdown -r now'
|
||||||
|
installer_remove = sudo_var + 'remove calamares'
|
||||||
|
installer_settings = sudo_var + 'remove calamares-settings-debian'
|
||||||
|
xDaily = 'sudo xDaily'
|
||||||
|
# Commands to run
|
||||||
|
prep_go = (set_terminal +
|
||||||
|
call_bash + "'" +
|
||||||
|
update_cmd + ' && ' +
|
||||||
|
upgrade_cmd + ' && ' +
|
||||||
|
full_cmd + "'" + '"'
|
||||||
|
)
|
||||||
|
|
||||||
|
final_go = (set_terminal +
|
||||||
|
call_bash + "'" +
|
||||||
|
clean_cmd + ' && ' +
|
||||||
|
update_cmd + ' && ' +
|
||||||
|
upgrade_cmd + ' && ' +
|
||||||
|
full_cmd + ' && ' +
|
||||||
|
remove_cmd + ' && ' +
|
||||||
|
#reboot_cmd + ' && ' +
|
||||||
|
installer_remove + ' && ' +
|
||||||
|
installer_settings + ' && ' +
|
||||||
|
xDaily + "'" + '"'
|
||||||
|
)
|
||||||
|
# Run the Commands in order
|
||||||
|
subprocess.Popen(prep_go, shell=True)
|
||||||
|
setsource(fpath, text, settext)
|
||||||
|
movepins()
|
||||||
|
subprocess.Popen(final_go, shell=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def center_screen():
|
||||||
|
""" gets the coordinates of the center of the screen """
|
||||||
|
screen_width = pepupdate.winfo_screenwidth()
|
||||||
|
screen_height = pepupdate.winfo_screenheight()
|
||||||
|
# Coordinates of the upper left corner of the window to make the window
|
||||||
|
# appear in the center
|
||||||
|
x_cordinate = int((screen_width / 2) - (WINDOW_WIDTH / 2))
|
||||||
|
y_cordinate = int((screen_height / 2) - (WINDOW_HEIGHT / 2))
|
||||||
|
pepupdate.geometry("{}x{}+{}+{}".format(WINDOW_WIDTH,
|
||||||
|
WINDOW_HEIGHT, x_cordinate, y_cordinate))
|
||||||
|
def ubase():
|
||||||
|
"""Check to see what base is being loaded"""
|
||||||
|
if os.path.exists("/etc/devuan_version"):
|
||||||
|
pepupdate.title(welconf.DEVUAN_TITLE)
|
||||||
|
lpath = upgradeconf.devcandy
|
||||||
|
l_g = tk.Label(pepupdate, image=lpath, width=128, height=128, borderwidth=0)
|
||||||
|
l_g.grid(
|
||||||
|
columnspan=2,
|
||||||
|
row=0,
|
||||||
|
column=0,
|
||||||
|
ipadx=5,
|
||||||
|
ipady=5,
|
||||||
|
padx=5,
|
||||||
|
pady=5)
|
||||||
|
elif os.path.exists("/etc/debian_version"):
|
||||||
|
pepupdate.title(upgradeconf.DEBIAN_TITLE)
|
||||||
|
|
||||||
|
# Set the window icon
|
||||||
|
pepupdate.tk.call('wm', 'iconphoto', pepupdate._w, tk.PhotoImage(
|
||||||
|
file='/usr/share/pixmaps/peppermint-old.png'))
|
||||||
|
|
||||||
|
|
||||||
|
codename_label = ttk.Label(pepupdate, text="Enter the Codename to upgrade to:")
|
||||||
|
codename_label.place(x=10, y=20)
|
||||||
|
|
||||||
|
examples_label = ttk.Label(pepupdate, text='** For example: bookworm, bullseye,'
|
||||||
|
' stretch **', bootstyle="danger")
|
||||||
|
examples_label.place(x=10, y=80)
|
||||||
|
|
||||||
|
warning_label = ttk.Label(pepupdate, text='Make sure to backup your data!',
|
||||||
|
bootstyle="warning")
|
||||||
|
warning_label.place(x=10, y=170)
|
||||||
|
|
||||||
|
code_value = tk.Text(pepupdate, height=1, width=25)
|
||||||
|
code_value.place(x=10, y=45)
|
||||||
|
|
||||||
|
|
||||||
|
btnsv = ttk.Button(
|
||||||
|
pepupdate,
|
||||||
|
text="Upgrade",
|
||||||
|
cursor="hand2",
|
||||||
|
bootstyle="light-outline",
|
||||||
|
width=8,
|
||||||
|
command=upgrade_cmd
|
||||||
|
)
|
||||||
|
btnsv.place(x=10, y=110)
|
||||||
|
|
||||||
|
btncl = ttk.Button(
|
||||||
|
pepupdate,
|
||||||
|
text="Cancel",
|
||||||
|
cursor="hand2",
|
||||||
|
bootstyle="light-outline",
|
||||||
|
width=8
|
||||||
|
)
|
||||||
|
btncl.place(x=120, y=110)
|
||||||
|
|
||||||
|
|
||||||
|
ubase()
|
||||||
|
# call Center screen
|
||||||
|
center_screen()
|
||||||
|
# run the application
|
||||||
|
pepupdate.mainloop()
|
|
@ -0,0 +1,32 @@
|
||||||
|
"""
|
||||||
|
* Author: "PepDebian(peppermintosteam@proton.me)
|
||||||
|
*
|
||||||
|
* License: SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*
|
||||||
|
* this files should be used for the over all style and design of
|
||||||
|
* the Welcome Screen
|
||||||
|
"""
|
||||||
|
from tkinter import PhotoImage
|
||||||
|
import ttkbootstrap as ttk
|
||||||
|
import os
|
||||||
|
|
||||||
|
# This will set the style to used for boostrap
|
||||||
|
# just change the name to what is needed for the
|
||||||
|
# the system
|
||||||
|
bbstyle = ttk.Window(themename="darkly")
|
||||||
|
|
||||||
|
# set the title of the window
|
||||||
|
DEBIAN_TITLE = "Upgrade Peppermint - (Debian)"
|
||||||
|
DEVUAN_TITLE = "U@grade Peppermint - (Devuan)"
|
||||||
|
|
||||||
|
# This will get the logged in user
|
||||||
|
gusr = os.getlogin()
|
||||||
|
spath = "/home/" + gusr + "/.local/share/pmostools/peptools"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,16 +24,6 @@ def wbase():
|
||||||
"""Check to see what base is being loaded"""
|
"""Check to see what base is being loaded"""
|
||||||
if os.path.exists("/etc/devuan_version"):
|
if os.path.exists("/etc/devuan_version"):
|
||||||
pewel.title(welconf.DEVUAN_TITLE)
|
pewel.title(welconf.DEVUAN_TITLE)
|
||||||
lpath = welconf.devcandy
|
|
||||||
l_g = tk.Label(pewel, image=lpath, width=128, height=128, borderwidth=0)
|
|
||||||
l_g.grid(
|
|
||||||
columnspan=2,
|
|
||||||
row=0,
|
|
||||||
column=0,
|
|
||||||
ipadx=5,
|
|
||||||
ipady=5,
|
|
||||||
padx=5,
|
|
||||||
pady=5)
|
|
||||||
elif os.path.exists("/etc/debian_version"):
|
elif os.path.exists("/etc/debian_version"):
|
||||||
pewel.title(welconf.DEBIAN_TITLE)
|
pewel.title(welconf.DEBIAN_TITLE)
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ from tkinter import PhotoImage
|
||||||
import ttkbootstrap as ttk
|
import ttkbootstrap as ttk
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# This will set the style to used for boostrap
|
# This will set the style to used for bootstrap
|
||||||
# just change the name to what is needed for the
|
# just change the name to what is needed for the
|
||||||
# the system
|
# the system
|
||||||
bbstyle = ttk.Window(themename="darkly")
|
bbstyle = ttk.Window(themename="darkly")
|
||||||
|
@ -19,14 +19,6 @@ bbstyle = ttk.Window(themename="darkly")
|
||||||
DEBIAN_TITLE = "Welcome to Peppermint - (Debian)"
|
DEBIAN_TITLE = "Welcome to Peppermint - (Debian)"
|
||||||
DEVUAN_TITLE = "Welcome to Peppermint - (Devuan)"
|
DEVUAN_TITLE = "Welcome to Peppermint - (Devuan)"
|
||||||
|
|
||||||
# set the logo for the screen
|
|
||||||
#debcandy = PhotoImage(file='/home/tommy/Developer/bubbles/iso_configs/pmostools/peptools/images/'
|
|
||||||
# 'pep-logo-deb.png'
|
|
||||||
# )
|
|
||||||
#devcandy = PhotoImage(file='/home/tommy/Developer/bubbles/iso_configs/pmostools/peptools/images/'
|
|
||||||
# 'pep-logo-dev.png'
|
|
||||||
# )
|
|
||||||
|
|
||||||
# This will get the logged in user
|
# This will get the logged in user
|
||||||
gusr = os.getlogin()
|
gusr = os.getlogin()
|
||||||
spath = "/home/" + gusr + "/.local/share/pmostools/peptools"
|
spath = "/home/" + gusr + "/.local/share/pmostools/peptools"
|
||||||
|
|
Loading…
Reference in New Issue