summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostyantyn Ovechko <fastinetserver@gmail.com>2010-08-12 17:07:57 +0300
committerKostyantyn Ovechko <fastinetserver@gmail.com>2010-08-12 17:07:57 +0300
commit013e18c797e301e691f4bda0f49a362a569035fd (patch)
treee46dbd55802f06a2f45c90be6b210c2ed7cd8d68
parentAdjust default folders. (diff)
downloadidfetch-013e18c797e301e691f4bda0f49a362a569035fd.tar.gz
idfetch-013e18c797e301e691f4bda0f49a362a569035fd.tar.bz2
idfetch-013e18c797e301e691f4bda0f49a362a569035fd.zip
Add install option to Makefiles
+Fix pathes by default
-rw-r--r--Makefile14
-rw-r--r--request/Makefile7
-rw-r--r--segget/Makefile13
-rwxr-xr-xsegget/init.d/seggetd2
-rw-r--r--segget/scripts/functions.py2
-rw-r--r--segget/scriptserver.cpp6
-rw-r--r--segget/segget.conf33
-rw-r--r--segget/segget.cpp4
-rw-r--r--segget/settings.cpp1
-rw-r--r--segget/settings.h2
-rw-r--r--tuiclient/Makefile5
11 files changed, 57 insertions, 32 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..16b56ef
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,14 @@
+all:
+ cd segget && make
+ cd request && make
+ cd tuiclient && make
+
+install:
+ cd segget && make install
+ cd request && make install
+ cd tuiclient && make install
+
+clean:
+ cd segget && make clean
+ cd request && make clean
+ cd tuiclient && make clean
diff --git a/request/Makefile b/request/Makefile
index d7d45c7..81df7a3 100644
--- a/request/Makefile
+++ b/request/Makefile
@@ -25,5 +25,12 @@ clean:
-rm -f $(OBJS)
-rm -f *~
-rm -f *.o
+
+install:
+ -mkdir -p /etc/seggetd
+ -cp *.conf /etc/seggetd
+ -cp request /usr/bin
+ -mkdir -p /tmp/seggetd
+ -mkdir -p /var/log/seggetd
.PRECIOUS: %.o
diff --git a/segget/Makefile b/segget/Makefile
index 5a069f2..497ba70 100644
--- a/segget/Makefile
+++ b/segget/Makefile
@@ -27,5 +27,18 @@ clean:
-rm -f $(BINS) $(OBJS)
-rm -f *.o
-rm -f *.log
+
+install:
+ -mkdir /etc/seggetd
+ -cp *.conf /etc/seggetd
+ -cp segget /usr/bin/seggetd
+ -cp ./init.d/seggetd /etc/init.d/seggetd
+ -mkdir -p /usr/share/seggetd
+ -cp -R ./webui /usr/share/seggetd
+ -mkdir -p /usr/share/seggetd/scripts
+ -cp -R ./scripts /usr/share/seggetd
+ -mkdir -p /tmp/seggetd/segments
+ -mkdir -p /usr/portage/distfiles
+ -mkdir -p /var/log/seggetd
.PRECIOUS: %.o
diff --git a/segget/init.d/seggetd b/segget/init.d/seggetd
index 16b83af..5e83746 100755
--- a/segget/init.d/seggetd
+++ b/segget/init.d/seggetd
@@ -14,7 +14,7 @@ elif [ -x /sbin/start-stop-daemon ]; then
SYS_F="De"
fi
-DAEMON=/usr/sbin/seggetd/segget
+DAEMON=/usr/bin/seggetd
CONF_DIR=/etc/seggetd
LOCKFILE=/var/lock/subsys/seggetd
diff --git a/segget/scripts/functions.py b/segget/scripts/functions.py
index 07fe90a..c2527b2 100644
--- a/segget/scripts/functions.py
+++ b/segget/scripts/functions.py
@@ -74,4 +74,4 @@ distfile=Tdistfile
segment=Tsegment
client_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
-client_socket.connect("/tmp/segget_script_socket") \ No newline at end of file
+client_socket.connect("/tmp/seggetd/script_socket") \ No newline at end of file
diff --git a/segget/scriptserver.cpp b/segget/scriptserver.cpp
index bd095a6..512e177 100644
--- a/segget/scriptserver.cpp
+++ b/segget/scriptserver.cpp
@@ -196,11 +196,11 @@ bool run_user_python_script(uint connection_num){
int result;
fd_set readfds, testfds;
- unlink("/tmp/segget_script_socket");
+ unlink(settings.script_socket_path.c_str());
// Create and name a socket for the server:
script_server_sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
server_address.sun_family = AF_UNIX;
- strcpy(server_address.sun_path, "/tmp/segget_script_socket");
+ strcpy(server_address.sun_path, settings.script_socket_path.c_str());
server_len = sizeof(server_address);
bind(script_server_sockfd, (struct sockaddr *)&server_address, server_len);
//Create a connection queue and initialize readfds to handle input from server_sockfd:
@@ -225,7 +225,7 @@ bool run_user_python_script(uint connection_num){
dup2(fileno(stdout_file), 1);
fclose(stdout_file);
}
- if (system((settings.python_path+" /home/mona/idfetcha/scripts/client.py").c_str())){
+ if (system((settings.python_path+" "+settings.scripts_dir+"/client.py").c_str())){
error_log_no_msg("Error in scriptserver.cpp: run_user_python_script calling system()");
}
_exit(0);
diff --git a/segget/segget.conf b/segget/segget.conf
index 4d6413d..219530e 100644
--- a/segget/segget.conf
+++ b/segget/segget.conf
@@ -1,6 +1,7 @@
[folders]
# By default segget daemon will use the following folders for its files:
# /etc/seggetd - for config files for seggetd, tuiclient and request tool
+# /etc/init.d/seggetd - init file for segget daemon
# /usr/bin - binary files: seggetd, tuiclient, request
# /usr/share/seggetd/scripts - for user-side python script files
# /usr/share/seggetd/webui - for webui files
@@ -14,27 +15,13 @@
# Define a dir to store distfiles
# Default:
# distfiles_dir=/usr/portage/distfiles
-distfiles_dir=./distfiles
+distfiles_dir=/usr/portage/distfiles
# SEGMENTS_DIR
# Define a dir to store distfiles' segments
# Default:
# segments_dir=/tmp/seggetd/segments
-#segments_dir=./tmp
-
-[pkg_list]
-# PKG_LIST_DIR
-# Define a dir with pkg.list file
-# Default:
-# pkg_list_dir=./
-pkg_list_dir=./
-
-# SYNOPSIS: del_pkg_list_when_dld_finished=0 | 1
-# - If del_pkg_list_when_dld_finished set to 1:
-# Segget deletes pkg.list file, after all distfiles were successfuly fetched.
-# Default:
-# del_pkg_list_when_dld_finished=1
-del_pkg_list_when_dld_finished=1
+segments_dir=/tmp/seggetd/segments
[portage]
# SYNOPSIS: fetch_only=0 | 1
@@ -99,8 +86,6 @@ max_connections=10
# current_speed_time_interval_msecs=1000
current_speed_time_interval_msecs=1000
-# NOT IMPLEMENTED YET: max_total_speed=50000
-
[mirrors]
# MAX_CONNECTIONS_NUM_PER_MIRROR
# Define how many simultaneous downloads from one mirror segget is allowed to
@@ -174,7 +159,7 @@ benchmark_oblivion=5
# If set to none, segget will not make symlinks.
# Default:
# provide_mirror_dir=none
-provide_mirror_dir=./provide_mirror_dir
+provide_mirror_dir=none
# SYNOPSIS: PROVIDE_MIRROR_FILES_RESTRICT_LIST_ON= 0 | 1
# If PROVIDE_MIRROR_DIR=none this option will be ignored.
@@ -244,8 +229,6 @@ network7_priority=0
network8_priority=0
network9_priority=0
-[schedule]
-
[user-data]
# USER_AGENT
# Set the User-Agent: header in the http request sent to the remote server.
@@ -388,22 +371,22 @@ python_path=/usr/bin/python
# be saved in net3_script_stdout.log.
# Default:
# scripts_dir=/usr/share/seggetd/scripts
-scripts_dir=./scripts
+scripts_dir=/usr/share/seggetd/scripts
# SCRIPT_SOCKET_PATH
# Segget uses AF_UNIX domain sockets for communication with python.
# Specify path for the socket on your filesystem.
# NOTE !: Default value can NOT be changed yet (option under development).
# Default:
-# script_socket_path=/tmp/segget_script_socket
-script_socket_path=/tmp/segget_script_socket
+# script_socket_path=/tmp/seggetd/script_socket
+script_socket_path=/tmp/seggetd/script_socket
[logs]
# LOGS_DIR
# Define a dir to store log files.
# Default:
# logs_dir=/var/log/seggetd
-logs_dir=/home/mona/idfetcha/logs
+logs_dir=/var/log/seggetd
# GENERAL_LOG_FILE
# Define a file name to store general log.
diff --git a/segget/segget.cpp b/segget/segget.cpp
index 1b472f1..a34b2f9 100644
--- a/segget/segget.cpp
+++ b/segget/segget.cpp
@@ -490,12 +490,12 @@ void start_daemon_mode(){
//stdout
if (dup(fileDesc)){
log_no_msg("Error in segget.cpp: start_daemon_mode: during dup(fileDesc) - stdout");
- exit(1);
+// exit(1);
}
//stderr
if (dup(fileDesc)){
log_no_msg("Error in segget.cpp: start_daemon_mode: during dup(fileDesc) - stderr");
- exit(1);
+// exit(1);
}
log_no_msg("Starting daemon routine");
routine();
diff --git a/segget/settings.cpp b/segget/settings.cpp
index c3a0c8f..c3db2b6 100644
--- a/segget/settings.cpp
+++ b/segget/settings.cpp
@@ -141,6 +141,7 @@ void Tsettings::init(){
conf.set("scripting_and_scheduling","python_path",python_path);
conf.set("scripting_and_scheduling","scripts_dir",scripts_dir);
+ conf.set("scripting_and_scheduling","script_socket_path",script_socket_path);
conf.clear();
}catch(...){
diff --git a/segget/settings.h b/segget/settings.h
index 3633aa4..0328501 100644
--- a/segget/settings.h
+++ b/segget/settings.h
@@ -89,6 +89,7 @@ class Tsettings{
//scripting_and_scheduling
string python_path;
string scripts_dir;
+ string script_socket_path;
//logs
string logs_dir;
string general_log_file;
@@ -149,6 +150,7 @@ class Tsettings{
//scripting_and_scheduling
python_path("/usr/bin/python"),
scripts_dir("/usr/share/seggetd/scripts"),
+ script_socket_path("/tmp/seggetd/script_socket"),
//logs
logs_dir("/var/log/seggetd"),
general_log_file("segget.log"),
diff --git a/tuiclient/Makefile b/tuiclient/Makefile
index 1386b2e..f2e93de 100644
--- a/tuiclient/Makefile
+++ b/tuiclient/Makefile
@@ -51,4 +51,9 @@ clean:
-rm -f $(BINS) $(OBJS)
-rm -f ./logs/*.log *.o
+install:
+ -mkdir /etc/seggetd
+ -cp tuiclient.conf /etc/seggetd
+ -cp tuiclient /usr/bin
+
.PRECIOUS: %.o