Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 0 additions & 96 deletions Makefile

This file was deleted.

3 changes: 3 additions & 0 deletions checksums.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# pypy versions and checksums - run ./update_pypy.sh to update
aa3bb92dbb529fa2d4920895b16d67a810b0c709207857d56cfe4a6e3b41e02a pypy2.7-v7.3.20-linux64.tar.bz2
f22a1be607deeaa4f9be6bc63aae09fe4fb5b990d6a23aa4e7c5960dc5d93c96 pypy2.7-v7.3.20-aarch64.tar.bz2
20 changes: 7 additions & 13 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,20 @@ Maintainer: Liraz Siri <liraz@turnkeylinux.org>
Build-Depends:
debhelper (>= 10),
dh-exec,
dh-python2 (>= 4.20201102+turnkey0),
python-all (>= 2.6.6-3~),
libcurl4-openssl-dev,
wget,
tar,
librsync-dev (>= 0.9.6),
libssl-dev,
Standards-Version: 4.0.0
X-Python-Version: >= 2.6

Package: tklbam
Architecture: all
Architecture: any
Depends:
ca-certificates,
${misc:Depends},
gnupg,
ntpdate,
pycurl-wrapper (>= 1.2),
pycurl-wrapper (<< 2.0),
gpg (>= 2.2.12),
${python:Depends},
python-crypto,
python-simplejson,
tklbam-duplicity (>= 0.6.18),
tklbam-python-boto (>= 2.3.0-2turnkey),
tklbam-squid (>= 2.7.STABLE9-2.1turnkey+25),
turnkey-pylib (>= 0.5),
tklbam-squid
Description: TurnKey GNU/Linux Backup and Migration agent
15 changes: 11 additions & 4 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
#! /usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk
progname=$(shell awk '/^Source/ {print $$2}' debian/control)
buildroot=debian/$(progname)

deproot=$(progname)/deproot
tmp=debian/tmp

%:
dh $@ --with python2 --buildsystem=makefile
dh $@

override_dh_auto_build:
./duct-tape-deps.sh

override_dh_auto_install:
dh_auto_install -- prefix=debian/$(DEB_SOURCE)/usr
override_dh_shlibdeps:
override_dh_makeshlibs:
25 changes: 15 additions & 10 deletions debian/tklbam.install
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#!/usr/bin/dh-exec

contrib/example-conf => /etc/tklbam/conf
contrib/example-overrides => /etc/tklbam/overrides
contrib/fixclock-hook => /etc/tklbam/hooks.d/fixclock
contrib/maria-db-changes-hook => /etc/tklbam/hooks.d/maria-db-changes
contrib/cron.sh => /etc/cron.daily/tklbam-backup

contrib/example-hook => /etc/tklbam/hooks.d/example
contrib/example-hook-pre-backup => /etc/tklbam/hooks.d/example-pre-backup
contrib/example-hook-post-restore => /etc/tklbam/hooks.d/example-post-restore
contrib/ez-apt-install.sh => /usr/share/tklbam/contrib/ez-apt-install.sh
# rename files
contrib/example-conf => /etc/tklbam/conf
contrib/example-overrides => /etc/tklbam/overrides
contrib/fixclock-hook => /etc/tklbam/hooks.d/fixclock
contrib/maria-db-changes-hook => /etc/tklbam/hooks.d/maria-db-changes
contrib/cron.sh => /etc/cron.daily/tklbam-backup

contrib/example-hook => /etc/tklbam/hooks.d/example
contrib/example-hook-pre-backup => /etc/tklbam/hooks.d/example-pre-backup
contrib/example-hook-post-restore => /etc/tklbam/hooks.d/example-post-restore
contrib/ez-apt-install.sh => /usr/share/tklbam/contrib/ez-apt-install.sh

# move files/dirs
lib/* /usr/lib/tklbam/

10 changes: 10 additions & 0 deletions debian/tklbam.links
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/usr/lib/tklbam/cmd.py /usr/bin/tklbam
/usr/lib/tklbam/cmd_backup.py /usr/bin/tklbam-backup
/usr/lib/tklbam/cmd_escrow.py /usr/bin/tklbam-escrow
/usr/lib/tklbam/cmd_init.py /usr/bin/tklbam-init
/usr/lib/tklbam/cmd_internal.py /usr/bin/tklbam-internal
/usr/lib/tklbam/cmd_list.py /usr/bin/tklbam-list
/usr/lib/tklbam/cmd_passphrase.py /usr/bin/tklbam-passphrase
/usr/lib/tklbam/cmd_restore.py /usr/bin/tklbam-restore
/usr/lib/tklbam/cmd_restore_rollback.py /usr/bin/tklbam-restore-rollback
/usr/lib/tklbam/cmd_status.py /usr/bin/tklbam-status
6 changes: 6 additions & 0 deletions dep-commit-ids
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
python-crypto:432d70d8c4120643955e877f59522c8b3f248bc7
python-pycurl:44b7871c4daeb6d3298a7be11840c9821798c56a
tklbam-duplicity:c5f4d9a09c4c127ed38720ed1848c04d40bc4612
turnkey-pylib:accf6fb9a26cee6b20c42606498bafef2b5a77cf
tklbam-python-boto:aa3759b09b3a81831270d3627d11a8433f7ebf32
pycurl-wrapper:adde46c337131f01d9f0e96259625e92ccfa37fa
49 changes: 49 additions & 0 deletions duct-tape-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash -eu

BASE_DIR="$PWD"
DEPROOT="$BASE_DIR/lib/deps"
TMP="$BASE_DIR/debian/tmp/tklbam-deps"
HOST_ARCH=$(dpkg --print-architecture)

export LD_LIBRARY_PATH="$DEPROOT/bin"

mkdir -p "$DEPROOT" "$TMP"

pypy_arch=
case $HOST_ARCH in
amd64)
pypy_arch="linux64";;
arm64)
pypy_arch="aarch64";;
*)
echo "ERROR: $HOST_ARCH unsupported" >&2
exit 1;;
esac

read -r pypy_checksum pypy_archive <<< "$( \
sed -n "/pypy2\.7.*$pypy_arch/{s|<*.*>||;p;q;}" "checksums.txt" \
)"

cd "$TMP" || exit 1

wget "https://downloads.python.org/pypy/$pypy_archive"

if [[ $(sha256sum "$pypy_archive") != "$pypy_checksum"*"$pypy_archive" ]]; then
echo "ERROR: $pypy_archive checksum mismatch" >&2
exit 1
fi

echo "unpacking $pypy_archive..."
tar -xf "$pypy_archive" --transform "s|^${pypy_archive%.tar.bz2}/||" -C "$DEPROOT"

while IFS= read -r line; do
pkg="${line%:*}"
commit_id="${line##*:}"

git clone "https://github.com/turnkeylinux/$pkg"
cd "$pkg" || exit 1
git checkout "$commit_id"
"$LD_LIBRARY_PATH/pypy" setup.py build
cd "$TMP" || exit 1
mv "$pkg/build/lib"*/* "$DEPROOT/site-packages"
done < "$BASE_DIR/dep-commit-ids"
6 changes: 3 additions & 3 deletions backup.py → lib/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import stat

