Category Archives: Arch Linux

Migrate subfolder to separate git repository

Let’s say you have a repository structure like below (eg. because previously it was SVN repository where everything was on one place).

  • .\Web
    • .\example.com
    • .\example.net

Now you would like to move example.com to separate git repository.

First of all, you need to install git-filter-repo.

# Clone old repository to new directory
git clone OLD_REPOSITORY example.com
cd example.com/

# Remove everything else except example.com directory
git filter-repo --path example.com/

# Make example.com new root directory
git filter-repo --subdirectory-filter example.com

# Push to a new repository
git remote add origin NEW_REPOSITORY
git push -u origin master

Installing Arch Linux ARM on Raspberry PI 3

Insert SD card to your system.

sudo fdisk -l
sudo fdisk /dev/sdX

Create partitions.

  • Clear partitions (o)
  • Create boot partition (n, p, 1, enter, +500M, t, c)
  • Create system partition (n, p, 2, enter, enter)
  • Write partitions (w)
sudo mkfs.vfat /dev/sdX1
sudo mkfs.ext4 /dev/sdX2

Mount new partitions.

sudo mkdir /mnt/boot/
sudo mkdir /mnt/root/

sudo mount /dev/sdx1 /mnt/boot/
sudo mount /dev/sdx2 /mnt/root/

Download and install Arch Linux ARM.

wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz
sudo su
tar zxvf ArchLinuxARM-rpi-aarch64-latest.tar.gz -C /mnt/root
mv /mnt/root/boot/* /mnt/boot
sync
umount /mnt/boot/
umount /mnt/root/

Remove SD card, insert it into Raspberry PI and boot it to complete the installation.

pacman-key --init
pacman-key --populate archlinuxarm
pacman -Syu

Automatic external monitor switch on Arch Linux

Install autorandr.

sudo pacman -S autorandr

Save current configuration. If you are on notebook you can eg. call it mobile.

autorandr --save mobile

Now connect you external monitor. Change the monitor settings as you wish and save it.

autorandr --save docked

From now on, when you connect external monitor it will automatically switch to it. If you disconnect it it will revert back internal monitor only.