2021-12-04 21:07:57 -08:00
|
|
|
#!/usr/bin/bash
|
|
|
|
|
|
|
|
|
|
set -e
|
2020-07-25 02:12:19 -07:00
|
|
|
|
2021-07-04 20:26:38 -07:00
|
|
|
if [ -z "$SOURCE_DIR" ]; then
|
|
|
|
|
echo "SOURCE_DIR must be set"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2020-07-25 02:12:19 -07:00
|
|
|
|
|
|
|
|
if [ -z "$GIT_COMMIT" ]; then
|
|
|
|
|
echo "GIT_COMMIT must be set"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -z "$TEST_DIR" ]; then
|
|
|
|
|
echo "TEST_DIR must be set"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2021-07-12 17:32:12 -07:00
|
|
|
umount /data/safe_staging/merged/ || true
|
|
|
|
|
sudo umount /data/safe_staging/merged/ || true
|
2022-05-12 19:38:58 -07:00
|
|
|
rm -rf /data/safe_staging/* || true
|
2021-07-12 17:32:12 -07:00
|
|
|
|
2022-07-19 13:37:03 -07:00
|
|
|
CONTINUE_PATH="/data/continue.sh"
|
2021-12-04 21:07:57 -08:00
|
|
|
tee $CONTINUE_PATH << EOF
|
|
|
|
|
#!/usr/bin/bash
|
|
|
|
|
|
2022-06-21 19:26:20 -07:00
|
|
|
sudo abctl --set_success
|
|
|
|
|
|
2022-07-19 13:37:03 -07:00
|
|
|
# patch sshd config
|
|
|
|
|
sudo mount -o rw,remount /
|
2022-11-21 21:18:35 -08:00
|
|
|
echo tici-$(cat /proc/cmdline | sed -e 's/^.*androidboot.serialno=//' -e 's/ .*$//') | sudo tee /etc/hostname
|
2022-07-19 13:37:03 -07:00
|
|
|
sudo sed -i "s,/data/params/d/GithubSshKeys,/usr/comma/setup_keys," /etc/ssh/sshd_config
|
|
|
|
|
sudo systemctl daemon-reload
|
|
|
|
|
sudo systemctl restart ssh
|
2023-06-22 14:21:11 -07:00
|
|
|
sudo systemctl restart NetworkManager
|
2022-07-19 13:37:03 -07:00
|
|
|
sudo systemctl disable ssh-param-watcher.path
|
|
|
|
|
sudo systemctl disable ssh-param-watcher.service
|
|
|
|
|
sudo mount -o ro,remount /
|
|
|
|
|
|
2021-12-04 21:07:57 -08:00
|
|
|
while true; do
|
2022-04-18 17:55:23 -07:00
|
|
|
if ! sudo systemctl is-active -q ssh; then
|
|
|
|
|
sudo systemctl start ssh
|
2022-03-07 15:57:18 -08:00
|
|
|
fi
|
2022-07-19 13:37:03 -07:00
|
|
|
sleep 5s
|
2021-12-04 21:07:57 -08:00
|
|
|
done
|
|
|
|
|
|
|
|
|
|
sleep infinity
|
|
|
|
|
EOF
|
|
|
|
|
chmod +x $CONTINUE_PATH
|
|
|
|
|
|
2020-07-25 02:12:19 -07:00
|
|
|
# set up environment
|
2021-12-04 21:07:57 -08:00
|
|
|
if [ ! -d "$SOURCE_DIR" ]; then
|
|
|
|
|
git clone https://github.com/commaai/openpilot.git $SOURCE_DIR
|
|
|
|
|
fi
|
2020-07-25 02:12:19 -07:00
|
|
|
cd $SOURCE_DIR
|
2021-12-04 21:07:57 -08:00
|
|
|
|
|
|
|
|
rm -f .git/index.lock
|
2021-07-19 14:44:16 -07:00
|
|
|
git reset --hard
|
2023-01-10 16:20:27 -08:00
|
|
|
git fetch --no-tags --no-recurse-submodules -j4 --verbose --depth 1 origin $GIT_COMMIT
|
2022-05-12 22:08:04 -07:00
|
|
|
find . -maxdepth 1 -not -path './.git' -not -name '.' -not -name '..' -exec rm -rf '{}' \;
|
2020-07-25 02:12:19 -07:00
|
|
|
git reset --hard $GIT_COMMIT
|
|
|
|
|
git checkout $GIT_COMMIT
|
2022-09-28 16:33:42 -07:00
|
|
|
git clean -xdff
|
2022-10-21 13:11:50 -07:00
|
|
|
git submodule sync
|
2021-01-23 18:34:18 -08:00
|
|
|
git submodule update --init --recursive
|
2022-09-28 16:33:42 -07:00
|
|
|
git submodule foreach --recursive "git reset --hard && git clean -xdff"
|
2021-07-02 16:29:57 -07:00
|
|
|
|
2022-05-12 22:08:04 -07:00
|
|
|
git lfs pull
|
|
|
|
|
(ulimit -n 65535 && git lfs prune)
|
2022-05-12 19:38:58 -07:00
|
|
|
|
2021-07-02 16:29:57 -07:00
|
|
|
echo "git checkout done, t=$SECONDS"
|
2023-01-10 16:20:27 -08:00
|
|
|
du -hs $SOURCE_DIR $SOURCE_DIR/.git
|
2020-07-25 02:12:19 -07:00
|
|
|
|
|
|
|
|
rsync -a --delete $SOURCE_DIR $TEST_DIR
|
|
|
|
|
|
2021-07-02 16:29:57 -07:00
|
|
|
echo "$TEST_DIR synced with $GIT_COMMIT, t=$SECONDS"
|