Skip to content

Commit c732bfc

Browse files
committed
update
1 parent 5aef259 commit c732bfc

14 files changed

+197
-310
lines changed

git.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ git pull
1919

2020
workdir=$(pwd)
2121

22+
echo "getting default osbeck servers"
23+
wget https://raw.githubusercontent.com/arcolinux/arcolinux-system-config/master/usr/local/bin/arcolinux-osbeck-as-mirror -O $workdir/usr/share/archlinux-tweak-tool/data/any/set-mainstream-servers
24+
25+
echo "getting fix pacman databases"
26+
wget https://raw.githubusercontent.com/arcolinux/arcolinux-system-config/master/usr/local/bin/arcolinux-fix-pacman-databases-and-keys -O $workdir/usr/share/archlinux-tweak-tool/data/any/fix-pacman-databases-and-keys
27+
2228
echo "getting default neofetch file"
2329
wget https://raw.githubusercontent.com/arcolinux/arcolinux-neofetch/master/etc/skel/.config/neofetch/config.conf -O $workdir/usr/share/archlinux-tweak-tool/data/arco/neofetch/config.conf
2430

Lines changed: 43 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#=================================================================
22
#= Author: Erik Dubois =
33
#=================================================================
4-
4+
import distro,os
55

66
def GUI(self, Gtk, GdkPixbuf, vboxStack19, sddm, Functions):
77

88
hbox1 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
99
hbox1_label = Gtk.Label(xalign=0)
10-
hbox1_label.set_text("ArcoLinux Fixes")
10+
hbox1_label.set_text("Fixes for " + distro.id())
1111
hbox1_label.set_name("title")
1212
hbox1.pack_start(hbox1_label, False, False, 10)
1313

@@ -17,27 +17,35 @@ def GUI(self, Gtk, GdkPixbuf, vboxStack19, sddm, Functions):
1717

1818
hbox2 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
1919
hbox2_label = Gtk.Label(xalign=0)
20-
hbox2_label.set_text("ArcoLinux fix pacman keys")
20+
hbox2_label.set_text("Reset and reload pacman keys")
2121
button_Apply_Pacman_Key_Fix = Gtk.Button(label="Fix keys")
2222
button_Apply_Pacman_Key_Fix.connect ("clicked", self.on_click_fix_pacman_keys)
2323
hbox2.pack_start(hbox2_label, False, False, 10)
2424
hbox2.pack_end(button_Apply_Pacman_Key_Fix, False, False, 10)
2525

2626
hbox3 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
2727
hbox3_label = Gtk.Label(xalign=0)
28-
hbox3_label.set_text("Set Osbeck as the only Arch Linux server")
29-
button_Apply_Osbeck = Gtk.Button(label="Set Osbeck")
30-
button_Apply_Osbeck.connect ("clicked", self.on_click_fix_osbeck)
28+
hbox3_label.set_text("Set mainstream servers for ArchLinux")
29+
button_Apply_Osbeck = Gtk.Button(label="Set mainstream")
30+
button_Apply_Osbeck.connect ("clicked", self.on_click_fix_mainstream)
3131
hbox3.pack_start(hbox3_label, False, False, 10)
3232
hbox3.pack_end(button_Apply_Osbeck, False, False, 10)
3333

3434
hbox4 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
3535
hbox4_label = Gtk.Label(xalign=0)
3636
hbox4_label.set_text("Get the best Arch Linux servers (takes a while)")
37-
button_Apply_Mirrors = Gtk.Button(label="Get Arch mirrors")
38-
button_Apply_Mirrors.connect ("clicked", self.on_click_fix_mirrors)
37+
button_Apply_Mirrors = Gtk.Button(label="Get Arch mirrors (reflector)")
38+
button_Apply_Mirrors.connect ("clicked", self.on_click_get_arch_mirrors)
39+
button_Apply_Mirrors2 = Gtk.Button(label="Get Arch mirrors (rate-mirrors)")
40+
button_Apply_Mirrors2.connect ("clicked", self.on_click_get_arch_mirrors2)
3941
hbox4.pack_start(hbox4_label, False, False, 10)
40-
hbox4.pack_end(button_Apply_Mirrors, False, False, 10)
42+
hbox4.pack_end(button_Apply_Mirrors, False, False, 10)
43+
hbox4.pack_end(button_Apply_Mirrors2, False, False, 10)
44+
45+
if not os.path.exists("/usr/bin/reflector"):
46+
button_Apply_Mirrors.set_sensitive(False)
47+
if not os.path.exists("/usr/bin/rate-mirrors"):
48+
button_Apply_Mirrors2.set_sensitive(False)
4149

