first compilation

This commit is contained in:
Page Asgardius 2023-12-31 10:55:53 -07:00
parent 8e10c5a23d
commit 227493cbca
15 changed files with 339 additions and 0 deletions

1
asia fonts arch linux.sh Normal file
View file

@ -0,0 +1 @@
sudo pacman -S adobe-source-han-sans-jp-fonts otf-ipafont adobe-source-han-sans-cn-fonts adobe-source-han-sans-tw-fonts ttf-baekmuk

4
fix dns arch.sh Normal file
View file

@ -0,0 +1,4 @@
sudo rm /etc/resolv.conf.orig
sudo rm /etc/resolv.conf
sudo ln -s /run/NetworkManager/resolv.conf /etc/resolv.conf
echo /etc/resolvconf file fixed

4
fix dns opensuse.sh Normal file
View file

@ -0,0 +1,4 @@
sudo rm /etc/resolv.conf.orig
sudo rm /etc/resolv.conf
sudo ln -s /run/netconfig/resolv.conf /etc/resolv.conf
echo /etc/resolvconf file fixed

View file

@ -0,0 +1,34 @@
fastboot flash partition ocean/gpt.bin
fastboot flash bootloader ocean/bootloader.img
fastboot flash logo ocean/logo.bin
fastboot flash boot ocean/boot.img
fastboot flash recovery ocean/recovery.img
fastboot flash dsp ocean/adspso.bin
fastboot oem fb_mode_set
fastboot flash oem ocean/oem.img
fastboot flash system ocean/system.img_sparsechunk.0
fastboot flash system ocean/system.img_sparsechunk.1
fastboot flash system ocean/system.img_sparsechunk.2
fastboot flash system ocean/system.img_sparsechunk.3
fastboot flash system ocean/system.img_sparsechunk.4
fastboot flash system ocean/system.img_sparsechunk.5
fastboot flash system ocean/system.img_sparsechunk.6
fastboot flash system ocean/system.img_sparsechunk.7
fastboot flash system ocean/system.img_sparsechunk.8
fastboot flash system ocean/system.img_sparsechunk.9
fastboot flash system ocean/system.img_sparsechunk.10
fastboot flash system_b ocean/system_b.img_sparsechunk.0
fastboot flash system_b ocean/system_b.img_sparsechunk.1
fastboot flash system_b ocean/system_b.img_sparsechunk.2
fastboot flash vendor ocean/vendor.img_sparsechunk.0
fastboot flash vendor ocean/vendor.img_sparsechunk.1
fastboot flash modem ocean/NON-HLOS.bin
fastboot erase modemst1
fastboot erase modemst2
fastboot flash fsg ocean/fsg.mbn
fastboot erase cache
fastboot erase userdata
fastboot erase customize
fastboot erase clogo
fastboot oem fb_mode_clear
fastboot reboot

5
jellyfinbackup.sh Normal file
View file

@ -0,0 +1,5 @@
#!/bin/bash
CURRENTDATE=`date +"%Y-%m-%d-%H-%M"`
sudo systemctl stop jellyfin
sudo borg create ssh://pi@naomi.asgardius.company:22/data/jellyfin::jellyfin-${CURRENTDATE} /var/lib/jellyfin /etc/jellyfin /var/log/jellyfin /var/cache/jellyfin /etc/default/jellyfin /usr/bin/jellyfinbackup
sudo systemctl start jellyfin

3
mediabackup.sh Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
CURRENTDATE=`date +"%Y-%m-%d-%H-%M"`
sudo borg create ssh://pi@naomi.asgardius.company:22/data/multimedia::media-${CURRENTDATE} /home/yunohost.multimedia/asgardius /usr/bin/mediabackup

1
mysql-docker.sh Normal file
View file

@ -0,0 +1 @@
docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=some-root -p 3306:3306 -d --restart always mysql

5
plexbackup.sh Normal file
View file

@ -0,0 +1,5 @@
#!/bin/bash
CURRENTDATE=`date +"%Y-%m-%d-%H-%M"`
sudo systemctl stop plexmediaserver
sudo borg create ssh://pi@naomi.asgardius.company:22/data/plex::plex-${CURRENTDATE} /var/lib/plexmediaserver /usr/bin/plexbackup
sudo systemctl start plexmediaserver

3
powerbalance.sh Normal file
View file

@ -0,0 +1,3 @@
for x in /sys/devices/system/cpu/cpu[1-3]*/online; do
echo 1 > "$x"
done

3
powersave.sh Normal file
View file

@ -0,0 +1,3 @@
for x in /sys/devices/system/cpu/cpu[1-3]*/online; do
echo 0 > "$x"
done

3
r3backup.sh Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
CURRENTDATE=`date +"%Y-%m-%d-%H-%M"`
sudo borg create ssh://pi@naomi.asgardius.company:22/data/r3backup::r3-${CURRENTDATE} /etc/systemd/system/r3* /home/asgardius/Documentos/r3 /etc/icecast2/icecast.xml /usr/bin/r3backup /usr/share/icecast2/web/icecast.png

6
test.sh Normal file
View file

@ -0,0 +1,6 @@
#!/bin/bash
while GOMAXPROCS=1 echo "Your command goes here"; [[ $? -ne 0 ]];
do
sleep 1
done

75
umsgadget.sh Normal file
View file

@ -0,0 +1,75 @@
#!/bin/bash
# Konfiguration fuer ein Composite Gadget Device
# mit mehreren HID und Flash Komponenten
#board config anlegen
if [ $# -eq 0 ]; then
if [ -d "/sys/kernel/config/usb_gadget/multiDeskBoard" ]; then
echo "" > /sys/kernel/config/usb_gadget/multiDeskBoard/UDC
fi
fi
if [ $# -eq 1 ]; then
if [ -d "/sys/kernel/config/usb_gadget/multiDeskBoard" ]; then
echo "" > /sys/kernel/config/usb_gadget/multiDeskBoard/UDC
echo $1 > /sys/kernel/config/usb_gadget/multiDeskBoard/functions/mass_storage.usb1/lun.0/file
ls /sys/class/udc > /sys/kernel/config/usb_gadget/multiDeskBoard/UDC
else
mkdir /sys/kernel/config/usb_gadget/multiDeskBoard
cd /sys/kernel/config/usb_gadget/multiDeskBoard
#hardware id setzen
echo 0x0419 > bcdDevice
echo 0x0200 > bcdUSB
echo 0x1d6b > idVendor
echo 0x0104 > idProduct
#Geraetetyp setzen
echo 0x00 > bDeviceClass
echo 0x00 > bDeviceSubClass
echo 0x00 > bDeviceProtocol
echo 0x08 > bMaxPacketSize0
#klartextbeschreibung setzen
mkdir strings/0x409
mkdir strings/0x407
cd strings/0x409
echo "RSI_HUD_Solutions" > manufacturer
echo "MultiDeskBoard" > product
echo "1337" > serialnumber
cd ../../
cd strings/0x407
echo "RSI_HUD_Solutions" > manufacturer
echo "MultiDeskBoard" > product
echo "1337" > serialnumber
cd ../../
#geraetefunktion setzen
mkdir functions/mass_storage.usb1
#mkdir functions/hid.usb0
#HID0 Funktion Konfiguration auf keyboard setzen
#cd functions/hid.usb0
#echo 1 > protocol
#echo 8 > report_length
#echo 1 > subclass
#cp /home/pi/USBConfigBuffer/mediaKeyboardRepDesc report_desc
#cd ../../
#Mass Storage 1 Konfiguration setzen
cd functions/mass_storage.usb1
echo 0 > stall
echo 1 > lun.0/removable
echo 0 > lun.0/ro
echo $1 > lun.0/file
cd ../../
#Bus Hardware Konfig anlegen und verlinken
mkdir configs/c.1
cd configs/c.1
echo 0x80 > bmAttributes
echo 100 > MaxPower
mkdir strings/0x409
echo "MDB Config1" > strings/0x409/configuration
mkdir strings/0x407
echo "MDB Config1" > strings/0x407/configuration
cd ../../
ln -s functions/mass_storage.usb1 configs/c.1
#ln -s functions/hid.usb0 configs/c.1
#Geraet aktivieren
ls /sys/class/udc > UDC
fi
fi

142
usbgadget.sh Normal file
View file

@ -0,0 +1,142 @@
#!/bin/bash -e
set -x
#set -euo pipefail
GADGET_NAME="g1"
LANGUAGE="0x409" # English
CONFIGFS="/sys/kernel/config/usb_gadget/"
ID_VENDOR="0x1d6b"
ID_PRODUCT="0x0104"
SERIAL="$(grep Serial /proc/cpuinfo | sed 's/Serial\s*: 0000\(\w*\)/\1/')"
MAC="$(echo ${SERIAL} | sed 's/\(\w\w\)/:\1/g' | cut -b 2-)"
MAC_HOST="12$(echo ${MAC} | cut -b 3-)"
MAC_DEV="02$(echo ${MAC} | cut -b 3-)"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
if [ ! -d $CONFIGFS ]; then
modprobe libcomposite
fi
# Enter ConfigFS
cd $CONFIGFS
# Cleaning
#echo "Cleaning up existing gadget"
#echo "Stopping getty"
#systemctl stop getty@ttyGS0.service
#echo "Removing config-level functions"
find ./$GADGET_NAME/configs/*/* -maxdepth 0 -type l -exec rm {} \; || true
#echo "Removing config-level strings"
find ./$GADGET_NAME/configs/*/strings/* -maxdepth 0 -type d -exec rmdir {} \; || true
#echo "Removing config-level OS descriptors"
find ./$GADGET_NAME/os_desc/* -maxdepth 0 -type l -exec rm {} \; || true
#echo "Removing gadget-level functions"
find ./$GADGET_NAME/functions/* -maxdepth 0 -type d -exec rmdir {} \; || true
#echo "Removing gadget-level strings"
find ./$GADGET_NAME/strings/* -maxdepth 0 -type d -exec rmdir {} \; || true
#echo "Removing gadget-level configs"
find ./$GADGET_NAME/configs/* -maxdepth 0 -type d -exec rmdir {} \; || true
#echo "Removing gadget"
rmdir ./$GADGET_NAME || true
#echo "Starting getty"
#systemctl start getty@ttyGS0.service
mkdir ./$GADGET_NAME && cd ./$GADGET_NAME
# Basic info
echo $ID_VENDOR > idVendor # Linux Foundation
echo $ID_PRODUCT > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice # v1.0.0
echo 0x0200 > bcdUSB # USB 2.0
#echo "Configuring gadget as composite device"
# https://msdn.microsoft.com/en-us/library/windows/hardware/ff540054(v=vs.85).aspx
echo 0xEF > bDeviceClass
echo 0x02 > bDeviceSubClass
echo 0x01 > bDeviceProtocol
#echo "Configuring OS descriptors"
# https://msdn.microsoft.com/en-us/library/hh881271.aspx
# OS descriptors
# WIndows extensions to force config
echo 1 > os_desc/use
echo 0xcd > os_desc/b_vendor_code
echo MSFT100 > os_desc/qw_sign
mkdir -p strings/$LANGUAGE
echo "7777777" > strings/$LANGUAGE/serialnumber
echo "eXander" > strings/$LANGUAGE/manufacturer
echo "exander's Gadget" > strings/$LANGUAGE/product
# Config #1 for OSX / Linux
mkdir -p configs/c.1/strings/$LANGUAGE
echo 250 > configs/c.1/MaxPower
echo "Config 1" > configs/c.1/strings/$LANGUAGE/configuration
mkdir -p functions/acm.usb0 # serial
mkdir -p functions/rndis.usb0 # network Flippin' Windows
#mkdir -p functions/ecm.usb0 # OSX / Linux
mkdir -p functions/hid.usb0 # keyboard
# https://msdn.microsoft.com/en-us/windows/hardware/gg463179.aspx
echo RNDIS > functions/rndis.usb0/os_desc/interface.rndis/compatible_id
echo 5162001 > functions/rndis.usb0/os_desc/interface.rndis/sub_compatible_id
echo $MAC_HOST > functions/rndis.usb0/host_addr
echo $MAC_DEV > functions/rndis.usb0/dev_addr
#echo $MAC_HOST > functions/ecm.usb0/host_addr
#echo $MAC_DEV > functions/ecm.usb0/dev_addr
# Set up the rndis device only first
ln -s functions/rndis.usb0 configs/c.1
# Tell Windows to use config #2
ln -s configs/c.1 os_desc
#ln -s configs/c.1 os_desc/c.1
# Show Windows the RNDIS device with
# bDeviceClass 0x02
# bDeviceSubClass 0x02
ls /sys/class/udc/ > UDC
# Give it time to install
sleep 5
# Yank it back
echo "" > UDC
# Setup keyboard
echo 1 > functions/hid.usb0/protocol
echo 1 > functions/hid.usb0/subclass
echo 8 > functions/hid.usb0/report_length
echo -ne \\x05\\x01\\x09\\x06\\xa1\\x01\\x05\\x07\\x19\\xe0\\x29\\xe7\\x15\\x00\\x25\\x01\\x75\\x01\\x95\\x08\\x81\\x02\\x95\\x01\\x75\\x08\\x81\\x03\\x95\\x05\\x75\\x01\\x05\\x08\\x19\\x01\\x29\\x05\\x91\\x02\\x95\\x01\\x75\\x03\\x91\\x03\\x95\\x06\\x75\\x08\\x15\\x00\\x25\\x65\\x05\\x07\\x19\\x00\\x29\\x65\\x81\\x00\\xc0 > functions/hid.usb0/report_desc
ln -s functions/acm.usb0 configs/c.1/
#ln -s functions/ecm.usb0 configs/c.1/
ln -s functions/hid.usb0 configs/c.1/
# Reset bDeviceClass to 0x00
# This is essential to make it work in Windows 10
# Basically forces it to use device information
# in the descriptors versus assuming a particular class.
echo "0x00" > bDeviceClass
# Re-attach the gadget
udevadm settle -t 5 || :
ls /sys/class/udc/ > UDC
# BOOM!

50
wifi-to-eth-route.sh Normal file
View file

@ -0,0 +1,50 @@
#!/bin/bash
# Share Wifi with Eth device
#
#
# This script is created to work with Raspbian Stretch
# but it can be used with most of the distributions
# by making few changes.
#
# Make sure you have already installed `dnsmasq`
# Please modify the variables according to your need
# Don't forget to change the name of network interface
# Check them with `ifconfig`
ip_address="192.168.2.1"
netmask="255.255.255.0"
dhcp_range_start="192.168.2.2"
dhcp_range_end="192.168.2.100"
dhcp_time="12h"
eth="eth0"
wlan="wlan0"
sudo systemctl start network-online.target &> /dev/null
sudo iptables -F
sudo iptables -t nat -F
sudo iptables -t nat -A POSTROUTING -o $wlan -j MASQUERADE
sudo iptables -A FORWARD -i $wlan -o $eth -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i $eth -o $wlan -j ACCEPT
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
sudo ifconfig $eth $ip_address netmask $netmask
# Remove default route created by dhcpcd
sudo ip route del 0/0 dev $eth &> /dev/null
sudo systemctl stop dnsmasq
sudo rm -rf /etc/dnsmasq.d/* &> /dev/null
echo -e "interface=$eth\n\
bind-interfaces\n\
server=176.103.130.130\n\
domain-needed\n\
bogus-priv\n\
dhcp-range=$dhcp_range_start,$dhcp_range_end,$dhcp_time" > /tmp/custom-dnsmasq.conf
sudo cp /tmp/custom-dnsmasq.conf /etc/dnsmasq.d/custom-dnsmasq.conf
sudo systemctl start dnsmasq