Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mission 16 pull request #51

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 1 addition & 1 deletion SOLDOUT_waiting_for_stock.list
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# name date
Love potion 7/12/1215
Excalibur 30/05/542
Philosopher stone 16/10/2024
2 changes: 1 addition & 1 deletion product.list
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# product price
arrow 1
bow 25
philosopher's_stone 100
philosopher's_stone 0
81 changes: 81 additions & 0 deletions setup_ssh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
read -p "Do you want to setup the ssh authentification method to work outside of the game (y/n)?" globalinstall


cd ${GSH_HOME}
# first setup ~/.ssh as a symlink or as a real directory depending of the above choice.
if [[ "$globalinstall" == "y" ]];
then
if [ ! -d ${REAL_HOME}/.ssh ]
then
echo "creating ~/.ssh directory (outside the game)"
mkdir ${REAL_HOME}/.ssh
chmod 700 ${GSH_HOME}/.ssh
fi
# remove local directory if .ssh is not a symlink
# or create (or reset) the symlink
if [ ! -L ${GSH_HOME}/.ssh ] && [ -e ${GSH_HOME}/.ssh ]
then
rm -rf ${GSH_HOME}/.ssh &> /dev/null
elif [ -L ${GSH_HOME}/.ssh ]
then
unlink ${GSH_HOME}/.ssh &> /dev/null
ln -s ${REAL_HOME}/.ssh
else
ln -s ${REAL_HOME}/.ssh
fi
else
# need to have it's own directory:
if [ ! -L ${GSH_HOME}/.ssh ] && [ -e ${GSH_HOME}/.ssh ] # if a symlink -> unlink + create directory
then
unlink ${GSH_HOME}/.ssh &> /dev/null
elif [ -e ${GSH_HOME}/.ssh ] # hard directory already exists -> clean it
then
rm -rf ${GSH_HOME}/.ssh
fi

mkdir ${GSH_HOME}/.ssh
chmod 700 ${GSH_HOME}/.ssh
fi

#Now .ssh is setup either as a symlink (if user ask for global installation) or as an empty real directory.

# create ~/.ssh/id_rsa.git
if [ ! -e ~/.ssh/id_rsa.git ]
then
ssh-keygen -t rsa -f ~/.ssh/id_rsa.git -N ""
chmod 600 ~/.ssh/id_rsa.git
fi

if [[ "$globalinstall" == "y" ]];
then
identityfile_path="${REAL_HOME}/.ssh/id_rsa.git"
else
identityfile_path="${GSH_HOME}/.ssh/id_rsa.git"
fi

if [ ! -e ~/.ssh/config ]
then
echo "Host github.com" >> ~/.ssh/config
echo " Hostname github.com" >> ~/.ssh/config
echo " User git" >> ~/.ssh/config
echo " IdentityFile ${identityfile_path}" >> ~/.ssh/config
# handle the content of the ~/.ssh/config file
elif $(cat ~/.ssh/config | grep github.com &> /dev/null)
then
echo "file ~/.ssh/config already has instruction for github: The script did not try to edit it."
echo "We do expect the following lines: (please check)"
echo "Host github.com"
echo " Hostname github.com"
echo " User git"
echo " IdentityFile ${identityfile_path}"
else
echo "adding configuration for github in ssh config file"
echo "" >> ~/.ssh/config
echo "Host github.com" >> ~/.ssh/config
echo " Hostname github.com" >> ~/.ssh/config
echo " User git" >> ~/.ssh/config
echo " IdentityFile ${identityfile_path}" >> ~/.ssh/config
fi



1 change: 1 addition & 0 deletions status
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
I have succeed level 1
I have succeed level 14 on mer. oct. 16 11:55:31 CEST 2024