4250
hbox5 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
4351
hbox5_label = Gtk.Label(xalign=0)
@@ -57,55 +65,43 @@ def GUI(self, Gtk, GdkPixbuf, vboxStack19, sddm, Functions):
5765

5866
hbox7 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
5967
hbox7_label = Gtk.Label(xalign=0)
60-
hbox7_label.set_text("Keyservers - get the ArcoLinux /etc/pacman.d/gnupg/gpg.conf")
61-
button_Apply_Pacman_Gpg_Conf = Gtk.Button(label="Reset gpg.conf")
68+
hbox7_label.set_text("Get the best keyservers for /etc/pacman.d/gnupg/gpg.conf")
69+
button_Apply_Pacman_Gpg_Conf = Gtk.Button(label="Backup and reset gpg.conf")
6270
button_Apply_Pacman_Gpg_Conf.connect ("clicked", self.on_click_fix_pacman_gpg_conf)
6371
hbox7.pack_start(hbox7_label, False, False, 10)
6472
hbox7.pack_end(button_Apply_Pacman_Gpg_Conf, False, False, 10)
6573

66-
67-
# hbox6 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
68-
69-
# hbox7 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
70-
71-
# hbox8 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
72-
73-
# hbox9 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
74-
75-
# hbox10 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
74+
hbox8 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
75+
hbox8_label = Gtk.Label(xalign=0)
76+
hbox8_label.set_text("Get the best keyservers for ~/.gnupg/gpg.conf")
77+
button_Apply_Pacman_Gpg_Conf_Local = Gtk.Button(label="Backup and reset gpg.conf")
78+
button_Apply_Pacman_Gpg_Conf_Local.connect ("clicked", self.on_click_fix_pacman_gpg_conf_local)
79+
hbox8.pack_start(hbox8_label, False, False, 10)
80+
hbox8.pack_end(button_Apply_Pacman_Gpg_Conf_Local, False, False, 10)
7681

77-
# hbox11 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
78-
79-
# hbox12 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
80-
81-
# hbox13 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
82-
83-
# hbox99 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
84-
# apply_sddm = Gtk.Button(label="Apply settings")
85-
# apply_sddm.connect("clicked", self.on_click_sddm_apply)
86-
87-
# reset_sddm = Gtk.Button(label="Reset")
88-
# reset_sddm.connect("clicked", self.on_click_sddm_reset)
82+
hbox9 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
83+
hbox9_label = Gtk.Label(xalign=0)
84+
hbox9_label.set_markup("<b>Distro specific</b>")
85+
hbox9.pack_start(hbox9_label, False, False, 10)
8986

