From 64983be1c1a34c45011b27112bfe63b7c2a6e131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20M=C3=BCnzer?= Date: Thu, 25 Jun 2026 10:10:18 +0000 Subject: [PATCH] =?UTF-8?q?hinzuf=C3=BCgen=20der=20fehlenden=20dateien?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Raspberry/PI4/cooler_skript.py | 67 +++++++++++++++++++ ansible | 1 + bz/win_usb_iso_2.sh | 115 +++++++++++++++++++++++++++++++++ bz/win_usb_zu_iso.sh | 44 +++++++++++++ 4 files changed, 227 insertions(+) create mode 100644 Raspberry/PI4/cooler_skript.py create mode 160000 ansible create mode 100644 bz/win_usb_iso_2.sh create mode 100644 bz/win_usb_zu_iso.sh diff --git a/Raspberry/PI4/cooler_skript.py b/Raspberry/PI4/cooler_skript.py new file mode 100644 index 0000000..b63ac95 --- /dev/null +++ b/Raspberry/PI4/cooler_skript.py @@ -0,0 +1,67 @@ +#------------------------------------------------------------------------------- +# Name: cooler_skript +# Purpose: Anschluss eines Kuehlkoerpers und Temperatur Sensor +# GPIO-Library: RPi.GPIO 0.5.4 +# +# Author: Felix Stern +# Website: www.tutorials-raspberrypi.de +# +# Created: 04.04.2014 +#------------------------------------------------------------------------------- +#!/usr/bin/env python +import RPi.GPIO as GPIO +import time +import os + +GPIO.setmode(GPIO.BCM) +GPIO.setwarnings(False) + +IMPULS_PIN = 23 #Pin, der zum Transistor fuehrt +SLEEP_TIME = 30 #Alle wie viel Sekunden die Temperatur ueberprueft wird +MAX_CPU_TEMP = 40 #Ab welcher CPU Temperatur der Luefter sich drehen soll +MAX_SENSOR_TEMP = 30 #Ab welcher Temperatur im Gehaeuse der Luefter sich drehen soll +SENSOR_ID = '' #ID des Sonsors, BITTE ANPASSEN, falls kein Sensor vorhanden leer lassen + + + +def get_sensor_temperature(): + try: + tempfile = open("/sys/bus/w1/devices/"+SENSOR_ID+"/w1_slave") + text = tempfile.read() + tempfile.close() + temperature_data = text.split()[-1] + temperature = float(temperature_data[2:]) + temperature = temperature / 1000 + return float(temperature) + except: + return 0 + +def get_cpu_temperature(): + temp = os.popen('vcgencmd measure_temp').readline() + return float(temp.replace("temp=","").replace("'C\n","")) + + + +def main(): + + #Init + GPIO.setup(IMPULS_PIN, GPIO.OUT) + GPIO.output(IMPULS_PIN, False) + + while True: + cpu_temp = get_cpu_temperature() + sensor_temp = get_sensor_temperature() + if cpu_temp >= MAX_CPU_TEMP or sensor_temp >= MAX_SENSOR_TEMP : + GPIO.output(IMPULS_PIN, True) + else: + GPIO.output(IMPULS_PIN, False) + + #print "gemessene CPU Temperatur:" + str(cpu_temp) + #print "gemessene Sensor Temperatur:" + str(sensor_temp) + + time.sleep(SLEEP_TIME) + + +if __name__ == '__main__': + main() + diff --git a/ansible b/ansible new file mode 160000 index 0000000..5567d37 --- /dev/null +++ b/ansible @@ -0,0 +1 @@ +Subproject commit 5567d37b669501bd8d8611fbc35e83e64c3f56ab diff --git a/bz/win_usb_iso_2.sh b/bz/win_usb_iso_2.sh new file mode 100644 index 0000000..28d5e19 --- /dev/null +++ b/bz/win_usb_iso_2.sh @@ -0,0 +1,115 @@ +#!/bin/bash +# (c) Christopher Münzer DB InfraGo Betriebszentrale Duisburg + +USB_DEVICE="/dev/sda" # Ändern Sie dies zu Ihrem USB-Stick +OUTPUT_ISO="windows_isbpn_$(date +%Y%m%d).iso" +LOG="/tmp/log.txt" + +touch $LOG + +echo "1. Analysiere USB-Stick..." >> $LOG +sudo fdisk -l "$USB_DEVICE" + +echo "2. Erstelle temporäre Verzeichnisse..." >> $LOG +TEMP_DIR=$(mktemp -d) +mkdir -p "$TEMP_DIR"/{mount1,mount2,iso} + +echo "3. Identifiziere Bootloader-Dateien..." >> $LOG + +# Boot-Sektor sichern (für BIOS-Boot) +sudo dd if="$USB_DEVICE" of="$TEMP_DIR/bootsect.bin" bs=512 count=1 2>/dev/null + +echo "4. Mounte und kopiere Partitionen..." >> $LOG + +# Erste Partition mounten (normalerweise FAT32/EFI) +PARTITION_COUNT=$(sudo fdisk -l "$USB_DEVICE" | grep "^/dev" | wc -l) + +if [ $PARTITION_COUNT -ge 1 ]; then + echo " - Kopiere Partition 1..." >> $LOG + sudo mount "${USB_DEVICE}1" "$TEMP_DIR/mount1" 2>/dev/null + if mountpoint -q "$TEMP_DIR/mount1"; then + sudo cp -r "$TEMP_DIR"/mount1/* "$TEMP_DIR/iso/" 2>/dev/null + sudo umount "$TEMP_DIR/mount1" 2>/dev/null + fi +fi + +if [ $PARTITION_COUNT -ge 2 ]; then + echo " - Kopiere Partition 2..." >> $LOG + sudo mount "${USB_DEVICE}2" "$TEMP_DIR/mount2" 2>/dev/null + if mountpoint -q "$TEMP_DIR/mount2"; then + sudo cp -r "$TEMP_DIR"/mount2/* "$TEMP_DIR/iso/" 2>/dev/null + sudo umount "$TEMP_DIR/mount2" 2>/dev/null + fi +fi + +echo "5. Suche nach Bootloader-Dateien..." >> $LOG +# Typische Windows-Boot-Dateien +BOOT_FILES=( + "bootmgr" + "bootmgr.efi" + "efi/boot/bootx64.efi" + "efi/boot/bootia32.efi" + "efi/microsoft/boot/bootmgfw.efi" + "boot/bcd" + "boot/boot.sdi" +) + +BOOT_IMAGE="" +for file in "${BOOT_FILES[@]}"; do + if [ -f "$TEMP_DIR/iso/$file" ]; then + echo " Gefunden: $file" + if [[ "$file" == *.efi ]] || [[ "$file" == *.bin ]]; then + BOOT_IMAGE="$file" + fi + fi +done + +echo "6. Erstelle bootfähige ISO..." >> $LOG + +if [ -n "$BOOT_IMAGE" ]; then + echo " Verwende Boot-Image: $BOOT_IMAGE" >> $LOG + sudo genisoimage \ + -b "$BOOT_IMAGE" \ + -no-emul-boot \ + -boot-load-size 8 \ + -iso-level 3 \ + -udf \ + -allow-limited-size \ + -J -l -D -N \ + -joliet-long \ + -relaxed-filenames \ + -o "$OUTPUT_ISO" \ + "$TEMP_DIR/iso" +else + echo " Kein Boot-Image gefunden, erstelle nicht-bootfähige ISO..." >> $LOG + sudo genisoimage \ + -iso-level 3 \ + -udf \ + -allow-limited-size \ + -J -l -D -N \ + -joliet-lo ng \ + -relaxed-filenames \ + -o "$OUTPUT_ISO" \ + "$TEMP_DIR/iso" + + echo " Hinweis: ISO ist nicht bootfähig. Für bootfähige ISO müssen Sie:" + echo " 1. Windows ADK auf einem Windows-System verwenden" + echo " 2. Oder die originale Windows ISO mit Ihren Dateien neu erstellen" +fi + +echo "7. Aufräumen..." >> $LOG +sudo rm -rf "$TEMP_DIR" + +echo "8. Prüfe ISO..." >> $LOG +if [ -f "$OUTPUT_ISO" ]; then + echo "Fertig! ISO erstellt: $OUTPUT_ISO" >> $LOG + echo "Größe: $(ls -lh "$OUTPUT_ISO" | awk '{print $5}')" + + # Teste ISO-Struktur + echo "ISO-Struktur:" + isoinfo -i "$OUTPUT_ISO" -l 2>/dev/null | head -20 || \ + xorriso -indev "$OUTPUT_ISO" -toc 2>/dev/null | head -20 || \ + echo "Kann ISO nicht lesen, aber Datei wurde erstellt." >> $LOG +else + echo "FEHLER: ISO wurde nicht erstellt!" >> $LOG +fi \ No newline at end of file diff --git a/bz/win_usb_zu_iso.sh b/bz/win_usb_zu_iso.sh new file mode 100644 index 0000000..45a197a --- /dev/null +++ b/bz/win_usb_zu_iso.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# (c) Christopher Münzer DB InfraGo Betriebszentrale Duisburg + +USB_DEVICE="/dev/sda" +OUTPUT_ISO="windows_$(date +%Y%m%d).iso" + +echo "1. Analysiere USB-Stick..." +sudo fdisk -l "$USB_DEVICE" + +echo "2. Erstelle temporäre Verzeichnisse..." +TEMP_DIR=$(mktemp -d) +mkdir -p "$TEMP_DIR"/{mount1,mount2,iso} + +echo "3. Kopiere Boot-Sektion..." +sudo dd if="$USB_DEVICE" of="$TEMP_DIR/bootsect.bin" bs=512 count=1 + +echo "4. Mounte und kopiere Partitionen..." +# Erste Partition (normalerweise FAT32/EFI) +sudo mount "${USB_DEVICE}1" "$TEMP_DIR/mount1" 2>/dev/null +sudo cp -r "$TEMP_DIR"/mount1/* "$TEMP_DIR/iso/" 2>/dev/null + +# Zweite Partition (normalerweise NTFS/Installation) +sudo mount "${USB_DEVICE}2" "$TEMP_DIR/mount2" 2>/dev/null +sudo cp -r "$TEMP_DIR"/mount2/* "$TEMP_DIR/iso/" 2>/dev/null + +echo "5. Erstelle bootfähige ISO..." +sudo genisoimage \ + -b efi/microsoft/boot/efisys.bin \ + -no-emul-boot \ + -boot-load-size 8 \ + -iso-level 3 \ + -udf \ + -allow-limited-size \ + -J -l -D -N \ + -joliet-long \ + -relaxed-filenames \ + -o "$OUTPUT_ISO" \ + "$TEMP_DIR/iso" + +echo "6. Aufräumen..." +sudo umount "$TEMP_DIR"/mount* 2>/dev/null +sudo rm -rf "$TEMP_DIR" + +echo "Fertig! ISO erstellt: $OUTPUT_ISO" \ No newline at end of file