beagleboneblack - 与 opkg 进行包同步

标签 beagleboneblack angstrom-linux opkg

我们使用运行 Angstrom Linux 的 BeagleBone Black 和 opkg 包管理器来为我们的一些系统提供支持。我们需要确保我们能够一致且可靠地访问特定版本的 opkg 软件包。我已经建立了一个内部 opkg 存储库。有什么方法可以在存储库之间同步包吗?例如我想将特定的包从公共(public)/并不总是可访问的存储库复制到我们的内部存储库,以实现速度和可靠的访问。

最佳答案

在尝试了各种软件包等之后,我找到了一种使用 Ubuntu 系统克隆(部分)存储库的方法。这是我采取的步骤:

# Install apache
sudo apt-get install apache2

# Install git
sudo apt-get install git

# Download the opkg-utils from the Yocto Project
git clone http://git.yoctoproject.org/git/opkg-utils

# Build the opkg-utils
cd opkg-utils && make; cd -

# Move them to a common directory
mv opkg-utils /usr/local/share\

# Add them to my path
echo "PATH=\"\$PATH:/usr/local/share/opkg-utils\"" >> /etc/environment

# Update my environment
source /etc/environment

# Create the structure of my repository
mkdir -p /var/www/repositories/opkg/beaglebone

# Create an index for the packages
opkg-make-index -l Packages.filelist -p Packages /var/www/repositories/opkg/beaglebone
cd /var/www/repositories/opkg/beaglebone
gzip -c Packages > Packages.gz

在我的客户端 BeagleBone Blacks 上,设置对此存储库的访问:

echo "src/gz reponame http://myserver/repositories/opkg/beaglebone" > /etc/opkg/rms-feed.conf
chmod 666 /etc/opkg/reponame-feed.conf
opkg update

在我的开发人员计算机上,任何时候我需要备份包:

#!/bin/bash

###############################################################################
#
# bbb_clone_package_to_internal_repo.sh
#
# Description:
# Clones an ipkg / opkg package to the internal repository server so that it can be deployed 
# to BeagleBone Black clients on demand. This is so that we can have backups in
# the event that a public server becomes temporarily or permanently 
# inaccessible.
#
# Pre-conditions:
# 1) The given package file must exist at the path specified. 
#
# Post-conditions:
# 1) The given package file will be sent to the internal repository server.
# 2) The opkg repository indexes will all be updated 
#
# Parameters:
# -p <file path.opk> : The package to be cloned
#
###############################################################################

PACKAGE_FILE_PATH=""
SERVER="myserver"

ERR_INVALID_PACKAGE_FILE_NAME=1
ERR_PACKAGE_FILE_NOT_ACCESSIBLE=2
ERR_FAILED_TO_COPY_PACKAGE_TO_SERVER=3
ERR_FAILED_TO_DEPLOY_PACKAGE_ON_SERVER=4

usage()
{
cat << EOF
usage: $0 [options]

This script copies a remote ipkg/opkg file to the $SERVER server for subsequent
deployment to BeagleBone Black boards.

OPTIONS:
    -p <file path.[io]pk>   The package file to be deployed

    -h,?                    Show this message

EOF
}

while getopts “p:h?” OPTION
do
    case $OPTION in
    p)
        PACKAGE_FILE_PATH="$OPTARG"
        ;;
    h)
        usage
        exit
        ;;
    ?)
        usage
        exit
        ;;
    esac
done

if [[ -z "$PACKAGE_FILE_PATH" || ! ( "$PACKAGE_FILE_PATH" =~ \.[io]pk$ ) ]]; then
    echo "The package file must not be blank and must have an .ipk or .opk suffix"
    exit $ERR_INVALID_PACKAGE_FILE_NAME
fi

# Retrieve the package
wget -q "$PACKAGE_FILE_PATH"
RESULT="$?"
if [[ $RESULT -ne 0 ]]; then
    echo "Failed to retrieve file $PACKAGE_FILE_PATH with result $RESULT"
    exit $ERR_PACKAGE_FILE_NOT_ACCESSIBLE
fi 

# Deploy the package to myserver 

PACKAGE_FILE_NAME="$(basename $PACKAGE_FILE_PATH)"
REPOSITORY_ROOT="/var/www/repositories/opkg/beaglebone"
scp "$PACKAGE_FILE_NAME" root@$SERVER:$REPOSITORY_ROOT
RESULT="$?"
if [[ $RESULT -ne 0 ]]; then

    echo "Failed to copy file $PACKAGE_FILE_NAME to server with result $RESULT"
    exit $ERR_FAILED_TO_COPY_PACKAGE_TO_SERVER
fi 

ssh root@$SERVER "chmod 644 $REPOSITORY_ROOT/$PACKAGE_FILE_NAME; opkg-make-index -l $REPOSITORY_ROOT/Packages.filelist -p $REPOSITORY_ROOT/Packages -r $REPOSITORY_ROOT/Packages $REPOSITORY_ROOT && gzip -c $REPOSITORY_ROOT/Packages > $REPOSITORY_ROOT/Packages.gz"
RESULT="$?"
if [[ $RESULT -ne 0 ]]; then

    echo "Failed to deploy file $PACKAGE_FILE_NAME in repository with result $RESULT"
    exit $ERR_FAILED_TO_DEPLOY_PACKAGE_ON_SERVER
fi 

exit 0

关于beagleboneblack - 与 opkg 进行包同步,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23699822/

相关文章:

ruby - 尝试在 Synology DiskStation DS216j 上安装 Ruby gems,找不到 Ruby 头文件

security - 保护 OPKG 存储库的安全

linux - node.js mplayer fifo 控制

linux - 鼠标和键盘在带有最新埃图像的 beagleboard 的 qemu 仿真中不起作用

beagleboard - BBB - 在启动时自动加载设备树覆盖

startup - 埃启动流程 [beaglebone]

ubuntu - Ubuntu 上 opkg 的 libcurl PKG_CONFIG_PATH 问题

c++ - 如何反转存储在内存地址的位?

linux - 在 beaglebone black 上的 wget 中出现错误的 header 错误

c - UART 比较图表。比格尔骨