我想使用本地终端的命令来备份 openwrt,这很简单,但我的问题在于,当我尝试将备份恢复到本地电脑时,就会出现问题。这是我目前所拥有的,第一部分没问题:
#!/bin/bash
ssh [email protected] sysupgrade --create-backup /tmp/main_backup.tar.gz
使用该命令,我创建了我的路由器的备份,并且我想将该备份 scp 到我的本地电脑。
我想使用本地终端的命令来备份 openwrt,这很简单,但我的问题在于,当我尝试将备份恢复到本地电脑时,就会出现问题。这是我目前所拥有的,第一部分没问题:
#!/bin/bash
ssh [email protected] sysupgrade --create-backup /tmp/main_backup.tar.gz
使用该命令,我创建了我的路由器的备份,并且我想将该备份 scp 到我的本地电脑。
我有 3 个脚本来构建 OpenWrt,但我无法将其设置为最后有时间。这是脚本给出的内容和脚本。
openwrt-snapshot-r22256+29-14334c222e-ipq806x-generic-linksys_ea8500-sysupgrade.bin
但我想要那种随着时间的描述:
openwrt-snapshot-r22256+29-14334c222e-20230310-ipq806x-generic-linksys_ea8500-sysupgrade.bin
剧本:
#!/bin/bash
# createbuildinfo
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source ${SCRIPT_DIR}/shared
STATUSFILE="$BINDIR/$BUILTBASENAME.status"
DIFFFILE="$BINDIR/$BUILTBASENAME.patch"
DIFFCONFIGFILE="$BINDIR/$BUILTBASENAME.diffconfig"
DATE=$(date +%Y%m%d-%H%M)
cd $BUILDROOT
echo "Creating build info for"
echo " $BUILTBASENAME in"
echo " $BINDIR "
getGitInfo() {
#params: directory
echo "###########################################################################"
(cd $1
echo -n "Repo : "
git remote -v show | grep fetch
echo -n "Branch : "
git rev-parse --abbrev-ref HEAD
echo -n "Commit : "
git show --format="%cd %h %s" --abbrev=7 --date=short | head -n 1 | cut -b1-60
echo "Status : "
git status --porcelain
)
}
getGitDiff() {
(cd $1
git --no-pager diff HEAD
)
}
echo "Generating git statusfile $STATUSFILE"
echo "Status for $BUILTBASENAME created $DATE" >$STATUSFILE
echo " " >>$STATUSFILE
getGitInfo $BUILDROOT >>$STATUSFILE
for feed in `cat feeds.conf | grep -v "^#" | awk '{print $2}'`
do
getGitInfo $BUILDROOT/feeds/$feed >>${STATUSFILE}
done
echo "Generating diff file $DIFFFILE"
getGitDiff $BUILDROOT >$DIFFFILE
echo "Generating diffconfile $DIFFCONFIGFILE"
$BUILDROOT/scripts/diffconfig.sh > $DIFFCONFIGFILE
#共享
#!/bin/bash
BRANCH="snapshot"
BUILDROOT="/run/media/james/D/ipq806x_builds/NSS_test/"
BUILTDIR="$BUILDROOT/../builds"
VERSION_NUMBER=$($BUILDROOT/scripts/getver.sh)
VERSION_DIST=$(grep CONFIG_VERSION_DIST $BUILDROOT/.config | awk -F\" '{print $2}')
VERSION_DIST="${VERSION_DIST:=OpenWRT}"
TARGET_PROFILE=$(grep CONFIG_TARGET_PROFILE $BUILDROOT/.config | awk -F\" '{print $2}' | sed 's/DEVICE_//')
TARGET_SUBTARGET=$(grep CONFIG_TARGET_SUBTARGET $BUILDROOT/.config | awk -F\" '{print $2}')
TARGET_BOARD=$(grep CONFIG_TARGET_BOARD $BUILDROOT/.config | awk -F\" '{print $2}')
BUILTBASENAME="${VERSION_DIST}-${BRANCH}-${VERSION_NUMBER}-${TARGET_BOARD}-${TARGET_SUBTARGET}-${TARGET_PROFILE}"
BUILTBASENAME=$(echo $BUILTBASENAME | sed 's/ /-/g' | awk '{print tolower($0)}')
BINDIR="$BUILDROOT/bin/targets/${TARGET_BOARD}/${TARGET_SUBTARGET}"
#createbuild
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source ${SCRIPT_DIR}/shared
echo "#### `date`: Starting build of $VERSION_DIST $VERSION_NUMBER ####"
cd $BUILDROOT
time make -j4 V=s 2>&1 $1 | tee build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
echo -en "\007"
echo "#### `date`: Build failed, bailing out... "
exit 1
fi
echo -en "\007"
echo "#### `date`: Build of $VERSION_DIST $VERSION_NUMBER complete ###"
if [ -z $1 ]; then
${SCRIPT_DIR}/createbuildinfo
echo "#### `date`: Moving completed build to $BUILTDIR/$BUILTBASENAME ####"
mkdir -p $BUILTDIR/$BUILTBASENAME
#mv -v $BINDIR/$BUILTBASENAME* $BUILTDIR/$BUILTBASENAME
mv -v /run/media/james/D/ipq806x_builds/NSS_test/bin/targets/ipq806x/generic/*.bin /run/media/james/D/ipq806x_builds/builds/latest/
rm $BUILTDIR/latest
ln -s $BUILTDIR/$BUILTBASENAME $BUILTDIR/latest
echo "All done! Sysupgrade file can be found in"
echo $BUILTDIR/latest/$BUILTBASENAME-squashfs-sysupgrade.bin
fi
我使用该表格创建我的 ssh 密钥:ssh-keygen -t ed25519 -C "[email protected]"
我得到:加密:aes256-cbc,是否可以改用 [email protected]?谢谢
我已经阅读了 ssh,并且我已将 ssh 与 OpenWrt 一起使用,我在 .ssh 中使用密钥 + 在 .ssh 中使用我的配置文件,但如果我还想将 ssh 服务器用作 localhost,我读到的是我也应该在 .ssh/config 中设置。
我不知道如何使用两者?
你可以帮帮我吗?谢谢你
我尝试添加有关最后一个内核的补丁,但不知道为什么不起作用..想法?谢谢
openwrtt$ patch -p1 < kernel.patch
patching file include/kernel-version.mk
Hunk #1 FAILED at 7.
1 out of 1 hunk FAILED -- saving rejects to file include/kernel-version.mk.rej
patching file target/linux/bcm27xx/patches-5.10/950-0139-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch
patching file target/linux/bcm27xx/patches-5.10/950-0151-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch
patching file target/linux/bcm27xx/patches-5.10/950-0249-kbuild-Disable-gcc-plugins.patch
patching file target/linux/bcm27xx/patches-5.10/950-0323-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch
patching file target/linux/bcm27xx/patches-5.10/950-0657-Documentation-devicetree-Add-documentation-for-imx37.patch
patching file target/linux/bcm27xx/patches-5.10/950-0733-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch
Hunk #1 FAILED at 26.
1 out of 1 hunk FAILED -- saving rejects to file target/linux/bcm27xx/patches-5.10/950-0733-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch.rej
patching file target/linux/generic/backport-5.10/610-v5.13-57-netfilter-flowtable-Set-offload-timeouts-according-t.patch
patching file target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch
patching file target/linux/generic/pending-5.10/834-ledtrig-libata.patch
patching file target/linux/oxnas/patches-5.10/999-libata-hacks.patch
patching file target/linux/realtek/patches-5.10/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch