Skip to content

Commit

Permalink
credentials config file added to cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetmertguduz committed May 31, 2024
1 parent 7790b96 commit efba909
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,30 @@ file(
MAKE_DIRECTORY "${dest_path}"
)

# CREATE CONFIG FILE
set(file_path "$ENV{HOME}/.yiffy/yiffy-config.txt")
# CREATE CONFIG FILES
set(config_file_path "$ENV{HOME}/.yiffy/yiffy-config.txt")
set(credentials_file_path "$ENV{HOME}/.yiffy/yiffy-credentials.txt")

install(SCRIPT
CODE "file(WRITE \"${file_path}\" \"plog:nsfw\")"
CODE "file(WRITE \"${config_file_path}\" \"plog:nsfw\")"
)

install(SCRIPT
CODE "file(WRITE \"${credentials_file_path}\" \"\")"
)

# INSTALL THE EXECUTABLE TO USR/LOCAL/BIN
install(TARGETS yiffy DESTINATION /usr/local/bin)

# Create and install the config file, ensuring it writes with the correct permissions
# Create and install the config files, ensuring they write with the correct permissions
install(CODE "
file(MAKE_DIRECTORY \"${dest_path}\")
file(WRITE \"${dest_path}/yiffy-config.txt\" \"plog:nsfw\")
file(WRITE \"${dest_path}/yiffy-credentials.txt\" \"\")
execute_process(COMMAND chmod 755 \"${dest_path}\")
execute_process(COMMAND chmod 755 \"${dest_path}/yiffy-config.txt\")
execute_process(COMMAND chmod 755 \"${dest_path}/yiffy-credentials.txt\")
execute_process(COMMAND chown $ENV{USER}:$ENV{USER} \"${dest_path}\")
execute_process(COMMAND chown $ENV{USER}:$ENV{USER} \"${dest_path}/yiffy-config.txt\")
execute_process(COMMAND chown $ENV{USER}:$ENV{USER} \"${dest_path}/yiffy-credentials.txt\")
")

0 comments on commit efba909

Please sign in to comment.