Skip to content

Commit d192d91

Browse files
Add files via upload
1 parent 36dc79c commit d192d91

File tree

8 files changed

+184
-0
lines changed

8 files changed

+184
-0
lines changed

setbian/setbian-0.0.2/DEBIAN/control

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Package: setbian
2+
Version: 0.0.2
3+
Section: utils
4+
Priority: optional
5+
Architecture: all
6+
Depends: python3, python3-tk, wget, curl, apt
7+
Maintainer: Bhuvanesh M <bhuvaneshm.developer@gmail.com>
8+
Description: Setbian - Smart Debian App Installer. A lightweight GUI tool built with Python and Tkinter. Developed by Bhuvanesh M.
9+
Binary file not shown.
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/python3
2+
import socket
3+
4+
# Check for internet connection before launching the main UI
5+
6+
def is_connected():
7+
try:
8+
socket.create_connection(("1.1.1.1", 53), timeout=3)
9+
return True
10+
except OSError:
11+
return False

setbian/setbian-0.0.2/usr/bin/msg.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/python3
2+
import tkinter as tk
3+
4+
def msg(pkg_name, status):
5+
6+
if not hasattr(msg, "popup"):
7+
msg.popup = tk.Toplevel()
8+
msg.popup.title("Installation Progress")
9+
msg.popup.geometry("350x100")
10+
msg.label = tk.Label(msg.popup, text="", font=("Arial", 12))
11+
msg.label.pack(pady=20)
12+
msg.popup.protocol("WM_DELETE_WINDOW", lambda: None) # Disable close
13+
14+
msg.label.config(text=f"{pkg_name}: {status}")
15+
msg.popup.update()
16+
17+
def msg_progress(pkg_name, phase, percent):
18+
19+
if not hasattr(msg_progress, "popup"):
20+
msg_progress.popup = tk.Toplevel()
21+
msg_progress.popup.title("Installation Progress")
22+
msg_progress.popup.geometry("350x100")
23+
msg_progress.label = tk.Label(msg_progress.popup, text="", font=("Arial", 12))
24+
msg_progress.label.pack(pady=20)
25+
msg_progress.popup.protocol("WM_DELETE_WINDOW", lambda: None)
26+
27+
msg_progress.label.config(text=f"{pkg_name}: {phase}... {percent}%")
28+
msg_progress.popup.update()
29+
30+
def close_progress():
31+
if hasattr(msg_progress, "popup"):
32+
msg_progress.popup.destroy()
33+
del msg_progress.popup
34+
35+
def sudo_password_prompt():
36+
"""
37+
Show a popup window indicating that sudo password is required.
38+
"""
39+
if not hasattr(sudo_password_prompt, "popup"):
40+
sudo_password_prompt.popup = tk.Toplevel()
41+
sudo_password_prompt.popup.title("Sudo Password Required")
42+
sudo_password_prompt.popup.geometry("350x100")
43+
label = tk.Label(
44+
sudo_password_prompt.popup,
45+
text="Please enter your sudo password in the terminal...",
46+
font=("Arial", 12),
47+
fg="red"
48+
)
49+
label.pack(pady=20)
50+
sudo_password_prompt.popup.protocol("WM_DELETE_WINDOW", lambda: None)
51+
sudo_password_prompt.popup.update()
52+
# Auto-close after 8 seconds
53+
sudo_password_prompt.popup.after(8000, close_sudo_prompt)
54+
55+
def close_sudo_prompt():
56+
if hasattr(sudo_password_prompt, "popup"):
57+
sudo_password_prompt.popup.destroy()
58+
del sudo_password_prompt.popup
59+
60+
def close_msg():
61+
if hasattr(msg, "popup"):
62+
msg.popup.destroy()
63+
del msg.popup
64+
close_progress()
65+
close_sudo_prompt()
66+

setbian/setbian-0.0.2/usr/bin/setbian

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/usr/bin/python3
2+
import tkinter as tk
3+
from tkinter import messagebox
4+
import subprocess
5+
import internet
6+
from msg import msg, msg_progress, sudo_password_prompt, close_sudo_prompt, close_msg
7+
8+
# Function to install selected packages
9+
def install_selected():
10+
selected = [pkg for name, pkg in available_apps.items() if vars_check[name].get()]
11+
12+
if not selected:
13+
messagebox.showinfo("No Selection", "Please select at least one app to install.")
14+
return
15+
16+
for name, pkg in available_apps.items():
17+
if vars_check[name].get():
18+
try:
19+
msg(name, "Downloading and Installing...")
20+
root.update()
21+
subprocess.run(
22+
["sudo", "apt", "install", "-y", pkg],
23+
check=True,
24+
stdout=subprocess.DEVNULL,
25+
stderr=subprocess.DEVNULL
26+
)
27+
msg(name, "Installed successfully!")
28+
except subprocess.CalledProcessError:
29+
msg(name, "Failed to install!")
30+
messagebox.showerror("Installation Error", f"Failed to install {pkg}")
31+
close_msg()
32+
return
33+
34+
close_msg()
35+
messagebox.showinfo("Success", "Selected apps installed successfully.")
36+
37+
# Launch GUI only if internet is connected
38+
if internet.is_connected():
39+
# Define available packages
40+
available_apps = {
41+
"Git": "git",
42+
"Curl": "curl",
43+
"VLC Media Player": "vlc",
44+
"GIMP": "gimp",
45+
"VS Code": "code",
46+
"FireFox":"firefox-esr",
47+
"Google Chromium":"chromium",
48+
"Mpv":'mpv',
49+
"Telegram":"telegram-desktop",
50+
}
51+
52+
# GUI setup
53+
root = tk.Tk()
54+
root.title("Setbian - Smart Debian App Installer")
55+
root.geometry("400x350")
56+
root.resizable(False, False)
57+
58+
tk.Label(root, text="Select Apps to Install:", font=("Arial", 14, "bold")).pack(pady=10)
59+
60+
# Create checkboxes dynamically
61+
vars_check = {}
62+
for app in available_apps:
63+
var = tk.BooleanVar()
64+
chk = tk.Checkbutton(root, text=app, variable=var, font=("Arial", 12))
65+
chk.pack(anchor='w', padx=40)
66+
vars_check[app] = var
67+
68+
# Install button
69+
install_btn = tk.Button(
70+
root,
71+
text="Install Selected",
72+
font=("Arial", 12, "bold"),
73+
bg="#4CAF50",
74+
fg="white",
75+
command=install_selected
76+
)
77+
install_btn.pack(pady=20)
78+
79+
# Run the app
80+
root.mainloop()
81+
82+
else:
83+
# Show internet error popup
84+
root = tk.Tk()
85+
root.withdraw() # Hide the main window
86+
messagebox.showerror(
87+
"No Internet Connection",
88+
"Please connect to the internet via Ethernet or Wi-Fi and relaunch Setbian.\n\nThank you!"
89+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Type=Application
2+
Version=0.0.2
3+
Name=SetBian
4+
Path=/usr/bin
5+
Exec=setbian
6+
Icon=
7+
Terminal=false
8+
Categories=Languages;Python;
9+
1.31 MB
Loading

0 commit comments

Comments
 (0)