Skip to content

Commit 3686ca2

Browse files
committed
Remove superfluous /usr/bin/ from commands
1 parent c0a2de4 commit 3686ca2

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

archinstall/lib/boot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __enter__(self) -> 'Boot':
2626
# '-P' or --console=pipe could help us not having to do a bunch
2727
# of os.write() calls, but instead use pipes (stdin, stdout and stderr) as usual.
2828
self.session = SysCommandWorker([
29-
'/usr/bin/systemd-nspawn',
29+
'systemd-nspawn',
3030
'-D', str(self.instance.target),
3131
'--timezone=off',
3232
'-b',

archinstall/lib/general.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ def trace_log(self) -> bytes | None:
458458

459459
def _pid_exists(pid: int) -> bool:
460460
try:
461-
return any(subprocess.check_output(['/usr/bin/ps', '--no-headers', '-o', 'pid', '-p', str(pid)]).strip())
461+
return any(subprocess.check_output(['ps', '--no-headers', '-o', 'pid', '-p', str(pid)]).strip())
462462
except subprocess.CalledProcessError:
463463
return False
464464

archinstall/lib/installer.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ def add_swapfile(self, size: str = '4G', enable_resume: bool = True, file: str =
451451
if enable_resume:
452452
resume_uuid = SysCommand(f'findmnt -no UUID -T {self.target}{file}').decode()
453453
resume_offset = SysCommand(
454-
f'/usr/bin/filefrag -v {self.target}{file}'
454+
f'filefrag -v {self.target}{file}'
455455
).decode().split('0:', 1)[1].split(":", 1)[1].split("..", 1)[0].strip()
456456

457457
self._hooks.append('resume')
@@ -499,7 +499,7 @@ def genfstab(self, flags: str = '-pU') -> None:
499499
info(f"Updating {fstab_path}")
500500

501501
try:
502-
gen_fstab = SysCommand(f'/usr/bin/genfstab {flags} {self.target}').output()
502+
gen_fstab = SysCommand(f'genfstab {flags} {self.target}').output()
503503
except SysCallError as err:
504504
raise RequirementError(
505505
f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n Error: {err}')
@@ -561,7 +561,7 @@ def set_locale(self, locale_config: LocaleConfiguration) -> bool:
561561
return False
562562

563563
try:
564-
SysCommand(f'/usr/bin/arch-chroot {self.target} locale-gen')
564+
SysCommand(f'arch-chroot {self.target} locale-gen')
565565
except SysCallError as e:
566566
error(f'Failed to run locale-gen on target: {e}')
567567
return False
@@ -582,7 +582,7 @@ def set_timezone(self, zone: str) -> bool:
582582

583583
if (Path("/usr") / "share" / "zoneinfo" / zone).exists():
584584
(Path(self.target) / "etc" / "localtime").unlink(missing_ok=True)
585-
SysCommand(f'/usr/bin/arch-chroot {self.target} ln -s /usr/share/zoneinfo/{zone} /etc/localtime')
585+
SysCommand(f'arch-chroot {self.target} ln -s /usr/share/zoneinfo/{zone} /etc/localtime')
586586
return True
587587

588588
else:
@@ -620,7 +620,7 @@ def enable_service(self, services: str | list[str]) -> None:
620620
plugin.on_service(service)
621621

622622
def run_command(self, cmd: str, *args: str, **kwargs: str) -> SysCommand:
623-
return SysCommand(f'/usr/bin/arch-chroot {self.target} {cmd}')
623+
return SysCommand(f'arch-chroot {self.target} {cmd}')
624624

625625
def arch_chroot(self, cmd: str, run_as: str | None = None) -> SysCommand:
626626
if run_as:
@@ -629,7 +629,7 @@ def arch_chroot(self, cmd: str, run_as: str | None = None) -> SysCommand:
629629
return self.run_command(cmd)
630630

631631
def drop_to_shell(self) -> None:
632-
subprocess.check_call(f"/usr/bin/arch-chroot {self.target}", shell=True)
632+
subprocess.check_call(f"arch-chroot {self.target}", shell=True)
633633

634634
def configure_nic(self, nic: Nic) -> None:
635635
conf = nic.as_systemd_config()
@@ -723,7 +723,7 @@ def mkinitcpio(self, flags: list[str]) -> bool:
723723
mkinit.write(content)
724724

725725
try:
726-
SysCommand(f'/usr/bin/arch-chroot {self.target} mkinitcpio {" ".join(flags)}', peek_output=True)
726+
SysCommand(f'arch-chroot {self.target} mkinitcpio {" ".join(flags)}', peek_output=True)
727727
return True
728728
except SysCallError as e:
729729
if e.worker:
@@ -865,16 +865,16 @@ def minimal_installation(
865865

866866
# TODO: Support locale and timezone
867867
# os.remove(f'{self.target}/etc/localtime')
868-
# sys_command(f'/usr/bin/arch-chroot {self.target} ln -s /usr/share/zoneinfo/{localtime} /etc/localtime')
869-
# sys_command('/usr/bin/arch-chroot /mnt hwclock --hctosys --localtime')
868+
# sys_command(f'arch-chroot {self.target} ln -s /usr/share/zoneinfo/{localtime} /etc/localtime')
869+
# sys_command('arch-chroot /mnt hwclock --hctosys --localtime')
870870
if hostname:
871871
self.set_hostname(hostname)
872872

873873
self.set_locale(locale_config)
874874
self.set_keyboard_language(locale_config.kb_layout)
875875

876876
# TODO: Use python functions for this
877-
SysCommand(f'/usr/bin/arch-chroot {self.target} chmod 700 /root')
877+
SysCommand(f'arch-chroot {self.target} chmod 700 /root')
878878

879879
if mkinitcpio and not self.mkinitcpio(['-P']):
880880
error('Error generating initramfs (continuing anyway)')
@@ -1071,10 +1071,10 @@ def _add_systemd_bootloader(
10711071

10721072
# Install the boot loader
10731073
try:
1074-
SysCommand(f"/usr/bin/arch-chroot {self.target} bootctl {' '.join(bootctl_options)} install")
1074+
SysCommand(f"arch-chroot {self.target} bootctl {' '.join(bootctl_options)} install")
10751075
except SysCallError:
10761076
# Fallback, try creating the boot loader without touching the EFI variables
1077-
SysCommand(f"/usr/bin/arch-chroot {self.target} bootctl --no-variables {' '.join(bootctl_options)} install")
1077+
SysCommand(f"arch-chroot {self.target} bootctl --no-variables {' '.join(bootctl_options)} install")
10781078

10791079
# Ensure that the $BOOT/loader/ directory exists before we try to create files in it.
10801080
#
@@ -1168,7 +1168,7 @@ def _add_grub_bootloader(
11681168
boot_dir = Path('/boot')
11691169

11701170
command = [
1171-
'/usr/bin/arch-chroot',
1171+
'arch-chroot',
11721172
str(self.target),
11731173
'grub-install',
11741174
'--debug'
@@ -1222,7 +1222,7 @@ def _add_grub_bootloader(
12221222

12231223
try:
12241224
SysCommand(
1225-
f'/usr/bin/arch-chroot {self.target} '
1225+
f'arch-chroot {self.target} '
12261226
f'grub-mkconfig -o {boot_dir}/grub/grub.cfg'
12271227
)
12281228
except SysCallError as err:
@@ -1277,7 +1277,7 @@ def _add_limine_bootloader(
12771277
shutil.copy(limine_path / 'limine-bios.sys', self.target / 'boot')
12781278

12791279
# `limine bios-install` deploys the stage 1 and 2 to the disk.
1280-
SysCommand(f'/usr/bin/arch-chroot {self.target} limine bios-install {parent_dev_path}', peek_output=True)
1280+
SysCommand(f'arch-chroot {self.target} limine bios-install {parent_dev_path}', peek_output=True)
12811281
except Exception as err:
12821282
raise DiskError(f'Failed to install Limine on {parent_dev_path}: {err}')
12831283

@@ -1523,7 +1523,7 @@ def user_create(self, user: str, password: str | None = None, groups: list[str]
15231523
if not handled_by_plugin:
15241524
info(f'Creating user {user}')
15251525
try:
1526-
SysCommand(f'/usr/bin/arch-chroot {self.target} useradd -m -G wheel {user}')
1526+
SysCommand(f'arch-chroot {self.target} useradd -m -G wheel {user}')
15271527
except SysCallError as err:
15281528
raise SystemError(f"Could not create user inside installation: {err}")
15291529

@@ -1537,7 +1537,7 @@ def user_create(self, user: str, password: str | None = None, groups: list[str]
15371537

15381538
if groups:
15391539
for group in groups:
1540-
SysCommand(f'/usr/bin/arch-chroot {self.target} gpasswd -a {user} {group}')
1540+
SysCommand(f'arch-chroot {self.target} gpasswd -a {user} {group}')
15411541

15421542
if sudo and self.enable_sudo(user):
15431543
self.helper_flags['user'] = True
@@ -1554,7 +1554,7 @@ def user_set_pw(self, user: str, password: str) -> bool:
15541554
sh = shlex.join(['sh', '-c', echo])
15551555

15561556
try:
1557-
SysCommand(f"/usr/bin/arch-chroot {self.target} " + sh[:-1] + " | chpasswd'")
1557+
SysCommand(f"arch-chroot {self.target} " + sh[:-1] + " | chpasswd'")
15581558
return True
15591559
except SysCallError:
15601560
return False
@@ -1563,15 +1563,15 @@ def user_set_shell(self, user: str, shell: str) -> bool:
15631563
info(f'Setting shell for {user} to {shell}')
15641564

15651565
try:
1566-
SysCommand(f"/usr/bin/arch-chroot {self.target} sh -c \"chsh -s {shell} {user}\"")
1566+
SysCommand(f"arch-chroot {self.target} sh -c \"chsh -s {shell} {user}\"")
15671567
return True
15681568
except SysCallError:
15691569
return False
15701570

15711571
def chown(self, owner: str, path: str, options: list[str] = []) -> bool:
15721572
cleaned_path = path.replace('\'', '\\\'')
15731573
try:
1574-
SysCommand(f"/usr/bin/arch-chroot {self.target} sh -c 'chown {' '.join(options)} {owner} {cleaned_path}'")
1574+
SysCommand(f"arch-chroot {self.target} sh -c 'chown {' '.join(options)} {owner} {cleaned_path}'")
15751575
return True
15761576
except SysCallError:
15771577
return False
@@ -1588,7 +1588,7 @@ def set_keyboard_language(self, language: str) -> bool:
15881588
# Setting an empty keymap first, allows the subsequent call to set layout for both console and x11.
15891589
from .boot import Boot
15901590
with Boot(self) as session:
1591-
os.system('/usr/bin/systemd-run --machine=archinstall --pty localectl set-keymap ""')
1591+
os.system('systemd-run --machine=archinstall --pty localectl set-keymap ""')
15921592

15931593
try:
15941594
session.SysCommand(["localectl", "set-keymap", language])

archinstall/lib/luks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def encrypt(
8181
key_file = self._get_key_file(key_file)
8282

8383
cryptsetup_args = shlex.join([
84-
'/usr/bin/cryptsetup',
84+
'cryptsetup',
8585
'--batch-mode',
8686
'--verbose',
8787
'--type', 'luks2',
@@ -108,7 +108,7 @@ def encrypt(
108108
return key_file
109109

110110
def _get_luks_uuid(self) -> str:
111-
command = f'/usr/bin/cryptsetup luksUUID {self.luks_dev_path}'
111+
command = f'cryptsetup luksUUID {self.luks_dev_path}'
112112

113113
try:
114114
return SysCommand(command).decode()
@@ -139,7 +139,7 @@ def unlock(self, key_file: Path | None = None) -> None:
139139
time.sleep(0.025)
140140

141141
result = SysCommand(
142-
'/usr/bin/cryptsetup open '
142+
'cryptsetup open '
143143
f'{self.luks_dev_path} '
144144
f'{self.mapper_name} '
145145
f'--key-file {key_file} '
@@ -202,7 +202,7 @@ def create_keyfile(self, target_path: Path, override: bool = False) -> None:
202202
def _add_key(self, key_file: Path) -> None:
203203
debug(f'Adding additional key-file {key_file}')
204204

205-
command = f'/usr/bin/cryptsetup -q -v luksAddKey {self.luks_dev_path} {key_file}'
205+
command = f'cryptsetup -q -v luksAddKey {self.luks_dev_path} {key_file}'
206206
worker = SysCommandWorker(command)
207207
pw_injected = False
208208

archinstall/lib/pacman/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def sync(self) -> None:
6464
'Could not sync mirrors',
6565
self.run,
6666
'-Syy',
67-
default_cmd='/usr/bin/pacman'
67+
default_cmd='pacman'
6868
)
6969
self.synced = True
7070

@@ -84,6 +84,6 @@ def strap(self, packages: str | list[str]) -> None:
8484
'Could not strap in packages',
8585
'Pacstrap failed. See /var/log/archinstall/install.log or above message for error details',
8686
SysCommand,
87-
f'/usr/bin/pacstrap -C /etc/pacman.conf -K {self.target} {" ".join(packages)} --noconfirm',
87+
f'pacstrap -C /etc/pacman.conf -K {self.target} {" ".join(packages)} --noconfirm',
8888
peek_output=True
8989
)

0 commit comments

Comments
 (0)