Skip to content

Commit

Permalink
Fix bananapi build #183 #156
Browse files Browse the repository at this point in the history
  • Loading branch information
guysoft committed Jan 2, 2016
1 parent 2a6d935 commit 8a8307f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ unpack /filesystem/boot /boot
apt-get update

# in case we are building from a regular raspbian image instead of the lite one...
apt-get remove -y --purge scratch squeak-plugins-scratch squeak-vm wolfram-engine python-minecraftpi minecraft-pi sonic-pi oracle-java8-jdk bluej greenfoot libreoffice-common libreoffice-core freepats nodered
remove_extra=""
if [ $( is_installed greenfoot ) -eq 1 ];
then
remove_extra="$remove_extra greenfoot nodered"
fi
apt-get remove -y --purge scratch squeak-plugins-scratch squeak-vm wolfram-engine python-minecraftpi minecraft-pi sonic-pi oracle-java8-jdk bluej libreoffice-common libreoffice-core freepats $remove_extra
apt-get autoremove -y

apt-get -y --force-yes install python2.7 python-virtualenv python-dev git screen libts-bin subversion cmake checkinstall avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev
Expand All @@ -62,14 +67,20 @@ pushd /home/pi
# since that stuff takes ages to compile during build, we do a somewhat dirty
# trick here by installing the raspbian versions, copying the libs over
# to our virtualenv and then purging the raspbian versions again
apt-get -y --force-yes install python-openssl python-cryptography
from=/usr/lib/python2.7/dist-packages
to=/home/pi/oprint/lib/python2.7/site-packages
for pattern in "cffi*" "cryptography*" "OpenSSL*" "ply*" "pycparser*" "pyOpenSSL*" "six*"
do
cp -v -r --preserve=mode,timestamps $from/$pattern $to/
done
apt-get remove -y --purge python-openssl python-cryptography
apt-get -y --force-yes install python-openssl
if [ $( is_in_apt python-cryptography ) -eq 1 ]; then
apt-get -y --force-yes install python-cryptography
from=/usr/lib/python2.7/dist-packages
to=/home/pi/oprint/lib/python2.7/site-packages
for pattern in "cffi*" "cryptography*" "OpenSSL*" "ply*" "pycparser*" "pyOpenSSL*" "six*"
do
cp -v -r --preserve=mode,timestamps $from/$pattern $to/
done
apt-get remove -y --purge python-openssl python-cryptography
else
sudo -u pi /home/pi/oprint/bin/pip install cryptography
apt-get remove -y --purge python-openssl
fi
apt-get autoremove -y
chown -R pi.pi /home/pi/oprint
sudo -u pi /home/pi/oprint/bin/pip install ndg-httpsclient pyasn1
Expand Down
16 changes: 16 additions & 0 deletions src/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -298,3 +298,19 @@ function minimize_ext() {
enlarge_ext $image 2 $((-$size_offset_mb + 1)) # +1 to compensat rounding mistakes
fi
}

function is_installed(){
# checks if a package is installed, returns 1 if installed and 0 if not.
# usage: is_installed <package_name>
dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed"
}

function is_in_apt(){
#checks if a package is in the apt repo, returns 1 if exists and 0 if not
#usage is_in_apt <package_name>
if [ $(apt-cache policy $1 | wc | awk '{print $1}') -gt 0 ]; then
echo 1
else
echo 0
fi
}
1 change: 1 addition & 0 deletions src/variants/bananapi-m1/pre_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ install_chroot_fail_on_error_trap
unpack /filesystem/root /

#cleanup
mkdir -p /var/cache/apt/archives
apt-get clean

0 comments on commit 8a8307f

Please sign in to comment.