예제 #1
0
def configureGrub(cryptDevice):
  cprint('Configuring grub')
  grubFile = '/mnt/etc/default/grub'
  grubContent = getFileContents(grubFile).replace('GRUB_CMDLINE_LINUX=""', f'GRUB_CMDLINE_LINUX="cryptdevice={cryptDevice}:crypt"')
  writeFileContent(grubFile, grubContent)

  chroot('grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub --recheck')
  chroot('grub-mkconfig -o /boot/grub/grub.cfg')
예제 #2
0
def updateAutokeyFolders():
    fileDir = f'{HOME}/.config/autokey'
    fileLocation = f'{fileDir}/autokey.json'
    cmd(f'mkdir -p {fileDir}')
    content = getFileContents(fileLocation)
    jsonContent = json.loads(content)
    jsonContent['folders'] = [f'{HOME}/dotfiles/autokey/my-rebinds']
    resultingContent = json.dumps(jsonContent, indent=4)
    writeFileContent(fileLocation, resultingContent)
예제 #3
0
def updateMkinitcpio():
  cprint('Configuring Mkinitcpio')
  file = '/mnt/etc/mkinitcpio.conf'
  content = getFileContents(file)
  content = content.replace('#COMPRESSION="xz"', '#COMPRESSION="xz"\nCOMPRESSION="pigz"')
  pattern = r'^HOOKS=\((.*)\)$'
  hooks = re.findall(pattern, content, re.MULTILINE)[0]
  hooks = hooks.replace('block', 'block keymap encrypt')
  hooks = hooks.replace('filesystems', 'lvm2 filesystems')
  content = re.sub(pattern, f'HOOKS=({hooks})', content, flags=re.MULTILINE)
  writeFileContent(file, content)
  chroot('mkinitcpio -p linux')
예제 #4
0
def setupUsers(user):
  cprint('Changing the shell for root')
  chroot('chsh -s /usr/bin/fish')

  def changeRootPw():
    cprint('Change root password')
    chroot('passwd')
  runInput(changeRootPw)

  chroot(f'useradd -m -G wheel -s /usr/bin/fish {user}')
  def changeUserPw():
    cprint('Password for the new user:'******'passwd {user}')
  runInput(changeUserPw)

  sudoers = '/mnt/etc/sudoers'
  contentToWrite = getFileContents(sudoers).replace('# %wheel ALL=(ALL) ALL', '%wheel ALL=(ALL) ALL').replace('root ALL=(ALL) ALL\n', f'root ALL=(ALL) ALL\n{user} ALL=(ALL) ALL\n')

  writeFileContent(sudoers, contentToWrite)
예제 #5
0
def enableMultiLibs():
  cprint('Enabling multilibs')
  pacmanConf = '/mnt/etc/pacman.conf'
  contentToWrite = getFileContents(pacmanConf).replace('#[multilib]\n#Include = /etc/pacman.d/mirrorlist', '[multilib]\nInclude = /etc/pacman.d/mirrorlist')

  writeFileContent(pacmanConf, contentToWrite)
예제 #6
0
def generateFStab():
  cprint('Generating fstab')
  fstabContent = run('genfstab -U /mnt').stdout
  # Add tmpfs
  fstabContent += 'tmpfs   /tmp         tmpfs   rw,nodev,nosuid          0  0\n'
  writeFileContent('/mnt/etc/fstab', fstabContent)
예제 #7
0
def updateXinit():
  xinitrc = f'{HOME}/.xinitrc'
  writeFileContent(xinitrc, 'setxkbmap -layout se -option nodeadkeys,caps:escape')
예제 #8
0
def updateProfile():
  profileLocation = f'{HOME}/.profile'
  writeFileContent(profileLocation, 'setxkbmap -layout se -option nodeadkeys,caps:escape')