beagleboneblack - Package synchronization with opkg -
we're using beaglebone black running angstrom linux , opkg package manager power of our systems. need ensure have consistent , reliable access specific versions of opkg packages. i've set in-house opkg repository. there way sync packages between repositories ? e.g. i'd copy specific packages public / not accessible repositories our internal repository, both speed , reliable access.
after fooling around various packages, etc, found way of cloning (parts of) repository using ubuntu system. here's steps took:
# install apache sudo apt-get install apache2 # install git sudo apt-get install git # download opkg-utils yocto project git clone http://git.yoctoproject.org/git/opkg-utils # build opkg-utils cd opkg-utils && make; cd - # move them common directory mv opkg-utils /usr/local/share\ # add them path echo "path=\"\$path:/usr/local/share/opkg-utils\"" >> /etc/environment # update environment source /etc/environment # create structure of repository mkdir -p /var/www/repositories/opkg/beaglebone # create index 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
on client beaglebone blacks, setup access repository:
echo "src/gz reponame http://myserver/repositories/opkg/beaglebone" > /etc/opkg/rms-feed.conf chmod 666 /etc/opkg/reponame-feed.conf opkg update
on developer machines, time need backup package:
#!/bin/bash ############################################################################### # # bbb_clone_package_to_internal_repo.sh # # description: # clones ipkg / opkg package internal repository server can deployed # beaglebone black clients on demand. can have backups in # event public server becomes temporarily or permanently # inaccessible. # # pre-conditions: # 1) given package file must exist @ path specified. # # post-conditions: # 1) given package file sent internal repository server. # 2) opkg repository indexes updated # # parameters: # -p <file path.opk> : package 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] script copies remote ipkg/opkg file $server server subsequent deployment beaglebone black boards. options: -p <file path.[io]pk> package file deployed -h,? show message eof } while getopts “p:h?” option 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$ ) ]]; echo "the package file must not blank , must have .ipk or .opk suffix" exit $err_invalid_package_file_name fi # retrieve package wget -q "$package_file_path" result="$?" if [[ $result -ne 0 ]]; echo "failed retrieve file $package_file_path result $result" exit $err_package_file_not_accessible fi # deploy package 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 ]]; echo "failed copy file $package_file_name server 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 ]]; echo "failed deploy file $package_file_name in repository result $result" exit $err_failed_to_deploy_package_on_server fi exit 0
Comments
Post a Comment