Fix mount/umount cmds
This commit is contained in:
parent
6eba72000b
commit
98c5007545
|
@ -9,32 +9,32 @@ if [[ "${TRACE-0}" == "1" ]]; then
|
|||
set -o xtrace
|
||||
fi
|
||||
|
||||
# Change to script dir
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
#l10n
|
||||
. gettext.sh
|
||||
export TEXTDOMAINDIR="$PWD"
|
||||
export TEXTDOMAIN="$(basename $0)"
|
||||
export TEXTDOMAIN="$(basename "$0")"
|
||||
|
||||
# Change to script dir
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Colored output
|
||||
#~ set +x
|
||||
bold=$(tput bold)
|
||||
function red(){
|
||||
echo -e "${bold}\x1B[31m$1 \x1B[0m"
|
||||
if [ ! -z "${2-}" ]; then
|
||||
if [ -n "${2-}" ]; then
|
||||
echo -e "\x1B[31m $($2) \x1B[0m"
|
||||
fi
|
||||
}
|
||||
function green(){
|
||||
echo -e "${bold}\x1B[32m$1 \x1B[0m"
|
||||
if [ ! -z "${2-}" ]; then
|
||||
if [ -n "${2-}" ]; then
|
||||
echo -e "\x1B[32m $($2) \x1B[0m"
|
||||
fi
|
||||
}
|
||||
function yellow(){
|
||||
echo -e "${bold}\x1B[33m$1 \x1B[0m"
|
||||
if [ ! -z "${2-}" ]; then
|
||||
if [ -n "${2-}" ]; then
|
||||
echo -e "\x1B[33m $($2) \x1B[0m"
|
||||
fi
|
||||
}
|
||||
|
@ -52,10 +52,19 @@ if [[ "${1-}" =~ ^-*d(ry)?$ ]]; then
|
|||
DRY_RUN=1
|
||||
yellow "`gettext \"!!! Running in dry mode. No modifications will be made.\n\"`"
|
||||
fi
|
||||
|
||||
HOTSPOT=0
|
||||
if [[ "${1-}" =~ ^-*w(ap)?$ ]]; then
|
||||
HOTSPOT=1
|
||||
yellow "`gettext \"We'll create a Wireless AP with nmcli'.\n\"`"
|
||||
fi
|
||||
|
||||
# Options
|
||||
# Device block to write on
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]] && [[ "$HOTSPOT" == 0 ]]; then
|
||||
SDCARD="${1}"
|
||||
elif [[ "$DRY_RUN" == 1 ]] && [[ "$HOTSPOT" == 1 ]]; then
|
||||
SDCARD="${3-}"
|
||||
else
|
||||
SDCARD="${2-}"
|
||||
fi
|
||||
|
@ -65,8 +74,8 @@ then
|
|||
red "`gettext \"Please specify an existing device block for your sd-card, e.g: '/dev/sda'.\"`" >&2
|
||||
exit 0
|
||||
fi
|
||||
DD_BS="128K"
|
||||
DISK_IMAGE="$HOME/niels/imgs/2022-10-25-pilpil-WIP.img.xz"
|
||||
DD_BS="256K"
|
||||
DISK_IMAGE="$HOME/niels/imgs/2023-01-05-pilpil.img.xz"
|
||||
if [[ ! -f "$DISK_IMAGE" ]]; then
|
||||
red "`gettext \"Disk image not found, aborting...\"`" >&2
|
||||
exit 0
|
||||
|
@ -76,6 +85,7 @@ if [[ ! -d "$CONFIG_DIR" ]]; then
|
|||
red "`gettext \"Config directory not found, aborting...\"`" >&2
|
||||
exit 0
|
||||
fi
|
||||
# Generate random http auth secret
|
||||
HTTP_SECRET=$(openssl rand -base64 12)
|
||||
PI_USER="pil"
|
||||
BOOT_MOUNT="/run/media/$USER/boot"
|
||||
|
@ -95,19 +105,22 @@ IFW="wlo1"
|
|||
#Band (bg = 2.4Ghz, a= 5Ghz)
|
||||
BAND="bg"
|
||||
# Hidden SSID
|
||||
#~ HIDE="802-11-wireless.hidden false"
|
||||
HIDE="802-11-wireless.hidden false"
|
||||
# Set channel manually
|
||||
CHAN="802-11-wireless.channel 1"
|
||||
#
|
||||
#
|
||||
# 0. Create AP connection
|
||||
# 0. Create AP connection if -w flag used
|
||||
#
|
||||
|
||||
green "`gettext \" * Creating hotspot connection in NetworkManager \n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
# If connection exists, delete it
|
||||
nmcli con delete $SSID
|
||||
if [[ "$DRY_RUN" == 0 ]] && [[ "$HOTSPOT" == 1 ]]; then
|
||||
#~ # If connection exists, delete it
|
||||
if [[ "$(nmcli con show | grep "$SSID")" != "" ]];then
|
||||
nmcli con delete "$SSID"
|
||||
fi
|
||||
nmcli con add type wifi ifname $IFW con-name $SSID autoconnect yes ssid $SSID
|
||||
nmcli con modify $SSID 802-11-wireless.mode ap 802-11-wireless.band "${BAND-}" "${CHAN-}" "${HIDE-}" ipv4.method shared
|
||||
nmcli con modify $SSID 802-11-wireless.mode ap 802-11-wireless.band "${BAND-}" ${CHAN-} ${HIDE-} ipv4.method shared
|
||||
nmcli con modify $SSID wifi-sec.key-mgmt wpa-psk
|
||||
nmcli con modify $SSID 802-11-wireless-security.proto rsn
|
||||
nmcli con modify $SSID 802-11-wireless-security.pairwise ccmp
|
||||
|
@ -115,7 +128,7 @@ if [[ ! "$DRY_RUN" ]]; then
|
|||
fi
|
||||
# 0.a set IP range on server
|
||||
green "`eval_gettext \" * Setting IP range \\\$IP_RANGE/24 in /etc/NetworkManager/system-connections/\\\$SSID.nmconnection ... \n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]] && [[ "$HOTSPOT" == 1 ]]; then
|
||||
sudo sed -i "/method=shared/a address1=$IP_RANGE/24, $IP_RANGE" /etc/NetworkManager/system-connections/$SSID.nmconnection
|
||||
# Remove existing leases
|
||||
sudo rm /var/lib/NetworkManager/dnsmasq-$IFW.leases
|
||||
|
@ -164,7 +177,7 @@ green "`eval_gettext \"Got host list : \\\$HOST_LIST \n\"`"
|
|||
# 5. Generate valid ssl cert/key for every IP in range
|
||||
# https://unix.stackexchange.com/questions/104171/create-ssl-certificate-non-interactively
|
||||
green "`eval_gettext \"Generating SSL crt/key for \\\$HOST_LIST...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
openssl req -new -newkey rsa:4096 -days 1825 -nodes -x509 \
|
||||
-subj "/C=/ST=Denial/L=/O=/CN=$IP_RANGE$FIRST" \
|
||||
-addext "subjectAltName=$HOST_LIST" \
|
||||
|
@ -186,47 +199,57 @@ do
|
|||
break
|
||||
fi
|
||||
red "`eval_gettext \"Received answer \\\$GO_DD. Running dd on \\\$SDCARD in 5 seconds.\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
sleep 5
|
||||
fi
|
||||
GO_DD=0
|
||||
# unmount / remount new filesystem
|
||||
green "`eval_gettext \"2/14 : Unmounting \\\$BOOT_MOUNT and \\\$ROOTFS_MOUNT ...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
umount $BOOT_MOUNT
|
||||
umount $ROOTFS_MOUNT
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
if $(mountpoint -q "$BOOT_MOUNT");then
|
||||
umount "$BOOT_MOUNT"
|
||||
fi
|
||||
if $(mountpoint -q "$ROOTFS_MOUNT");then
|
||||
umount "$ROOTFS_MOUNT"
|
||||
fi
|
||||
xzcat "$DISK_IMAGE" | sudo dd of=$SDCARD bs="$DD_BS" oflag=dsync status=progress && sync
|
||||
fi
|
||||
green "`eval_gettext \"3/14 : Remounting \\\$BOOT_MOUNT and \\\$ROOTFS_MOUNT ...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
sleep 1
|
||||
systemctl --user restart gvfs-udisks2-volume-monitor
|
||||
#~ systemctl --user restart gvfs-udisks2-volume-monitor
|
||||
PARTS="$(lsblk "$SDCARD" --noheadings --raw -o NAME | tail -2)"
|
||||
PART_BOOT="$(echo $PARTS | awk '{print $1}')"
|
||||
PART_ROOTFS="$(echo $PARTS | awk '{print $2}')"
|
||||
udisksctl mount -b /dev/"$PART_BOOT"
|
||||
udisksctl mount -b /dev/"$PART_ROOTFS"
|
||||
sleep 3
|
||||
fi
|
||||
green "`eval_gettext \"4/14 : Changing hostname to \\\$HOST_NAME in \\\$ROOTFS_MOUNT/etc/hostname and \\\$ROOTFS_MOUNT/etc/hosts ...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
# TODO : /etc/resolv.conf ?
|
||||
# Change hostname
|
||||
echo "$HOST_NAME" | sudo tee "$ROOTFS_MOUNT/etc/hostname"
|
||||
# Reflect that in /etc/hosts
|
||||
sudo sed -i "$d" "$ROOTFS_MOUNT/etc/hosts"
|
||||
sudo sed -i "$ d" "$ROOTFS_MOUNT/etc/hosts"
|
||||
echo -e "127.0.1.1\t$HOST_NAME" | sudo tee -a "$ROOTFS_MOUNT/etc/hosts"
|
||||
fi
|
||||
## Enable SSH
|
||||
green "`eval_gettext \"5/14 : Enabling SSH server on boot : \\\$BOOT_MOUNT/ssh ...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
touch "$BOOT_MOUNT/ssh"
|
||||
sync
|
||||
fi
|
||||
## Generate SSH private/public key and install it - Disable passwd login
|
||||
green "`eval_gettext \"6/14 : Generating private/public SSH key as \\\$HOME/.ssh/\\\$HOST_NAME ...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
ssh-keygen -t ed25519 -f "$HOME/.ssh/$HOST_NAME" -N ""
|
||||
fi
|
||||
red "`eval_gettext \"New SSH key pair generated as \\\$HOME/.ssh/\\\$HOST_NAME. Add to ~/.ssh/config ? (y/n)\"`"
|
||||
read -n 2 ADD_SSH_CONF
|
||||
if [[ "$ADD_SSH_CONF" == "`gettext \"y\"`" ]];then
|
||||
green "`eval_gettext \"Adding \\\$HOST_NAME with ip \\\$HOST in \\\$HOME/.ssh/config\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
# Add to ~/.ssh/config
|
||||
echo -e "\nHost $HOST_NAME\n\tHostname $HOST\n\tIdentityFile ~/.ssh/$HOST_NAME\n\tUser $PI_USER" | tee -a "$HOME/.ssh/config"
|
||||
fi
|
||||
|
@ -235,19 +258,19 @@ do
|
|||
fi
|
||||
# Copy public key to rpi
|
||||
green "`eval_gettext \"7/14 : Installing public SSH key \\\$HOME/.ssh/\\\$HOST.pub in \\\$ROOTFS_MOUNT/home/\\\$PI_USER/.ssh/authorized_keys...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
sudo cp "$HOME/.ssh/$HOST_NAME.pub" "$ROOTFS_MOUNT/home/$PI_USER/.ssh/authorized_keys"
|
||||
sync
|
||||
fi
|
||||
# Disable PW login
|
||||
green "`eval_gettext \"8/14 : Disabling SSH password based login in \\\$ROOTFS_MOUNT/etc/ssh/sshd_config ...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
echo -e "PasswordAuthentication no\nChallengeResponseAuthentication no\nUsePAM no" | sudo tee -a "$ROOTFS_MOUNT/etc/ssh/sshd_config"
|
||||
sync
|
||||
fi
|
||||
# 3. Configure wifi with static IP
|
||||
green "`eval_gettext \"9/14 : Configuring wireless connection to \\\$SSID with pw \\\$PASSWD : ...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
echo "ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
|
||||
update_config=1
|
||||
country=FR
|
||||
|
@ -266,19 +289,19 @@ network={
|
|||
fi
|
||||
# Request specific IP to dhcp server
|
||||
green "`eval_gettext \"10/14 : Setting static IP \\\$HOST in \\\$ROOTFS_MOUNT/etc/dhcpcd.conf...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
echo -e "interface wlan0\nrequest $HOST" | sudo tee -a "$ROOTFS_MOUNT/etc/dhcpcd.conf"
|
||||
sync
|
||||
fi
|
||||
# 5. Install previously generated SSL key/crt
|
||||
green "`eval_gettext \"11/14 : Installing SSL : \\\$CONFIG_DIR/selfCA.crt and $CONFIG_DIR/selfCA.key in \\\$ROOTFS_MOUNT/etc/ssl/certs/ and \\\$ROOTFS_MOUNT/etc/ssl/private/nginx-selfsigned.key...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
sudo cp "$CONFIG_DIR/selfCA.crt" "$ROOTFS_MOUNT/etc/ssl/certs/nginx-selfsigned.crt"
|
||||
sudo cp "$CONFIG_DIR/selfCA.key" "$ROOTFS_MOUNT/etc/ssl/private/nginx-selfsigned.key"
|
||||
sync
|
||||
fi
|
||||
green "`eval_gettext \"12/14 : Installing http auth secrets in \\\$CONFIG_DIR/pilpil-server.toml, \\\$ROOTFS_MOUNT/home/pil/.config/systemd/user/vlc.service and \\\$ROOTFS_MOUNT/home/pil/pilpil-client/defaults.toml...\n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
#~ Change VLC/pilpil http auth secret
|
||||
sed -i "s:secret:$HTTP_SECRET:g" "$CONFIG_DIR/pilpil-server.toml"
|
||||
sed -i "s:secret:$HTTP_SECRET:g" "$ROOTFS_MOUNT/home/pil/.config/systemd/user/vlc.service"
|
||||
|
@ -286,7 +309,7 @@ network={
|
|||
fi
|
||||
#~ # 6. Copy medias
|
||||
green "`eval_gettext \"13/14 : Syncing media folder \\\$LOCAL_MEDIA_DIR/ with \\\$REMOTE_MEDIA_DIR/ \n\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
# Remove filler file
|
||||
if [[ -f "$REMOTE_MEDIA_DIR/remove_me" ]]; then
|
||||
sudo rm "$REMOTE_MEDIA_DIR/remove_me"
|
||||
|
@ -300,13 +323,13 @@ network={
|
|||
MEDIA_SIZE=$(du -c "$LOCAL_MEDIA_DIR" | tail -1 | awk '{print $1}')
|
||||
yellow "`eval_gettext \"Size of medias : \\\$MEDIA_SIZE sectors\"`"
|
||||
fi
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
# Only copy files if enough space available
|
||||
if [[ "$MEDIA_SIZE" -lt "$ROOTFS_AVAILABLE_SPACE" ]]; then
|
||||
USER_ID=$( cat "$ROOTFS_MOUNT/etc/passwd" | grep $PI_USER | awk -F: '{print $3}' )
|
||||
GROUP_ID=$( cat "$ROOTFS_MOUNT/etc/passwd" | grep $PI_USER | awk -F: '{print $4}' )
|
||||
sudo cp "$LOCAL_MEDIA_DIR/"* "$REMOTE_MEDIA_DIR/"
|
||||
sudo chown -R $USER_ID:$GROUP_ID "$REMOTE_MEDIA_DIR"
|
||||
sudo chown -R "$USER_ID:$GROUP_ID" "$REMOTE_MEDIA_DIR"
|
||||
sync
|
||||
else
|
||||
red "`eval_gettext \"Not enough space on \\\$ROOTFS_MOUNT, skipping...\"`"
|
||||
|
@ -314,9 +337,13 @@ network={
|
|||
fi
|
||||
# Unmount FS
|
||||
green "`gettext \"14/14 : Unmounting filesystems\"`"
|
||||
if [[ ! "$DRY_RUN" ]]; then
|
||||
umount "$BOOT_MOUNT"
|
||||
umount "$ROOTFS_MOUNT"
|
||||
if [[ "$DRY_RUN" == 0 ]]; then
|
||||
if $(mountpoint -q "$BOOT_MOUNT");then
|
||||
umount "$BOOT_MOUNT"
|
||||
fi
|
||||
if $(mountpoint -q "$ROOTFS_MOUNT");then
|
||||
umount "$ROOTFS_MOUNT"
|
||||
fi
|
||||
fi
|
||||
yellow "`eval_gettext \"Client $(($IP-9))/$CLIENT_NUMBER.\"`"
|
||||
#~ echo "$IP / $(($IP_CNT-1))"
|
||||
|
|
176
prepa_rpios.md
176
prepa_rpios.md
|
@ -30,6 +30,14 @@ network={
|
|||
5. Se connecter via SSH.
|
||||
6. Adduser pil
|
||||
|
||||
### Options du pilote brcmfmac pour le wifi intégré des rpi 3+/4
|
||||
|
||||
Voir ici : [https://wiki.arthus.net/?Rpi_wifi_-_BCM4345_and_CTRL-EVENT-ASSOC-REJECT](https://wiki.arthus.net/?Rpi_wifi_-_BCM4345_and_CTRL-EVENT-ASSOC-REJECT)
|
||||
|
||||
```
|
||||
echo 'options brcmfmac roamoff=1 feature_disable=0x82000' | sudo tee /etc/modprobe.d/brcmfmac.conf
|
||||
```
|
||||
|
||||
## Modification de config.txt
|
||||
|
||||
Ajouter les lignes suivantes au fichier `/boot/config.txt` :
|
||||
|
@ -41,10 +49,101 @@ hdmi_mode=16 # fullHD@60
|
|||
|
||||
[all]
|
||||
# Désactivation du bluetooth
|
||||
dtoverlay=pi3-disable-bt
|
||||
dtoverlay=disable-bt
|
||||
max_framebuffers=2
|
||||
# Mémoire vidéo
|
||||
gpu_mem=320
|
||||
# Désactiver le logo éclair et l'arc en ciel au démarrage
|
||||
boot_delay=1
|
||||
avoid_warnings=1
|
||||
disable_splash=1
|
||||
```
|
||||
|
||||
### Activation du pilote GPU libre pour le décodage vidéo matériel
|
||||
|
||||
Ajouter à '/boot/config.txt' :
|
||||
```
|
||||
dtoverlay=vc4-kms-v3d
|
||||
```
|
||||
|
||||
#### Utilisation gpu
|
||||
|
||||
```
|
||||
vcgencmd get_mem <type>
|
||||
```
|
||||
|
||||
Where type is:
|
||||
* arm: total memory assigned to arm
|
||||
* gpu: total memory assigned to gpu
|
||||
* malloc_total: total memory assigned to gpu malloc heap
|
||||
* malloc: free gpu memory in malloc heap
|
||||
* reloc_total: total memory assigned to gpu relocatable heap
|
||||
* reloc: free gpu memory in relocatable heap
|
||||
|
||||
### Overclocking
|
||||
|
||||
```
|
||||
|
||||
# SD card reader OC (expect 20% rio improvement)
|
||||
# https://www.pidramble.com/wiki/benchmarks/microsd-cards
|
||||
# Samsung Pro/Evo+ is recommended
|
||||
# default value : 50
|
||||
# value needs to be an int divisor of core_freq
|
||||
# NEEDS A UHS-1/Class10 SD CARD !
|
||||
# dtparam=sd_overclock=84
|
||||
# to check value in os : cat /sys/kernel/debug/mmc0/ios
|
||||
|
||||
[pi4]
|
||||
# Run as fast as firmware / board allows
|
||||
arm_boost=1
|
||||
dtoverlay=disable-bt
|
||||
dtoverlay=vc4-kms-v3d
|
||||
max_framebuffers=2
|
||||
|
||||
# Apply to rpi3, rpi3+, cm3
|
||||
[pi3]
|
||||
# Safe OC values
|
||||
# gpu_freq : Sets core_freq, h264_freq, isp_freq, v3d_freq and hevc_freq together
|
||||
# default values :
|
||||
# arm_freq 1200
|
||||
# gpu_freq 400
|
||||
# sdram_freq 450
|
||||
arm_freq=1300
|
||||
gpu_freq=462
|
||||
sdram_freq=500
|
||||
over_voltage=3
|
||||
dtparam=sd_overclock=66
|
||||
# Disable bluetooth
|
||||
dtoverlay=disable-bt
|
||||
#dtoverlay=disable-wifi
|
||||
# Enable DRM VC4 V3D driver
|
||||
dtoverlay=vc4-kms-v3d
|
||||
max_framebuffers=2
|
||||
gpu_mem=64
|
||||
|
||||
# Override OC values for 3+ models
|
||||
[pi3+]
|
||||
# Defaults values :
|
||||
# arm_freq 1400
|
||||
# core_freq 400
|
||||
# gpu_freq 400
|
||||
# sdram_freq 500
|
||||
arm_freq=1500
|
||||
sdram_freq=550
|
||||
|
||||
[pi1]
|
||||
# Defaults values :
|
||||
# arm_freq 700
|
||||
# core_freq 250
|
||||
# sdram_freq 400
|
||||
arm_freq=950
|
||||
core_freq=300
|
||||
sdram_freq=500
|
||||
over_voltage=6
|
||||
gpu_mem=128
|
||||
|
||||
[all]
|
||||
# Forcer HDMI Full HD
|
||||
hdmi_group=1
|
||||
hdmi_mode=16 # fullHD@60
|
||||
# Désactiver le logo éclair et l'arc en ciel au démarrage
|
||||
boot_delay=1
|
||||
avoid_warnings=1
|
||||
|
@ -118,8 +217,7 @@ Lancer la commande `raspi-config`, puis aller dans "1 System Options", "S5 Boot
|
|||
```
|
||||
sudo apt-get update
|
||||
# min
|
||||
sudo apt-get install vlc vlc-plugin-base python3-minimal python3-pip nginx file lua5.2
|
||||
python pip install flask flask-httpauth waitress toml werkzeug
|
||||
sudo apt-get install vlc vlc-plugin-base python3-minimal python3-pip nginx file lua5.2 python pip install flask flask-httpauth waitress toml werkzeug ffmpeg ffmpegthumbnailer
|
||||
# build
|
||||
# sudo apt-get install vlc git dkms firmware-realtek firmware-iwlwifi firmware-ipw2x00 firmware-atheros raspberrypi-kernel-headers build-essential va-driver-all va-driver vdpau-driver-all
|
||||
```
|
||||
|
@ -178,7 +276,7 @@ Description=VLC http service
|
|||
|
||||
[Service]
|
||||
WorkingDirectory=/home/pil/
|
||||
ExecStart=/usr/bin/cvlc --quiet -I http --no-osd --http-password=secret
|
||||
ExecStart=/usr/bin/cvlc --quiet -I http --no-osd --http-password=secret --file-caching=5000
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
|
@ -204,7 +302,8 @@ After=network.target
|
|||
|
||||
[Service]
|
||||
WorkingDirectory=/home/pil/pilpil-client
|
||||
ExecStart=/home/pil/pilpil-client/app.py
|
||||
#ExecStart=/home/pil/pilpil-client/app.py
|
||||
ExecStart=/home/pil/.local/bin/waitress-serve --listen=127.0.0.1:5000 app:app
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
|
@ -279,7 +378,15 @@ puis redémarrer networkmanager :
|
|||
```
|
||||
sudo systemctl restart NetworkManager
|
||||
```
|
||||
|
||||
|
||||
#### Supprimer baux dhcp
|
||||
|
||||
```
|
||||
sudo rm /var/lib/NetworkManager/*.leases
|
||||
```
|
||||
|
||||
`sudo rm /var/lib/NetworkManager/dnsmasq-wlo1.leases`
|
||||
|
||||
### IP fixes des clients
|
||||
|
||||
#### Bail dhcp permanent
|
||||
|
@ -364,27 +471,72 @@ Use `raspi-config` to resize the file system; "Advanced options" > "Expand Files
|
|||
|
||||
## Other :
|
||||
|
||||
### VLC : local jquery and flowplayer libs
|
||||
|
||||
#### Jquery
|
||||
|
||||
Récupérer les librairies jquery sur le system de fichier local dans '/usr/share/vlc/lua/http/js' :
|
||||
|
||||
```
|
||||
sudo mkdir -p /usr/share/vlc/lua/http/js/ajax/libs/jquery/1.6.1/
|
||||
sudo mkdir -p /usr/share/vlc/lua/http/js/ajax/libs/jqueryui/1.8.13/
|
||||
sudo wget -P /usr/share/vlc/lua/http/js/ajax/libs/jquery/1.6.1/ https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js
|
||||
sudo wget -P /usr/share/vlc/lua/http/js/ajax/libs/jqueryui/1.8.13/ https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js
|
||||
```
|
||||
|
||||
Remplacer les liens d'importation dans '/usr/share/vlc/lua/http/index.html', l.40-41 :
|
||||
|
||||
```html
|
||||
<script type="text/javascript" src="./js/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="./js/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
|
||||
```
|
||||
|
||||
#### Flowplayer
|
||||
|
||||
```
|
||||
sudo mkdir -p /usr/share/vlc/lua/http/js/swf
|
||||
sudo wget -P /usr/share/vlc/lua/http/js/ https://releases.flowplayer.org/js/flowplayer-3.2.6.min.js
|
||||
sudo wget -P /usr/share/vlc/lua/http/js/swf https://releases.flowplayer.org/swf/flowplayer-3.2.7.swf
|
||||
```
|
||||
|
||||
Remplacer les liens d'importation dans '/usr/share/vlc/lua/http/index.html', l.211-213 :
|
||||
|
||||
```js
|
||||
$.getScript('./js/flowplayer-3.2.6.min.js', function(data, textStatus){
|
||||
$('#player').empty();
|
||||
flowplayer("player", "./js/swf/flowplayer-3.2.7.swf");
|
||||
```
|
||||
|
||||
### VLC http LUA : ajouter des méthodes
|
||||
|
||||
On modifie le fichier [`httprequests.lua`](https://code.videolan.org/videolan/vlc/-/blob/master/share/lua/intf/modules/httprequests.lua) :
|
||||
`/usr/lib/arm-linux-gnueabihf/vlc/lua/intf/modules/httprequests.lua`
|
||||
|
||||
Pour être sur d'avoir la bonne version, `apt-get source vlc-plugin-base` après avoir décommenter la ligne pour les sources dans `/etc/apt/sources.list`.
|
||||
Pour être sur d'avoir la bonne version, `apt-get source vlc-plugin-base` après avoir décommenté la ligne pour les sources dans `/etc/apt/sources.list`.
|
||||
|
||||
Puis `tar -xvf vlc_3.0.17.4.orig.tar.xz vlc-3.0.17.4/share/lua/intf/modules/httprequests.lua`.
|
||||
|
||||
On compile avec luac en faisant attention à bien utiliser la bonne version de luac ( 5.2 avec VLC-3.0.17.4 au 09-2022 ) :
|
||||
|
||||
```
|
||||
file httprequests.luac
|
||||
file /usr/lib/arm-linux-gnueabihf/vlc/lua/intf/modules/httprequests.luac
|
||||
luac.out: Lua bytecode, version 5.2
|
||||
|
||||
luac -v
|
||||
Lua 5.2 Copyright (C) 1994-2021 Lua.org, PUC-Rio
|
||||
```
|
||||
|
||||
Ajout ligne 131 :
|
||||
* Ajout ligne 131 :
|
||||
|
||||
```lua
|
||||
elseif command == "pl_move" then
|
||||
vlc.playlist.move( id, tonumber(val) )
|
||||
vlc.playlist.move( id, tonumber(val) or -1 )
|
||||
```
|
||||
|
||||
* Compilation :
|
||||
|
||||
```
|
||||
luac -o /usr/lib/arm-linux-gnueabihf/vlc/lua/intf/modules/httprequests.luac vlc-3.0.17.4/share/lua/intf/modules/httprequests.lua
|
||||
```
|
||||
|
||||
[https://salsa.debian.org/multimedia-team/vlc](https://salsa.debian.org/multimedia-team/vlc)
|
||||
|
|
Loading…
Reference in New Issue