90-
# hbox99.pack_end(apply_sddm, False, False, 0)
91-
# hbox99.pack_end(reset_sddm, False, False, 0)
92-
93-
87+
hbox10 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
88+
hbox10_label = Gtk.Label(xalign=0)
89+
hbox10_label.set_markup("<b>For any Arch based system</b>")
90+
hbox10.pack_start(hbox10_label, False, False, 10)
91+
9492
# ======================================================================
9593
# VBOX STACK
9694
# ======================================================================
95+
9796
vboxStack19.pack_start(hbox1, False, False, 0)
98-
vboxStack19.pack_start(hbox0, False, False, 0)
97+
vboxStack19.pack_start(hbox0, False, False, 0)
98+
vboxStack19.pack_start(hbox10, False, False, 20)
9999
vboxStack19.pack_start(hbox2, False, False, 0)
100100
vboxStack19.pack_start(hbox3, False, False, 0)
101101
vboxStack19.pack_start(hbox4, False, False, 0)
102-
vboxStack19.pack_start(hbox5, False, False, 0)
103-
vboxStack19.pack_start(hbox6, False, False, 0)
104102
vboxStack19.pack_start(hbox7, False, False, 0)
105-
# vboxStack19.pack_start(hbox8, False, False, 0)
106-
# vboxStack19.pack_start(hbox9, False, False, 0)
107-
# vboxStack19.pack_start(hbox10, False, False, 0)
108-
# vboxStack19.pack_start(hbox11, False, False, 0)
109-
# vboxStack19.pack_start(hbox12, False, False, 0)
110-
# vboxStack19.pack_start(hbox13, False, False, 0)
111-
# vboxStack19.pack_end(hbox99, False, False, 0)
103+
vboxStack19.pack_start(hbox8, False, False, 0)
104+
vboxStack19.pack_start(hbox9, False, False, 20)
105+
if Functions.distr == "arcolinux":
106+
vboxStack19.pack_start(hbox5, False, False, 0)
107+
#vboxStack19.pack_start(hbox6, False, False, 0)

usr/share/archlinux-tweak-tool/Functions.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
sudo_username = os.getlogin()
2222
home = "/home/" + str(sudo_username)
2323

24+
gpg_conf = "/etc/pacman.d/gnupg/gpg.conf"
25+
gpg_conf_local = home + "/.gnupg/gpg.conf"
26+
27+
gpg_conf_original = "/usr/share/archlinux-tweak-tool/data/any/gpg.conf"
28+
gpg_conf_local_original = "/usr/share/archlinux-tweak-tool/data/any/gpg.conf"
29+
2430
sddm_default = "/etc/sddm.conf"
2531
sddm_default_original = "/usr/share/archlinux-tweak-tool/data/arco/sddm/sddm.conf"
2632

@@ -574,6 +580,36 @@ def install_alacritty(self):
574580
stdout=subprocess.PIPE,
575581
stderr=subprocess.STDOUT)
576582

583+
# =====================================================
584+
# REFLECTOR
585+
# =====================================================
586+
587+
def install_reflector(self):
588+
install = 'pacman -S reflector --needed --noconfirm'
589+
590+
if os.path.exists("/usr/bin/reflector"):
591+
pass
592+
else:
593+
subprocess.call(install.split(" "),
594+
shell=False,
595+
stdout=subprocess.PIPE,
596+
stderr=subprocess.STDOUT)
597+
598+
# =====================================================
599+
# RATE-MIRRORS
600+
# =====================================================
601+
602+
def install_rate_mirrors(self):
603+
install = 'pacman -S rate-mirrors --needed --noconfirm'
604+
605+
if os.path.exists("/usr/bin/rate-mirrors"):
606+
pass
607+
else:
608+
subprocess.call(install.split(" "),
609+
shell=False,
610+
stdout=subprocess.PIPE,
611+
stderr=subprocess.STDOUT)
612+
577613
# =====================================================
578614
# ZSH + PACKAGES (ARCOLINUXD)
579615
# =====================================================
@@ -771,4 +807,4 @@ def check_content(value, file): # noqa
771807
return True
772808
else:
773809
return False
774-
return False
810+
return False

usr/share/archlinux-tweak-tool/archlinux-tweak-tool.py

Lines changed: 52 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import GUI
2828
import subprocess
2929
import utilities
30-
from Functions import install_alacritty, os, pacman
30+
from Functions import install_alacritty,install_reflector,install_rate_mirrors, os, pacman
3131
from subprocess import PIPE, STDOUT
3232
from time import sleep
3333
gi.require_version('Gtk', '3.0')
@@ -1766,52 +1766,88 @@ def on_click_user_apply(self, widget):
17661766

