Skip to content

Instantly share code, notes, and snippets.

@Kenta11
Created February 12, 2022 16:43
Show Gist options
  • Save Kenta11/0c00b502865ae92ca37b4e50026984e8 to your computer and use it in GitHub Desktop.
Save Kenta11/0c00b502865ae92ca37b4e50026984e8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
# Download directory
DOWNLOAD=~/Downloads/tree
# create a tree directory
mkdir tree
cd tree
# create a repository which contains v1.1
git init
echo '*.o' > .gitignore
echo 'tree' >> .gitignore
## decompress tree
tree_tar_file=tree-1.1.tgz
tree_tar_file_without_extension=${tree_tar_file%.tgz}
mkdir -p /tmp/${tree_tar_file_without_extension}/
tar zxvf ${DOWNLOAD}/${tree_tar_file} -C /tmp/${tree_tar_file_without_extension}/
## copy to git repository
mv /tmp/${tree_tar_file_without_extension}/${tree_tar_file_without_extension%b*}/* .
rm -rf /tmp/${tree_tar_file_without_extension}/
## commit to repository
git add .
git commit -m "Add ${tree_tar_file_without_extension}"
git tag v1.1
# commit tree <v1.2
for tree_tar_file in tree-1.2.tgz tree-1.3.tgz tree-1.4b1.tgz tree-1.4b2.tgz tree-1.4b3.tgz tree-1.5.0.tgz tree-1.5.1.1.tgz tree-1.5.1.2.tgz tree-1.5.2.tgz tree-1.5.2.1.tgz tree-1.5.2.2.tgz tree-1.5.3.tgz tree-1.6.0.tgz tree-1.7.0.tgz tree-1.8.0.tgz tree-2.0.0.tgz tree-2.0.1.tgz; do
# remove all files
rm -rf *
# decompress tree
tree_tar_file_without_extension=${tree_tar_file%.tgz}
mkdir -p /tmp/${tree_tar_file_without_extension}/
tar zxvf ${DOWNLOAD}/${tree_tar_file} -C /tmp/${tree_tar_file_without_extension}/
# copy to git repository
mv /tmp/${tree_tar_file_without_extension}/${tree_tar_file_without_extension%b*}/* .
rm -rf /tmp/${tree_tar_file_without_extension}/
# commit to repository
git add .
git commit -m "Update to ${tree_tar_file%.tgz}"
git tag v${tree_tar_file_without_extension#tree-}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment