pb пре 1 година
родитељ
комит
562274a04e
4 измењених фајлова са 134 додато и 33 уклоњено
  1. 119
    23
      i.lin.sh
  2. 8
    8
      index.js
  3. 3
    0
      lin_verse.js
  4. 4
    2
      repo-manifest.js

+ 119
- 23
i.lin.sh Прегледај датотеку

@@ -1,32 +1,128 @@
sudo apt update

# Install prerequisites for dev environment
# PB : TODO -- Prompt if not passed in.
REPOSERVER=http://git.bbh
DEFAULTREPOOWNER=chess
REPOOWNER=$DEFAULTREPOOWNER
INSTANCENAME=elixir
INSTANCETYPE=dev
GITUSER=pb
GITEMAIL=pradeep@bbh.org.in

sudo apt install python2
sudo apt install build-essential
sudo apt install -y make
sudo apt install nodejs
sudo apt install npm
sudo apt install git
--
git clone http://git.bbh.org.in/chess/elxr.git
cd elxr
elxr use elixir
cd ..
elxr i

# Install mysql
sudo apt install mysql-server -y
systemctl is-active mysql
sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'mysql#minA1';"
sudo mysql_secure_installation
sudo mysql -e "FLUSH PRIVILEGES;" -u root -pmysql#minA1
systemctl status mysql.service
#OPTIONS
SKIPPREREQS=true
SKIPDEVPREREQS=true

# Init DB schema and Load Data
mysql -u root -pmysql#minA1 < cihsr-data/cihsr-dev-schema.sql
if [ "$SKIPPREREQS" = "true" ]; then
echo "skipping prereqs for firstrun"
else

sudo groupadd chessprod

echo "$USER"
sudo usermod -a -G chessprod $USER

sudo apt update

# Install prerequisites for dev environment
sudo apt install git
git config --global user.name "$GITUSER"
git config --global credential.helper store
#git config --global credential.helper 'store --file ~/.git-credentials'
#echo "Enter git username: "
#read gitUser
#git config --global user.name '${gitUser}'
#echo "username=$gitUser" >> ~/.git-credentials
#echo "Enter git password: "
#read gitPassword
#git config --global user.password '${gitPassword}'
#echo "password=$gitPassword" >> ~/.git-credentials
#chmod 0600 ~/.git-credentials

sudo apt install python2
sudo apt install build-essential
sudo apt install -y make

#INSTALLING NODE JS
cd ~
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
sleep 2
touch ~/.bashrc
source ~/.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
sleep 2
nvm list-remote
sleep 2
nvm install v16.19.1
sleep 2
node --version
npm --version

# OLD version...
#sudo apt install nodejs
#sudo apt install npm
# For production we create a npm global per user.
# npm prefix is not compatible with nvm!!!
# mkdir -p ~/.user_global_node_modules/
# npm config set prefix '~/.user_global_node_modules'
# sudo mkdir /usr/local/lib/node_modules/
# sudo chown -R root:chessprod /usr/local/lib/node_modules/
# sudo chmod g+w /usr/local/lib/node_modules/
# grep -qxF 'export PATH=~/.user_global_node_modules/bin:$PATH' ~/.profile || echo 'export PATH=~/.user_global_node_modules/bin:$PATH' >> ~/.profile

if [ "$SKIPPREREQS" = "true" ]; then
echo "skipping dev prereqs for firstrun"
else
#install code
sudo apt-get install wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
rm -f packages.microsoft.gpg
sudo apt install apt-transport-https
sudo apt update
sudo apt install code
install code
sudo apt-get install wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
rm -f packages.microsoft.gpg
sudo apt install apt-transport-https
sudo apt update
sudo apt install code
fi

sudo mkdir -p /var/chess
sudo chown $USER:$USER /var/chess
ROOT=/var/chess/$INSTANCENAME/$INSTANCETYPE
echo $ROOT
sudo mkdir -p $ROOT
cd $ROOT

git clone $REPOSERVER/$REPOOWNER/elxr.git

cd elxr
npm i
npm link
cd ..

# Install mysql
#sudo apt install mysql-server -y
systemctl is-active mysql
#sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'mysql#minA1';"
#sudo mysql_secure_installation
#sudo mysql -e "FLUSH PRIVILEGES;" -u root -pmysql#minA1
#systemctl status mysql.service

# Init DB schema and Load Data
#mysql -u root -pmysql#minA1 < cihsr-data/cihsr-dev-schema.sql
fi

echo module.exports = { instanceName : "'$INSTANCENAME'", reposerver: "'$REPOSERVER'", gitUser: "'$GITUSER'", gitEmail:"'$GITEMAIL'" } > installchoices.js
elxr use elixir
elxr i


+ 8
- 8
index.js Прегледај датотеку

@@ -566,7 +566,7 @@ shell_verse.acquireElevationState().then((isElevated) => {
// PB : TODO -- pick up remote definitions per repository...
var reposmanfiest = utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION }
, {}, selectedinstance, loadmanifest( selectedinstance.root + '/' + repo
, { utils, username : selectedinstance.username, instanceName : selectedinstance.instanceName
, { username : selectedinstance.username, instanceName : selectedinstance.instanceName
, node_env : selectedinstance.node_env, reposerver : selectedinstance.reposerver }
))
@@ -861,7 +861,7 @@ shell_verse.acquireElevationState().then((isElevated) => {
try {
// PB : TODO -- pick up remote definitions per repository...
return utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION }
, {}, require(path.normalize( mpath + '/repo-manifest'))( null, moverrides ))
, {}, require(path.normalize( mpath + '/repo-manifest'))( {utils}, null, moverrides ))
}
catch(e){
@@ -1231,7 +1231,7 @@ shell_verse.acquireElevationState().then((isElevated) => {
// Also attepmt to load preconfig specially for new chessinstances from ../chess-config/...
var __repo_manifest_elxr = loadmanifest( instance.root + '/elxr'
, { utils, username : instance.username /** ??? TODO */ , instanceName : instance.instanceName /** ??? TODO */
, { username : instance.username /** ??? TODO */ , instanceName : instance.instanceName /** ??? TODO */
, node_env : clioverrides.node_env, reposerver : instance.reposerver /** ??? TODO */ } // options
)
@@ -1244,10 +1244,10 @@ shell_verse.acquireElevationState().then((isElevated) => {
if(instance_specific_config_manifest.error) console.log(instance_specific_config_manifest.e.message)
delete __repo_manifest_elxr.error
delete __repo_manifest_elxr.e
delete __repo_manifest_elxr.utils
// delete __repo_manifest_elxr.utils
delete instance_specific_config_manifest.error
delete instance_specific_config_manifest.e
delete instance_specific_config_manifest.utils
// delete instance_specific_config_manifest.utils
// selectedinstance is not complete until we load in the following order of priority...
// 1) inline defaults
@@ -1833,7 +1833,7 @@ shell_verse.acquireElevationState().then((isElevated) => {
// PB : TODO -- pick up remote definitions per repository...
var reposmanfiest = utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION }
, {}, selectedinstance, loadmanifest( selectedinstance.root + '/' + repo
, { utils, username : selectedinstance.username, instanceName : selectedinstance.instanceName
, { username : selectedinstance.username, instanceName : selectedinstance.instanceName
, node_env : selectedinstance.node_env, reposerver : selectedinstance.reposerver }
))

@@ -4315,7 +4315,7 @@ shell_verse.acquireElevationState().then((isElevated) => {
statuslog.statuslog(e, e)
var manifestpath = path.normalize(selected.root + '/' + selected.instanceName + '-config-' + selected.node_env + '/repo-manifest');
utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION }
, selectedinstance, require(manifestpath)( null, { utils, username : selectedinstance.username, instanceName : selectedinstance.instanceName
, selectedinstance, require(manifestpath)( {utils}, null, { username : selectedinstance.username, instanceName : selectedinstance.instanceName
, node_env : selectedinstance.node_env, reposerver : 'https://git.bbh.org.in' } ))
console.dir(selectedinstance.repos)
// Config from server always override merges into selection except for the current selection.
@@ -4549,7 +4549,7 @@ shell_verse.acquireElevationState().then((isElevated) => {

var manifestpath = path.normalize(selected.root + '/' + selected.instanceName + '-config-' + selected.node_env + '/repo-manifest');
utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION }
, selectedinstance, require(manifestpath)( null, { utils, username : selectedinstance.username, instanceName : selectedinstance.instanceName
, selectedinstance, require(manifestpath)( {utils}, null, { username : selectedinstance.username, instanceName : selectedinstance.instanceName
, node_env : selectedinstance.node_env, reposerver : selectedinstance.reposerver }))
console.dir(selectedinstance.repos)
// Config from server always override merges into selection except for the current selection.

+ 3
- 0
lin_verse.js Прегледај датотеку

@@ -94,6 +94,9 @@ var shell_verse = {
, runElevatedBatch( batchToRun ){
// In windows we don't need to run each task. We hand over to another shell which in elevated state rebuilds the whole batch and runs.
// Irrespective of the batch we just call runElevated once.
batchToRun.forEach(element => {
element.processedArgs = batchToRun[0].processedArgs
});
return any(batchToRun.map(shell_verse.runElevated))
}


+ 4
- 2
repo-manifest.js Прегледај датотеку

@@ -1,7 +1,9 @@
module.exports = ((name, options)=>{
module.exports = ((meta, options)=>{

var name = meta.name
const utils = meta.utils
options = options || { username : `guest`, reposerver : `https://git.bbh.org.in`, password : `noneforguest` }
utils = options.utils

// Default set of users in main repos.
var users = [

Loading…
Откажи
Сачувај