17671767
def on_click_fix_pacman_keys(self,widget):
17681768
install_alacritty(self)
1769-
Functions.subprocess.call("alacritty -e /usr/local/bin/arcolinux-fix-pacman-databases-and-keys",
1769+
Functions.subprocess.call("alacritty --hold -e /usr/share/archlinux-tweak-tool/data/any/fix-pacman-databases-and-keys",
17701770
shell=True,
17711771
stdout=Functions.subprocess.PIPE,
17721772
stderr=Functions.subprocess.STDOUT)
17731773
GLib.idle_add(Functions.show_in_app_notification, self, "Pacman keys fixed")
17741774

1775-
def on_click_fix_osbeck(self,widget):
1776-
command = '/usr/local/bin/arcolinux-osbeck-as-mirror'
1775+
def on_click_fix_mainstream(self,widget):
1776+
command = 'alacritty --hold -e /usr/share/archlinux-tweak-tool/data/any/set-mainstream-servers'
17771777
Functions.subprocess.call(command.split(" "),
17781778
shell=False,
17791779
stdout=Functions.subprocess.PIPE,
17801780
stderr=Functions.subprocess.STDOUT)
1781-
GLib.idle_add(Functions.show_in_app_notification, self, "Osbeck set as Arch Linux")
1781+
command_show = 'alacritty --hold -e cat /etc/pacman.d/mirrorlist'
1782+
Functions.subprocess.call(command_show.split(" "),
1783+
shell=False,
1784+
stdout=Functions.subprocess.PIPE,
1785+
stderr=Functions.subprocess.STDOUT)
1786+
GLib.idle_add(Functions.show_in_app_notification, self, "Mainstream servers have been saved")
17821787

1783-
def on_click_fix_mirrors(self,widget):
1784-
install_alacritty(self)
1785-
Functions.subprocess.call("alacritty -e /usr/local/bin/arcolinux-get-mirrors",
1788+
def on_click_get_arch_mirrors(self,widget):
1789+
install_reflector(self)
1790+
Functions.subprocess.call("alacritty --hold -e /usr/share/archlinux-tweak-tool/data/any/archlinux-get-mirrors-reflector",
1791+
shell=True,
1792+
stdout=Functions.subprocess.PIPE,
1793+
stderr=Functions.subprocess.STDOUT)
1794+
GLib.idle_add(Functions.show_in_app_notification, self, "Fastest Arch Linux servers saved")
1795+
1796+
def on_click_get_arch_mirrors2(self,widget):
1797+
#install_rate_mirrors(self)
1798+
Functions.subprocess.call("alacritty --hold -e /usr/share/archlinux-tweak-tool/data/any/archlinux-get-mirrors-rate-mirrors",
17861799
shell=True,
17871800
stdout=Functions.subprocess.PIPE,
17881801
stderr=Functions.subprocess.STDOUT)
17891802
GLib.idle_add(Functions.show_in_app_notification, self, "Fastest Arch Linux servers saved")
17901803

1804+
17911805
def on_click_fix_sddm_conf(self,widget):
1792-
command = '/usr/local/bin/arcolinux-fix-sddm-config'
1806+
command = 'alacritty --hold -e /usr/share/archlinux-tweak-tool/data/arco/bin/arcolinux-fix-sddm-config'
17931807
Functions.subprocess.call(command,
17941808
shell=True,
17951809
stdout=Functions.subprocess.PIPE,
17961810
stderr=Functions.subprocess.STDOUT)
17971811
GLib.idle_add(Functions.show_in_app_notification, self, "Saved the original /etc/sddm.conf")
17981812

17991813
def on_click_fix_pacman_conf(self,widget):
1800-
command = '/usr/local/bin/arcolinux-fix-pacman-conf'
1814+
command = 'alacritty --hold -e /usr/local/bin/arcolinux-fix-pacman-conf'
18011815
Functions.subprocess.call(command,
18021816
shell=True,
18031817
stdout=Functions.subprocess.PIPE,
18041818
stderr=Functions.subprocess.STDOUT)
18051819
GLib.idle_add(Functions.show_in_app_notification, self, "Saved the original /etc/pacman.conf")
18061820

18071821
def on_click_fix_pacman_gpg_conf(self,widget):
1808-
command = '/usr/local/bin/arcolinux-fix-pacman-gpg-conf'
1809-
Functions.subprocess.call(command,
1810-
shell=True,
1811-
stdout=Functions.subprocess.PIPE,
1812-
stderr=Functions.subprocess.STDOUT)
1813-
GLib.idle_add(Functions.show_in_app_notification, self, "Saved the original /etc/pacman.d/gnupg/gpg.conf")
1822+
if not os.path.isfile(Functions.gpg_conf + ".bak"):
1823+
Functions.shutil.copy(Functions.gpg_conf,
1824+
Functions.gpg_conf + ".bak")
1825+
Functions.shutil.copy(Functions.gpg_conf_original,
1826+
Functions.gpg_conf)
1827+
1828+
GLib.idle_add(Functions.show_in_app_notification, self, "The new /etc/pacman.d/gnupg/gpg.conf has been saved")
1829+
1830+
def on_click_fix_pacman_gpg_conf_local(self,widget):
1831+
if not os.path.isdir(Functions.home + "/.gnupg"):
1832+
try:
1833+
Functions.os.makedirs(Functions.home + "/.gnupg", 0o766)
1834+
Functions.permissions(Functions.home + "/.gnupg")
1835+
except Exception as e:
1836+
print(e)
1837+
1838+
if not os.path.isfile(Functions.gpg_conf_local + ".bak"):
1839+
try:
1840+
Functions.shutil.copy(Functions.gpg_conf_local,
1841+
Functions.gpg_conf_local + ".bak")
1842+
Functions.permissions(Functions.gpg_conf_local + ".bak")
1843+
except Exception as e:
1844+
print(e)
1845+
1846+
Functions.shutil.copy(Functions.gpg_conf_local_original,
1847+
Functions.gpg_conf_local)
1848+
Functions.permissions(Functions.gpg_conf_local)
18141849

1850+
GLib.idle_add(Functions.show_in_app_notification, self, "The new ~/.gnupg/gpg.conf has been saved")
18151851

18161852
# #====================================================================
18171853
# # DESKTOPR

usr/share/archlinux-tweak-tool/data/arco/bin/arco-dev renamed to usr/share/archlinux-tweak-tool/data/any/archlinux-get-mirrors-rate-mirrors

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#tput setaf 8 = light blue
2727
##################################################################################################################
2828

29-
sudo pacman -Sy
30-
sudo pacman -S sublime-text-4 --noconfirm --needed
31-
sudo pacman -S the_platinum_searcher-bin --noconfirm --needed
32-
sudo pacman -S ripgrep --noconfirm --needed
33-
sudo pacman -S meld --noconfirm --needed
29+
rate-mirrors --allow-root arch | sudo tee /etc/pacman.d/mirrorlist
30+
31+
echo "###############################################################################"
32+
echo "### DONE - YOU CAN CLOSE THIS WINDOW ####"
33+
echo "###############################################################################"

usr/share/archlinux-tweak-tool/data/arco/bin/arcolinux-get-mirrors renamed to usr/share/archlinux-tweak-tool/data/any/archlinux-get-mirrors-reflector

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@
2626
#tput setaf 8 = light blue
2727
##################################################################################################################
2828

29-
#sudo /usr/bin/reflector --latest 100 --fastest 100 --number 10 --save /etc/pacman.d/mirrorlist
30-
sudo /usr/bin/reflector --score 100 --fastest 10 --number 10 --verbose --save /etc/pacman.d/mirrorlist
29+
sudo /usr/bin/reflector --score 100 --fastest 10 --number 10 --verbose --save /etc/pacman.d/mirrorlist
30+
31+
echo "###############################################################################"
32+
echo "### DONE - YOU CAN CLOSE THIS WINDOW ####"
33+
echo "###############################################################################"

0 commit comments

Comments
 (0)