Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
2d0359aa
Commit
2d0359aa
authored
Apr 04, 2021
by
Kim Nguyễn
Browse files
Add a convenience script to install all dependencies in the current opam switch.
parent
acb706f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
tools/init_opam_switch.sh
0 → 100755
View file @
2d0359aa
#!/bin/sh
#This script is used to initialize a freshly created opam switch
#with CDuce PINS
#Change these variables to suit your needs
GIT_REPO
=
"git+https://gitlab.math.univ-paris-diderot.fr/cduce/cduce"
BRANCH
=
"dune-switch"
PACKAGES
=
"cduce-types cduce"
##
OPAM
=
`
which opam
`
SCRIPT_PATH
=
`
dirname
$0
`
BASE_PATH
=
"
$(
cd
${
SCRIPT_PATH
}
/..
;
pwd
)
"
if
test
-z
"
$OPAM
"
;
then
echo
"Error: cannot find opam in PATH, is it installed ?"
exit
1
fi
DEPS
=
"
${
PACKAGES
}
"
for
p
in
$PACKAGES
do
OFILE
=
"
${
BASE_PATH
}
/
${
p
}
.opam"
if
test
-f
"
$OFILE
"
;
then
DEPS
=
"
${
DEPS
}
$(
opam show
--file
=
${
OFILE
}
-f
depopts:,depends: |
\
sed
-e
's/[{][^}]*[}]\|[()|]\|^depopts:\|^depends://g'
|
\
sed
-e
's/[^"]*["]\([^"]*\)["]/\1 /g'
|
\
xargs
echo
)
"
else
echo
"Error: cannot find opam file
${
p
}
.opam in
$(
cd
${
SCRIPT_PATH
}
/..
;
pwd
)
"
exit
2
fi
done
DEPS
=
"
$(
for
i
in
${
DEPS
}
;
do
echo
"
${
i
}
"
;
done
|
sort
-u
| xargs
echo
)
"
"
$OPAM
"
pin
-y
--no-action
add cduce-types
"
${
GIT_REPO
}
#
${
BRANCH
}
"
"
$OPAM
"
pin
-y
--no-action
add cduce
"
${
GIT_REPO
}
#
${
BRANCH
}
"
"
$OPAM
"
install
-y
$DEPS
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment