From 7fd700b3c4ac3268b2904ea66f89c5272db8ab65 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 09:25:40 +0200 Subject: Updated to clone net-deploy branch --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f9a70e65..88984d2c 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # archinstall -Just a bare bone automated [Arch](https://wiki.archlinux.org/index.php/Arch_Linux) install +Just a bare bone automated [Arch](https://wiki.archlinux.org/index.php/Arch_Linux) install with network deployment instructions based on MAC-address. # Autorun on Arch Live CD # cd ~/archlive # echo -e "git\npython-psutil" >> packages.both - # echo "git clone https://github.com/Torxed/archinstall.git" >> ./airootfs/root/customize_airootfs.sh + # echo "git clone -b net-deploy --single-branch https://github.com/Torxed/archinstall.git" >> ./airootfs/root/customize_airootfs.sh # echo "chmod +x ~/archinstall/archinstall.py" >> ./airootfs/root/customize_airootfs.sh # mkdir ./airootfs/etc/skel # echo '[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && sh -c ~/archinstall/archinstall.py' >> ./airootfs/etc/skel/.zprofile @@ -19,7 +19,7 @@ Whenever this live-cd boots, from here on now - it'll run `archinstall.py`. # Manually run it on a booted Live CD - # git clone https://github.com/Torxed/archinstall.git + # git clone -b net-deploy --single-branch https://github.com/Torxed/archinstall.git # python3 ./archinstall/archinstall.py # Some parameters you can give it -- cgit v1.2.3-70-g09d2 From 807a0db4458b56724f2792083f6744ac46bf0953 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 09:40:10 +0200 Subject: A simple text script for net-deploy --- deployments/9c:d6:43:ae:11:4f.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 deployments/9c:d6:43:ae:11:4f.json diff --git a/deployments/9c:d6:43:ae:11:4f.json b/deployments/9c:d6:43:ae:11:4f.json new file mode 100644 index 00000000..6de532fa --- /dev/null +++ b/deployments/9c:d6:43:ae:11:4f.json @@ -0,0 +1,5 @@ +{ + "install ssh": { + "pacman -y -S openssh" : null + } +} -- cgit v1.2.3-70-g09d2 From 290ab5003205817c59fd08c79fc077002c27c813 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 09:42:21 +0200 Subject: Update 9c:d6:43:ae:11:4f.json --- deployments/9c:d6:43:ae:11:4f.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployments/9c:d6:43:ae:11:4f.json b/deployments/9c:d6:43:ae:11:4f.json index 6de532fa..6b4bd69e 100644 --- a/deployments/9c:d6:43:ae:11:4f.json +++ b/deployments/9c:d6:43:ae:11:4f.json @@ -1,5 +1,5 @@ { "install ssh": { - "pacman -y -S openssh" : null + "pacman -y -S cmatrix" : null } } -- cgit v1.2.3-70-g09d2 From 828cca1beb78d86a6d646b24aed9d412b8b2b890 Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 09:51:38 +0200 Subject: Added support for remote HTTPS instructions --- archinstall.py | 56 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/archinstall.py b/archinstall.py index a9721e17..1d3672a0 100644 --- a/archinstall.py +++ b/archinstall.py @@ -1,7 +1,9 @@ #!/usr/bin/python3 -import psutil, os, re, struct, sys +import psutil, os, re, struct, sys, json +import urllib.request, urllib.parse from glob import glob -from socket import inet_ntoa, AF_INET, AF_INET6 +#from select import epoll, EPOLLIN, EPOLLHUP +from socket import socket, inet_ntoa, AF_INET, AF_INET6, AF_PACKET from collections import OrderedDict as oDict from subprocess import Popen, STDOUT, PIPE @@ -30,11 +32,14 @@ def get_default_gateway_linux(): return inet_ntoa(struct.pack(" Date: Sat, 7 Apr 2018 10:05:30 +0200 Subject: Modified the install command and debug output --- archinstall.py | 46 +++++++++++++++++++++----------------- deployments/9c:d6:43:ae:11:4f.json | 2 +- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/archinstall.py b/archinstall.py index 1d3672a0..f078445f 100644 --- a/archinstall.py +++ b/archinstall.py @@ -213,7 +213,8 @@ if __name__ == '__main__': #o = run('arch-chroot /mnt usermod --password {} root'.format(PIN)) #TODO: This doesn't work either: (why the hell not?) # echo "newpass" | passwd --stdin root ? - o = run("arch-chroot /mnt echo 'root:{pin}' | chpasswd".format(**args, pin=PIN)) + #o = run("arch-chroot /mnt echo 'root:{pin}' | chpasswd".format(**args, pin=PIN)) + o = run('arch-chroot /mnt echo "{pin}" | passwd --stdin root'.format(**args, pin=PIN)) if 'user' in args: o = run('arch-chroot /mnt useradd -m -G wheel {user}'.format(**args)) o = run("arch-chroot /mnt echo '{user}:{pin}' | chpasswd".format(**args, pin=PIN)) @@ -241,25 +242,28 @@ if __name__ == '__main__': entry.write('initrd /initramfs-linux.img\n') entry.write('options cryptdevice=UUID={UUID}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n'.format(UUID=UUID)) - locmac = get_local_MACs() - for mac in locmac: - try: - instructions = grab_url_data('https://raw.githubusercontent.com/Torxed/archinstall/net-deploy/deployments/{}.json'.format(mac)) - except urllib.error.HTTPError: - print('[N] No instructions for this box on this mac: {}'.format(mac)) - continue - - instructions = json.loads(instructions.decode('UTF-8')) - - for title in instructions: - print('[N] {}'.format(title)) - for command in instructions[title]: - o = run(command) # arch-chroot /mnt ... - if instructions[title][command]: + ## == If we got networking, + # Try fetching instructions for this box and execute them. + if get_default_gateway_linux(): + locmac = get_local_MACs() + for mac in locmac: + try: + instructions = grab_url_data('https://raw.githubusercontent.com/Torxed/archinstall/net-deploy/deployments/{}.json'.format(mac)) + except urllib.error.HTTPError: + print('[N] No instructions for this box on this mac: {}'.format(mac)) + continue + + instructions = json.loads(instructions.decode('UTF-8')) + + for title in instructions: + print('[N] {}'.format(title)) + for command in instructions[title]: + o = run(command) # arch-chroot /mnt ... + #if instructions[title][command]: print(o) - o = run('umount -R /mnt') - if args['post'] == 'reboot': - o = run('reboot now') - else: - print('Done. "reboot" when you\'re done tinkering.') + #o = run('umount -R /mnt') + #if args['post'] == 'reboot': + # o = run('reboot now') + #else: + # print('Done. "reboot" when you\'re done tinkering.') diff --git a/deployments/9c:d6:43:ae:11:4f.json b/deployments/9c:d6:43:ae:11:4f.json index 6b4bd69e..ab988e44 100644 --- a/deployments/9c:d6:43:ae:11:4f.json +++ b/deployments/9c:d6:43:ae:11:4f.json @@ -1,5 +1,5 @@ { "install ssh": { - "pacman -y -S cmatrix" : null + "pacman -Syy --noconfirm cmatrix" : null } } -- cgit v1.2.3-70-g09d2 From da12297c848c0bedb4f7d14561d36b6019bba0a4 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 10:42:01 +0200 Subject: Create 08:00:27:d4:fd:ef.json --- deployments/08:00:27:d4:fd:ef.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 deployments/08:00:27:d4:fd:ef.json diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json new file mode 100644 index 00000000..ab988e44 --- /dev/null +++ b/deployments/08:00:27:d4:fd:ef.json @@ -0,0 +1,5 @@ +{ + "install ssh": { + "pacman -Syy --noconfirm cmatrix" : null + } +} -- cgit v1.2.3-70-g09d2 From 20ba0b145cdccf5bf98879ca9e1a6811ef078519 Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 10:48:23 +0200 Subject: Forgot to execute post-install inside arch-chroot --- archinstall.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/archinstall.py b/archinstall.py index f078445f..5970b385 100644 --- a/archinstall.py +++ b/archinstall.py @@ -214,7 +214,7 @@ if __name__ == '__main__': #TODO: This doesn't work either: (why the hell not?) # echo "newpass" | passwd --stdin root ? #o = run("arch-chroot /mnt echo 'root:{pin}' | chpasswd".format(**args, pin=PIN)) - o = run('arch-chroot /mnt echo "{pin}" | passwd --stdin root'.format(**args, pin=PIN)) + o = run('arch-chroot /mnt \'echo "{pin}" | passwd --stdin root\''.format(**args, pin=PIN)) if 'user' in args: o = run('arch-chroot /mnt useradd -m -G wheel {user}'.format(**args)) o = run("arch-chroot /mnt echo '{user}:{pin}' | chpasswd".format(**args, pin=PIN)) @@ -258,9 +258,10 @@ if __name__ == '__main__': for title in instructions: print('[N] {}'.format(title)) for command in instructions[title]: - o = run(command) # arch-chroot /mnt ... - #if instructions[title][command]: - print(o) + o = run('arch-chroot /mnt {c}'.format(c=command)) + if instructions[title][command] and not instructions[title][command] in o: + print('[W] Post install command failed: {}'.format(o.decode('UTF-8'))) + #print(o) #o = run('umount -R /mnt') #if args['post'] == 'reboot': -- cgit v1.2.3-70-g09d2 From 07df81aaa1ac261ada1d5e672a19e13286f5d1a4 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 11:27:41 +0200 Subject: Added wrapaur installation (i preferred pacaur) --- deployments/08:00:27:d4:fd:ef.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index ab988e44..3bf0db9f 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -1,5 +1,10 @@ { "install ssh": { - "pacman -Syy --noconfirm cmatrix" : null + "pacman -Syy --noconfirm git" : null, + "useradd -m -G wheel builder" : null, + "git https://aur.archlinux.org/wrapaur.git /tmp/wrapaur" : null, + "chown -R builder.builder /tmp/wrapaur" : null, + "su - builder -c \"cd /tmp/wrapaur; /usr/bin/makepkg -s\"" : null, + "pacman -U --noconfirm /tmp/wrapaur/*.xz" : null, } } -- cgit v1.2.3-70-g09d2 From b2287c171c39a1e3ec87a2dc42822f55b928e742 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 11:57:44 +0200 Subject: Scrapped wrapaur, doing it manually instead. --- deployments/08:00:27:d4:fd:ef.json | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index 3bf0db9f..f3b6d8e8 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -2,9 +2,13 @@ "install ssh": { "pacman -Syy --noconfirm git" : null, "useradd -m -G wheel builder" : null, - "git https://aur.archlinux.org/wrapaur.git /tmp/wrapaur" : null, - "chown -R builder.builder /tmp/wrapaur" : null, - "su - builder -c \"cd /tmp/wrapaur; /usr/bin/makepkg -s\"" : null, - "pacman -U --noconfirm /tmp/wrapaur/*.xz" : null, + "#Correct way would be to do cat PKGBUILD | grep 'depends=' | head -n 1 | ..." : null, + "sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' /etc/sudoers" : null, + "git https://aur.archlinux.org/slimdhcp-git.git /tmp/slimdhcp" : null, + "chown -R builder.builder /tmp/slimdhcp" : null, + "su - builder -c \"cd /tmp/slimdhcp; /usr/bin/makepkg -s --noconfirm\"" : null, + "pacman -U --noconfirm /tmp/slimdhcp/*.xz" : null, + "rm -rf /tmp/slimdhcp" : null, + "sed -i 's/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/' /etc/sudoers" : null, } } -- cgit v1.2.3-70-g09d2 From d0f563162684f0f861c08a9a37e42f0b7a8ee3b2 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 12:05:45 +0200 Subject: Separated the build-prerequisits --- deployments/08:00:27:d4:fd:ef.json | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index f3b6d8e8..a900fd22 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -1,14 +1,19 @@ { - "install ssh": { + "Setup temp build env": { "pacman -Syy --noconfirm git" : null, "useradd -m -G wheel builder" : null, "#Correct way would be to do cat PKGBUILD | grep 'depends=' | head -n 1 | ..." : null, - "sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' /etc/sudoers" : null, + "sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' /etc/sudoers" : null + }, + "install slimdhcp": { + "git https://aur.archlinux.org/slimdhcp-git.git /tmp/slimdhcp" : null, "chown -R builder.builder /tmp/slimdhcp" : null, - "su - builder -c \"cd /tmp/slimdhcp; /usr/bin/makepkg -s --noconfirm\"" : null, - "pacman -U --noconfirm /tmp/slimdhcp/*.xz" : null, + "su - builder -c \\"cd /tmp/slimdhcp; /usr/bin/makepkg -s --noconfirm\\"" : null, + "pacman -U --noconfirm /tmp/slimdhcp/*.xz" : null + }, + "Remove temp build env": { "rm -rf /tmp/slimdhcp" : null, - "sed -i 's/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/' /etc/sudoers" : null, + "sed -i 's/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/' /etc/sudoers" : null } } -- cgit v1.2.3-70-g09d2 From 9869d8d27db7ae6c13f5ed426d6263da3cf6fb7b Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 13:21:23 +0200 Subject: Made sure commands are executed in order --- archinstall.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archinstall.py b/archinstall.py index 5970b385..d8de16b1 100644 --- a/archinstall.py +++ b/archinstall.py @@ -253,7 +253,8 @@ if __name__ == '__main__': print('[N] No instructions for this box on this mac: {}'.format(mac)) continue - instructions = json.loads(instructions.decode('UTF-8')) + print('Decoding:', instructions) + instructions = json.loads(instructions.decode('UTF-8'), object_pairs_hook=oDict) for title in instructions: print('[N] {}'.format(title)) -- cgit v1.2.3-70-g09d2 From 22f4963dd28106dda9fe8b875b1ccfad7dd7d3c2 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 13:40:10 +0200 Subject: Update 08:00:27:d4:fd:ef.json --- deployments/08:00:27:d4:fd:ef.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index a900fd22..cd8d534f 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -9,7 +9,7 @@ "git https://aur.archlinux.org/slimdhcp-git.git /tmp/slimdhcp" : null, "chown -R builder.builder /tmp/slimdhcp" : null, - "su - builder -c \\"cd /tmp/slimdhcp; /usr/bin/makepkg -s --noconfirm\\"" : null, + "su - builder -c \"cd /tmp/slimdhcp; /usr/bin/makepkg -s --noconfirm\"" : null, "pacman -U --noconfirm /tmp/slimdhcp/*.xz" : null }, "Remove temp build env": { -- cgit v1.2.3-70-g09d2 From 17c810d897505949b547a3c0ed555cedf9b4acdf Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 14:09:25 +0200 Subject: more debug --- archinstall.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/archinstall.py b/archinstall.py index d8de16b1..2e1f30c6 100644 --- a/archinstall.py +++ b/archinstall.py @@ -41,13 +41,15 @@ def get_local_MACs(): macs[addr.address] = nic return macs -def run(cmd): +def run(cmd, echo=False): #print('[!] {}'.format(cmd)) handle = Popen(cmd, shell='True', stdout=PIPE, stderr=STDOUT) output = b'' while handle.poll() is None: data = handle.stdout.read() if len(data): + if echo: + print(data.decode('UTF-8', end='')) # print(data.decode('UTF-8'), end='') output += data output += handle.stdout.read() @@ -253,13 +255,14 @@ if __name__ == '__main__': print('[N] No instructions for this box on this mac: {}'.format(mac)) continue - print('Decoding:', instructions) + #print('Decoding:', instructions) instructions = json.loads(instructions.decode('UTF-8'), object_pairs_hook=oDict) for title in instructions: print('[N] {}'.format(title)) for command in instructions[title]: - o = run('arch-chroot /mnt {c}'.format(c=command)) + print('[N] Command: {}'.format(command)) + o = run('arch-chroot /mnt {c}'.format(c=command), echo=True) if instructions[title][command] and not instructions[title][command] in o: print('[W] Post install command failed: {}'.format(o.decode('UTF-8'))) #print(o) -- cgit v1.2.3-70-g09d2 From 14ee4cdf8ced0fc76cf92a0f2f4cbf11c1824266 Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 14:23:08 +0200 Subject: Changed git update command --- archinstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall.py b/archinstall.py index 2e1f30c6..21886b5b 100644 --- a/archinstall.py +++ b/archinstall.py @@ -62,7 +62,7 @@ def update_git(): ## Not the most elegant way to make sure git conflicts doesn't occur (yea fml) os.remove('/root/archinstall/archinstall.py') os.remove('/root/archinstall/README.md') - output = run('git pull') + output = run('git fetch --all') # git reset --hard origin/ if b'error:' in output: print('[N] Could not update git source for some reason.') -- cgit v1.2.3-70-g09d2 From d1c0600ebfa0679edc0aa2a8a9fd0e426170b27a Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 14:35:51 +0200 Subject: print error --- archinstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall.py b/archinstall.py index 21886b5b..b02616cb 100644 --- a/archinstall.py +++ b/archinstall.py @@ -49,7 +49,7 @@ def run(cmd, echo=False): data = handle.stdout.read() if len(data): if echo: - print(data.decode('UTF-8', end='')) + print(data.decode('UTF-8'), end='') # print(data.decode('UTF-8'), end='') output += data output += handle.stdout.read() -- cgit v1.2.3-70-g09d2 From 32dac37e83998a089d3a27361de16b474add6a16 Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 15:05:21 +0200 Subject: Comments break and hang the script --- deployments/08:00:27:d4:fd:ef.json | 1 - 1 file changed, 1 deletion(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index cd8d534f..a6f2e2da 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -2,7 +2,6 @@ "Setup temp build env": { "pacman -Syy --noconfirm git" : null, "useradd -m -G wheel builder" : null, - "#Correct way would be to do cat PKGBUILD | grep 'depends=' | head -n 1 | ..." : null, "sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' /etc/sudoers" : null }, "install slimdhcp": { -- cgit v1.2.3-70-g09d2 From f7dcfac21a60b7667f5996240ba933e1ae6954c5 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 15:13:09 +0200 Subject: syntax error in git clone command --- deployments/08:00:27:d4:fd:ef.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index a6f2e2da..d4414bb8 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -6,7 +6,7 @@ }, "install slimdhcp": { - "git https://aur.archlinux.org/slimdhcp-git.git /tmp/slimdhcp" : null, + "git clone https://aur.archlinux.org/slimdhcp-git.git /tmp/slimdhcp" : null, "chown -R builder.builder /tmp/slimdhcp" : null, "su - builder -c \"cd /tmp/slimdhcp; /usr/bin/makepkg -s --noconfirm\"" : null, "pacman -U --noconfirm /tmp/slimdhcp/*.xz" : null -- cgit v1.2.3-70-g09d2 From c68152fb365c2964579322680b905ad096d04112 Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 15:15:31 +0200 Subject: Fixed git fetch, hopefully --- archinstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall.py b/archinstall.py index b02616cb..f8ebe9fe 100644 --- a/archinstall.py +++ b/archinstall.py @@ -62,7 +62,7 @@ def update_git(): ## Not the most elegant way to make sure git conflicts doesn't occur (yea fml) os.remove('/root/archinstall/archinstall.py') os.remove('/root/archinstall/README.md') - output = run('git fetch --all') # git reset --hard origin/ + output = run('(cd /root/archinstall; git fetch --all)') # git reset --hard origin/ if b'error:' in output: print('[N] Could not update git source for some reason.') -- cgit v1.2.3-70-g09d2 From 88dfcad86c314fc5aa90a508f4e76d666f69099f Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 15:32:28 +0200 Subject: Debugging --- archinstall.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/archinstall.py b/archinstall.py index f8ebe9fe..57db7958 100644 --- a/archinstall.py +++ b/archinstall.py @@ -53,6 +53,7 @@ def run(cmd, echo=False): # print(data.decode('UTF-8'), end='') output += data output += handle.stdout.read() + print('Command done:', output) handle.stdout.close() return output @@ -62,6 +63,7 @@ def update_git(): ## Not the most elegant way to make sure git conflicts doesn't occur (yea fml) os.remove('/root/archinstall/archinstall.py') os.remove('/root/archinstall/README.md') + # sh -c 'cd /c && ../a/helloworld' output = run('(cd /root/archinstall; git fetch --all)') # git reset --hard origin/ if b'error:' in output: -- cgit v1.2.3-70-g09d2 From 8e22ac18d66b0ec06b8e7923c01876a9a5c95b7f Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 16:28:11 +0200 Subject: more debing --- archinstall.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall.py b/archinstall.py index 57db7958..204a5f54 100644 --- a/archinstall.py +++ b/archinstall.py @@ -53,7 +53,7 @@ def run(cmd, echo=False): # print(data.decode('UTF-8'), end='') output += data output += handle.stdout.read() - print('Command done:', output) + print('Command done:', output, handle.poll()) handle.stdout.close() return output @@ -210,7 +210,7 @@ if __name__ == '__main__': o = run('arch-chroot /mnt rm /etc/localtime') o = run('arch-chroot /mnt ln -s /usr/share/zoneinfo/Europe/Stockholm /etc/localtime') o = run('arch-chroot /mnt hwclock --hctosys --localtime') - o = run('arch-chroot /mnt {hostname}'.format(**args)) + o = run('arch-chroot /mnt echo "{hostname}" > /etc/hostname'.format(**args)) o = run("arch-chroot /mnt sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen") o = run('arch-chroot /mnt locale-gen') o = run('arch-chroot /mnt chmod 700 /root') -- cgit v1.2.3-70-g09d2 From 4933d474da012736d2a81a77133408847db5bbc3 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 16:49:38 +0200 Subject: Update 08:00:27:d4:fd:ef.json --- deployments/08:00:27:d4:fd:ef.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index d4414bb8..a6a63699 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -6,7 +6,7 @@ }, "install slimdhcp": { - "git clone https://aur.archlinux.org/slimdhcp-git.git /tmp/slimdhcp" : null, + "git clone https://aur.archlinux.org/slimdhcp-git.git /tmp/slimdhcp" : {"cwd" : "/tmp/"}, "chown -R builder.builder /tmp/slimdhcp" : null, "su - builder -c \"cd /tmp/slimdhcp; /usr/bin/makepkg -s --noconfirm\"" : null, "pacman -U --noconfirm /tmp/slimdhcp/*.xz" : null -- cgit v1.2.3-70-g09d2 From 88b50f4dd317629a8ec49d8c127430c2d6a2396d Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 16:51:18 +0200 Subject: Improving the sys exec function --- archinstall.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/archinstall.py b/archinstall.py index 204a5f54..7fee4220 100644 --- a/archinstall.py +++ b/archinstall.py @@ -41,9 +41,9 @@ def get_local_MACs(): macs[addr.address] = nic return macs -def run(cmd, echo=False): +def run(cmd, echo=False, *args, **kwargs): #print('[!] {}'.format(cmd)) - handle = Popen(cmd, shell='True', stdout=PIPE, stderr=STDOUT) + handle = Popen(cmd, shell='True', stdout=PIPE, stderr=STDOUT, **kwargs) output = b'' while handle.poll() is None: data = handle.stdout.read() @@ -263,8 +263,9 @@ if __name__ == '__main__': for title in instructions: print('[N] {}'.format(title)) for command in instructions[title]: - print('[N] Command: {}'.format(command)) - o = run('arch-chroot /mnt {c}'.format(c=command), echo=True) + opts = instructions[title] if instructions[title] else {} + print('[N] Command: {} ({])'.format(command, opts)) + o = run('arch-chroot /mnt {c}'.format(c=command), echo=True, **opts) if instructions[title][command] and not instructions[title][command] in o: print('[W] Post install command failed: {}'.format(o.decode('UTF-8'))) #print(o) -- cgit v1.2.3-70-g09d2 From d5ba7879438b7df64c101da1f55f433878c797eb Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 17:09:10 +0200 Subject: Debugging --- archinstall.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall.py b/archinstall.py index 7fee4220..d16a271c 100644 --- a/archinstall.py +++ b/archinstall.py @@ -218,7 +218,7 @@ if __name__ == '__main__': #TODO: This doesn't work either: (why the hell not?) # echo "newpass" | passwd --stdin root ? #o = run("arch-chroot /mnt echo 'root:{pin}' | chpasswd".format(**args, pin=PIN)) - o = run('arch-chroot /mnt \'echo "{pin}" | passwd --stdin root\''.format(**args, pin=PIN)) + o = run("arch-chroot /mnt 'echo {pin} | passwd --stdin root".format(pin='"{pin}"'.format(**args, pin=PIN))) if 'user' in args: o = run('arch-chroot /mnt useradd -m -G wheel {user}'.format(**args)) o = run("arch-chroot /mnt echo '{user}:{pin}' | chpasswd".format(**args, pin=PIN)) @@ -264,7 +264,7 @@ if __name__ == '__main__': print('[N] {}'.format(title)) for command in instructions[title]: opts = instructions[title] if instructions[title] else {} - print('[N] Command: {} ({])'.format(command, opts)) + print('[N] Command: {} ({})'.format(command, opts)) o = run('arch-chroot /mnt {c}'.format(c=command), echo=True, **opts) if instructions[title][command] and not instructions[title][command] in o: print('[W] Post install command failed: {}'.format(o.decode('UTF-8'))) -- cgit v1.2.3-70-g09d2 From d02aabbdfd8f60fe3a7f8bf5ca7b4b0531c4608f Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 17:24:29 +0200 Subject: Further debugging --- archinstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall.py b/archinstall.py index d16a271c..91fb9da1 100644 --- a/archinstall.py +++ b/archinstall.py @@ -263,7 +263,7 @@ if __name__ == '__main__': for title in instructions: print('[N] {}'.format(title)) for command in instructions[title]: - opts = instructions[title] if instructions[title] else {} + opts = instructions[title][command] if instructions[title][command] else {} print('[N] Command: {} ({})'.format(command, opts)) o = run('arch-chroot /mnt {c}'.format(c=command), echo=True, **opts) if instructions[title][command] and not instructions[title][command] in o: -- cgit v1.2.3-70-g09d2 From 8dedabbf76b5a134f78dd1dfc72458e496d558ec Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 17:27:39 +0200 Subject: Added a description --- README.md | 4 ++++ description.jpg | Bin 0 -> 96324 bytes 2 files changed, 4 insertions(+) create mode 100644 description.jpg diff --git a/README.md b/README.md index 88984d2c..bf3e9959 100644 --- a/README.md +++ b/README.md @@ -52,3 +52,7 @@ Whenever this live-cd boots, from here on now - it'll run `archinstall.py`. --post=reboot (Default) After a successful install, reboots into the system. + +## End note + + ![description](description.jpg) \ No newline at end of file diff --git a/description.jpg b/description.jpg new file mode 100644 index 00000000..b05daf2b Binary files /dev/null and b/description.jpg differ -- cgit v1.2.3-70-g09d2 From 88f1f85bf4b50897a080780f5403f7453350672b Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 17:41:47 +0200 Subject: Problem with the optional parameters in the post install script --- archinstall.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/archinstall.py b/archinstall.py index 91fb9da1..d471f161 100644 --- a/archinstall.py +++ b/archinstall.py @@ -263,10 +263,11 @@ if __name__ == '__main__': for title in instructions: print('[N] {}'.format(title)) for command in instructions[title]: - opts = instructions[title][command] if instructions[title][command] else {} + opts = instructions[title][command] if type(instructions[title][command]) in (dict, oDict) else {} + print('[N] Command: {} ({})'.format(command, opts)) o = run('arch-chroot /mnt {c}'.format(c=command), echo=True, **opts) - if instructions[title][command] and not instructions[title][command] in o: + if len(instructions[title][command]) and type(instructions[title][command]) == bytes and not instructions[title][command] in o: print('[W] Post install command failed: {}'.format(o.decode('UTF-8'))) #print(o) -- cgit v1.2.3-70-g09d2 From 11d782baa6347df81be238daa68a28545d36a848 Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 18:09:59 +0200 Subject: Wrong logical order on command failed logic --- archinstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall.py b/archinstall.py index d471f161..079e4b5a 100644 --- a/archinstall.py +++ b/archinstall.py @@ -267,7 +267,7 @@ if __name__ == '__main__': print('[N] Command: {} ({})'.format(command, opts)) o = run('arch-chroot /mnt {c}'.format(c=command), echo=True, **opts) - if len(instructions[title][command]) and type(instructions[title][command]) == bytes and not instructions[title][command] in o: + if type(instructions[title][command]) == bytes and len(instructions[title][command]) and not instructions[title][command] in o: print('[W] Post install command failed: {}'.format(o.decode('UTF-8'))) #print(o) -- cgit v1.2.3-70-g09d2 From f975df7ec2e77eefbeefe4f5f20a655851d5a116 Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 18:27:04 +0200 Subject: more debugging --- archinstall.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/archinstall.py b/archinstall.py index 079e4b5a..9f185b77 100644 --- a/archinstall.py +++ b/archinstall.py @@ -61,9 +61,8 @@ def update_git(): default_gw = get_default_gateway_linux() if(default_gw): ## Not the most elegant way to make sure git conflicts doesn't occur (yea fml) - os.remove('/root/archinstall/archinstall.py') - os.remove('/root/archinstall/README.md') - # sh -c 'cd /c && ../a/helloworld' + #os.remove('/root/archinstall/archinstall.py') + #os.remove('/root/archinstall/README.md') output = run('(cd /root/archinstall; git fetch --all)') # git reset --hard origin/ if b'error:' in output: -- cgit v1.2.3-70-g09d2 From 396e0da983cb9887b015cde003c5e1c587ae3dde Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 19:21:49 +0200 Subject: Update 08:00:27:d4:fd:ef.json --- deployments/08:00:27:d4:fd:ef.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index a6a63699..59743b1d 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -7,6 +7,8 @@ "install slimdhcp": { "git clone https://aur.archlinux.org/slimdhcp-git.git /tmp/slimdhcp" : {"cwd" : "/tmp/"}, + "pwd" : null, + "ls -l /tmp/" : null, "chown -R builder.builder /tmp/slimdhcp" : null, "su - builder -c \"cd /tmp/slimdhcp; /usr/bin/makepkg -s --noconfirm\"" : null, "pacman -U --noconfirm /tmp/slimdhcp/*.xz" : null -- cgit v1.2.3-70-g09d2 From a8287c43e5fe46d5ab51083e8d623dfea4e7a885 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 19:30:36 +0200 Subject: Update 08:00:27:d4:fd:ef.json --- deployments/08:00:27:d4:fd:ef.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index 59743b1d..4fd8ca10 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -7,7 +7,7 @@ "install slimdhcp": { "git clone https://aur.archlinux.org/slimdhcp-git.git /tmp/slimdhcp" : {"cwd" : "/tmp/"}, - "pwd" : null, + "pwd" : {"cwd" : "/tmp/"}, "ls -l /tmp/" : null, "chown -R builder.builder /tmp/slimdhcp" : null, "su - builder -c \"cd /tmp/slimdhcp; /usr/bin/makepkg -s --noconfirm\"" : null, -- cgit v1.2.3-70-g09d2 From e0c9f457ad774005ad4a176f1d00405eb5482c90 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 20:10:11 +0200 Subject: /tmp can't be used The reason being, arch-chroot flushes /tmp on each command execution. So unless all commands are executed in one big gulp, another folder needs to be used. Hence, /root --- deployments/08:00:27:d4:fd:ef.json | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index 4fd8ca10..8c72c9d2 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -6,15 +6,13 @@ }, "install slimdhcp": { - "git clone https://aur.archlinux.org/slimdhcp-git.git /tmp/slimdhcp" : {"cwd" : "/tmp/"}, - "pwd" : {"cwd" : "/tmp/"}, - "ls -l /tmp/" : null, - "chown -R builder.builder /tmp/slimdhcp" : null, - "su - builder -c \"cd /tmp/slimdhcp; /usr/bin/makepkg -s --noconfirm\"" : null, - "pacman -U --noconfirm /tmp/slimdhcp/*.xz" : null + "git clone https://aur.archlinux.org/slimdhcp-git.git /root/slimdhcp" : {"cwd" : "/tmp/"}, + "chown -R builder.builder /root/slimdhcp" : null, + "su - builder -c \"cd /root/slimdhcp; /usr/bin/makepkg -s --noconfirm\"" : null, + "pacman -U --noconfirm /root/slimdhcp/*.xz" : null }, "Remove temp build env": { - "rm -rf /tmp/slimdhcp" : null, + "rm -rf /root/slimdhcp" : null, "sed -i 's/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/' /etc/sudoers" : null } } -- cgit v1.2.3-70-g09d2 From fec25121e042c53ff3ec045fb1ae0c6a023c82e2 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 20:38:54 +0200 Subject: Update 08:00:27:d4:fd:ef.json --- deployments/08:00:27:d4:fd:ef.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index 8c72c9d2..ab8152b7 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -6,13 +6,13 @@ }, "install slimdhcp": { - "git clone https://aur.archlinux.org/slimdhcp-git.git /root/slimdhcp" : {"cwd" : "/tmp/"}, - "chown -R builder.builder /root/slimdhcp" : null, - "su - builder -c \"cd /root/slimdhcp; /usr/bin/makepkg -s --noconfirm\"" : null, - "pacman -U --noconfirm /root/slimdhcp/*.xz" : null + "git clone https://aur.archlinux.org/slimdhcp-git.git /home/builder/slimdhcp" : {"cwd" : "/tmp/"}, + "chown -R builder.builder /home/builder/slimdhcp" : null, + "su - builder -c \"cd /home/builder/slimdhcp; /usr/bin/makepkg -s --noconfirm\"" : null, + "pacman -U --noconfirm /home/builder/slimdhcp/*.xz" : null }, "Remove temp build env": { - "rm -rf /root/slimdhcp" : null, + "rm -rf /home/builder/slimdhcp" : null, "sed -i 's/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/' /etc/sudoers" : null } } -- cgit v1.2.3-70-g09d2 From bfd6c2e62662992b5b38cf7390c58ec2177a0cb7 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 21:06:37 +0200 Subject: Update 08:00:27:d4:fd:ef.json --- deployments/08:00:27:d4:fd:ef.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index ab8152b7..1f0554f9 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -6,7 +6,7 @@ }, "install slimdhcp": { - "git clone https://aur.archlinux.org/slimdhcp-git.git /home/builder/slimdhcp" : {"cwd" : "/tmp/"}, + "git clone https://aur.archlinux.org/slimdhcp-git.git /home/builder/" : {"cwd" : "/tmp/"}, "chown -R builder.builder /home/builder/slimdhcp" : null, "su - builder -c \"cd /home/builder/slimdhcp; /usr/bin/makepkg -s --noconfirm\"" : null, "pacman -U --noconfirm /home/builder/slimdhcp/*.xz" : null -- cgit v1.2.3-70-g09d2 From 090202706b5767f446ee0c13b3bbac2acab0e6e6 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 21:15:22 +0200 Subject: Update 08:00:27:d4:fd:ef.json --- deployments/08:00:27:d4:fd:ef.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index 1f0554f9..cdb62e4f 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -6,7 +6,7 @@ }, "install slimdhcp": { - "git clone https://aur.archlinux.org/slimdhcp-git.git /home/builder/" : {"cwd" : "/tmp/"}, + "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, "pacman -U --noconfirm /home/builder/slimdhcp/*.xz" : null -- cgit v1.2.3-70-g09d2 From a104ce2ead607626107ca76a9a41b07fd79d6583 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 21:31:13 +0200 Subject: Update 08:00:27:d4:fd:ef.json --- deployments/08:00:27:d4:fd:ef.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index cdb62e4f..323f14b1 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -7,9 +7,9 @@ "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, - "pacman -U --noconfirm /home/builder/slimdhcp/*.xz" : null + "chown -R builder.builder /home/builder/slimdhcp/slimdhcp" : null, + "su - builder -c \"cd /home/builder/slimdhcp/slimdhcp; /usr/bin/makepkg -s --noconfirm\"" : null, + "pacman -U --noconfirm /home/builder/slimdhcp/slimdhcp/*.xz" : null }, "Remove temp build env": { "rm -rf /home/builder/slimdhcp" : null, -- cgit v1.2.3-70-g09d2 From e8900ee8804d6a24876db1263a72ba84b46be376 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 21:45:40 +0200 Subject: Update 08:00:27:d4:fd:ef.json --- deployments/08:00:27:d4:fd:ef.json | 1 - 1 file changed, 1 deletion(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index 323f14b1..9af96694 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -12,7 +12,6 @@ "pacman -U --noconfirm /home/builder/slimdhcp/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 } } -- cgit v1.2.3-70-g09d2 From f02156a246bdbcaf7f1ed28fd8f36e9c47a95ef6 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 21:50:59 +0200 Subject: Update 08:00:27:d4:fd:ef.json --- deployments/08:00:27:d4:fd:ef.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index 9af96694..b7d433aa 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -7,9 +7,9 @@ "install slimdhcp": { "git clone https://aur.archlinux.org/slimdhcp-git.git /home/builder/slimdhcp" : null, - "chown -R builder.builder /home/builder/slimdhcp/slimdhcp" : null, - "su - builder -c \"cd /home/builder/slimdhcp/slimdhcp; /usr/bin/makepkg -s --noconfirm\"" : null, - "pacman -U --noconfirm /home/builder/slimdhcp/slimdhcp/*.xz" : null + "chown -R builder.builder /home/builder/slimdhcp" : null, + "su - builder -c \"(cd /home/builder/slimdhcp/; /usr/bin/makepkg -s --noconfirm\")" : null, + "pacman -U --noconfirm /home/builder/slimdhcp/*.xz" : null }, "Remove temp build env": { "sed -i 's/%wheel ALL=(ALL) NO/# %wheel ALL=(ALL) NO/' /etc/sudoers" : null -- cgit v1.2.3-70-g09d2 From 5e8e2f41263ac11901ff2cd5db3da09c35c4f75f Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 22:01:20 +0200 Subject: Update 08:00:27:d4:fd:ef.json --- deployments/08:00:27:d4:fd:ef.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index b7d433aa..5ad67b20 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -8,7 +8,7 @@ "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, + "su - builder -c \"(cd /home/builder/slimdhcp/; /usr/bin/makepkg -s --noconfirm)\"" : null, "pacman -U --noconfirm /home/builder/slimdhcp/*.xz" : null }, "Remove temp build env": { -- cgit v1.2.3-70-g09d2 From bb312e0e835820abf2393a86eecd84c501d83901 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 22:13:40 +0200 Subject: Update 08:00:27:d4:fd:ef.json --- deployments/08:00:27:d4:fd:ef.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index 5ad67b20..8ec8f574 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -9,9 +9,10 @@ "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, - "pacman -U --noconfirm /home/builder/slimdhcp/*.xz" : 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 } } -- cgit v1.2.3-70-g09d2 From 36d024b8032278bed8c119aa05d486dc088b002c Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 7 Apr 2018 22:13:55 +0200 Subject: Update 08:00:27:d4:fd:ef.json --- deployments/08:00:27:d4:fd:ef.json | 1 - 1 file changed, 1 deletion(-) diff --git a/deployments/08:00:27:d4:fd:ef.json b/deployments/08:00:27:d4:fd:ef.json index 8ec8f574..48e038c0 100644 --- a/deployments/08:00:27:d4:fd:ef.json +++ b/deployments/08:00:27:d4:fd:ef.json @@ -5,7 +5,6 @@ "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, -- cgit v1.2.3-70-g09d2 From 13a1c2ab3a1035d22cfe05a9ef1c801daa2a2a82 Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 22:48:14 +0200 Subject: Verified a working network install, removing debugs --- archinstall.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/archinstall.py b/archinstall.py index 9f185b77..b43c7e2f 100644 --- a/archinstall.py +++ b/archinstall.py @@ -48,12 +48,14 @@ def run(cmd, echo=False, *args, **kwargs): while handle.poll() is None: data = handle.stdout.read() if len(data): - if echo: + if echo and 'flush': print(data.decode('UTF-8'), end='') # print(data.decode('UTF-8'), end='') output += data - output += handle.stdout.read() - print('Command done:', output, handle.poll()) + data = handle.stdout.read() + if echo: + print(data.decode('UTF-8'), end='') + output += data handle.stdout.close() return output @@ -159,6 +161,7 @@ if __name__ == '__main__': with open(args['pwfile'], 'r') as pw: PIN = pw.read().strip() + print() print('[!] Disk PASSWORD is: {}'.format(PIN)) print() print('[N] Setting up {drive}.'.format(**args)) @@ -213,11 +216,13 @@ if __name__ == '__main__': o = run("arch-chroot /mnt sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen") o = run('arch-chroot /mnt locale-gen') o = run('arch-chroot /mnt chmod 700 /root') + + ## == Passwords #o = run('arch-chroot /mnt usermod --password {} root'.format(PIN)) #TODO: This doesn't work either: (why the hell not?) # echo "newpass" | passwd --stdin root ? #o = run("arch-chroot /mnt echo 'root:{pin}' | chpasswd".format(**args, pin=PIN)) - o = run("arch-chroot /mnt 'echo {pin} | passwd --stdin root".format(pin='"{pin}"'.format(**args, pin=PIN))) + o = run("arch-chroot /mnt sh -c 'echo {pin} | passwd --stdin root'".format(pin='"{pin}"'.format(**args, pin=PIN)), echo=True) if 'user' in args: o = run('arch-chroot /mnt useradd -m -G wheel {user}'.format(**args)) o = run("arch-chroot /mnt echo '{user}:{pin}' | chpasswd".format(**args, pin=PIN)) @@ -265,7 +270,7 @@ if __name__ == '__main__': opts = instructions[title][command] if type(instructions[title][command]) in (dict, oDict) else {} print('[N] Command: {} ({})'.format(command, opts)) - o = run('arch-chroot /mnt {c}'.format(c=command), echo=True, **opts) + o = run('arch-chroot /mnt {c}'.format(c=command), **opts) if type(instructions[title][command]) == bytes and len(instructions[title][command]) and not instructions[title][command] in o: print('[W] Post install command failed: {}'.format(o.decode('UTF-8'))) #print(o) -- cgit v1.2.3-70-g09d2 From 82fe1585529f31445fd14ff7fa933d8d732d678f Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 23:15:32 +0200 Subject: Finalizing working net deploy --- archinstall.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/archinstall.py b/archinstall.py index b43c7e2f..42096b2a 100644 --- a/archinstall.py +++ b/archinstall.py @@ -218,11 +218,9 @@ if __name__ == '__main__': o = run('arch-chroot /mnt chmod 700 /root') ## == Passwords - #o = run('arch-chroot /mnt usermod --password {} root'.format(PIN)) - #TODO: This doesn't work either: (why the hell not?) - # echo "newpass" | passwd --stdin root ? - #o = run("arch-chroot /mnt echo 'root:{pin}' | chpasswd".format(**args, pin=PIN)) - o = run("arch-chroot /mnt sh -c 'echo {pin} | passwd --stdin root'".format(pin='"{pin}"'.format(**args, pin=PIN)), echo=True) + # o = run('arch-chroot /mnt usermod --password {} root'.format(PIN)) + # o = run("arch-chroot /mnt sh -c 'echo {pin} | passwd --stdin root'".format(pin='"{pin}"'.format(**args, pin=PIN)), echo=True) + o = run("arch-chroot /mnt sh -c \"echo 'root:{pin}' | chpasswd\"".format(**args, pin=PIN)) if 'user' in args: o = run('arch-chroot /mnt useradd -m -G wheel {user}'.format(**args)) o = run("arch-chroot /mnt echo '{user}:{pin}' | chpasswd".format(**args, pin=PIN)) @@ -265,18 +263,18 @@ if __name__ == '__main__': instructions = json.loads(instructions.decode('UTF-8'), object_pairs_hook=oDict) for title in instructions: - print('[N] {}'.format(title)) + print('[N] Network Deploy: {}'.format(title)) for command in instructions[title]: opts = instructions[title][command] if type(instructions[title][command]) in (dict, oDict) else {} - print('[N] Command: {} ({})'.format(command, opts)) + #print('[N] Command: {} ({})'.format(command, opts)) o = run('arch-chroot /mnt {c}'.format(c=command), **opts) if type(instructions[title][command]) == bytes and len(instructions[title][command]) and not instructions[title][command] in o: print('[W] Post install command failed: {}'.format(o.decode('UTF-8'))) #print(o) - #o = run('umount -R /mnt') - #if args['post'] == 'reboot': - # o = run('reboot now') - #else: - # print('Done. "reboot" when you\'re done tinkering.') + o = run('umount -R /mnt') + if args['post'] == 'reboot': + o = run('reboot now') + else: + print('Done. "reboot" when you\'re done tinkering.') -- cgit v1.2.3-70-g09d2 From e395962fe22305755a5dc6b5c3650d12cf5b3604 Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Sat, 7 Apr 2018 23:32:49 +0200 Subject: Fixed password change for custom user as well as hostname and locale gen. --- archinstall.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/archinstall.py b/archinstall.py index 42096b2a..dad42737 100644 --- a/archinstall.py +++ b/archinstall.py @@ -212,8 +212,10 @@ if __name__ == '__main__': o = run('arch-chroot /mnt rm /etc/localtime') o = run('arch-chroot /mnt ln -s /usr/share/zoneinfo/Europe/Stockholm /etc/localtime') o = run('arch-chroot /mnt hwclock --hctosys --localtime') - o = run('arch-chroot /mnt echo "{hostname}" > /etc/hostname'.format(**args)) - o = run("arch-chroot /mnt sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen") + #o = run('arch-chroot /mnt echo "{hostname}" > /etc/hostname'.format(**args)) + #o = run("arch-chroot /mnt sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen") + o = run("arch-chroot /mnt sh -c \"echo '{hostname}' > /etc/hostname\"".format(**args)) + o = run("arch-chroot /mnt sh -c \"echo -n 'en_US.UTF-8' > /etc/locale.gen\"") o = run('arch-chroot /mnt locale-gen') o = run('arch-chroot /mnt chmod 700 /root') @@ -223,7 +225,7 @@ if __name__ == '__main__': o = run("arch-chroot /mnt sh -c \"echo 'root:{pin}' | chpasswd\"".format(**args, pin=PIN)) if 'user' in args: o = run('arch-chroot /mnt useradd -m -G wheel {user}'.format(**args)) - o = run("arch-chroot /mnt echo '{user}:{pin}' | chpasswd".format(**args, pin=PIN)) + o = run("arch-chroot /mnt sh -c \"echo '{user}:{pin}' | chpasswd\"".format(**args, pin=PIN)) with open('/mnt/etc/mkinitcpio.conf', 'w') as mkinit: ## TODO: Don't replace it, in case some update in the future actually adds something. -- cgit v1.2.3-70-g09d2