Skip to content
Open
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
24 changes: 22 additions & 2 deletions worker/uploadiso
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,24 @@ esac

# Check what files we have.
[ -f "$ROS_OUTPUT/bootcd.iso" ] && BOOTCD=1 || BOOTCD=0
[ $UPLOAD_REGTESTCD -a -f "${ROS_OUTPUT}/bootcdregtest.iso" ] && REGTESTCD=1 || REGTESTCD=0
[ -f "$ROS_OUTPUT/livecd.iso" ] && LIVECD=1 || LIVECD=0

if [ $BOOTCD -eq 0 -a $LIVECD -eq 0 ]; then
if [ $BOOTCD -eq 0 -a $REGTESTCD -eq 0 -a $LIVECD -eq 0 ]; then
echo "* There are no ISO files to process."
exit 2
fi

# Rsync them onto the file server.
BOOT=reactos-bootcd-$REVISION_SUFFIX-$UPLOAD_SUFFIX
if [ $REGTESTCD ]; then
REGT=reactos-bootcdregtest-$REVISION_SUFFIX-$UPLOAD_SUFFIX
fi
LIVE=reactos-livecd-$REVISION_SUFFIX-$UPLOAD_SUFFIX

echo "* Rsyncing ISO files onto iso.reactos.org..."
cd $ROS_OUTPUT
rsync --stats -e "ssh -l $UPLOAD_USER -i $UPLOAD_KEY" -rtvz --include=bootcd.iso --include=livecd.iso --exclude=* . $UPLOAD_HOST:$UPLOAD_TEMPDIR || exit 1
rsync --stats -e "ssh -l $UPLOAD_USER -i $UPLOAD_KEY" -rtvz --include=bootcd.iso --include=bootcdregtest.iso --include=livecd.iso --exclude=* . $UPLOAD_HOST:$UPLOAD_TEMPDIR || exit 1
echo -e "* Done.\n"

# Remotely compress them on the file server and update symbolic links.
Expand All @@ -47,6 +51,22 @@ else
echo "* There is no $BOOT to compress."
fi

if [ $REGTESTCD ]; then
# Cleanup ISOs/7z archives in the remote /temp/ folder that are older than 1 week.
echo "* Remotely cleaning old bootcdregtest ISOs..."
ssh $SSHOPTS "find $UPLOAD_ISODIR/temp/ -mindepth 1 -maxdepth 1 '(' -name \"*.iso\" -o -name \"*.7z\" ')' -type f -mtime +7 -delete"
Comment on lines +55 to +57

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the command I came up with, in order to delete ISOs/7z archives in the remote /temp/ directory, if they are older than 1 week.

Side-note: I tested locally this command by using -mmin option instead of -mtime in order to be able to specify a time amount in minutes (and not in days).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the "1 week" limit was arbitrarily taken; maybe this needs to be reduced to just a couple of days, or whatever?


echo "* Remotely compressing $REGT..."
ssh $SSHOPTS "ln $UPLOAD_TEMPDIR/bootcdregtest.iso $UPLOAD_TEMPDIR/$REGT.iso"
ssh $SSHOPTS "7za a -bd -t7z $UPLOAD_TEMPDIR/$BOOT.7z $UPLOAD_TEMPDIR/$REGT.iso -mx9 | tail -n +4"
ssh $SSHOPTS "rm $UPLOAD_TEMPDIR/$REGT.iso"
ssh $SSHOPTS "mv $UPLOAD_TEMPDIR/$REGT.7z $UPLOAD_ISODIR/temp/"
ssh $SSHOPTS "chmod 0644 $UPLOAD_ISODIR/temp/$REGT.7z"
#ssh $SSHOPTS "ln -snf $REGT.7z $UPLOAD_ISODIR/temp/latest-$UPLOAD_SUFFIX"
elif [ $UPLOAD_REGTESTCD ]; then
echo "* There is no $REGT to compress."
fi

if [ $LIVECD ]; then
echo "* Remotely compressing $LIVE..."
ssh $SSHOPTS "ln $UPLOAD_TEMPDIR/livecd.iso $UPLOAD_TEMPDIR/$LIVE.iso"
Expand Down