Adding installer script
This commit is contained in:
Executable
+34
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
echo "--- Welcome to Beluga installer ---"
|
||||||
|
read -p "Do you want to start the installation ? (Y/n)" confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
|
||||||
|
|
||||||
|
# Check dependencies
|
||||||
|
|
||||||
|
if ! command -v "meson" &>/dev/null; then
|
||||||
|
echo "❌ Error: meson not found. Please install it first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Create config files
|
||||||
|
|
||||||
|
echo "Create config files ..."
|
||||||
|
mkdir -pv ~/.beluga/
|
||||||
|
cp -rv ./assets/ ~/.beluga/
|
||||||
|
cp -rv ./config/ ~/.beluga/
|
||||||
|
|
||||||
|
# Compile the project
|
||||||
|
|
||||||
|
|
||||||
|
echo "Start compilation ..."
|
||||||
|
meson setup --reconfigure build/
|
||||||
|
meson compile -C build/
|
||||||
|
|
||||||
|
# Add to path
|
||||||
|
echo "Adding beluga to the path"
|
||||||
|
sudo cp -f ./build/beluga /usr/local/bin/
|
||||||
|
|
||||||
|
echo "Installation finish"
|
||||||
|
echo "Check ~/.beluga/config/init.lisp for customization"
|
||||||
@@ -5,6 +5,9 @@
|
|||||||
* interactions. \version 0.1 \date 21 septembre 2024
|
* interactions. \version 0.1 \date 21 septembre 2024
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
@@ -22,14 +25,20 @@ struct editorConfig E;
|
|||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
|
char * splash_screen = (char *) calloc(256, sizeof(char));
|
||||||
|
|
||||||
enableRawMode();
|
enableRawMode();
|
||||||
initEditor();
|
initEditor();
|
||||||
if (argc >= 2) {
|
if (argc >= 2) {
|
||||||
E.state = READ_AND_WRITE;
|
E.state = READ_AND_WRITE;
|
||||||
editorOpen(argv[1]);
|
editorOpen(argv[1]);
|
||||||
} else {
|
} else {
|
||||||
editorOpen("assets/beluga.txt");
|
strcat(splash_screen, getenv("HOME"));
|
||||||
|
strcat(splash_screen, "/.beluga/assets/beluga.txt");
|
||||||
|
fprintf(stderr, "%s\n", splash_screen);
|
||||||
|
editorOpen(splash_screen);
|
||||||
}
|
}
|
||||||
|
free(splash_screen);
|
||||||
|
|
||||||
editorSetStatusMessage("HELP: Ctrl-S = save | Ctrl-Q = quit");
|
editorSetStatusMessage("HELP: Ctrl-S = save | Ctrl-Q = quit");
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -34,6 +34,7 @@ void initBuiltins() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initEditor() {
|
void initEditor() {
|
||||||
|
char init_file_path[256];
|
||||||
E.cursor_x = 0;
|
E.cursor_x = 0;
|
||||||
E.cursor_y = 0;
|
E.cursor_y = 0;
|
||||||
E.rx = 0;
|
E.rx = 0;
|
||||||
@@ -53,8 +54,10 @@ void initEditor() {
|
|||||||
|
|
||||||
E.number_of_keybinds = 0;
|
E.number_of_keybinds = 0;
|
||||||
|
|
||||||
|
strcat(init_file_path, getenv("HOME"));
|
||||||
E.fd_init_file = fopen("config/init.lisp", "r");
|
strcat(init_file_path, "/.beluga/config/init.lisp");
|
||||||
|
printf("%s\n", init_file_path);
|
||||||
|
E.fd_init_file = fopen(init_file_path, "r");
|
||||||
E.ctx = lisp_init();
|
E.ctx = lisp_init();
|
||||||
E.env = lisp_env(E.ctx);
|
E.env = lisp_env(E.ctx);
|
||||||
lisp_lib_load(E.ctx);
|
lisp_lib_load(E.ctx);
|
||||||
|
|||||||
Reference in New Issue
Block a user