aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-12-07 02:18:27 +0200
committerkaotisk <kaotisk@arching-kaos.org>2024-12-07 02:18:27 +0200
commit2bca2705e9c83010bfafc0e6debfab10f867c06d (patch)
tree9a41980c3cdb3b16b586ec80f7daf3fd23225ef4
parent5402530100772eb3a8db649a52ee454145ae54dc (diff)
downloadarching-kaos-tools-2bca2705e9c83010bfafc0e6debfab10f867c06d.tar.gz
arching-kaos-tools-2bca2705e9c83010bfafc0e6debfab10f867c06d.tar.bz2
arching-kaos-tools-2bca2705e9c83010bfafc0e6debfab10f867c06d.zip
Provide custom installer for NodeJS
-rwxr-xr-xinstall.sh36
-rw-r--r--src/include/aklog.h12
-rw-r--r--src/tests/test_aklog.c12
3 files changed, 43 insertions, 17 deletions
diff --git a/install.sh b/install.sh
index c7cb613..895a610 100755
--- a/install.sh
+++ b/install.sh
@@ -79,13 +79,39 @@ do
if [ "$packageManager" != "" ]
then
printf "\t Attempting installation..."
- $sudoBin $packageManager $installCommand $dontAskFlag $dep > /dev/null 2>&1
- if [ $? -ne 0 ]
+ if [ "$dep" == "npm" ]
then
- printf "\t Failed to install!\n"
- exit 1
+ curl -o nvm_installer.sh https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh
+ if [ $? -ne 0 ]
+ then
+ print "\t Failed to download!\n"
+ exit 1
+ fi
+ printf "\t Downloaded!"
+ bash nvm_installer.sh
+ if [ $? -ne 0 ]
+ then
+ print "\t Failed to install nvm!\n"
+ exit 1
+ fi
+ printf "\t nvm installed!"
+ printf "\t Installing latest nodejs..."
+ nvm install $(nvm ls-remote|tail -n 1)
+ if [ $? -ne 0 ]
+ then
+ print "\t Failed to install nodejs!\n"
+ exit 1
+ fi
+ printf "\t nodejs installed!\n"
+ else
+ $sudoBin $packageManager $installCommand $dontAskFlag $dep > /dev/null 2>&1
+ if [ $? -ne 0 ]
+ then
+ printf "\t Failed to install!\n"
+ exit 1
+ fi
+ printf "\t installed!\n"
fi
- printf "\t installed!\n"
else
printf "\t Don't know how to install!\n\nInstall $dep manually!\n"
exit 1
diff --git a/src/include/aklog.h b/src/include/aklog.h
index ce475fe..ad7581d 100644
--- a/src/include/aklog.h
+++ b/src/include/aklog.h
@@ -5,11 +5,11 @@ void ak_log_print_log_line(char* line);
void ak_log_follow();
void ak_log_grep(char* string);
void ak_log_rotate();
-void ak_log_message(char* program, char* type, char* message);
-void ak_log_exit(char* program, char* message);
-void ak_log_warning(char* program, char* message);
-void ak_log_debug(char* program, char* message);
-void ak_log_error(char* program, char* message);
-void ak_log_info(char* program, char* message);
+void ak_log_message(const char* program, char* type, char* message);
+void ak_log_exit(const char* program, char* message);
+void ak_log_warning(const char* program, char* message);
+void ak_log_debug(const char* program, char* message);
+void ak_log_error(const char* program, char* message);
+void ak_log_info(const char* program, char* message);
#endif // AKLOG
diff --git a/src/tests/test_aklog.c b/src/tests/test_aklog.c
index 934124d..a2408a9 100644
--- a/src/tests/test_aklog.c
+++ b/src/tests/test_aklog.c
@@ -22,32 +22,32 @@ void test_rotate()
void test_log_message()
{
- ak_log_message("TEST", "TEST", "test message info");
+ ak_log_message(__func__, "TEST", "test message info");
}
void test_exit()
{
- ak_log_exit("TEST", "test message info");
+ ak_log_exit(__func__, "test message info");
}
void test_warning()
{
- ak_log_warning("TEST", "test message info");
+ ak_log_warning(__func__, "test message info");
}
void test_debug()
{
- ak_log_debug("TEST", "test message info");
+ ak_log_debug(__func__, "test message info");
}
void test_error()
{
- ak_log_error("TEST", "test message info");
+ ak_log_error(__func__, "test message info");
}
void test_info()
{
- ak_log_info("TEST", "test message info");
+ ak_log_info(__func__, "test message info");
}
int main (void)