import shutil
import simplejson
import json

from paths import Paths

Expand Down Expand Up @@ -73,12 +73,12 @@ def fromfile(cls, path):
if not exists(path):
return None

d = simplejson.load(file(path))
d = json.load(file(path))
return cls(*(d[attr]
for attr in ('profile_id', 'overrides', 'skip_files', 'skip_packages', 'skip_database')))

def tofile(self, path):
simplejson.dump(dict(self), file(path, "w"))
json.dump(dict(self), file(path, "w"))

class Backup:
class Error(Exception):
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 9 additions & 1 deletion cmd.py → lib/cmd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/lib/tklbam/deps/bin/python2
#
# Copyright (c) 2010-2012 Liraz Siri <liraz@turnkeylinux.org>
#
Expand All @@ -21,6 +21,14 @@
Default: $TKLBAM_REGISTRY

"""
import sys
sys.path = [
'',
'/usr/lib/tklbam',
'/usr/lib/tklbam/deps/lib_pypy',
'/usr/lib/tklbam/deps/lib-python/2.7',
'/usr/lib/tklbam/deps/site-packages',
]
from os.path import *
from cliwrapper import CliWrapper

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions registry.py → lib/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import re
from os.path import *
from paths import Paths as _Paths
import simplejson
import json

from datetime import datetime

Expand Down Expand Up @@ -204,12 +204,12 @@ def backup_resume_conf(self, val=UNDEFINED):
return

try:
return BackupSessionConf(simplejson.loads(s))
return BackupSessionConf(json.loads(s))
except:
return

else:
s = simplejson.dumps(val)
s = json.dumps(val)
self._file_str(self.path.backup_resume, s)

backup_resume_conf = property(backup_resume_conf, backup_resume_conf)
Expand Down
4 changes: 2 additions & 2 deletions restore.py → lib/restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import mysql
import pgsql

import simplejson
import json

from temp import TempFile

Expand All @@ -52,7 +52,7 @@ def __init__(self, backup_extract_path, limits=[], rollback=True, simulate=False
if simulate:
rollback = False

self.conf = AttrDict(simplejson.loads(file(self.extras.backup_conf).read())) \
self.conf = AttrDict(json.loads(file(self.extras.backup_conf).read())) \
if exists(self.extras.backup_conf) else None

self.simulate = simulate
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions update-dep-versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash -eu


tmp_file="$(mktemp -d)"

COMMIT_ID_PATH="$(pwd)/dep-commit-ids"

rm -f "$COMMIT_ID_PATH"

cd "$tmp_file"
for pkg in python-crypto python-pycurl tklbam-duplicity turnkey-pylib tklbam-python-boto pycurl-wrapper; do
echo "# getting HEAD commit id for $pkg"
if [[ $pkg == "pycurl-wrapper" ]]; then
commit_id="$(git ls-remote "https://github.com/turnkeylinux/$pkg" | grep refs/heads/python2 | awk '{ print $1 }')"
else
commit_id="$(git ls-remote "https://github.com/turnkeylinux/$pkg" | grep HEAD | awk '{ print $1 }')"
fi
echo "$pkg:$commit_id" >> "$COMMIT_ID_PATH"
done

rm -r "$tmp_file"
28 changes: 28 additions & 0 deletions update_pypy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash -eu

# Run this script to update the version of pypy to be dynamically downloaded
# when building the tklbam deb package. Will always download the latest pypy.

# pypy arch -> debian arch:
# - linux64 = amd64
# - aarch64 = arm64

SUPPORTED_ARCH=(linux64 aarch64)

tmp_file=$(mktemp)

curl --silent https://pypy.org/checksums.html --output "$tmp_file"

echo "# pypy versions and checksums - run ./update_pypy.sh to update" > \
checksums.txt
for arch in "${SUPPORTED_ARCH[@]}"; do
sed -n "/pypy2\.7.*$arch/{s|<*.*>||;p;q;}" "$tmp_file" >> checksums.txt
done
rm -rf "$tmp_file"
if git diff --quiet HEAD -- checksums.txt; then
echo "no update available - checksums.txt unchanged"
else
echo "checksums.txt updated; double check and commit"
# non-zero exit if there's something to do
exit 1
fi