Merge branch 'master' of ssh://86thumbs.net:3022/waldek/linux_introduction

This commit is contained in:
waldek 2022-07-14 11:46:43 +02:00
commit 98125772f3
13 changed files with 10155 additions and 6 deletions

4
.gitignore vendored
View File

@ -1,2 +1,6 @@
*.swp
tmp.*
*.raw
.mkosi*
*.tgz
*.img

View File

@ -454,6 +454,34 @@ echo "or may I call you $first?"
It is worth discovering what happens when you supply too many or to little values.
Please try this out!
# Coding challenge - Birthday **day**
Write me `bash` program that asks for your date of birth and prints the day of the week that was.
Like the output below.
```
waldek@server:~$ bash birthday.sh
what is your birthday (day month year)? 07 10 1986
you where born on a Tuesday
```
<details>
<summary>Spoiler warning!</summary>
```bash
#!/bin/bash
read -p "what is your date of birth? (day month year) " day month year
day_of_the_week=$(date +%A -d "$month/$day/$year")
echo "you where born on a $day_of_the_week"
```
</details>
## With command line arguments
We can create a similar behaviour but with command line arguments.
@ -1127,20 +1155,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.

38
advanced/outline.md Normal file
View File

@ -0,0 +1,38 @@
* learning_vim_configuration.md
* 1 day
* learning_python3.md
* 15 days
* learning_processes.md
* 1 day
* learning_disks.md
* 1 day
* DOC NOT WRITTEN
* learning_disk_management.md
* 1 day
* DOC NOT WRITTEN
* learning_systemd.md
* 2 days
* learning_udev.md
* 1 day
* learning_dbus.md
* 1 day
* TODO add busctl doc
* learning_systemd_udev_integration.md
* 1 day
* learning_systemd_udev_dbus_integration.md
* 1 day
* learning_systemd_login.md
* 1 day
* learning_ssh.md
* 1 day
* learning_remote_graphical_interaction.md
* 1 day
* learning_regex.md
* 1 day
* learning_centralized_system_monitoring.md
* 1 day
* TODO outline python plugin exercise
* learning_centralized_account_management.md
* 1 day
* learning_centralized_account_management_freeipa.md
* 1 day

5000
assets/broken_ip_01.list Normal file

File diff suppressed because it is too large Load Diff

5000
assets/broken_ip_02.list Normal file

File diff suppressed because it is too large Load Diff

BIN
assets/jpeg_ext.tar Normal file

Binary file not shown.

View File

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

View File

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

BIN
assets/shasum.tar Normal file

Binary file not shown.

BIN
assets/tree.tar Normal file

Binary file not shown.

View File

@ -627,6 +627,14 @@ If you want to dig into it I suggest [this](https://wiki.debian.org/Permissions#
> The first of the 4 octal digits which represent permissions contains the setuid and setgid bits. These can be used to override some of the defaults described above but it is not worth getting into details other than to note that the user private groups project collaboration idiom (see below) depends on the behavior of the setgid bit.
## Advanced permissions
| type | value |
| ---- | ----- |
| sticky bit | 1 |
| setgid | 2 |
| setuid | 4 |
## Essential programs
Below is a small list of often used programs when dealing with file permissions.

View File

@ -1855,9 +1855,11 @@ Download [this](../assets/generic-food.csv) list of food and show me some stats!
## Mini exercise 5
A [list](../assets/broken_ip.list) of IP addresses got corrupted during a copy.
A [list](../assets/broken_ip_01.list) of IP addresses got corrupted during a copy.
Can you clean it up please?
[Here](../assets/broken_ip_02.list) is a more complicated one...
## Mini exercise 6
[Here](../assets/packages.list) is a list of all installed and uninstalled packages from one of my computers.

View File

@ -9,6 +9,7 @@
* [debian](https://wiki.debian.org/nspawn)
* [arch](https://wiki.archlinux.org/title/systemd-nspawn#Use_a_%22macvlan%22_or_%22ipvlan%22_interface)
* [systemd-sysext](https://0pointer.net/blog/testing-my-system-code-in-usr-without-modifying-usr.html)
* [mkosi](http://0pointer.net/blog/mkosi-a-tool-for-generating-os-images.html) tutorial for building images
* show usage of `systemd-run`
* exercise on minimal wayland configuration
* [history of command line arguments](https://blog.liw.fi/posts/2022/05/07/unix-cli/)
@ -30,6 +31,7 @@
* goaccess script for log [interpretation](https://github.com/stockrt/nginx2goaccess/blob/master/nginx2goaccess.sh)
* advanced [htop](https://peteris.rocks/blog/htop/)
* systemd [tips and tricks](https://www.freedesktop.org/wiki/Software/systemd/TipsAndTricks/)
* dbus [user session](https://serverfault.com/questions/892465/starting-systemd-services-sharing-a-session-d-bus-on-headless-system) for headless machines
## started