made paths use absolute path
This commit is contained in:
parent
cf49ef0731
commit
6fbdcb8850
8 changed files with 26 additions and 24 deletions
|
@ -1,4 +1,7 @@
|
|||
# must be synced with `setup.py`
|
||||
# this variable may be altered by the script
|
||||
# most notably by `src/interface/choose_action.py`
|
||||
|
||||
content_dir = "/tmp/com.developomp.setup"
|
||||
tmp_dir = content_dir
|
||||
home_dir = "/home/pomp"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import inquirer
|
||||
from glob import glob
|
||||
from os.path import exists
|
||||
from os.path import exists, abspath
|
||||
|
||||
from ..util import import_file
|
||||
from src.log import log
|
||||
|
@ -9,7 +9,7 @@ from src import constants
|
|||
|
||||
def choose_action():
|
||||
if exists(".git/") and exists("src/"):
|
||||
constants.content_dir = "."
|
||||
constants.content_dir = abspath(".")
|
||||
|
||||
content_dir = constants.content_dir
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from src.constants import content_dir
|
||||
from src.util import paru_install, copy_file
|
||||
from src.constants import content_dir, home_dir
|
||||
|
||||
from os import makedirs
|
||||
|
||||
|
@ -13,6 +13,6 @@ def setup() -> None:
|
|||
|
||||
# copy configuration file
|
||||
copy_file(
|
||||
f"{content_dir}/home/pomp/.config/alacritty/alacritty.yml",
|
||||
f"{content_dir}{home_dir}/.config/alacritty/alacritty.yml",
|
||||
"~/.config/alacritty/alacritty.yml",
|
||||
)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from src.util import flatpak_install, paru_install, copy_file
|
||||
from src.constants import content_dir
|
||||
from src.constants import content_dir, home_dir
|
||||
from src import log
|
||||
from os import system
|
||||
|
||||
|
@ -55,7 +55,7 @@ def setup():
|
|||
paru_install("betterdiscordctl-git")
|
||||
|
||||
copy_file(
|
||||
f"{content_dir}/home/pomp/.config/autostart/discord.desktop",
|
||||
f"{content_dir}{home_dir}/.config/autostart/discord.desktop",
|
||||
"~/.config/autostart/discord.desktop",
|
||||
)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from src.util import flatpak_install, copy_file
|
||||
from src.constants import content_dir
|
||||
from src.constants import content_dir, home_dir
|
||||
|
||||
name = "Ungoogled chromium"
|
||||
post_install = ["restore onetab"]
|
||||
|
@ -10,4 +10,4 @@ def setup():
|
|||
|
||||
flatpak_install("com.github.Eloston.UngoogledChromium")
|
||||
|
||||
config_path = "/home/pomp/.var/app/com.github.Eloston.UngoogledChromium/config/chromium/System Profile"
|
||||
config_path = f"{home_dir}/.var/app/com.github.Eloston.UngoogledChromium/config/chromium/System Profile"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from src.util import flatpak_install, copy_file
|
||||
from src.constants import content_dir
|
||||
from src.constants import content_dir, home_dir
|
||||
|
||||
from os import system
|
||||
|
||||
|
@ -56,18 +56,18 @@ def setup():
|
|||
|
||||
# autostart vscodium
|
||||
copy_file(
|
||||
f"{content_dir}/home/pomp/.config/autostart/codium.desktop",
|
||||
f"{content_dir}{home_dir}/.config/autostart/codium.desktop",
|
||||
"~/.config/autostart/codium.desktop",
|
||||
)
|
||||
|
||||
# vscodium settings
|
||||
copy_file(
|
||||
f"{content_dir}/home/pomp/.config/VSCodium/User/settings.json",
|
||||
f"{content_dir}{home_dir}/.config/VSCodium/User/settings.json",
|
||||
"~/.config/VSCodium/User/settings.json",
|
||||
)
|
||||
|
||||
# enable vscode extension store
|
||||
copy_file(
|
||||
f"{content_dir}/home/pomp/.config/VSCodium/product.json",
|
||||
f"{content_dir}{home_dir}/.config/VSCodium/product.json",
|
||||
"~/.config/VSCodium/product.json",
|
||||
)
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
from src.util import paru_install, smart_mkdir, download, unzip
|
||||
from src.constants import content_dir
|
||||
from src.constants import tmp_dir, home_dir
|
||||
from shutil import rmtree, move
|
||||
from os import remove, system
|
||||
from os.path import exists
|
||||
from os.path import exists, basename
|
||||
import requests
|
||||
import glob
|
||||
|
||||
name = "fonts"
|
||||
|
||||
# path to temporarily save font related files
|
||||
TMP_FONTS_DIRECTORY = f"{content_dir}/tmp/fonts"
|
||||
TMP_FONTS_DIRECTORY = f"{tmp_dir}/tmp/fonts"
|
||||
|
||||
# fonts to download
|
||||
FONT_NAMES = ("Audiowide", "Varela Round", "Ubuntu Mono", "Nanum Gothic Coding")
|
||||
|
||||
# where to unzip the fonts
|
||||
FONT_INSTALL_DIR = "~/.local/share/fonts"
|
||||
FONT_INSTALL_DIR = f"{home_dir}/.local/share/fonts"
|
||||
|
||||
|
||||
def setup():
|
||||
|
@ -43,7 +43,6 @@ def setup():
|
|||
zip_path = f"{TMP_FONTS_DIRECTORY}/{font_name}.zip"
|
||||
|
||||
# download and unzip if either zip file or unzipped directory exists
|
||||
if exists(zip_path) and exists("{TMP_FONTS_DIRECTORY}/{font_name}"):
|
||||
download(zip_path, f"https://fonts.google.com/download?family={font_name}")
|
||||
unzip(zip_path, f"{TMP_FONTS_DIRECTORY}/{font_name}")
|
||||
remove(zip_path)
|
||||
|
@ -52,7 +51,7 @@ def setup():
|
|||
|
||||
# "install" fonts
|
||||
for ttf_file_path in glob.glob(f"{TMP_FONTS_DIRECTORY}/**/*.ttf"):
|
||||
move(ttf_file_path, f"{FONT_INSTALL_DIR}/{ttf_file_path}")
|
||||
move(ttf_file_path, f"{FONT_INSTALL_DIR}/{basename(ttf_file_path)}")
|
||||
|
||||
# regenerate font cache
|
||||
system("fc-cache -vf")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from src.util import paru_install, copy_file
|
||||
from src.constants import content_dir
|
||||
from src.constants import content_dir, home_dir
|
||||
from src import log
|
||||
|
||||
from os.path import isdir
|
||||
|
@ -13,7 +13,7 @@ def setup():
|
|||
|
||||
paru_install("zsh")
|
||||
|
||||
if isdir("/home/pomp/.oh-my-zsh"):
|
||||
if isdir(f"{home_dir}/.oh-my-zsh"):
|
||||
log.log("zsh already configured. Skipping.")
|
||||
return
|
||||
|
||||
|
@ -33,4 +33,4 @@ def setup():
|
|||
)
|
||||
|
||||
# apply zshrc configuration
|
||||
copy_file(f"{content_dir}/home/pomp/.zshrc", "~/.zshrc")
|
||||
copy_file(f"{content_dir}{home_dir}/.zshrc", "~/.zshrc")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue