mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-20 12:42:50 +00:00
rubygems mirror script
This commit is contained in:
parent
b5ea8682e2
commit
0328080802
49
rubygems.sh
Executable file
49
rubygems.sh
Executable file
@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
GEM=${GEM:-"gem"}
|
||||
export HOME="/tmp/rubygems"
|
||||
CONF="$HOME/.gem/.mirrorrc"
|
||||
|
||||
mkdir -p "$HOME/.gem"
|
||||
|
||||
INIT=${INIT:-"0"}
|
||||
|
||||
if [ ! -d "$TUNASYNC_WORKING_DIR" ]; then
|
||||
mkdir -p $TUNASYNC_WORKING_DIR
|
||||
INIT="1"
|
||||
fi
|
||||
|
||||
echo "Syncing to $TUNASYNC_WORKING_DIR"
|
||||
|
||||
if [[ $INIT == "0" ]]; then
|
||||
|
||||
cat > $CONF << EOF
|
||||
---
|
||||
- from: https://rubygems.org
|
||||
to: ${TUNASYNC_WORKING_DIR}
|
||||
parallelism: 10
|
||||
retries: 2
|
||||
delete: true
|
||||
skiperror: true
|
||||
EOF
|
||||
|
||||
/usr/bin/timeout -s INT 7200 $GEM mirror
|
||||
if [[ $? == 124 ]]; then
|
||||
echo 'Sync timeout (/_\\)'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
cat > $CONF << EOF
|
||||
---
|
||||
- from: https://rubygems.org
|
||||
to: ${TUNASYNC_WORKING_DIR}
|
||||
parallelism: 10
|
||||
retries: 2
|
||||
delete: true
|
||||
skiperror: true
|
||||
EOF
|
||||
|
||||
$GEM mirror
|
||||
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user