Fixed merge.

This commit is contained in:
Anton Hvornum 2020-08-18 21:56:22 +00:00
commit af875e3902
26 changed files with 52 additions and 644 deletions

View File

@ -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,16 @@ 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):
log(f'Adding bootloader to {self.boot_partition}')
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}')

View File

@ -14,6 +14,22 @@ 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':
description = ''
with open(os.path.join(root, file), 'r') as fh:
first_line = fh.readline()
if first_line[0] == '#':
description = first_line[1:].strip()
cache[file] = {'path' : os.path.join(root, file), 'description' : description}
break
return cache
class Imported():
def __init__(self, spec, imported):
self.spec = spec
@ -29,42 +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}.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')
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'
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'
return f'{UPSTREAM_URL}/{self._path}.py'
except urllib.error.HTTPError:
pass
@ -80,13 +82,10 @@ 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)
else:
raise ProfileError(f'Extension {os.path.splitext(absolute_path)[1]} is not a supported profile model. Only .py is supported.')
with open(absolute_path, 'r') as fh:
return json.load(fh)
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',
@ -103,106 +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')
elif os.path.isfile(f'{path}/{self.name}.json'):
return os.path.abspath(f'{path}/{self.name}.json')
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'
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'
return f'{UPSTREAM_URL}/applications/{self._path}.py'
except urllib.error.HTTPError:
pass

View File

@ -1,76 +0,0 @@
{
"args" : {
"password" : "0000",
"db_pass" : "<RND_STR>",
"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}
}
}
}

View File

@ -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}
}
}
}

View File

@ -1,22 +0,0 @@
{
"args" : {
"include" : "workstation",
"user" : "anton",
"password" : "<STDIN>"
},
"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}
}
}
}

View File

@ -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
}
}

View File

@ -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,
}

View File

@ -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,
}

View File

@ -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}
}

View File

@ -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
}
}
}
}

View File

@ -1,3 +1,5 @@
# A desktop environemtn using "Awesome" window manager.
import archinstall
arguments = {

View File

@ -1,22 +0,0 @@
{
"args" : {
"password" : "<STDIN>",
"_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"
}
}

View File

@ -1,22 +0,0 @@
{
"args" : {
"password" : "<STDIN>",
"_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"
}
}

View File

@ -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
}
}
}

View File

@ -1,13 +0,0 @@
{
"args" : {
"password" : "<STDIN>",
"_editor" : "nano",
"_utils" : "openssh git curl dhclient",
"post" : "don't reboot"
},
"post" : {
"Install workstation packages": {
"pacman -Syy --noconfirm {_utils} {_editor}" : {"pass-args" : true}
}
}
}

View File

@ -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
}
}
}

View File

@ -1,5 +0,0 @@
{
"install cmatrix": {
"pacman -Syy --noconfirm cmatrix" : null
}
}

View File

@ -1,55 +0,0 @@
{
"args" : {
"password" : "<STDIN>",
"_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
}
}
}

View File

@ -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
}
}

View File

@ -1,22 +0,0 @@
{
"args" : {
"password" : "<STDIN>",
"_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"
}
}

View File

@ -1,26 +0,0 @@
{
"args" : {
"password" : "<STDIN>",
"_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"
}
}

View File

@ -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 '<?php print(\"Welcome!\"); ?>' >> /mnt/srv/http/index.php": {"no-chroot" : true}
},
"Setup webserver autostarts": {
"systemctl enable dhcpcd" : null,
"systemctl enable lighttpd2" : null,
"systemctl enable php" : null
}
}
}

View File

@ -1,30 +0,0 @@
{
"args" : {
"password" : "<STDIN>",
"_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"
}
}

View File

@ -1,37 +0,0 @@
{
"pre" : {
"git-branch" : "aur-support"
},
"args" : {
"password" : "<STDIN>",
"_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"
}
}

View File

@ -1,6 +0,0 @@
{
"args" : {
"password" : "0000",
"include" : "workstation"
}
}

View File

@ -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.",