Browse Source

Fixes for linux

production
guest 3 weeks ago
parent
commit
3662cc1dd5
4 changed files with 3895 additions and 3828 deletions
  1. 2
    0
      i.lin.sh
  2. 46
    0
      i.sqlexpress.sh
  3. 3823
    3823
      index.js
  4. 24
    5
      lin_verse.js

+ 2
- 0
i.lin.sh View File

#sudo apt-get autoremove #sudo apt-get autoremove
#sudo apt-get autoclean #sudo apt-get autoclean


sudo apt install openjdk-22-jre-headless



fi fi



+ 46
- 0
i.sqlexpress.sh View File

# https://www.geeksforgeeks.org/how-to-install-sql-server-express-in-linux/
# https://learn.microsoft.com/en-us/answers/questions/1685683/how-to-install-sql-server-2022-on-ubuntu-server-24

curl -O http://debian.mirror.ac.za/debian/pool/main/o/openldap/libldap-2.5-0_2.5.13+dfsg-5_amd64.deb
sudo dpkg -i libldap-2.5-0_2.5.13+dfsg-5_amd64.deb
curl -O http://debian.mirror.ac.za/debian/pool/main/o/openldap/libldap-dev_2.5.13+dfsg-5_amd64.deb
sudo dpkg -i libldap-dev_2.5.13+dfsg-5_amd64.deb

#curl -OL http://archive.ubuntu.com/ubuntu/pool/main/o/openldap/libldap-2.5-0_2.5.18+dfsg-0ubuntu0.22.04.1_amd64.deb
#sudo apt-get install ./libldap-2.5-0_2.5.18+dfsg-0ubuntu0.22.04.1_amd64.deb

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list | sudo tee /etc/apt/sources.list.d/mssql-server-2022.list
# sudo add-apt-repository “$(wget -qO- https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list)”
# sudo add-apt-repository “$(wget -qO- https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2019.list)”


sudo apt update && sudo apt install -y mssql-server
sudo /opt/mssql/bin/mssql-conf setup

#sudo systemctl status mssql-server.service
sudo systemctl status mssql-server --no-pager

curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt update && sudo apt install -y mssql-tools unixodbc-dev
sudo ln -s /opt/mssql-tools/bin/sqlcmd /usr/local/bin
sqlcmd -S localhost -U SA

setfacl -R -m u:mssql:rwx ~/elvt/pgsys/elixir-data/dbs/elixir/run

SELECT OBJECT_SCHEMA_NAME(object_id) AS SchemaName, name AS TableName
FROM master.sys.objects WHERE type_desc = 'USER_TABLE' AND is_ms_shipped = 0;


# Install redis
# https://docs.vultr.com/how-to-install-redis-on-ubuntu-24-04
sudo apt install redis-server
sudo systemctl enable redis-server.service
sudo systemctl start redis


# sqlcmd -S localhost -U sa -Q "RESTORE DATABASE [ELIXIR_DEV] FROM DISK = N'/home/elvt/elvt/pgsys/elixir-data/dbdumps/reduced_elixir_backup' WITH FILE = 1, NOUNLOAD, REPLACE, NORECOVERY, STATS = 5"

cp /home/elvt/pgsys/elixir-data/dbdumps/reduced_elixir_backup' /tmp
sqlcmd -S localhost -U sa -Q "RESTORE DATABASE ELIXIR FROM DISK = '/tmp/reduced_elixir_backup' WITH MOVE 'Elixir' TO '/var/opt/mssql/data/elixir.mdf', MOVE 'Elixir_log' TO '/var/opt/mssql/data/elixir_log.ldf'"

+ 3823
- 3823
index.js
File diff suppressed because it is too large
View File


+ 24
- 5
lin_verse.js View File

const { any } = require('bbhverse'); const { any } = require('bbhverse');
const fs = require('fs') const fs = require('fs')
var path = require('path');


var cli = require('./cliverse') var cli = require('./cliverse')
var nodeShellExec = cli.nodeShellExec; var nodeShellExec = cli.nodeShellExec;
var __isElevated = null; var __isElevated = null;
var shell_verse = { var shell_verse = {
// getCommonTask is agnostic of whether we are running in an elevated shell or not. It runs in either case. // getCommonTask is agnostic of whether we are running in an elevated shell or not. It runs in either case.
getCommonTask( taskToRun ){ return ()=>{ return shell_verse.runTask(taskToRun) }}
init( o ){ Object.assign(this, o) }
, downloadsdir : '../Downloads'
, getCommonTask( taskToRun ){ return ()=>{ return shell_verse.runTask(taskToRun) }}
, runTask : ( taskToRun ) => { , runTask : ( taskToRun ) => {
if (__isElevated) return shell_verse.runElevated( taskToRun ) if (__isElevated) return shell_verse.runElevated( taskToRun )
else return shell_verse.runNonElevated( taskToRun ) else return shell_verse.runNonElevated( taskToRun )
} }


, elevatedRunner( taskToRun ){
, elevatedRunner( taskToRun, inBatch ){
// PB : TODO -- Should be called only when we are in an elevated shell that was already requested from an unelevated shell with a batch of tasks. // PB : TODO -- Should be called only when we are in an elevated shell that was already requested from an unelevated shell with a batch of tasks.
try { try {
// PB : We do not need IPC in linux. Until a real sudo elevation is required eveything works in non elevated mode... // PB : We do not need IPC in linux. Until a real sudo elevation is required eveything works in non elevated mode...
} }
catch (e) { catch (e) {
console.error('Error Invalid command : ' + e) console.error('Error Invalid command : ' + e)
// fs.writeFileSync('run.done', 'error')
if(!inBatch) fs.writeFileSync('run.done', 'error')
} }
finally { finally {
} }


if(taskToRun.processedArgs.skipelevated) return Promise.resolve({ skipped : true }); if(taskToRun.processedArgs.skipelevated) return Promise.resolve({ skipped : true });


if(__isElevated) {

if (__isElevated) {
return shell_verse.elevatedRunner(taskToRun) return shell_verse.elevatedRunner(taskToRun)
} }
else { else {
}).catch((e) => { }).catch((e) => {
e.info = taskToRun.info; e.info = taskToRun.info;
if(taskToRun.errHandler) throw taskToRun.errHandler(e) if(taskToRun.errHandler) throw taskToRun.errHandler(e)
taskToRun.statuslog.statuslog(e);
taskToRun.statuslog.statuslog(e); //
// console.error(e) // console.error(e)
throw e; throw e;
}).finally(()=>{}) }).finally(()=>{})
return elevatedRunner(taskToRun); return elevatedRunner(taskToRun);
} }
, iswin(){ return false} , iswin(){ return false}

, ensureDirectoryExistence(filePath) {
var dirname = path.dirname(filePath);
if (fs.existsSync(dirname)) {
return filePath;
}
this.ensureDirectoryExistence(dirname);
fs.mkdirSync(dirname);
return filePath;
}
, generateDependencies(){
}
, iswin(){ return false}
, islin(){ return true} , islin(){ return true}
} }



Loading…
Cancel
Save