nodejs from source

This commit is contained in:
Marc
2021-11-30 10:57:05 +01:00
parent 952edb4270
commit 3781c5108b
8 changed files with 62 additions and 23 deletions
+22 -14
View File
@@ -1,32 +1,40 @@
#!/bin/bash
sudo umount rootfs/proc -R
sudo rm -rf rootfs/
sudo rm root.iso
sudo rm chibrax.tar.gz
# 2> /dev/null veut dire que l'on veut pas voire les erreurs
sudo umount rootfs/proc -R 2> /dev/null
sudo rm -rf rootfs/ 2> /dev/null
sudo rm root.iso 2> /dev/null
sudo rm chibrax.tar.gz 2> /dev/null
mkdir -p rootfs/
mkdir -p rootfs/boot
mkdir -p rootfs/chibrax
#installation de node & de grub
sudo pacstrap rootfs coreutils nodejs grub sed
#installation de grub
sudo pacstrap rootfs coreutils grub sed
echo "construction de Nodejs"
chmod +x ./nodejs/build.sh
cd nodejs && ./build.sh || exit 1 && cd -
echo "done"
chmod +x ./chibraxLoader/build.sh
cd chibraxLoader && ./build.sh && cd -
sudo cp chibraxLoader/init rootfs/bin/
sudo cp chibraxLoader/init rootfs/bin/ || exit 1
cd kernel && ./from_current.sh && cd -
sudo cp kernel/src/vmlinuz rootfs/boot
sudo cp kernel/src/vmlinuz rootfs/boot || exit 1
echo "Cloning the firmware"
git clone https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
# on masque les erreurs si le depot est deja clone
git clone https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git 2> /dev/null
cd linux-firmware && git pull && cd -
sudo mkdir -p rootfs/usr/lib/firmware
sudo cp linux-firmware/* rootfs/usr/lib/firmware/ -r
echo "rebuilding C++ hooks"
./clibs.sh
sudo cp linux-firmware/* rootfs/usr/lib/firmware/ -r || exit 1
echo "done"
sudo cp rootfs\ overrides/* rootfs/ -r
echo "rebuilding C++ hooks"
./clibs.sh || exit 1
echo "done"
sudo cp rootfs\ overrides/* rootfs/ -r || exit 1
sudo rm rootfs/var/cache -rf
+4 -4
View File
@@ -1,9 +1,9 @@
#include <unistd.h>
#define ERR 1
#define node "/bin/node"
#include <stdio.h>
//Chemin exacte de node (a changer aprés la creation d'un gestionnaire de packets)
#define node "/usr/local/bin/node"
#define chibrax "/chibrax/index.js"
int main() {
return execl(node, node, chibrax);
execl(node, node, chibrax);
}
+1 -1
View File
@@ -1,5 +1,5 @@
#!/bin/bash
node node_modules/node-gyp/bin/node-gyp.js configure
node node_modules/node-gyp/bin/node-gyp.js build
sudo node node_modules/node-gyp/bin/node-gyp.js build
cp build/Release/syscall.node rootfs\ overrides/chibrax/syscall.node
+6
View File
@@ -41,6 +41,12 @@ echo "coping rootfs"
cp rootfs/* $CHIBRAX_MOUNT_POINT -r
echo "done"
echo "removing arch's grub hooks"
rm rootfs/etc/grub.d/10_linux
rm rootfs/etc/grub.d/20_linux_xen
#celui sert a rien tant qu'on ne supporte pas l'uefi
rm rootfs/etc/grub.d/30_uefi-firmware
echo "installing grub"
arch-chroot $CHIBRAX_MOUNT_POINT grub-install --target=i386-pc ${LOOP_ROOT} --modules=part_msdos
arch-chroot $CHIBRAX_MOUNT_POINT grub-mkconfig -o /boot/grub/grub.cfg
+3 -3
View File
@@ -1,12 +1,12 @@
if [ -f /bin/pacman ] # btw
then
sudo pacman -S python gcc make bc
sudo pacman -S python gcc make bc unzip wget sudo binutils nasm
else if [ -f /bin/apt ] #deb / ubuntu
then
sudo apt-get install python3 g++ make
sudo apt-get install python3 g++ make bc unzip wget sudo
else if [ -f /bin/dnf ] #fedora
then
sudo dnf install python3 gcc-c++ make bc
sudo dnf install python3 gcc-c++ make bc unzip wget sudo
fi
fi
fi
+1
View File
@@ -0,0 +1 @@
src
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
if [ "$EUID" = 0 ]
then echo "Please don't run this as root"
exit
fi
VERSION=17.1.0
if [ ! -f src ]
then
mkdir src -p
cd src
curl https://github.com/nodejs/node/archive/refs/tags/v$VERSION.zip -L --output $VERSION.zip || exit 1
unzip $VERSION.zip || exit 1
cd -
fi
cd src/node-$VERSION
./configure || exit 1
make -j$(nproc) || exit 1
cd -
sudo src/node-$VERSION/tools/install.py install $(pwd)/../rootfs || exit 1
@@ -1,5 +1,5 @@
let environment = {
path: ["/usr/bin", "/usr/lib/sheebr"],
path: ["/usr/bin", "/usr/lib/sheebr", "/usr/local/bin"],
ls_color: JSON.stringify({
di: [01, 34],
ln: [01, 36],