Compare commits

..

No commits in common. "main" and "v0.0.3" have entirely different histories.
main ... v0.0.3

7 changed files with 128 additions and 511 deletions

View File

@ -1,260 +0,0 @@
#!/bin/bash
#===============================================================================
# 从SD卡操作eMMC备份脚本
#===============================================================================
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
error_msg() { echo -e "${RED}[ERROR] $1${NC}" >&2; exit 1; }
info_msg() { echo -e "${GREEN}[INFO] $1${NC}"; }
warn_msg() { echo -e "${YELLOW}[WARN] $1${NC}"; }
[[ $EUID -eq 0 ]] || error_msg "需要root权限"
EMMC_DEV="/dev/mmcblk0"
USB_DIR="/mnt/XIN_USB/rock5c"
OUTPUT_FILE="${USB_DIR}/rock5c_emmc_$(date +%Y%m%d_%H%M%S).img"
info_msg "从SD卡备份eMMC (智能压缩版)..."
info_msg "eMMC设备: ${EMMC_DEV}"
info_msg "输出到: ${OUTPUT_FILE}"
# 获取原始eMMC大小
ORIGINAL_SIZE=$(blockdev --getsize64 ${EMMC_DEV})
ORIGINAL_SIZE_GB=$((ORIGINAL_SIZE / 1073741824))
info_msg "原始eMMC大小: ${ORIGINAL_SIZE_GB}GB"
# 检查设备
[[ -b "${EMMC_DEV}" ]] || error_msg "eMMC设备不存在: ${EMMC_DEV}"
[[ -d "${USB_DIR}" ]] || error_msg "USB目录不存在: ${USB_DIR}"
# 检查eMMC没有被挂载
if mount | grep -q mmcblk0; then
error_msg "eMMC还在使用中请确保从SD卡启动"
fi
info_msg "✅ eMMC设备可安全操作"
# 步骤1: 检查eMMC分区信息
info_msg "步骤1: 分析eMMC分区..."
parted -s ${EMMC_DEV} unit MB print
# 检查eMMC上的数据大小
info_msg "检查eMMC数据使用量..."
TEMP_MOUNT="/tmp/check_emmc"
mkdir -p "${TEMP_MOUNT}"
# 检查分区是否存在
[[ -b "${EMMC_DEV}p1" ]] || error_msg "未找到boot分区 ${EMMC_DEV}p1"
[[ -b "${EMMC_DEV}p2" ]] || error_msg "未找到root分区 ${EMMC_DEV}p2"
# 临时挂载检查使用量
mount ${EMMC_DEV}p1 "${TEMP_MOUNT}" -o ro
EMMC_BOOT_USED=$(df --block-size=1M "${TEMP_MOUNT}" | tail -1 | awk '{print $3}')
umount "${TEMP_MOUNT}"
mount ${EMMC_DEV}p2 "${TEMP_MOUNT}" -o ro
EMMC_ROOT_USED=$(df --block-size=1M "${TEMP_MOUNT}" | tail -1 | awk '{print $3}')
umount "${TEMP_MOUNT}"
rm -rf "${TEMP_MOUNT}"
TOTAL_USED=$((EMMC_BOOT_USED + EMMC_ROOT_USED))
info_msg "eMMC使用情况: Boot ${EMMC_BOOT_USED}MB + Root ${EMMC_ROOT_USED}MB = 总计 ${TOTAL_USED}MB"
MIN_TARGET_SIZE=$((TOTAL_USED + 1024)) # 需要1GB额外空间
info_msg "最小目标eMMC: ${MIN_TARGET_SIZE}MB (约$((MIN_TARGET_SIZE / 1024))GB)"
# 步骤2: 智能收缩eMMC分区
info_msg "步骤2: 智能收缩eMMC分区..."
# 记录原始分区信息
parted -s ${EMMC_DEV} unit s print > "${USB_DIR}/original_partition.txt"
P1_START=$(parted -s ${EMMC_DEV} unit s print | grep "^ 1" | awk '{print $2}' | sed 's/s$//')
P1_END=$(parted -s ${EMMC_DEV} unit s print | grep "^ 1" | awk '{print $3}' | sed 's/s$//')
P2_START=$(parted -s ${EMMC_DEV} unit s print | grep "^ 2" | awk '{print $2}' | sed 's/s$//')
ORIGINAL_P2_END=$(parted -s ${EMMC_DEV} unit s print | grep "^ 2" | awk '{print $3}' | sed 's/s$//')
info_msg "分区布局: P1=${P1_START}s-${P1_END}s, P2=${P2_START}s-${ORIGINAL_P2_END}s"
# 文件系统检查
e2fsck -f -y ${EMMC_DEV}p2
# 先尝试收缩到最小值
info_msg "计算文件系统最小大小..."
resize2fs -M ${EMMC_DEV}p2 2>&1 | tee /tmp/resize.log
# 获取收缩后的实际大小
FS_SIZE_BLOCKS=$(dumpe2fs -h ${EMMC_DEV}p2 2>/dev/null | grep "^Block count:" | awk '{print $3}')
BLOCK_SIZE=$(dumpe2fs -h ${EMMC_DEV}p2 2>/dev/null | grep "^Block size:" | awk '{print $3}')
# 添加默认值防止空值
[[ -z "$FS_SIZE_BLOCKS" ]] && FS_SIZE_BLOCKS=1048576 # 默认4GB worth of blocks
[[ -z "$BLOCK_SIZE" ]] && BLOCK_SIZE=4096 # 默认4K
FS_SIZE_MB=$(( (FS_SIZE_BLOCKS * BLOCK_SIZE) / 1048576 ))
info_msg "文件系统最小大小: ${FS_SIZE_MB}MB"
# 添加缓冲空间确保系统能正常运行
SHRINK_TARGET=$((FS_SIZE_MB + 512)) # 512MB缓冲
resize2fs ${EMMC_DEV}p2 ${SHRINK_TARGET}M
# 计算新的分区结束位置(扇区)
NEW_P2_END_SECTORS=$((P2_START + (SHRINK_TARGET * 1048576 / 512)))
# 重新创建收缩的分区
parted -s ${EMMC_DEV} rm 2
parted -s ${EMMC_DEV} unit s mkpart primary ext4 ${P2_START}s ${NEW_P2_END_SECTORS}s
partprobe ${EMMC_DEV}
sleep 2
info_msg "✅ eMMC分区已收缩到 ${SHRINK_TARGET}MB"
# 步骤3: 创建备份信息文件
info_msg "步骤3: 创建备份信息..."
cat > "${OUTPUT_FILE}.info" <<EOF
#!/bin/bash
# 备份信息文件 - 用于智能恢复
BACKUP_DATE="$(date)"
SOURCE_SIZE_GB=${ORIGINAL_SIZE_GB}
DATA_USED_MB=${TOTAL_USED}
MIN_TARGET_SIZE_MB=${MIN_TARGET_SIZE}
# 分区信息
P1_START=${P1_START}
P1_END=${P1_END}
P2_START=${P2_START}
P2_SHRUNK_END=${NEW_P2_END_SECTORS}
ORIGINAL_P2_END=${ORIGINAL_P2_END}
EOF
# 步骤4: 备份收缩后的eMMC
info_msg "步骤4: 备份收缩后的eMMC..."
# 确保包含完整的GPT备份表通常在磁盘末尾
# GPT需要首尾各34个扇区再加一些缓冲
BACKUP_SIZE_SECTORS=$((NEW_P2_END_SECTORS + 34 + 2048)) # 34扇区GPT + 1MB额外缓冲
BACKUP_SIZE_MB=$((BACKUP_SIZE_SECTORS * 512 / 1048576))
info_msg "备份大小: ${BACKUP_SIZE_MB}MB (原始: ${ORIGINAL_SIZE_GB}GB, 可恢复到: ≥${MIN_TARGET_SIZE}MB)"
dd if=${EMMC_DEV} of="${OUTPUT_FILE}" bs=512 count=${BACKUP_SIZE_SECTORS} status=progress
# 修复GPT备份表
info_msg "修复备份镜像的GPT表..."
sgdisk -e "${OUTPUT_FILE}" 2>/dev/null || true
info_msg "✅ eMMC备份完成"
# 步骤5: 恢复eMMC原始大小
info_msg "步骤5: 恢复eMMC原始分区大小..."
parted -s ${EMMC_DEV} rm 2
parted -s ${EMMC_DEV} unit s mkpart primary ext4 ${P2_START}s ${ORIGINAL_P2_END}s
partprobe ${EMMC_DEV}
sleep 2
resize2fs ${EMMC_DEV}p2
info_msg "✅ eMMC已恢复原始大小 ${ORIGINAL_SIZE_GB}GB"
# 验证备份镜像
info_msg "步骤6: 验证备份镜像..."
LOOP_DEV=$(losetup -P -f --show "${OUTPUT_FILE}")
sleep 3
if [[ -b "${LOOP_DEV}p1" ]] && [[ -b "${LOOP_DEV}p2" ]]; then
info_msg "✅ 备份镜像分区表完整"
parted -s "${LOOP_DEV}" print
# 检查文件系统
e2fsck -n "${LOOP_DEV}p1" && echo "✅ Boot分区文件系统正常"
e2fsck -n "${LOOP_DEV}p2" && echo "✅ Root分区文件系统正常"
else
warn_msg "❌ 备份镜像分区表有问题"
fi
losetup -d "${LOOP_DEV}"
FINAL_SIZE=$(du -h "${OUTPUT_FILE}" | cut -f1)
FINAL_SIZE_ACTUAL=$(du --apparent-size -h "${OUTPUT_FILE}" | cut -f1)
# 创建智能恢复脚本
RESTORE_SCRIPT="${USB_DIR}/restore_adaptive.sh"
cat > "${RESTORE_SCRIPT}" <<'RESTORE_EOF'
#!/bin/bash
# 自适应恢复脚本 - 支持不同大小的eMMC
set -e
IMAGE_FILE="$1"
TARGET_DEV="/dev/mmcblk0"
[[ -f "${IMAGE_FILE}" ]] || { echo "用法: $0 <镜像文件>"; exit 1; }
[[ -f "${IMAGE_FILE}.info" ]] || { echo "缺少信息文件"; exit 1; }
source "${IMAGE_FILE}.info"
echo "恢复镜像到eMMC"
echo "目标设备: ${TARGET_DEV}"
TARGET_SIZE=$(blockdev --getsize64 ${TARGET_DEV})
TARGET_SIZE_MB=$((TARGET_SIZE / 1048576))
echo "目标eMMC: $((TARGET_SIZE / 1073741824))GB"
if [[ ${TARGET_SIZE_MB} -lt ${MIN_TARGET_SIZE_MB} ]]; then
echo "错误: 目标eMMC太小需要至少 ${MIN_TARGET_SIZE_MB}MB"
exit 1
fi
echo "警告: 将清空 ${TARGET_DEV}!"
read -p "继续? (yes): " confirm
[[ "$confirm" == "yes" ]] || exit 1
echo "写入镜像..."
dd if="${IMAGE_FILE}" of=${TARGET_DEV} bs=4M status=progress
sync
partprobe ${TARGET_DEV}
sleep 3
# 扩展分区到最大
MAX_P2_END=$((TARGET_SIZE / 512 - 34))
parted -s ${TARGET_DEV} rm 2
parted -s ${TARGET_DEV} unit s mkpart primary ext4 ${P2_START}s ${MAX_P2_END}s
partprobe ${TARGET_DEV}
sleep 2
e2fsck -f -y ${TARGET_DEV}p2
resize2fs ${TARGET_DEV}p2
echo "✅ 恢复完成! 分区已扩展到最大空间"
RESTORE_EOF
chmod +x "${RESTORE_SCRIPT}"
info_msg "========================================="
info_msg "🎉 智能eMMC备份成功完成!"
info_msg "========================================="
info_msg "📁 备份文件: ${OUTPUT_FILE}"
info_msg "📏 备份大小: ${FINAL_SIZE}"
info_msg "📄 信息文件: ${OUTPUT_FILE}.info"
info_msg "🔧 恢复脚本: ${RESTORE_SCRIPT}"
info_msg ""
info_msg "源eMMC: ${ORIGINAL_SIZE_GB}GB"
info_msg "数据使用: ${TOTAL_USED}MB"
info_msg "最小目标: ${MIN_TARGET_SIZE}MB (约$((MIN_TARGET_SIZE / 1024))GB)"
info_msg ""
info_msg "🚀 恢复方法:"
info_msg " 1. 从SD卡启动目标设备"
info_msg " 2. 运行: bash ${RESTORE_SCRIPT} ${OUTPUT_FILE}"
info_msg ""
info_msg "✅ 支持恢复到任意大小eMMC (≥${MIN_TARGET_SIZE}MB)"
info_msg "✅ 自动扩展分区到最大可用空间"
info_msg "✅ 保持双分区结构不变"
info_msg "========================================="

View File

@ -1 +1 @@
http://xplayer-ota.pureroad.cn/files_20251203_232832.tar.xz
http://xplayer-ota.pureroad.cn/files_20250808_090231.tar.xz

View File

@ -1,3 +1,3 @@
apt-get update -y
apt-get install ansible-core -y
./ota
ansible-playbook playbooks/site.yml -e force_update=true

2
ota
View File

@ -22,4 +22,4 @@ if [ -f "files_download.txt" ]; then
done < files_download.txt
fi
ansible-playbook playbooks/site.yml -e force_update=true
ansible-playbook playbooks/site.yml

View File

@ -2,76 +2,7 @@
hosts: localhost
become: yes
vars:
packages: "bluez \
mpc \
libasound2-dev \
libudev-dev \
libfmt-dev \
libfmt9 \
libchromaprint1 \
libupnp17 \
libnfs14 \
libavutil58 \
libavformat60 \
libavcodec60 \
libcdio-paranoia2 \
libcdio-cdda2 \
libcdio19 \
libmms0 \
libsoxr0 \
libid3tag0 \
libiso9660-11 \
libzzip-0-13 \
libao4 \
libjack-jackd2-0 \
libpipewire-0.3-0 \
libpulse0 \
libshout3 \
libsndio7.0 \
libopenal1 \
libavahi-common3 \
libavahi-client3 \
libadplug-2.3.3-0 \
libflac12 \
libfluidsynth3 \
libaudiofile1 \
libfaad2 \
libgme0 \
libmad0 \
libmikmod3 \
libmodplug1 \
libmpcdec6 \
libmpg123-0 \
libopus0 \
libsndfile1 \
libogg0 \
libvorbis0a \
libwavpack1 \
libwildmidi2 \
libvorbisenc2 \
libmp3lame0 \
libtwolame0 \
libshine3 \
net-tools \
libconfig9 \
avahi-daemon
libdbus-1-3 \
libglib2.0-0 \
libbluetooth3 \
libsbc1 \
libfdk-aac2 \
libldacbt-abr2 \
libldacbt-enc2 \
aria2 \
cloud-guest-utils"
tasks:
- name: update script
shell:
cmd: |
/usr/bin/install_bluealsa_openaptx.sh
ignore_errors: yes
- name: switch mirror
copy:
@ -80,73 +11,76 @@
mode: '0644'
tags: apt
- name: check missing packages
shell:
cmd: |
MISSING=""
for pkg in {{ packages }}; do
# 先检查原包名
if dpkg-query -W -f='${Status}' "$pkg" 2>/dev/null | grep -q "install ok installed"; then
continue
# 如果原包名不存在,尝试检查带 t64 后缀的版本
elif dpkg-query -W -f='${Status}' "${pkg}t64" 2>/dev/null | grep -q "install ok installed"; then
continue
else
MISSING="yes"
break
fi
done
if [ -n "$MISSING" ]; then
echo "missing"
else
echo "all_installed"
fi
args:
executable: /bin/bash
register: package_check
changed_when: false
ignore_errors: yes
tags: apt
- name: update apt cache
shell:
cmd: |
if command -v apt-fast &> /dev/null; then
apt-fast update -y || apt-get update -y
else
apt-get update -y
fi
when: package_check.stdout == "missing"
ignore_errors: yes
- name: Update apt cache
apt:
update_cache: yes
cache_valid_time: 3600
become: yes
tags: apt
- name: install dependencies
shell:
cmd: |
if command -v apt-fast &> /dev/null; then
apt-fast install -y {{ packages }} || apt-get install -y {{ packages }}
else
apt-get install -y {{ packages }}
fi
when: package_check.stdout == "missing"
ignore_errors: yes
apt:
name:
- bluez
- mpc
- libasound2-dev
- libudev-dev
- libfmt-dev
- libfmt9
- libchromaprint1
- libupnp17
- libnfs14
- libavutil58
- libavformat60
- libavcodec60
- libcdio-paranoia2
- libcdio-cdda2
- libcdio19
- libmms0
- libsoxr0
- libid3tag0
- libiso9660-11
- libzzip-0-13
- libao4
- libjack-jackd2-0
- libpipewire-0.3-0
- libpulse0
- libshout3
- libsndio7.0
- libopenal1
- libavahi-common3
- libavahi-client3
- libadplug-2.3.3-0
- libflac12
- libfluidsynth3
- libaudiofile1
- libfaad2
- libgme0
- libmad0
- libmikmod3
- libmodplug1
- libmpcdec6
- libmpg123-0
- libopus0
- libsndfile1
- libogg0
- libvorbis0a
- libwavpack1
- libwildmidi2
- libvorbisenc2
- libmp3lame0
- libtwolame0
- libshine3
- libmp3lame0
- libtwolame0
- net-tools
- libconfig9
- avahi-daemon
# - upmpdcli
state: present
become: yes
tags: apt
- name: Create directories
file:
path: "{{ item.path }}"
state: directory
mode: "{{ item.mode | default('0755') }}"
recurse: yes
loop:
- path: /var/lib/mpd/playlists
- path: /var/lib/mpd/music
- path: /usr/local/lib/systemd/system
- path: /srv/login
- path: /usr/var/lib/bluealsa
- path: /srv/bluez-alsa
- name: Copy static files
copy:
src: "{{ item.src }}"
@ -155,8 +89,8 @@
loop:
- src: ../files/modules
dest: /etc/modules
- src: ../files/login/
dest: /srv/login/
- src: ../files/login
dest: /srv/
- src: ../files/sshd_config
dest: /etc/ssh/sshd_config
mode: '0600'
@ -177,18 +111,16 @@
- src: ../files/cpufrequtils
dest: /etc/default/cpufrequtils
mode: '0644'
- src: ../files/led-startup.sh
dest: /usr/bin/led-startup.sh
mode: '0755'
- src: ../files/xplayer-start.sh
dest: /usr/local/bin/xplayer-start.sh
mode: '0755'
- src: ../files/apt-fast
dest: /usr/local/bin/apt-fast
mode: '0755'
- src: ../files/apt-fast.conf
dest: /etc/apt-fast.conf
mode: '0644'
- name: Create directories
file:
path: "{{ item.path }}"
state: directory
mode: "{{ item.mode | default('0755') }}"
loop:
- path: /var/lib/mpd/playlists
- path: /var/lib/mpd/music
- path: /usr/local/lib/systemd/system
- name: update mpd data
copy:
@ -235,29 +167,6 @@
register: copy_result
changed_when: copy_result.changed or (force_update | default(false) | bool)
- name: update bluealsa
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "{{ item.mode | default('0644') }}"
loop:
- src: ../files/bluealsa.service
dest: /etc/systemd/system/bluealsa.service
- src: ../files/install_bluealsa_openaptx.sh
dest: /usr/bin/install_bluealsa_openaptx.sh
mode: '0755'
- src: ../files/bluealsa_bundle.tar.gz
dest: /srv/bluez-alsa/bluealsa_bundle.tar.gz
tags: bluealsa
notify:
- install_bluealsa_openaptx
- reload_systemd
- enable_bluealsa
- stop_bluealsa
- start_bluealsa
register: copy_result
changed_when: copy_result.changed or (force_update | default(false) | bool)
- name: update camilladsp
copy:
src: "{{ item.src }}"
@ -266,8 +175,8 @@
loop:
- src: ../files/camilladsp.service
dest: /etc/systemd/system/camilladsp.service
- src: ../files/camilladsp.yml
dest: /etc/camilladsp.yml
- src: ../files/camilladsp-conf
dest: /root/
- src: ../files/camilladsp
dest: /usr/local/bin/camilladsp
mode: '0755'
@ -299,7 +208,6 @@
mode: '0755'
- src: ../files/99-usb-auto-mount.rules
dest: /etc/udev/rules.d/99-usb-auto-mount.rules
mode: '0644'
tags: usb
notify:
@ -456,34 +364,6 @@
- name: restart_shairport_sync
shell:
cmd: systemctl restart shairport-sync
- name: enable_sing-box
shell:
cmd: systemctl enable sing-box
- name: start_sing-box
shell:
cmd: systemctl start sing-box
- name: restart_sing-box
shell:
cmd: systemctl restart sing-box
- name: install_bluealsa_openaptx
shell:
cmd: /usr/bin/install_bluealsa_openaptx.sh
- name: enable_bluealsa
shell:
cmd: systemctl enable bluealsa
- name: stop_bluealsa
shell:
cmd: systemctl stop bluealsa
- name: start_bluealsa
shell:
cmd: systemctl start bluealsa
- name: restart_bluealsa
shell:
cmd: systemctl restart bluealsa
- name: enable_xplayer_server
shell:
@ -499,7 +379,16 @@
- name: reboot_required
shell:
cmd: sync && reboot
cmd: echo "need reboot"
- name: enable_sing-box
shell:
cmd: systemctl enable sing-box
- name: start_sing-box
shell:
cmd: systemctl start sing-box
- name: restart_sing-box
shell:
cmd: systemctl restart sing-box

74
sync.sh
View File

@ -1,45 +1,33 @@
mkdir -p files
rsync 5c:/etc/ssh/sshd_config files/sshd_config
rsync 5c:/root/.ssh/authorized_keys files/authorized_keys
rsync 5c:/etc/asound.conf files/asound.conf
rsync 5c:/usr/local/bin/camilladsp files/camilladsp
rsync 5c:/etc/camilladsp.yml files/camilladsp.yml
# rsync -avz 5c:/root/camilladsp-conf files/
rsync 5c:/usr/local/lib/systemd/system/mpd.socket files/mpd.socket
rsync 5c:/usr/local/lib/systemd/system/mpd.service files/mpd.service
rsync 5c:/usr/local/bin/mpd files/mpd
rsync 5c:/etc/mpd.conf files/mpd.conf
rsync 5c:/etc/systemd/system/xplayer-server.service files/xplayer-server.service
rsync 5c:/usr/local/bin/server files/server
rsync 5c:/usr/bin/ota files/ota
rsync -avz 5c:/etc/apt/sources.list.d ./files/
rsync 5c:/etc/modules files/modules
rsync 5c:/etc/modprobe.d/snd-aloop.conf files/snd-aloop.conf
rsync 5c:/etc/systemd/system/camilladsp.service files/camilladsp.service
rsync 5c:/usr/lib/systemd/system/bluetooth.service files/bluetooth.service
rsync 5c:/etc/udev/rules.d/99-usb-auto-mount.rules files/99-usb-auto-mount.rules
rsync 5c:/usr/local/bin/usb-mount.sh files/usb-mount.sh
rsync 5c:/etc/custom_service/start_service.sh files/start_service.sh
rsync 5c:/etc/bluetooth/input.conf files/input.conf
rsync 5c:/etc/bluetooth/main.conf files/main.conf
rsync 5c:/etc/default/cpufrequtils files/cpufrequtils
rsync 5c:/usr/lib/systemd/system/shairport-sync.service files/shairport-sync.service
rsync 5c:/usr/local/bin/shairport-sync files/shairport-sync
rsync 5c:/etc/shairport-sync.conf files/shairport-sync.conf
rsync 5c:/usr/bin/shairport_monitor.sh files/shairport_monitor.sh
# rsync 5c:/etc/upmpdcli.conf files/upmpdcli.conf
rsync 5c:/usr/bin/sing-box files/sing-box
rsync 5c:/etc/systemd/system/sing-box.service files/sing-box.service
rsync -avz --exclude='login/' 5c:/srv/login/ files/login/
rsync 5c:/usr/bin/led-startup.sh files/led-startup.sh
rsync 5c:/usr/local/bin/xplayer-start.sh files/xplayer-start.sh
rsync 5c:/usr/bin/install_bluealsa_openaptx.sh files/install_bluealsa_openaptx.sh
rsync 5c:/etc/systemd/system/bluealsa.service files/bluealsa.service
rsync 5c:/srv/bluez-alsa/bluealsa_bundle.tar.gz files/bluealsa_bundle.tar.gz
rsync 5c:/usr/local/bin/apt-fast files/apt-fast
rsync 5c:/etc/apt-fast.conf files/apt-fast.conf
# Clean up macOS resource fork files
find files -name "._*" -type f -delete
rsync am60:/etc/ssh/sshd_config files/sshd_config
rsync am60:/root/.ssh/authorized_keys files/authorized_keys
rsync am60:/etc/asound.conf files/asound.conf
rsync am60:/usr/local/bin/camilladsp files/camilladsp
rsync -avz am60:/root/camilladsp-conf files/
rsync am60:/usr/local/lib/systemd/system/mpd.socket files/mpd.socket
rsync am60:/usr/local/lib/systemd/system/mpd.service files/mpd.service
rsync am60:/usr/local/bin/mpd files/mpd
rsync am60:/etc/mpd.conf files/mpd.conf
rsync am60:/etc/systemd/system/xplayer-server.service files/xplayer-server.service
rsync am60:/usr/local/bin/server files/server
rsync am60:/usr/bin/ota files/ota
rsync -avz am60:/etc/apt/sources.list.d ./files/
rsync am60:/etc/modules files/modules
rsync am60:/etc/modprobe.d/snd-aloop.conf files/snd-aloop.conf
rsync am60:/etc/systemd/system/camilladsp.service files/camilladsp.service
rsync am60:/usr/lib/systemd/system/bluetooth.service files/bluetooth.service
rsync am60:/etc/udev/rules.d/99-usb-auto-mount.rules files/99-usb-auto-mount.rules
rsync am60:/usr/local/bin/usb-mount.sh files/usb-mount.sh
rsync am60:/etc/custom_service/start_service.sh files/start_service.sh
rsync am60:/etc/bluetooth/input.conf files/input.conf
rsync am60:/etc/bluetooth/main.conf files/main.conf
rsync am60:/etc/default/cpufrequtils files/cpufrequtils
rsync am60:/usr/lib/systemd/system/shairport-sync.service files/shairport-sync.service
rsync am60:/usr/local/bin/shairport-sync files/shairport-sync
rsync am60:/etc/shairport-sync.conf files/shairport-sync.conf
rsync am60:/usr/bin/shairport_monitor.sh files/shairport_monitor.sh
rsync am60:/etc/upmpdcli.conf files/upmpdcli.conf
rsync am60:/usr/bin/sing-box files/sing-box
rsync am60:/etc/systemd/system/sing-box.service files/sing-box.service
rsync -avz am60:/srv/login files/login
echo "done"

View File

@ -44,7 +44,7 @@ generate_upload_token() {
local put_policy="{\"scope\":\"${scope}\",\"deadline\":${deadline}}"
# Base64编码上传策略按照七牛云官方文档先base64再替换+/为-_policy需要去掉=
local encoded_put_policy=$(echo -n "$put_policy" | base64 | tr '+/' '-_')
local encoded_put_policy=$(echo -n "$put_policy" | base64 | tr '+/' '-_' | tr -d '=')
# 使用HMAC-SHA1签名对编码后的策略进行签名
# 注意签名的base64编码不去掉=号!