diff --git a/.gitignore b/.gitignore index 23c0921..57236ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ *.swp tmp.* +*.raw +.mkosi* +*.tgz +*.img diff --git a/advanced/learning_bash_scripting.md b/advanced/learning_bash_scripting.md index e038315..881d11b 100644 --- a/advanced/learning_bash_scripting.md +++ b/advanced/learning_bash_scripting.md @@ -1127,20 +1127,18 @@ If you did it with a prefix, now try with a postfix. # Coding challenge - Rename jpeg files -Download [these](../assets/) files, which are all `jpeg` files. +Download [these](../assets/jpeg_ext.tar) files, which are all `jpeg` files. The extensions however are not really uniform. Find the most common extension type and rename all files with that extension. # Coding challenge - Remove duplicate files -Find all duplicate files and move them to a different directory. +Find all duplicate files from [this](../assets/shasum.tar) and move them to a different directory. How certain are you that they are duplicates? -TODO - shasum exercise - # Coding challenge - File tree -Download [this](../assets/) file and use the content of the directory to write me a program that prints the content as a tree structure. +Download [this](../assets/tree.tar) file and use the content of the directory to write me a program that prints the content as a tree structure. You can be *creative* but it's interesting to learn how to perform these action by hand. As an extra challenge I would like you to add different behaviour to the script, depending on the input. For example, if the input file is a `tar.gz` file, the program will automatically uncompress and then show the tree. diff --git a/assets/jpeg_ext.tar b/assets/jpeg_ext.tar new file mode 100644 index 0000000..eb4ec05 Binary files /dev/null and b/assets/jpeg_ext.tar differ diff --git a/assets/nspawn/full_bridged.yaml b/assets/nspawn/full_bridged.yaml index f06b482..eb417d6 100644 --- a/assets/nspawn/full_bridged.yaml +++ b/assets/nspawn/full_bridged.yaml @@ -21,6 +21,9 @@ actions: - htop - vim-nox - tmux + - grub-efi + - initramfs-tools + - linux-image-amd64 - action: run description: enable essential systemd services @@ -41,3 +44,51 @@ actions: file: {{ $image }} compression: gz + - action: image-partition + imagename: {{ $image }}.img + imagesize: 2GB + partitiontype: gpt + mountpoints: + - mountpoint: / + partition: root + - mountpoint: /boot/efi + partition: efi + flags: [ boot ] + partitions: + - name: efi + fs: vfat + start: 1MiB + end: 513MiB + options: [ x-systemd.automount ] + parttype: C12A7328-F81F-11D2-BA4B-00A0C93EC93B # ESP guid + - name: root + # parttype: 4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709 # linux root x86_64 + parttype: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 # linux partition + fs: ext4 + start: 513MiB + end: 1999MB + + - action: filesystem-deploy + description: Deploying filesystem onto image + setup-kernel-cmdline: true + setup-fstab: true + + # - action: run + # chroot: true + # command: grub-install --target=x86_64-efi --no-nvram /dev/vda + # + # - action: run + # chroot: true + # command: update-grub + # + # - action: run + # chroot: true + # command: mkdir -p /boot/efi/EFI/BOOT && cp /boot/efi/EFI/debian/grubx64.efi /boot/efi/EFI/BOOT/BOOTX64.EFI + # + # - action: run + # chroot: true + # command: update-initramfs -u + # + # - action: run + # chroot: true + # command: sed -i 's/vda/sda/g' /boot/grub/grub.cfg diff --git a/assets/nspawn/mkosi.default b/assets/nspawn/mkosi.default new file mode 100644 index 0000000..c3e7e8c --- /dev/null +++ b/assets/nspawn/mkosi.default @@ -0,0 +1,18 @@ +[Distribution] +Distribution=debian +Release=bullseye + +[Output] +Format=gpt_ext4 +Bootable=yes +Output=image.raw + +[Packages] +Packages= + openssh-client + vim-nox + +[Validation] +Password=waldek + + diff --git a/assets/shasum.tar b/assets/shasum.tar new file mode 100644 index 0000000..c1297be Binary files /dev/null and b/assets/shasum.tar differ diff --git a/assets/tree.tar b/assets/tree.tar new file mode 100644 index 0000000..a47fdb0 Binary files /dev/null and b/assets/tree.tar differ