Month: October 2014
Submit a changeset to Gerrit based on another user change
I’ve submited another change to CyanogenMod project that add the “Delete application” menu to the “Developer Option” advanced menu (link to gerrit)
An user has requested an edit to a file in order to change the string displayed in the setting application, and initially I’ve thought that the change was related to my submit (but after I realized that is another CM project…)
BTW the question is: “How to amend a commit that another user has previously changed with another changeset not in my working copy?” (…a little bit obscure….)
For example, the commit status on Gerrit is:
- Patchset 1 : author Sarbyn
- Patchset 2 : author Sarbyn
- Patchset 3 : author Sarbyn
- Patchset 4 : author XYZ
My working copy is on patchset 3 and I need to submit a change about patchset 4.
Solution
The steps are:
- git stash
- click on the checkout-link in Download on the right patch set and copy&paste the git command in your working copy
- git stash pop
- Edit the file
- git commit –amend and keep the Change-Id the same
Alix.2D + Voyage Linux = a DIY home NAS
This is my 3th attempt to build a DIY home nas.
The first attempt with a Raspberry PI was a disaster: the well-known “USB POWER BUG” makes my NAS (with 2 USB DISK) pretty unstable.
The second attempt with an ALIX board + voyage linux crashes without any reason, but I admit that the initial setup was a mess…
The goal is:
- An home NAS with 2 external USB: a little one EXT-4 for my mac TimeMachine (using Netatalk) and a bigger one NTFS as a generic storage (using Samba)
- TrasmissionDaemon with WEB interface, as thin torrent client
Now is up and running. But if it will die again I think that I will buy a QNAP 🙂
Contents
- 1 Install VOYAGE LINUX
- 2 Install VIM
- 3 Fix sudo
- 4 Add new user
- 5 Install NTFS-3G
- 6 Fstab and volumes
- 7 Enable swap file
- 8 Samba
- 9 SSH
- 10 Transmission
- 11 FIX cracklib config
- 12 Netatalk
- 13 FIX BOOT
- 14 Fix timezone
- 15 NOIP client
- 16 PUT APT cache on external disk
- 17 Clear APT cache
- 18 Final step – do a CompactFlash backup
- 19 EXTRA – Mount image done with DD
Install VOYAGE LINUX
Read the Voyage Linux README
Install VIM
# apt-get install vim
Fix sudo
# chown -R root:root /usr/bin/sudo # chmod u+s /usr/bin/sudo # chown root:root /usr/lib/sudo/sudoers.so # chown root:root /etc/sudoers # chown root:root /etc/sudoers.d/ # chown root:root /etc/sudoers.d/README # chown root:root /var/lib/sudo visudo --- add user
Add new user
# useradd -m -s /bin/bash sarbyn # passwd sarbyn
Install NTFS-3G
# apt-get install ntfs-3g
Fstab and volumes
# mkdir /mnt/TimeMachine # mkdir /mnt/MUSIC # chown sarbyn:sarbyn /mnt/MUSIC # chown sarbyn:sarbyn /mnt/TimeMachine UUID=206606FF6606D606 /mnt/MUSIC ntfs-3g rw,defaults 0 0 UUID=03c90579-88f0-4478-ae8d-adc64972a07d /mnt/TimeMachine ext4 defaults 0 0
Enable swap file
# mkswap /mnt/MUSIC/swapfile # swapon /mnt/MUSIC/swapfile
Samba
# apt-get install samba samba-common-bin # service samba stop # mv /var/lib/samba /var/tmp/samba # ln -s /var/tmp/samba /var/lib/samba # smbpasswd -a sarbyn
[mnt] path = /mnt read only = Yes guest only = Yes guest ok = Yes [mnt_RW] path = /mnt read only = No valid user = sarbyn browseable = yes writable = yes
Next add these directories to the file etc/default/voyage-util so it now contains the line:
VOYAGE_SYNC_DIRS=”/var/cache”
SSH
$ mkdir .ssh $ chmod 0700 .ssh/ $ cd .ssh $ ls $ vim authorized_keys $ chmod 600 authorized_keys
Disable root login and plaintext login in /etc/ssh/sshd_config file
Transmission
# apt-get install transmission-daemon # service transmission-daemon stop # cp settings.json /etc/transmission-daemon/ # service transmission-daemon start
Next add transmission directories to the file etc/default/voyage-util so it now contains the line:
VOYAGE_SYNC_DIRS=”/var/cache /var/lib/transmission-daemon”
FIX cracklib config
# apt-get install cracklib-runtime # create-cracklib-dict /usr/share/dict/* Before root@voyage:/var/cache/cracklib# ls -la -rw-r--r-- 1 root root 1024 Oct 4 13:28 cracklib_dict.hwm -rw-r--r-- 1 root root 16 Oct 4 13:28 cracklib_dict.pwd -rw-r--r-- 1 root root 16 Oct 4 13:28 cracklib_dict.pwi -rw-r--r-- 1 root root 65 Oct 4 13:17 src-dicts AFTER root@voyage:/var/cache/cracklib# ls -la -rw-r--r-- 1 root root 1024 Oct 7 22:46 cracklib_dict.hwm -rw-r--r-- 1 root root 412696 Oct 7 22:46 cracklib_dict.pwd -rw-r--r-- 1 root root 22968 Oct 7 22:46 cracklib_dict.pwi -rw-r--r-- 1 root root 65 Oct 4 13:17 src-dicts
# cd /usr/lib/ # root@voyage:/usr/lib# ln -s /var/cache/cracklib/cracklib_dict.hwm # root@voyage:/usr/lib# ln -s /var/cache/cracklib/cracklib_dict.pwd # root@voyage:/usr/lib# ln -s /var/cache/cracklib/cracklib_dict.pwi
Netatalk
*DON’T USE NETATALK FROM DEBIAN REPOS*
The older version of netatalk are VERY…VERY unstable. Download the sources from Netatalk site and follow —> this tutorial <—
# apt-get install build-essential libssl-dev libgcrypt11-dev libkrb5-dev libpam0g-dev libwrap0-dev libdb-dev libmysqlclient-dev libavahi-client-dev libacl1-dev libldap2-dev libcrack2-dev systemtap-sdt-dev libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev tracker libtracker-sparql-0.14-dev libtracker-miner-0.14-dev
Next add /usr/local/var/netatalk to the file etc/default/voyage-util so it now contains the line:
VOYAGE_SYNC_DIRS=”/var/cache /var/lib/transmission-daemon /usr/local/var/netatalk”
# apt-get install avahi-daemon # insserv avahi-daemon # insserv netatalk # /etc/init.d/avahi-daemon start # /etc/init.d/netatalk start
Edit “/usr/local/etc/afp.conf”.
[Global] ; Global server settings uam list = uams_dhx.so,uams_dhx2.so set password = yes [MusicAFP] path = /mnt/MUSIC [TimeMachineAFP] path = /mnt/TimeMachine time machine = yes
Add user to Netatalk (using the SHORT password)
# afppasswd -an sarbyn
FIX BOOT
The NTFS volume does not mount at boot, so add some lines on /etc/rc.local
# vim /etc/rc.local service transmission-daemon stop mount -a swapon /mnt/MUSIC/swapfile service transmission-daemon start # chmod +x /etc/rc.local
Fix timezone
# ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
NOIP client
# wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz # tar xzf noip-duc-linux.tar.gz # cd no-ip-2.1.9 # make # make install
Next add /usr/local/etc/ to the file etc/default/voyage-util so it now contains the line:
VOYAGE_SYNC_DIRS=”/var/cache /var/lib/transmission-daemon /usr/local/var/netatalk /usr/local/etc”
PUT APT cache on external disk
# remountrw # cd /var/cache # rm apt # ln -s /mnt/MUSIC/APT_CACHE/ apt # remountro
Clear APT cache
# apt-get clean
Final step – do a CompactFlash backup
Now is all setted up but it’s better to do a CompatFlash backup using dd
# dd if=DISK of=voyage-backup.img bs=1m
EXTRA – Mount image done with DD
# apt-get install kpartx # kpartx -a MUSIC/backup_voyage_2014_10_09.iso # mount /dev/mapper/loop0p1 /mnt/cf -o loop,ro