Skip to content

Instantly share code, notes, and snippets.

@yuga
Created August 12, 2014 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuga/e6258a2f879b9f22fc20 to your computer and use it in GitHub Desktop.
Save yuga/e6258a2f879b9f22fc20 to your computer and use it in GitHub Desktop.
cowbuilderのバッドノウハウ集
#!/bin/bash
PRG=$(readlink -f "$0")
PRGDIR=$(dirname "${PRG}")
set -x
set -e
list=(
haskell-names-th_0.0.1.0.dsc
haskell-sql-words_0.0.1.0.dsc
haskell-hdbc-session_0.0.1.0.dsc
haskell-persistable-record_0.0.1.0.dsc
haskell-relational-query_0.0.1.0.dsc
haskell-relational-schemas_0.0.1.0.dsc
haskell-relational-query-hdbc_0.0.1.0.dsc
)
sudo rm -rf /var/cache/pbuilder/multidist/sid
sudo cowbuilder-md --archlist=amd64 --distlist=sid --create
cat > rc <<EOS
# pbuilderrc file
# Location of the dir where you keep pbuilder hook scripts.
HOOKDIR=${PRGDIR}/hooks
# Path to your local repo to be used as a mirror written as apt source line.
OTHERMIRROR="deb [trusted=yes] file://${PRGDIR}/repo ./"
#OTHERMIRROR="deb file://${PRGDIR}/repo ./"
# Path to your local repo. Thi tells pbuilder to mount this directory so it is available in the chroot.
BINDMOUNTS="${PRGDIR}/repo"
# As we need to have the apt-ftparchive command, we need to insure this package is installed.
EXTRAPACKAGES="apt-utils"
EOS
rm -rf repo hooks
mkdir repo hooks
cp repo-saved/*.deb repo ||:
pushd repo
apt-ftparchive packages . > Packages
chmod 664 Packages
popd
sudo cp rc /root/.pbuilderrc
sudo cowbuilder-md --archlist=amd64 --distlist=sid --update --config rc
sudo rm /root/.pbuilderrc
cat > hooks/D05update-local-repo <<EOS
#!/bin/sh
# update-local-repo
# Path to the local repo.
LOCAL_REPO=${PRGDIR}/repo
# Generate a Packages file.
(cd \$LOCAL_REPO ; apt-ftparchive packages . > Packages)
# Update to include any new packages n the local repo.
apt-get update
EOS
chmod 775 hooks/D05update-local-repo
for pkg in "${list[@]}"; do
echo "${pkg}"
sudo cowbuilder-md --archlist=amd64 --distlist=sid --build "${pkg}" --config rc
cp /var/cache/pbuilder/multidist/sid/result/*.deb repo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment