From 928654ae350b9b79062e4d0bcb18f4b6ccea3b6b Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 4 Aug 2020 11:34:00 +0200 Subject: Added two new functions. Fixed set_locale. enable_service() was added as well as activate_ntp(). --- archinstall/lib/installer.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 3310c335..ea9a605a 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -79,9 +79,9 @@ class Installer(): if not len(locale): return True with open(f'{self.mountpoint}/etc/locale.gen', 'a') as fh: - fh.write(f'{locale} {encoding}\n') + fh.write(f'{locale}.{encoding} {encoding}\n') with open(f'{self.mountpoint}/etc/locale.conf', 'w') as fh: - fh.write(f'LANG={locale}\n') + fh.write(f'LANG={locale}.{encoding}\n') return True if sys_command(f'/usr/bin/arch-chroot {self.mountpoint} locale-gen').exit_code == 0 else False @@ -91,6 +91,15 @@ class Installer(): o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} ln -s /usr/share/zoneinfo/{zone} /etc/localtime')) return True + def activate_ntp(self): + if self.pacstrap('ntp'): + if self.enable_service('ntpd'): + return True + + def enable_service(self, service): + log(f'Enabling service {service}') + return self.arch_chroot(f'systemctl enable {service}').exit_code == 0 + def run_command(self, cmd, *args, **kwargs): return sys_command(f'/usr/bin/arch-chroot {self.mountpoint} {cmd}') -- cgit v1.2.3-54-g00ecf From 2dea2426b2426a284d5789770c136356ded69aa7 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 4 Aug 2020 11:36:07 +0200 Subject: Version bump rc4 --- PKGBUILD | 2 +- archinstall/lib/installer.py | 1 + make.sh | 8 ++++---- setup.py | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index d54e0dc3..801c2b8d 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Anton Hvornum anton@hvornum.se # Contributor: Anton Hvornum anton@hvornum.se pkgname="archinstall" -pkgver="v2.0.4rc3" +pkgver="v2.0.4rc4" pkgdesc="Installs a pre-built binary of ${pkgname}" pkgrel=1 url="https://github.com/Torxed/archinstall" diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index ea9a605a..a6fafb03 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -92,6 +92,7 @@ class Installer(): return True def activate_ntp(self): + log(f'Adding bootloader to {self.boot_partition}') if self.pacstrap('ntp'): if self.enable_service('ntpd'): return True diff --git a/make.sh b/make.sh index e369209a..46d2d00d 100755 --- a/make.sh +++ b/make.sh @@ -1,15 +1,15 @@ #!/bin/bash # Description: Crude build/maker script for PKGBUILD dependencies and stuff. -rm -rf archinstall.egg-info/ build/ src/ pkg/ dist/ archinstall.build/ archinstall-v2.0.4rc3-x86_64/ *.pkg.*.xz archinstall-*.tar.gz +rm -rf archinstall.egg-info/ build/ src/ pkg/ dist/ archinstall.build/ archinstall-v2.0.4rc4-x86_64/ *.pkg.*.xz archinstall-*.tar.gz nuitka3 --standalone --show-progress archinstall cp -r examples/ archinstall.dist/ -mv archinstall.dist archinstall-v2.0.4rc3-x86_64 -tar -czvf archinstall-v2.0.4rc3.tar.gz archinstall-v2.0.4rc3-x86_64 +mv archinstall.dist archinstall-v2.0.4rc4-x86_64 +tar -czvf archinstall-v2.0.4rc4.tar.gz archinstall-v2.0.4rc4-x86_64 makepkg -f python3 setup.py sdist bdist_wheel echo 'python3 -m twine upload dist/*; rm -rf dist/' -rm -rf archinstall.egg-info/ build/ src/ pkg/ archinstall.build/ archinstall-v2.0.4rc3-x86_64/ +rm -rf archinstall.egg-info/ build/ src/ pkg/ archinstall.build/ archinstall-v2.0.4rc4-x86_64/ diff --git a/setup.py b/setup.py index 5c77be17..6512bd8c 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open("README.md", "r") as fh: setuptools.setup( name="archinstall", - version="v2.0.4rc3", + version="v2.0.4rc4", author="Anton Hvornum", author_email="anton@hvornum.se", description="Arch Linux installer - guided, templates etc.", -- cgit v1.2.3-54-g00ecf From 9d7962f39c1d8d8321da9c3653ca7e8d1def5c9b Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 4 Aug 2020 14:30:15 +0200 Subject: Added a list_profiles() function, that lists all current local profiles. Also removed support for .json as it's redundant for the future. --- archinstall/lib/profiles.py | 39 ++++++++++++--------------------------- make.sh | 2 +- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index c1e2f8a9..f0de62d3 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -14,6 +14,16 @@ def grab_url_data(path): response = urllib.request.urlopen(safe_path, context=ssl_context) return response.read() +def list_profiles(base='./profiles/'): + # TODO: Grab from github page as well, not just local static files + cache = {} + for root, folders, files in os.walk(base): + for file in files: + if os.path.splitext(file)[1] == '.py': + cache[file] = os.path.join(root, file) + break + return cache + class Imported(): def __init__(self, spec, imported): self.spec = spec @@ -44,8 +54,6 @@ class Profile(): return os.path.abspath(f'{self.name}') for path in ['./profiles', '/etc/archinstall', '/etc/archinstall/profiles', os.path.abspath(f'{os.path.dirname(__file__)}/../profiles')]: # Step out of /lib - if os.path.isfile(f'{path}/{self.name}.json'): - return os.path.abspath(f'{path}/{self.name}.json') elif os.path.isfile(f'{path}/{self.name}.py'): return os.path.abspath(f'{path}/{self.name}.py') @@ -55,18 +63,6 @@ class Profile(): return f'{UPSTREAM_URL}/{self.name}.py' except urllib.error.HTTPError: pass - try: - if (cache := grab_url_data(f'{UPSTREAM_URL}/{self.name}.json')): - self._cache = cache - return f'{UPSTREAM_URL}/{self.name}.json' - except urllib.error.HTTPError: - pass - try: - if (cache := grab_url_data(f'{UPSTREAM_URL}/{self.name}.json')): - self._cache = cache - return f'{UPSTREAM_URL}/{self.name}.json' - except urllib.error.HTTPError: - pass return None @@ -80,11 +76,8 @@ class Profile(): imported = importlib.util.module_from_spec(spec) sys.modules[os.path.basename(absolute_path)] = imported return Imported(spec, imported) - elif absolute_path[:4] == 'http': - return json.loads(self._cache) - - with open(absolute_path, 'r') as fh: - return json.load(fh) + else: + raise ProfileError(f'Extension {os.path.splitext(absolute_path)[1]} is not a supported profile model. Only .py is supported.') raise ProfileError(f'No such profile ({self.name}) was found either locally or in {UPSTREAM_URL}') @@ -190,8 +183,6 @@ class Application(Profile): for path in ['./applications', './profiles/applications', '/etc/archinstall/applications', '/etc/archinstall/profiles/applications', os.path.abspath(f'{os.path.dirname(__file__)}/../profiles/applications')]: if os.path.isfile(f'{path}/{self.name}.py'): return os.path.abspath(f'{path}/{self.name}.py') - elif os.path.isfile(f'{path}/{self.name}.json'): - return os.path.abspath(f'{path}/{self.name}.json') try: if (cache := grab_url_data(f'{UPSTREAM_URL}/applications/{self.name}.py')): @@ -199,11 +190,5 @@ class Application(Profile): return f'{UPSTREAM_URL}/applications/{self.name}.py' except urllib.error.HTTPError: pass - try: - if (cache := grab_url_data(f'{UPSTREAM_URL}/applications/{self.name}.json')): - self._cache = cache - return f'{UPSTREAM_URL}/applications/{self.name}.json' - except urllib.error.HTTPError: - pass return None \ No newline at end of file diff --git a/make.sh b/make.sh index 46d2d00d..82333a5f 100755 --- a/make.sh +++ b/make.sh @@ -6,7 +6,7 @@ rm -rf archinstall.egg-info/ build/ src/ pkg/ dist/ archinstall.build/ archinsta nuitka3 --standalone --show-progress archinstall cp -r examples/ archinstall.dist/ mv archinstall.dist archinstall-v2.0.4rc4-x86_64 -tar -czvf archinstall-v2.0.4rc4.tar.gz archinstall-v2.0.4rc4-x86_64 +tar -czvf archinstall-v2.0.4rc4-x86_64.tar.gz archinstall-v2.0.4rc4-x86_64 makepkg -f python3 setup.py sdist bdist_wheel -- cgit v1.2.3-54-g00ecf From 44e920297b2fd6f929e379025cd239baa0d41cc5 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 4 Aug 2020 14:41:11 +0200 Subject: elif mixup --- archinstall/lib/profiles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index f0de62d3..0e76ba3d 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -54,7 +54,7 @@ class Profile(): return os.path.abspath(f'{self.name}') for path in ['./profiles', '/etc/archinstall', '/etc/archinstall/profiles', os.path.abspath(f'{os.path.dirname(__file__)}/../profiles')]: # Step out of /lib - elif os.path.isfile(f'{path}/{self.name}.py'): + if os.path.isfile(f'{path}/{self.name}.py'): return os.path.abspath(f'{path}/{self.name}.py') try: -- cgit v1.2.3-54-g00ecf From 0b8a3d9540dd3a9a752a8736701b514a779d636b Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 4 Aug 2020 14:45:25 +0200 Subject: Removed legacy .json profiles. Not in favor of .py --- profiles/00:01:23:45:67:89.json | 76 ----------------------------------- profiles/00:11:22:33:44:55.json | 19 --------- profiles/38:00:25:5a:ed:d5.json | 22 ---------- profiles/applications/awesome.json | 17 -------- profiles/applications/gnome.json | 6 --- profiles/applications/kde.json | 6 --- profiles/applications/postgresql.json | 5 --- profiles/default.json | 17 -------- profiles/desktop.py | 2 + profiles/desktop_gnome.json | 22 ---------- profiles/desktop_kde.json | 22 ---------- profiles/dns_server.json | 29 ------------- profiles/gitea.json | 13 ------ profiles/local_mirror.json | 31 -------------- profiles/minimal_example.json | 5 --- profiles/pentest.json | 55 ------------------------- profiles/router.json | 17 -------- profiles/ubuntu.json | 22 ---------- profiles/vmhost.json | 26 ------------ profiles/webserver.json | 41 ------------------- profiles/workstation.json | 30 -------------- profiles/workstation_aur.json | 37 ----------------- profiles/workstation_unattended.json | 6 --- 23 files changed, 2 insertions(+), 524 deletions(-) delete mode 100644 profiles/00:01:23:45:67:89.json delete mode 100644 profiles/00:11:22:33:44:55.json delete mode 100644 profiles/38:00:25:5a:ed:d5.json delete mode 100644 profiles/applications/awesome.json delete mode 100644 profiles/applications/gnome.json delete mode 100644 profiles/applications/kde.json delete mode 100644 profiles/applications/postgresql.json delete mode 100644 profiles/default.json delete mode 100644 profiles/desktop_gnome.json delete mode 100644 profiles/desktop_kde.json delete mode 100644 profiles/dns_server.json delete mode 100644 profiles/gitea.json delete mode 100644 profiles/local_mirror.json delete mode 100644 profiles/minimal_example.json delete mode 100644 profiles/pentest.json delete mode 100644 profiles/router.json delete mode 100644 profiles/ubuntu.json delete mode 100644 profiles/vmhost.json delete mode 100644 profiles/webserver.json delete mode 100644 profiles/workstation.json delete mode 100644 profiles/workstation_aur.json delete mode 100644 profiles/workstation_unattended.json diff --git a/profiles/00:01:23:45:67:89.json b/profiles/00:01:23:45:67:89.json deleted file mode 100644 index 23f83653..00000000 --- a/profiles/00:01:23:45:67:89.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "args" : { - "password" : "0000", - "db_pass" : "", - "include" : "webserver", - "packages" : "openssh sudo openvpn easy-rsa powerdns", - "post" : "stay", - "country" : "SE", - "mirrors" : true - }, - "post" : { - "install database": "postgresql", - "Configure database": { - "su - postgres -c 'psql -c \"CREATE DATABASE pdns;\"'" : {"boot" : true, "debug" : true}, - "su - postgres -c 'psql -c \"CREATE USER pdns WITH ENCRYPTED PASSWORD \\'{db_pass}\\';\"'" : {"boot" : true, "debug" : true}, - "su - postgres -c 'psql -c \"GRANT ALL PRIVILEGES ON DATABASE pdns TO pdns;\"'" : {"boot" : true, "debug" : true}, - "psql -U pdns -d pdns -a -f /usr/share/doc/powerdns/schema.pgsql.sql" : {"boot" : true, "debug" : true}, - "echo '{db_pass}' > /mnt/root/db_pass.txt" : {"no-chroot" : true, "pass-args" : true}, - "echo 'launch=gpgsql' >> /mnt/etc/powerdns/pdns.conf" : {"no-chroot" : true}, - "echo 'gpgsql-host=127.0.0.1' >> /mnt/etc/powerdns/pdns.conf" : {"no-chroot" : true}, - "echo 'gpgsql-port=5432' >> /mnt/etc/powerdns/pdns.conf" : {"no-chroot" : true}, - "echo 'gpgsql-dbname=pdns' >> /mnt/etc/powerdns/pdns.conf" : {"no-chroot" : true}, - "echo 'gpgsql-user=pdns' >> /mnt/etc/powerdns/pdns.conf" : {"no-chroot" : true}, - "echo 'gpgsql-password=\"{db_pass}\"' >> /mnt/etc/powerdns/pdns.conf" : {"no-chroot" : true, "pass-args" : true} - }, - "Configure OpenVPN" : { - "mkdir -p /etc/openvpn/server/vpn_ccd" : null, - "echo 'port 112' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'proto udp' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'dev tap' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'ca ca.crt' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'cert vpn.hvornum.se.crt' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'key vpn.hvornum.se.key' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'tls-crypt ta.key' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'dh dh.pem' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'server 10.0.50.0 255.255.255.0' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'ifconfig-pool-persist ipp.txt' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'client-config-dir /vpn_ccd' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'client-to-client' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'keepalive 10 120' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'cipher AES-256-CBC' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'tls-version-min 1.2' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'tls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-256-CBC-SHA:TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA:TLS-DHE-RSA-WITH-AES-128-CBC-SHA:TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'auth SHA512' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'compress lz4-v2' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'push \"compress lz4-v2\"' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'user nobody' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'group nobody' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'persist-key' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'persist-tun' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'verb 4' >> /mnt/etc/openvpn/server/vpn.hvornum.se.conf": {"no-chroot" : true}, - "echo 'push \"dhcp-option DNS 8.8.8.8\"' >> /mnt/etc/openvpn/server/vpn_ccd/nas.hvornum.se": {"no-chroot" : true}, - "echo 'push \"redirect-gateway autolocal bypass-dhcp\"' >> /mnt/etc/openvpn/server/vpn_ccd/nas.hvornum.se": {"no-chroot" : true}, - "echo 'push \"dhcp-option DNS 8.8.8.8\"' >> /mnt/etc/openvpn/server/vpn_ccd/laptop": {"no-chroot" : true}, - "echo 'push \"redirect-gateway def1 bypass-dhcp\"' >> /mnt/etc/openvpn/server/vpn_ccd/laptop": {"no-chroot" : true} - }, - "Create vhost table" : { - "echo 'defaultzone = { docroot \"/srv/http/default\"; index [\"index.html\"]; };' >> /mnt/etc/lighttpd2/vhost.conf": {"no-chroot" : true}, - "echo 'hvornum = { docroot \"/srv/http/default\"; index [\"index.html\"]; };' >> /mnt/etc/lighttpd2/vhost.conf": {"no-chroot" : true}, - "echo 'vhost.map [default => defaultzone, \"hvornum.se\" => hvornum];' >> /mnt/etc/lighttpd2/vhost.conf": {"no-chroot" : true} - }, - "Configure helpers" : { - "echo '[Unit]' >> /mnt/etc/systemd/system/issue.service": {"no-chroot" : true}, - "echo 'Description=MOTD Updater' >> /mnt/etc/systemd/system/issue.service": {"no-chroot" : true}, - "echo '[Service]' >> /mnt/etc/systemd/system/issue.service": {"no-chroot" : true}, - "echo 'ExecStart=/usr/bin/motd_updater' >> /mnt/etc/systemd/system/issue.service": {"no-chroot" : true}, - "echo '[Install]' >> /mnt/etc/systemd/system/issue.service": {"no-chroot" : true}, - "echo 'WantedBy=multi-user.target' >> /mnt/etc/systemd/system/issue.service": {"no-chroot" : true}, - "echo '#!/bin/bash' > /mnt/usr/bin/motd_updater": {"no-chroot" : true}, - "echo 'cat /etc/hostname > /etc/issue' >> /mnt/usr/bin/motd_updater": {"no-chroot" : true}, - "hostname -i >> /etc/issue' >> /mnt/usr/bin/motd_updater": {"no-chroot" : true}, - "chmod +x /mnt/usr/bin/motd_updater": {"no-chroot" : true}, - "systemctl enable issue.service": {"boot" : true} - } - } -} diff --git a/profiles/00:11:22:33:44:55.json b/profiles/00:11:22:33:44:55.json deleted file mode 100644 index 909b4256..00000000 --- a/profiles/00:11:22:33:44:55.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "args" : { - "include" : "workstation", - "user" : "anton", - "password" : "1111", - "post" : "don't reboot" - }, - "post" : { - "Setup user" : { - "useradd -m -G wheel -s /bin/bash anton" : null, - "sh -c \"echo {user}:{password} | chpasswd\"" : {"pass-args" : true} - }, - "Setup a basic virtual environment": { - "mkdir -p /home/{user}/virts" : {"pass-args" : true}, - "qemu-img create -f qcow2 /home/{user}/virts/test_deploy.qcow2 4G" : {"pass-args" : true}, - "chown -R {user}.{user} /home/{user}/virts" : {"pass-args" : true} - } - } -} diff --git a/profiles/38:00:25:5a:ed:d5.json b/profiles/38:00:25:5a:ed:d5.json deleted file mode 100644 index 3a8e1fb8..00000000 --- a/profiles/38:00:25:5a:ed:d5.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "args" : { - "include" : "workstation", - "user" : "anton", - "password" : "" - }, - "post" : { - "Configure laptop" : { - "pacman -Syy --noconfirm opencl-nvidia nvidia xorg-xrandr" : {"pass-args" : true}, - "echo 'XTerm.vt100.faceName: Liberation Mono:size=8,antialias=false' > /mnt/etc/skel/.Xresources" : {"no-chroot" : true}, - "echo 'XTerm.vt100.font: 7x13' >> /mnt/etc/skel/.Xresources" : {"no-chroot" : true}, - "wget https://raw.githubusercontent.com/Torxed/Scripts/master/bash/backlight -O /usr/bin/backlight" : {"pass-args" : true}, - "wget https://raw.githubusercontent.com/Torxed/Scripts/master/bash/bat.sh -O /usr/bin/bat" : {"pass-args" : true}, - "echo 'Section \"Module\"\n\tLoad \"modesetting\"\nEndSection' >> /mnt/etc/X11/xorg.conf" : {"no-chroot" : true}, - "echo 'Section \"Device\"\n\tIdentifier \"nvidia\"\n\tDriver \"nvidia\"\n\tBusID \"1:0:0\"\n\tOption \"AllowEmptyInitialConfiguration\"\nEndSection' >> /mnt/etc/X11/xorg.conf" : {"no-chroot" : true} - }, - "Setup user" : { - "useradd -m -G wheel -s /bin/bash anton" : null, - "sh -c \"echo {user}:{password} | chpasswd\"" : {"pass-args" : true} - } - } -} diff --git a/profiles/applications/awesome.json b/profiles/applications/awesome.json deleted file mode 100644 index 42715e6f..00000000 --- a/profiles/applications/awesome.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "Installing awesome window manager" : { - "sed -i 's/^twm &/#&/' /etc/X11/xinit/xinitrc" : null, - "sed -i 's/^xclock/#&/' /etc/X11/xinit/xinitrc" : null, - "sed -i 's/^xterm/#&/' /etc/X11/xinit/xinitrc" : null, - "sed -i 's/^exec xterm/#&/' /etc/X11/xinit/xinitrc" : null, - "sh -c \"echo 'xscreensaver -no-splash &' >> /etc/X11/xinit/xinitrc\"" : null, - "sh -c \"echo 'exec {_window_manager}' >> /etc/X11/xinit/xinitrc\"" : {"pass-args" : true}, - "sed -i 's/xterm/xterm -ls -xrm \"XTerm*selectToClipboard: true\"/' /mnt/etc/xdg/awesome/rc.lua" : {"no-chroot" : true}, - "sed -i 's/{ \"open terminal\", terminal/{ \"Chromium\", \"chromium\" },\n &/' /mnt/etc/xdg/awesome/rc.lua" : {"no-chroot" : true}, - "sed -i 's/{ \"open terminal\", terminal/{ \"File handler\", \"nemo\" },\n &/' /mnt/etc/xdg/awesome/rc.lua" : {"no-chroot" : true}, - "sed -i 's/^globalkeys = gears.table.join(/&\n awful.key({ modkey, }, \"l\", function() awful.spawn(\"xscreensaver-command -lock &\") end),\n/' /mnt/etc/xdg/awesome/rc.lua" : {"no-chroot" : true}, - "awk -i inplace -v RS='' '{gsub(/awful.key\\({ modkey,.*?}, \"Tab\",.*?\"client\"}\\),/, \"awful.key({ modkey, }, \"Tab\",\n function ()\n awful.client.focus.byidx(-1)\n if client.focus then\n client.focus:raise()\n end\n end),\n awful.key({ modkey, \"Shift\" }, \"Tab\",\n function ()\n awful.client.focus.byidx(1)\n if client.focus then\n client.focus.raise()\n end\n end),\"); print}' /mnt/etc/xdg/awesome/rc.lua" : {"no-chroot" : true}, - "gsettings set org.nemo.desktop show-desktop-icons false" : null, - "xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search" : null - } -} diff --git a/profiles/applications/gnome.json b/profiles/applications/gnome.json deleted file mode 100644 index 4b568544..00000000 --- a/profiles/applications/gnome.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "sed -i 's/^twm &/#&/' /etc/X11/xinit/xinitrc" : null, - "sed -i 's/^xclock/#&/' /etc/X11/xinit/xinitrc" : null, - "sed -i 's/^xterm/#&/' /etc/X11/xinit/xinitrc" : null, - "sed -i 's/^exec xterm/#&/' /etc/X11/xinit/xinitrc" : null, -} diff --git a/profiles/applications/kde.json b/profiles/applications/kde.json deleted file mode 100644 index 4b568544..00000000 --- a/profiles/applications/kde.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "sed -i 's/^twm &/#&/' /etc/X11/xinit/xinitrc" : null, - "sed -i 's/^xclock/#&/' /etc/X11/xinit/xinitrc" : null, - "sed -i 's/^xterm/#&/' /etc/X11/xinit/xinitrc" : null, - "sed -i 's/^exec xterm/#&/' /etc/X11/xinit/xinitrc" : null, -} diff --git a/profiles/applications/postgresql.json b/profiles/applications/postgresql.json deleted file mode 100644 index 05976fd9..00000000 --- a/profiles/applications/postgresql.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "pacman -Syy --noconfirm postgresql" : {"debug" : true}, - "systemctl enable postgresql" : {"debug" : true}, - "su - postgres -c \"initdb -D /var/lib/postgres/data\"" : {"debug" : true} -} \ No newline at end of file diff --git a/profiles/default.json b/profiles/default.json deleted file mode 100644 index cd205f84..00000000 --- a/profiles/default.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "args" : { - "password" : "0000", - "post" : "stay" - }, - "post" : { - "test exit codes" : { - "ssh test@77.80.220.176" : {"events" : { - "continue connecting" : "yes\n", - "s password" : "test\n" - }, - "boot" : true, - "debug" : true - } - } - } -} diff --git a/profiles/desktop.py b/profiles/desktop.py index a1c2cdba..67e4fd25 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -1,3 +1,5 @@ +# A desktop environemtn using "Awesome" window manager. + import archinstall arguments = { diff --git a/profiles/desktop_gnome.json b/profiles/desktop_gnome.json deleted file mode 100644 index be239a91..00000000 --- a/profiles/desktop_gnome.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "args" : { - "password" : "", - "_mediaplayer" : "lollypop gstreamer gst-plugins-good gnome-keyring", - "_filebrowser" : "nemo gpicview-gtk3", - "_webbrowser" : "chromium", - "_window_manager" : "awesome", - "_keyboard_layout" : "sv-latin1", - "_virtulization" : "qemu ovmf", - "post" : "don't reboot" - }, - "post" : { - "Install workstation packages": { - "pacman -Syy --noconfirm openssh sshfs git {_webbrowser} {_mediaplayer} {_window_manager} {_virtulization} {_filebrowser} dhclient gnu-free-fonts ttf-liberation xorg-server xorg-xrandr xorg-xinit xterm nano wget pulseaudio pulseaudio-alsa pavucontrol smbclient cifs-utils xscreensaver" : {"pass-args" : true} - }, - "Setup loclization" : { - "sh -c \"echo 'setxkbmap se' >> /etc/X11/xinit/xinitrc\"" : null, - "sh -c \"echo 'KEYMAP={_keyboard_layout}\nFONT=lat9w-16' >> /etc/vconsole.conf\"" : {"pass-args" : true} - }, - "Configure desktop environment" : "gnome" - } -} diff --git a/profiles/desktop_kde.json b/profiles/desktop_kde.json deleted file mode 100644 index 6a15bf30..00000000 --- a/profiles/desktop_kde.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "args" : { - "password" : "", - "_mediaplayer" : "lollypop gstreamer gst-plugins-good gnome-keyring", - "_filebrowser" : "nemo gpicview-gtk3", - "_webbrowser" : "chromium", - "_window_manager" : "awesome", - "_keyboard_layout" : "sv-latin1", - "_virtulization" : "qemu ovmf", - "post" : "don't reboot" - }, - "post" : { - "Install workstation packages": { - "pacman -Syy --noconfirm openssh sshfs git {_webbrowser} {_mediaplayer} {_window_manager} {_virtulization} {_filebrowser} dhclient gnu-free-fonts ttf-liberation xorg-server xorg-xrandr xorg-xinit xterm nano wget pulseaudio pulseaudio-alsa pavucontrol smbclient cifs-utils xscreensaver" : {"pass-args" : true} - }, - "Setup loclization" : { - "sh -c \"echo 'setxkbmap se' >> /etc/X11/xinit/xinitrc\"" : null, - "sh -c \"echo 'KEYMAP={_keyboard_layout}\nFONT=lat9w-16' >> /etc/vconsole.conf\"" : {"pass-args" : true} - }, - "Configure desktop environment" : "kde" - } -} diff --git a/profiles/dns_server.json b/profiles/dns_server.json deleted file mode 100644 index 423fe872..00000000 --- a/profiles/dns_server.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "args" : { - "password" : "0000", - "post" : "stay" - }, - "post" : { - "Installing DNS + Database": { - "pacman -Syy --noconfirm powerdns postgresql" : null - }, - "Setup Database": { - "sh -c \"echo 'postgres:{pin}' | chpasswd\"" : null, - "su - postgres -c \"initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data'\"" : null, - "systemctl start postgresql" : null, - "su - postgres -c \"psql -c \\\"CREATE USER pdns WITH PASSWORD 'SomePassword';\\\"\"" : {"debug" : true} - }, - "Setup DNS": { - "sh -c \"echo -e 'launch=gpgsql\ngpgsql-host=127.0.0.1\ngpgsql-user=pdns\ngpgsql-dbname=pdns\ngpgsql-password={PIN}' >> /etc/powerdns/pdns.conf\"" : null, - "psql -U pdns -d pdns -a -f /usr/share/doc/powerdns/schema.pgsql.sql" : null - }, - "Install DNS Entries": { - - }, - "Setup autostarts": { - "systemctl enable dhcpcd" : null, - "systemctl enable postgresql" : null, - "systemctl enable powerdns" : null - } - } -} diff --git a/profiles/gitea.json b/profiles/gitea.json deleted file mode 100644 index efb4c15e..00000000 --- a/profiles/gitea.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "args" : { - "password" : "", - "_editor" : "nano", - "_utils" : "openssh git curl dhclient", - "post" : "don't reboot" - }, - "post" : { - "Install workstation packages": { - "pacman -Syy --noconfirm {_utils} {_editor}" : {"pass-args" : true} - } - } -} diff --git a/profiles/local_mirror.json b/profiles/local_mirror.json deleted file mode 100644 index 79347f8b..00000000 --- a/profiles/local_mirror.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "args" : { - "password" : "0001" - }, - "post" : { - "Setup temp build env": { - "pacman -Syy --noconfirm git" : null, - "useradd -m -G wheel builder" : null, - "sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' /etc/sudoers" : null - }, - "install lighttpd2-git": { - "git clone https://aur.archlinux.org/lighttpd2-git.git /home/builder/lighttpd2" : null, - "chown -R builder.builder /home/builder/lighttpd2" : null, - "su - builder -c \"(cd /home/builder/lighttpd2/; /usr/bin/makepkg -s --noconfirm)\"" : null, - "sh -c 'pacman -U --noconfirm /home/builder/lighttpd2/*.xz'" : null - }, - "Remove temp build env": { - "rm -rf /home/builder/lighttpd2" : null, - "sed -i 's/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/' /etc/sudoers" : null - }, - "Create mirror": { - "mkdir -p /srv/http/archlinux/arch_offline/os/x86_64" : null, - "pacman --noconfirm --dbpath /tmp/ -Syu -w --cachedir /srv/http/archlinux/arch_offline/os/x86_64 base base-devel git python python-systemd awesome xorg-xinit xorg-server xterm nano screen sudo iptables mesa-libgl dhclient dnsmasq darkhttpd openssh sshfs openssl openvpn gcc openvpn rtorrent powerdns postgresql" : null, - "sh -c 'repo-add /srv/http/archlinux/arch_offline/os/x86_64/arch_offline.db.tar.gz /srv/http/archlinux/arch_offline/os/x86_64/*.pkg.tar.xz'" : null - }, - "Setup autostarts": { - "systemctl enable dhcpcd" : null, - "systemctl enable lighttpd2" : null - } - } -} diff --git a/profiles/minimal_example.json b/profiles/minimal_example.json deleted file mode 100644 index ec5e7d1c..00000000 --- a/profiles/minimal_example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "install cmatrix": { - "pacman -Syy --noconfirm cmatrix" : null - } -} diff --git a/profiles/pentest.json b/profiles/pentest.json deleted file mode 100644 index 900836ce..00000000 --- a/profiles/pentest.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "args" : { - "password" : "", - "_filebrowser" : "nemo gpicview-gtk3", - "_webbrowser" : "chromium", - "_window_manager" : "awesome", - "_keyboard_layout" : "sv-latin1", - "_virtulization" : "qemu ovmf", - "_pentest" : "nfs-utils smbmap crackmapexec samba bloodhound responder smbclient openvpn nmap tcpdump python-psutil python-systemd python-pycryptodomex screen", - "post" : "don't reboot" - }, - "post" : { - "Install workstation packages": { - "pacman -Syy --noconfirm openssh sshfs git {_webbrowser} {_window_manager} {_virtulization} {_filebrowser} dhclient gnu-free-fonts ttf-liberation xorg-server xorg-xrandr xorg-xinit xterm nano wget pulseaudio pulseaudio-alsa pavucontrol smbclient cifs-utils xscreensaver" : {"pass-args" : true} - }, - "Setup virtulization" : { - "sh -c \"Description=\\\"Bridge for virtual machines\\\"\nInterface=br0\nConnection=bridge\nBindsToInterfaces=(eno1)\nIP=no\nExecUpPost=\\\"ip link set dev br0 address $(cat /sys/class/net/eno1/address); IP=dhcp; ip_set\\\"\nExecDownPre=\\\"IP=dhcp\\\"\n\n## Ignore (R)STP and immediately activate the bridge\nSkipForwardingDelay=yes\"" : null - }, - "Setup loclization" : { - "sh -c \"echo 'setxkbmap se' >> /etc/X11/xinit/xinitrc\"" : null, - "sh -c \"echo 'KEYMAP={_keyboard_layout}\nFONT=lat9w-16' >> /etc/vconsole.conf\"" : {"pass-args" : true} - }, - "Configure desktop environment" : "awesome", - "Configure pentest environment" : { - "curl -O https://blackarch.org/strap.sh" : null, - "chmod +x strap.sh" : null, - "sh strap.sh" : {"debug" : true}, - "rm -rf /etc/pacman.d/gnupg" : null, - "pacman-key --init" : null, - "pacman-key --populate" : null, - "pacman-key --populate archlinux" : null, - "pacman-key --update" : null, - "pacman -Syy" : null, - "sh strap.sh" : null, - "sh strap.sh" : {"debug" : true}, - "pacman -Syy --noconfirm {_pentest}" : {"pass-args" : true}, - "touch /mnt/etc/openvpn/client/customer.conf" : {"no-chroot" : true}, - "sed -i 's/After=network.target/After=openvpn-client@customer.service\n&/' /mnt/usr/lib/systemd/system/sshd.service" : {"no-chroot" : true}, - "sed -i 's/ExecStart=/ExecStartPre=\\/usr\\/bin\\/sleep 30\n&/' /mnt/usr/lib/systemd/system/sshd.service" : {"no-chroot" : true}, - "echo 'Interface=eno1\nConnection=ethernet\nIP=dhcp' > /mnt/etc/netctl/LAN" : {"no-chroot" : true}, - "git clone https://github.com/Torxed/dumper.git" : null, - "mkdir /mnt/etc/dumper" : {"no-chroot" : true}, - "cp dumper/config.json /etc/dumper/" : null, - "cp dumper/dumper.py /usr/bin/" : null, - "chmod 440 /etc/dumper/config.json" : null, - "chmod 540 /usr/bin/dumper.py" : null, - "cp dumper/systemd/dumper\\@.service /etc/systemd/system/" : null, - "sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 192.168.0.10/' /mnt/etc/ssh/sshd_config" : {"no-chroot" : true}, - "rm -rf dumper" : null, - "netctl enable LAN" : {"boot" : true}, - "systemctl enable dumper@eno1.service" : null, - "systemctl enable sshd" : null - } - } -} diff --git a/profiles/router.json b/profiles/router.json deleted file mode 100644 index 48e038c0..00000000 --- a/profiles/router.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "Setup temp build env": { - "pacman -Syy --noconfirm git" : null, - "useradd -m -G wheel builder" : null, - "sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' /etc/sudoers" : null - }, - "install slimdhcp": { - "git clone https://aur.archlinux.org/slimdhcp-git.git /home/builder/slimdhcp" : null, - "chown -R builder.builder /home/builder/slimdhcp" : null, - "su - builder -c \"(cd /home/builder/slimdhcp/; /usr/bin/makepkg -s --noconfirm)\"" : null, - "sh -c 'pacman -U --noconfirm /home/builder/slimdhcp/*.xz'" : null - }, - "Remove temp build env": { - "rm -rf /home/builder/slimdhcp" : null, - "sed -i 's/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/' /etc/sudoers" : null - } -} diff --git a/profiles/ubuntu.json b/profiles/ubuntu.json deleted file mode 100644 index be239a91..00000000 --- a/profiles/ubuntu.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "args" : { - "password" : "", - "_mediaplayer" : "lollypop gstreamer gst-plugins-good gnome-keyring", - "_filebrowser" : "nemo gpicview-gtk3", - "_webbrowser" : "chromium", - "_window_manager" : "awesome", - "_keyboard_layout" : "sv-latin1", - "_virtulization" : "qemu ovmf", - "post" : "don't reboot" - }, - "post" : { - "Install workstation packages": { - "pacman -Syy --noconfirm openssh sshfs git {_webbrowser} {_mediaplayer} {_window_manager} {_virtulization} {_filebrowser} dhclient gnu-free-fonts ttf-liberation xorg-server xorg-xrandr xorg-xinit xterm nano wget pulseaudio pulseaudio-alsa pavucontrol smbclient cifs-utils xscreensaver" : {"pass-args" : true} - }, - "Setup loclization" : { - "sh -c \"echo 'setxkbmap se' >> /etc/X11/xinit/xinitrc\"" : null, - "sh -c \"echo 'KEYMAP={_keyboard_layout}\nFONT=lat9w-16' >> /etc/vconsole.conf\"" : {"pass-args" : true} - }, - "Configure desktop environment" : "gnome" - } -} diff --git a/profiles/vmhost.json b/profiles/vmhost.json deleted file mode 100644 index 0b2dabec..00000000 --- a/profiles/vmhost.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "args" : { - "password" : "", - "_keyboard_layout" : "us", - "_editor" : "vim", - "_window_manager" : "i3", - "_window_manager_dependencies" : "xorg-server xorg-xrandr xorg-xinit xterm", - "_window_manager_utilities" : "slock xscreensaver terminus-font-otb gnu-free-fonts ttf-liberation xsel", - "_virtulization" : "qemu ovmf", - "_utils" : "git htop dhclient curl", - "post" : "don't reboot" - }, - "post" : { - "Install workstation packages": { - "pacman -Syy --noconfirm {_editor} {_utils} {_window_manager} {_window_manager_dependencies} {_window_manager_utilities} {_virtulization}" : {"pass-args" : true} - }, - "Setup virtulization" : { - "sh -c \"Description=\\\"Bridge for virtual machines\\\"\nInterface=br0\nConnection=bridge\nBindsToInterfaces=(eno1)\nIP=no\nExecUpPost=\\\"ip link set dev br0 address $(cat /sys/class/net/eno1/address); IP=dhcp; ip_set\\\"\nExecDownPre=\\\"IP=dhcp\\\"\n\n## Ignore (R)STP and immediately activate the bridge\nSkipForwardingDelay=yes\"" : null - }, - "Setup localization" : { - "sh -c \"echo 'setxkbmap us' >> /etc/X11/xinit/xinitrc\"" : null, - "sh -c \"echo 'KEYMAP={_keyboard_layout}\nFONT=lat9w-16' >> /etc/vconsole.conf\"" : {"pass-args" : true} - }, - "Configure desktop environment" : "i3" - } -} diff --git a/profiles/webserver.json b/profiles/webserver.json deleted file mode 100644 index 6925ab00..00000000 --- a/profiles/webserver.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "args" : { - "password" : "0000", - "post" : "stay" - }, - "post" : { - "Setup webserver build env": { - "pacman -Syy --noconfirm git wget" : null, - "useradd -m -G wheel builder" : null, - "sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' /etc/sudoers" : null - }, - "install lighttpd2-git and PHP": { - "git clone https://aur.archlinux.org/lighttpd2-git.git /home/builder/lighttpd2" : null, - "chown -R builder.builder /home/builder/lighttpd2" : null, - "su - builder -c \"(cd /home/builder/lighttpd2/; /usr/bin/makepkg -s --noconfirm)\"" : null, - "sh -c 'pacman -U --noconfirm /home/builder/lighttpd2/*.xz'" : null, - "pacman -Syy --noconfirm spawn-fcgi php-cgi php" : null - }, - "Remove webserver build env": { - "rm -rf /home/builder/lighttpd2" : null, - "sed -i 's/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/' /etc/sudoers" : null - }, - "Configure lighttpd2": { - "wget https://raw.githubusercontent.com/Torxed/Scripts/master/bash/spawn_php -O /etc/lighttpd2/spawn_php" : null, - "wget https://raw.githubusercontent.com/Torxed/Scripts/master/systemd/php.service -O /etc/systemd/system/php.service" : null, - "chmod +x /etc/lighttpd2/spawn_php" : null, - "touch /etc/lighttpd2/vhost.conf" : null, - "sed -i 's/static/#static/' /mnt/etc/lighttpd2/lighttpd.conf" : {"no-chroot" : true, "debug" : true}, - "sed -i 's/\"mod_dirlist\"/\"mod_dirlist\",\\n\\t\\t\"mod_fastcgi\",\\n\\t\\t\"mod_vhost\"/' /mnt/etc/lighttpd2/lighttpd.conf" : {"no-chroot" : true, "debug" : true}, - "echo 'include \"/etc/lighttpd2/php.conf\";' >> //mnt/etc/lighttpd2/lighttpd.conf": {"no-chroot" : true}, - "echo 'include \"/etc/lighttpd2/vhost.conf\";' >> //mnt/etc/lighttpd2/lighttpd.conf": {"no-chroot" : true}, - "echo 'if phys.path =$ \".php\" { fastcgi \"unix:/tmp/php.sock\"; }' >> /mnt/etc/lighttpd2/php.conf": {"no-chroot" : true}, - "echo '' >> /mnt/srv/http/index.php": {"no-chroot" : true} - }, - "Setup webserver autostarts": { - "systemctl enable dhcpcd" : null, - "systemctl enable lighttpd2" : null, - "systemctl enable php" : null - } - } -} diff --git a/profiles/workstation.json b/profiles/workstation.json deleted file mode 100644 index 37216b0e..00000000 --- a/profiles/workstation.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "args" : { - "password" : "", - "_keyboard_layout" : "sv-latin1", - "_editor" : "nano", - "_mediaplayer" : "lollypop gstreamer gst-plugins-good gnome-keyring", - "_filebrowser" : "nemo gpicview-gtk3", - "_webbrowser" : "chromium", - "_window_manager" : "awesome", - "_window_manager_dependencies" : "xorg-server xorg-xrandr xorg-xinit xterm", - "_window_manager_utilities" : "feh slock xscreensaver terminus-font-otb gnu-free-fonts ttf-liberation xsel", - "_virtulization" : "qemu ovmf", - "_utils" : "openssh sshfs git htop pkgfile scrot dhclient wget smbclient cifs-utils libu2f-host", - "_audio" : "pulseaudio pulseaudio-alsa pavucontrol", - "post" : "don't reboot" - }, - "post" : { - "Install workstation packages": { - "pacman -Syy --noconfirm {_webbrowser} {_utils} {_mediaplayer} {_window_manager} {_window_manager_dependencies} {_window_manager_utilities} {_virtulization} {_filebrowser} {_editor}" : {"pass-args" : true} - }, - "Setup virtulization" : { - "sh -c \"Description=\\\"Bridge for virtual machines\\\"\nInterface=br0\nConnection=bridge\nBindsToInterfaces=(eno1)\nIP=no\nExecUpPost=\\\"ip link set dev br0 address $(cat /sys/class/net/eno1/address); IP=dhcp; ip_set\\\"\nExecDownPre=\\\"IP=dhcp\\\"\n\n## Ignore (R)STP and immediately activate the bridge\nSkipForwardingDelay=yes\"" : null - }, - "Setup loclization" : { - "sh -c \"echo 'setxkbmap se' >> /etc/X11/xinit/xinitrc\"" : null, - "sh -c \"echo 'KEYMAP={_keyboard_layout}\nFONT=lat9w-16' >> /etc/vconsole.conf\"" : {"pass-args" : true} - }, - "Configure desktop environment" : "awesome" - } -} diff --git a/profiles/workstation_aur.json b/profiles/workstation_aur.json deleted file mode 100644 index d3c26672..00000000 --- a/profiles/workstation_aur.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "pre" : { - "git-branch" : "aur-support" - }, - "args" : { - "password" : "", - "_keyboard_layout" : "sv-latin1", - "_editor" : "nano", - "_mediaplayer" : "lollypop gstreamer gst-plugins-good gnome-keyring", - "_filebrowser" : "nemo gpicview-gtk3", - "_webbrowser" : "chromium", - "_code_editor" : "sublime-text-dev", - "_window_manager" : "awesome", - "_window_manager_dependencies" : "xorg-server xorg-xrandr xorg-xinit xterm", - "_window_manager_utilities" : "feh slock xscreensaver terminus-font-otb gnu-free-fonts ttf-liberation xsel", - "_virtulization" : "qemu ovmf", - "_utils" : "openssh sshfs git htop pkgfile scrot dhclient wget smbclient cifs-utils libu2f-host", - "_audio" : "pulseaudio pulseaudio-alsa pavucontrol", - "post" : "don't reboot" - }, - "post" : { - "Install workstation packages": { - "pacman -Syy --noconfirm {_webbrowser} {_utils} {_mediaplayer} {_window_manager} {_window_manager_dependencies} {_window_manager_utilities} {_virtulization} {_filebrowser} {_editor}" : {"pass-args" : true} - }, - "Install aur packages" : { - "yay -Syy --noconfirm {_code_editor}" : {"pass-args" : true, "runas" : "aibuilder"} - }, - "Setup virtulization" : { - "sh -c \"Description=\\\"Bridge for virtual machines\\\"\nInterface=br0\nConnection=bridge\nBindsToInterfaces=(eno1)\nIP=no\nExecUpPost=\\\"ip link set dev br0 address $(cat /sys/class/net/eno1/address); IP=dhcp; ip_set\\\"\nExecDownPre=\\\"IP=dhcp\\\"\n\n## Ignore (R)STP and immediately activate the bridge\nSkipForwardingDelay=yes\"" : null - }, - "Setup loclization" : { - "sh -c \"echo 'setxkbmap se' >> /etc/X11/xinit/xinitrc\"" : null, - "sh -c \"echo 'KEYMAP={_keyboard_layout}\nFONT=lat9w-16' >> /etc/vconsole.conf\"" : {"pass-args" : true} - }, - "Configure desktop environment" : "awesome" - } -} diff --git a/profiles/workstation_unattended.json b/profiles/workstation_unattended.json deleted file mode 100644 index 089f7f40..00000000 --- a/profiles/workstation_unattended.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "args" : { - "password" : "0000", - "include" : "workstation" - } -} -- cgit v1.2.3-54-g00ecf From b2a8fd985746a06ccbdfe87f7f1d4c780fdaaabc Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 4 Aug 2020 14:50:36 +0200 Subject: Adding description handling in profiles. --- archinstall/lib/profiles.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 0e76ba3d..4e14ea67 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -20,7 +20,13 @@ def list_profiles(base='./profiles/'): for root, folders, files in os.walk(base): for file in files: if os.path.splitext(file)[1] == '.py': - cache[file] = os.path.join(root, file) + description = '' + with open(os.path.join(root, file), 'r') as fh: + first_line = fh.readline() + if first_line[0] == '#': + description = first_line.strip() + + cache[file] = {'path' : os.path.join(root, file), 'description' : ''} break return cache -- cgit v1.2.3-54-g00ecf From 2af2f90280dbe035586fac71cc9387d2d823cf3c Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 4 Aug 2020 14:56:50 +0200 Subject: Added a debug --- archinstall/lib/profiles.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 4e14ea67..ed8e317b 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -23,9 +23,10 @@ def list_profiles(base='./profiles/'): description = '' with open(os.path.join(root, file), 'r') as fh: first_line = fh.readline() + print(first_line) if first_line[0] == '#': description = first_line.strip() - + cache[file] = {'path' : os.path.join(root, file), 'description' : ''} break return cache -- cgit v1.2.3-54-g00ecf From b29c35de23c1334b693e71456f199937af4ba4ab Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 4 Aug 2020 14:57:33 +0200 Subject: Fixed description support --- archinstall/lib/profiles.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index ed8e317b..1f55facd 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -23,11 +23,10 @@ def list_profiles(base='./profiles/'): description = '' with open(os.path.join(root, file), 'r') as fh: first_line = fh.readline() - print(first_line) if first_line[0] == '#': description = first_line.strip() - cache[file] = {'path' : os.path.join(root, file), 'description' : ''} + cache[file] = {'path' : os.path.join(root, file), 'description' : description} break return cache -- cgit v1.2.3-54-g00ecf From 11f36102db539ea8648a5aeaf2b799b554b3e272 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 4 Aug 2020 14:58:10 +0200 Subject: Fixed description support --- archinstall/lib/profiles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 1f55facd..3360d4bb 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -24,7 +24,7 @@ def list_profiles(base='./profiles/'): with open(os.path.join(root, file), 'r') as fh: first_line = fh.readline() if first_line[0] == '#': - description = first_line.strip() + description = first_line[1:].strip() cache[file] = {'path' : os.path.join(root, file), 'description' : description} break -- cgit v1.2.3-54-g00ecf From 27e20ae433ba3d374c5e5eefca77c5bc320fd64e Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 5 Aug 2020 10:29:34 +0200 Subject: Removed support entirely for .json. Cleaning up the Profile() class **a lot**. Also tweaked some variable names to better suit the actual usage, which was a path definition not a name definition anymore --- archinstall/lib/profiles.py | 109 ++++++++------------------------------------ 1 file changed, 19 insertions(+), 90 deletions(-) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 3360d4bb..47d6eaf8 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -45,28 +45,28 @@ class Imported(): raise args[1] class Profile(): - def __init__(self, installer, name, args={}): - self.name = name + def __init__(self, installer, path, args={}): + self._path = path self.installer = installer self._cache = None self.args = args def __repr__(self, *args, **kwargs): - return f'Profile({self.name} <"{self.path}">)' + return f'Profile({self._path} <"{self.path}">)' @property def path(self, *args, **kwargs): - if os.path.isfile(f'{self.name}'): - return os.path.abspath(f'{self.name}') + if os.path.isfile(f'{self._path}'): + return os.path.abspath(f'{self._path}') for path in ['./profiles', '/etc/archinstall', '/etc/archinstall/profiles', os.path.abspath(f'{os.path.dirname(__file__)}/../profiles')]: # Step out of /lib - if os.path.isfile(f'{path}/{self.name}.py'): - return os.path.abspath(f'{path}/{self.name}.py') + if os.path.isfile(f'{path}/{self._path}.py'): + return os.path.abspath(f'{path}/{self._path}.py') try: - if (cache := grab_url_data(f'{UPSTREAM_URL}/{self.name}.py')): + if (cache := grab_url_data(f'{UPSTREAM_URL}/{self._path}.py')): self._cache = cache - return f'{UPSTREAM_URL}/{self.name}.py' + return f'{UPSTREAM_URL}/{self._path}.py' except urllib.error.HTTPError: pass @@ -85,7 +85,7 @@ class Profile(): else: raise ProfileError(f'Extension {os.path.splitext(absolute_path)[1]} is not a supported profile model. Only .py is supported.') - raise ProfileError(f'No such profile ({self.name}) was found either locally or in {UPSTREAM_URL}') + raise ProfileError(f'No such profile ({self._path}) was found either locally or in {UPSTREAM_URL}') def install(self): # To avoid profiles importing the wrong 'archinstall', @@ -102,98 +102,27 @@ class Profile(): # TODO: Remove __builtins__['installation'] = self.installer with instructions as runtime: - log(f'Profile {self.name} finished successfully.', bg='black', fg='green') - else: - if 'args' in instructions: - self.args = instructions['args'] - if 'post' in instructions: - instructions = instructions['post'] - - for title in instructions: - log(f'Running post installation step {title}') - - log('[N] Network Deploy: {}'.format(title)) - if type(instructions[title]) == str: - log('[N] Loading {} configuration'.format(instructions[title])) - log(f'Loading {instructions[title]} configuration') - instructions[title] = Application(self.installer, instructions[title], args=self.args) - instructions[title].install() - else: - for command in instructions[title]: - raw_command = command - opts = instructions[title][command] if type(instructions[title][command]) in (dict, OrderedDict) else {} - if len(opts): - if 'pass-args' in opts or 'format' in opts: - command = command.format(**self.args) - ## FIXME: Instead of deleting the two options - ## in order to mute command output further down, - ## check for a 'debug' flag per command and delete these two - if 'pass-args' in opts: - del(opts['pass-args']) - elif 'format' in opts: - del(opts['format']) - - if 'pass-args' in opts and opts['pass-args']: - command = command.format(**self.args) - - if 'runas' in opts and f'su - {opts["runas"]} -c' not in command: - command = command.replace('"', '\\"') - command = f'su - {opts["runas"]} -c "{command}"' - - if 'no-chroot' in opts and opts['no-chroot']: - log(f'Executing {command} as simple command from live-cd.') - o = sys_command(command, opts) - elif 'chroot' in opts and opts['chroot']: - log(f'Executing {command} in chroot.') - ## Run in a manually set up version of arch-chroot (arch-chroot will break namespaces). - ## This is a bit risky in case the file systems changes over the years, but we'll probably be safe adding this as an option. - ## **> Prefer if possible to use 'no-chroot' instead which "live boots" the OS and runs the command. - o = sys_command(f"mount /dev/mapper/luksdev {self.installer.mountpoint}") - o = sys_command(f"cd {self.installer.mountpoint}; cp /etc/resolv.conf etc") - o = sys_command(f"cd {self.installer.mountpoint}; mount -t proc /proc proc") - o = sys_command(f"cd {self.installer.mountpoint}; mount --make-rslave --rbind /sys sys") - o = sys_command(f"cd {self.installer.mountpoint}; mount --make-rslave --rbind /dev dev") - o = sys_command(f'chroot {self.installer.mountpoint} /bin/bash -c "{command}"') - o = sys_command(f"cd {self.installer.mountpoint}; umount -R dev") - o = sys_command(f"cd {self.installer.mountpoint}; umount -R sys") - o = sys_command(f"cd {self.installer.mountpoint}; umount -R proc") - else: - if 'boot' in opts and opts['boot']: - log(f'Executing {command} in boot mode.') - defaults = { - 'login:' : 'root\n', - 'Password:' : self.args['password']+'\n', - f'[root@{self.args["hostname"]} ~]#' : command+'\n', - } - if not 'events' in opts: opts['events'] = {} - events = {**defaults, **opts['events']} - del(opts['events']) - o = b''.join(sys_command(f'/usr/bin/systemd-nspawn -D {self.installer.mountpoint} -b --machine temporary', events=events)) - else: - log(f'Executing {command} in with systemd-nspawn without boot.') - o = b''.join(sys_command(f'/usr/bin/systemd-nspawn -D {self.installer.mountpoint} --machine temporary {command}')) - if type(instructions[title][raw_command]) == bytes and len(instructions['post'][title][raw_command]) and not instructions['post'][title][raw_command] in o: - log(f'{command} failed: {o.decode("UTF-8")}') - log('[W] Post install command failed: {}'.format(o.decode('UTF-8'))) + log(f'Profile {self._path} finished successfully.', bg='black', fg='green') + return True class Application(Profile): def __repr__(self, *args, **kwargs): - return f'Application({self.name} <"{self.path}">)' + return f'Application({self._path} <"{self.path}">)' @property def path(self, *args, **kwargs): - if os.path.isfile(f'{self.name}'): - return os.path.abspath(f'{self.name}') + if os.path.isfile(f'{self._path}'): + return os.path.abspath(f'{self._path}') for path in ['./applications', './profiles/applications', '/etc/archinstall/applications', '/etc/archinstall/profiles/applications', os.path.abspath(f'{os.path.dirname(__file__)}/../profiles/applications')]: - if os.path.isfile(f'{path}/{self.name}.py'): - return os.path.abspath(f'{path}/{self.name}.py') + if os.path.isfile(f'{path}/{self._path}.py'): + return os.path.abspath(f'{path}/{self._path}.py') try: - if (cache := grab_url_data(f'{UPSTREAM_URL}/applications/{self.name}.py')): + if (cache := grab_url_data(f'{UPSTREAM_URL}/applications/{self._path}.py')): self._cache = cache - return f'{UPSTREAM_URL}/applications/{self.name}.py' + return f'{UPSTREAM_URL}/applications/{self._path}.py' except urllib.error.HTTPError: pass -- cgit v1.2.3-54-g00ecf From 1d8591c7fe2a9c4d2a6338cc332e7704751acbe7 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 9 Aug 2020 09:24:45 +0200 Subject: Added make.sh into PKGBUILD --- PKGBUILD | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 801c2b8d..fd5219d3 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -7,12 +7,33 @@ pkgrel=1 url="https://github.com/Torxed/archinstall" license=('GPLv3') provides=("${pkgname}") -md5sums=('SKIP') +#md5sums=('SKIP') arch=('x86_64') -source=("${pkgname}-${pkgver}-x86_64.tar.gz") -#makedepends=('python>=3.8') +#source=("${pkgname}-${pkgver}-x86_64.tar.gz") +makedepends=('nuitka' 'git') + +build() { + rm -rf archinstall + + git clone "${url}.git" + cd ./archinstall + + nuitka3 --standalone --show-progress archinstall + cp -r examples/ archinstall.dist/ + mv archinstall.dist archinstall-${pkgver}-x86_64 + tar -czvf archinstall-${pkgver}-x86_64.tar.gz archinstall-${pkgver}-x86_64 + + mv archinstall-${pkgver}-x86_64.tar.gz ../ + cd .. + pkgsrc=$(pwd) +} package() { + cd "${pkgsrc}" + pwd + ls -l + tar xvzf archinstall-${pkgver}-x86_64.tar.gz + cd "${pkgname}-${pkgver}-x86_64" mkdir -p "${pkgdir}/var/lib/archinstall/" -- cgit v1.2.3-54-g00ecf